Skip to content

Commit

Permalink
Add java.jdt.ls.javac.enabled setting.
Browse files Browse the repository at this point in the history
- Report setting through 'telemetry/event' notification
- Use a JDK 23 for building
- Bump ECJ to 3.39.0.v20240820-0604
- Bump target platform to match new jdt-core-incubator site

Signed-off-by: Roland Grunberg <[email protected]>
  • Loading branch information
rgrunber committed Oct 16, 2024
1 parent c0ed19c commit 7296d00
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up JDK 17
- name: Set up JDK 23
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '23'
distribution: 'temurin'
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.ChildListPropertyDescriptor;
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
import org.eclipse.jdt.ui.text.java.IInvocationContext;
import org.eclipse.jdt.ui.text.java.IProblemLocation;
import org.eclipse.jdt.internal.corext.fix.IProposableFix;
import org.eclipse.jdt.internal.ui.text.correction.SuppressWarningsBaseSubProcessor;
import org.eclipse.jdt.internal.ui.text.correction.SuppressWarningsProposalCore;
import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposalCore;
import org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler;
import org.eclipse.jdt.ui.cleanup.ICleanUp;
import org.eclipse.jdt.ui.text.java.IInvocationContext;
import org.eclipse.jdt.ui.text.java.IProblemLocation;
import org.eclipse.jdt.ui.text.java.correction.ASTRewriteCorrectionProposalCore;
import org.eclipse.lsp4j.CodeActionKind;

Expand Down Expand Up @@ -50,4 +53,11 @@ protected ProposalKindWrapper createASTRewriteCorrectionProposal(String name, IC
return CodeActionHandler.wrap(new ASTRewriteCorrectionProposalCore(name, cu, rewrite, relevance), CodeActionKind.QuickFix);
}

@Override
protected ProposalKindWrapper createFixCorrectionProposal(IProposableFix fix, ICleanUp cleanUp, int relevance, IInvocationContext context) {
FixCorrectionProposalCore proposal = new FixCorrectionProposalCore(fix, cleanUp, relevance, context);
proposal.setCommandId("org.eclipse.jdt.ui.correction.addSuppressWarnings");
return CodeActionHandler.wrap(proposal, CodeActionKind.QuickFix);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ public void onBuildFinished(long buildFinishedTime) {
properties.add("buildFileNames", buildFileNamesList);
}
properties.addProperty("javaProjectCount", javaProjectCount);
properties.addProperty("javac.enabled", Boolean.toString(prefs.getPreferences().isJavacEnabled()));
if (sourceLevelMin != 0) {
properties.addProperty("compiler.source.min", Float.toString(sourceLevelMin));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,11 +516,13 @@ public class Preferences {

public static final String JAVA_JDT_LS_PROTOBUF_SUPPORT_ENABLED = "java.jdt.ls.protobufSupport.enabled";
public static final String JAVA_JDT_LS_ANDROID_SUPPORT_ENABLED = "java.jdt.ls.androidSupport.enabled";
public static final String JAVA_JDT_LS_JAVAC_ENABLED = "java.jdt.ls.javac.enabled";

public static final String JAVA_COMPILE_NULLANALYSIS_NONNULL = "java.compile.nullAnalysis.nonnull";
public static final String JAVA_COMPILE_NULLANALYSIS_NULLABLE = "java.compile.nullAnalysis.nullable";
public static final String JAVA_COMPILE_NULLANALYSIS_NONNULLBYDEFAULT = "java.compile.nullAnalysis.nonnullbydefault";
public static final String JAVA_COMPILE_NULLANALYSIS_MODE = "java.compile.nullAnalysis.mode";
public static final String JAVA_COMPLETION_ENGINE = "java.completion.engine";

public static final String LIFECYCLE_MAPPING_METADATA_SOURCE_NAME = "lifecycle-mapping-metadata.xml";

Expand Down Expand Up @@ -702,6 +704,7 @@ public class Preferences {
private ProjectEncodingMode projectEncoding;
private boolean avoidVolatileChanges;
private boolean protobufSupportEnabled;
private boolean javacEnabled;
private boolean androidSupportEnabled;
private List<String> nonnullTypes;
private List<String> nullableTypes;
Expand Down Expand Up @@ -958,6 +961,7 @@ public Preferences() {
inlayHintsParameterMode = InlayHintsParameterMode.LITERALS;
projectEncoding = ProjectEncodingMode.IGNORE;
avoidVolatileChanges = true;
javacEnabled = false;
nonnullTypes = new ArrayList<>();
nullableTypes = new ArrayList<>();
nonnullbydefaultTypes = new ArrayList<>();
Expand Down Expand Up @@ -1335,6 +1339,8 @@ public static Preferences createFrom(Map<String, Object> configuration) {
prefs.setAvoidVolatileChanges(avoidVolatileChanges);
boolean protobufSupported = getBoolean(configuration, JAVA_JDT_LS_PROTOBUF_SUPPORT_ENABLED, false);
prefs.setProtobufSupportEnabled(protobufSupported);
boolean javacEnabled = getBoolean(configuration, JAVA_JDT_LS_JAVAC_ENABLED, false);
prefs.setJavacEnabled(javacEnabled);
boolean androidSupported = getBoolean(configuration, JAVA_JDT_LS_ANDROID_SUPPORT_ENABLED, false);
prefs.setAndroidSupportEnabled(androidSupported);
List<String> nonnullTypes = getList(configuration, JAVA_COMPILE_NULLANALYSIS_NONNULL, Collections.emptyList());
Expand Down Expand Up @@ -1379,10 +1385,10 @@ public static Preferences createFrom(Map<String, Object> configuration) {
}
}
prefs.setFilesAssociations(new ArrayList<>(associations));

String searchScope = getString(configuration, JAVA_SEARCH_SCOPE, null);
prefs.setSearchScope(SearchScope.fromString(searchScope, SearchScope.all));

return prefs;
}

Expand Down Expand Up @@ -2381,6 +2387,14 @@ public void setAndroidSupportEnabled(boolean androidSupportEnabled) {
this.androidSupportEnabled = androidSupportEnabled;
}

public boolean isJavacEnabled() {
return this.javacEnabled;
}

public void setJavacEnabled(boolean javacEnabled) {
this.javacEnabled = javacEnabled;
}

public List<String> getNonnullTypes() {
return this.nonnullTypes;
}
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<unit id="org.eclipse.pde.junit.runtime" version="0.0.0" />
<unit id="org.eclipse.jdt.junit4.runtime" version="0.0.0" />
<unit id="org.eclipse.jdt.core.manipulation" version="0.0.0" />
<repository location="https://download.eclipse.org/eclipse/updates/4.34-I-builds/I20240919-1840/"/>
<repository location="https://download.eclipse.org/eclipse/updates/4.34-I-builds/I20241014-1810/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.jdt.core.compiler.batch" version="0.0.0"/>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<cbi.jarsigner.skip>true</cbi.jarsigner.skip>
<generateSourceRef>true</generateSourceRef>
<cbi-jdt-repo.url>https://repo.eclipse.org/content/repositories/eclipse-staging/</cbi-jdt-repo.url>
<cbi-ecj-version>3.38.0.v20240524-2033</cbi-ecj-version>
<cbi-ecj-version>3.39.0.v20240820-0604</cbi-ecj-version>
</properties>
<modules>
<module>org.eclipse.jdt.ls.target</module>
Expand Down

0 comments on commit 7296d00

Please sign in to comment.