Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable NonNullByDefault for lspe4.plugin #1009

Merged
merged 15 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
target/
bin/
.settings/de.loskutov.anyedit.AnyEditTools.prefs
# Local work folder that is not checked in
_LOCAL/

# Eclipse
/bin/
/*/bin/
**/.settings/*
!**/.settings/org.eclipse.core.resoures.prefs
!**/.settings/org.eclipse.jdt.core.prefs
!**/.settings/org.eclipse.pde.core.prefs
**/.pydevproject

# Maven
/target/
/*/target/
.polyglot.*
.META-INF_MANIFEST.MF
dash-licenses/
*.log

# OSX
.DS_Store

# Vim
*.swo
*.swp
6 changes: 6 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
1 change: 0 additions & 1 deletion org.eclipse.lsp4e.debug/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions org.eclipse.lsp4e.test/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion org.eclipse.lsp4e.tests.mock/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion org.eclipse.lsp4e.tests.mock/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mock Language Server to test LSP4E
Bundle-SymbolicName: org.eclipse.lsp4e.tests.mock
Bundle-Version: 0.16.9.qualifier
Bundle-Version: 0.16.10.qualifier
Bundle-Vendor: Eclipse LSP4E
Bundle-RequiredExecutionEnvironment: JavaSE-17
Require-Bundle: org.eclipse.lsp4j;bundle-version="[0.23.0,0.24.0)",
Expand Down
18 changes: 16 additions & 2 deletions org.eclipse.lsp4e/.classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
3 changes: 0 additions & 3 deletions org.eclipse.lsp4e/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
/target/
/bin/
/resources/highlight.min.js/
/.settings/
4 changes: 2 additions & 2 deletions org.eclipse.lsp4e/.project
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<name>org.eclipse.pde.ds.core.builder</name>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we undo the changes in this file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could but evertime I checkout or switch a branch with Eclipse, the entries get modified/reordered, so I guessed that is how new Eclipse or m2e versions like it.

<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
Expand Down
18 changes: 13 additions & 5 deletions org.eclipse.lsp4e/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.builder.annotationPath.allLocations=enabled
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=org.eclipse.lsp4j.jsonrpc.validation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.notowning=org.eclipse.jdt.annotation.NotOwning
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.annotation.owning=org.eclipse.jdt.annotation.Owning
org.eclipse.jdt.core.compiler.annotation.resourceanalysis=disabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is resourceanalysis=disabled related to this PR? If so, how?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is the default setting. it is set by eclipse 2024-06 automatically.

org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
Expand All @@ -17,6 +21,7 @@ org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
Expand All @@ -37,10 +42,12 @@ org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompatibleOwningContract=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.insufficientResourceAnalysis=warning
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
Expand All @@ -59,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=wa
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=error
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=info
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
Expand All @@ -68,7 +75,7 @@ org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
Expand All @@ -78,7 +85,8 @@ org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed=info
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
Expand Down
1 change: 0 additions & 1 deletion org.eclipse.lsp4e/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.0",
org.eclipse.core.externaltools;bundle-version="1.0.400",
org.eclipse.debug.ui;bundle-version="3.11.200",
org.eclipse.swt;bundle-version="3.122.0",
org.eclipse.jdt.annotation;bundle-version="2.1.0";resolution:=optional,
org.eclipse.tm4e.languageconfiguration,
org.eclipse.tm4e.ui,
org.eclipse.ui.editors,
Expand Down
3 changes: 3 additions & 0 deletions org.eclipse.lsp4e/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ bin.includes = META-INF/,\
schema/,\
OSGI-INF/
src.includes = schema/

# JDT Null Analysis for Eclipse
additional.bundles = org.eclipse.jdt.annotation
sebthom marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ public void setup(IDocument document) {

@Override
public void setup(final IDocument document, IPath location, LocationKind locationKind) {
if (document == null) {
return;
}
// Force document connect
CompletableFuture.runAsync(
() -> PENDING_CONNECTIONS.add(LanguageServers.forDocument(document).collectAll(ls -> CompletableFuture.completedFuture(null))),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.lsp4e.LanguageServersRegistry.LaunchConfigurationLanguageServerDefinition;

public class ContentTypeToLSPLaunchConfigEntry extends ContentTypeToLanguageServerDefinition {
Expand All @@ -31,8 +31,8 @@ public class ContentTypeToLSPLaunchConfigEntry extends ContentTypeToLanguageServ
private final ILaunchConfiguration launchConfiguration;
private final Set<String> launchModes;

public ContentTypeToLSPLaunchConfigEntry(@NonNull IContentType contentType, @NonNull ILaunchConfiguration launchConfig,
@NonNull Set<String> launchModes) {
public ContentTypeToLSPLaunchConfigEntry(IContentType contentType, ILaunchConfiguration launchConfig,
Set<String> launchModes) {
super(contentType, new LaunchConfigurationLanguageServerDefinition(launchConfig, launchModes), null);
this.launchConfiguration = launchConfig;
this.launchModes = Collections.unmodifiableSet(launchModes);
Expand Down Expand Up @@ -64,7 +64,7 @@ public Set<String> getLaunchModes() {
return launchModes;
}

static ContentTypeToLSPLaunchConfigEntry readFromPreference(String preferenceEntry) {
static @Nullable ContentTypeToLSPLaunchConfigEntry readFromPreference(String preferenceEntry) {
String[] parts = preferenceEntry.split(":"); //$NON-NLS-1$
if (parts.length != 2) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,22 @@
import java.util.AbstractMap.SimpleEntry;

import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.lsp4e.LanguageServersRegistry.LanguageServerDefinition;
import org.eclipse.lsp4e.enablement.EnablementTester;

public class ContentTypeToLanguageServerDefinition extends SimpleEntry<IContentType, LanguageServerDefinition> {

private static final long serialVersionUID = 6002703726009331762L;
private final EnablementTester enablement;
private final @Nullable EnablementTester enablement;

public ContentTypeToLanguageServerDefinition(@NonNull IContentType contentType,
@NonNull LanguageServerDefinition provider,
public ContentTypeToLanguageServerDefinition(IContentType contentType, LanguageServerDefinition provider,
@Nullable EnablementTester enablement) {
super(contentType, provider);
this.enablement = enablement;
}

public boolean isEnabled(URI uri) {
public boolean isEnabled(@Nullable URI uri) {
return isUserEnabled() && isExtensionEnabled(uri);
}

Expand All @@ -48,11 +46,11 @@ public boolean isUserEnabled() {
return true;
}

public boolean isExtensionEnabled(URI uri) {
public boolean isExtensionEnabled(@Nullable URI uri) {
return enablement != null ? enablement.evaluate(uri) : true;
}

public EnablementTester getEnablementCondition() {
public @Nullable EnablementTester getEnablementCondition() {
return enablement;
}

Expand Down
Loading
Loading