Skip to content

Commit

Permalink
Drop support for older Java versions
Browse files Browse the repository at this point in the history
- Don't propose compilation targets below 1.8 JLS
- don't show old EE's in wizards

Requires eclipse-jdt/eclipse.jdt.debug#452
Requires eclipse-jdt/eclipse.jdt.core#2606
See #1465
  • Loading branch information
iloveeclipse committed Jun 26, 2024
1 parent 690340f commit 45fbd7b
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 258 deletions.
4 changes: 2 additions & 2 deletions org.eclipse.jdt.core.manipulation/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.31.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.20.0,4.0.0)",
org.eclipse.ltk.core.refactoring;bundle-version="[3.14.0,4.0.0)",
org.eclipse.jdt.core;bundle-version="[3.38.0,4.0.0)",
org.eclipse.jdt.core;bundle-version="[3.39.0,4.0.0)",
org.eclipse.core.expressions;bundle-version="[3.9.0,4.0.0)",
org.eclipse.text;bundle-version="[3.14.0,4.0.0)",
org.eclipse.jdt.launching;bundle-version="3.21.0",
org.eclipse.jdt.launching;bundle-version="3.23.0",
org.eclipse.core.filesystem;bundle-version="1.10.0",
org.eclipse.core.filebuffers;bundle-version="3.8.0",
org.eclipse.search.core;bundle-version="3.16.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1143,28 +1143,20 @@ public static String getCompilerCompliance(IVMInstall2 vMInstall, String default
return JavaCore.VERSION_9;
} else if (version.startsWith(JavaCore.VERSION_1_8)) {
return JavaCore.VERSION_1_8;
} else if (version.startsWith(JavaCore.VERSION_1_7)) {
return JavaCore.VERSION_1_7;
} else if (version.startsWith(JavaCore.VERSION_1_6)) {
return JavaCore.VERSION_1_6;
} else if (version.startsWith(JavaCore.VERSION_1_5)) {
return JavaCore.VERSION_1_5;
} else if (version.startsWith(JavaCore.VERSION_1_4)) {
return JavaCore.VERSION_1_4;
} else if (version.startsWith(JavaCore.VERSION_1_3)
|| version.startsWith(JavaCore.VERSION_1_2)
|| version.startsWith(JavaCore.VERSION_1_1)) {
return JavaCore.VERSION_1_3;
}
return JavaCore.isSupportedJavaVersion(version) ? defaultCompliance : JavaModelUtil.VERSION_LATEST;
return JavaCore.isJavaSourceVersionSupportedByCompiler(version) ? defaultCompliance : JavaModelUtil.VERSION_LATEST;
}

public static String getExecutionEnvironmentCompliance(IExecutionEnvironment executionEnvironment) {
Map<String, String> complianceOptions= executionEnvironment.getComplianceOptions();
if (complianceOptions != null) {
String compliance= complianceOptions.get(JavaCore.COMPILER_COMPLIANCE);
if (compliance != null)
return compliance;
if (compliance != null) {
if(JavaCore.isJavaSourceVersionSupportedByCompiler(compliance)) {
return compliance;
}
return JavaCore.getFirstJavaSourceVersionSupportedByCompiler();
}
}

// fallback:
Expand Down Expand Up @@ -1199,16 +1191,8 @@ public static String getExecutionEnvironmentCompliance(IExecutionEnvironment exe
return JavaCore.VERSION_9;
} else if (desc.indexOf(JavaCore.VERSION_1_8) != -1) {
return JavaCore.VERSION_1_8;
} else if (desc.indexOf(JavaCore.VERSION_1_7) != -1) {
return JavaCore.VERSION_1_7;
} else if (desc.indexOf(JavaCore.VERSION_1_6) != -1) {
return JavaCore.VERSION_1_6;
} else if (desc.indexOf(JavaCore.VERSION_1_5) != -1) {
return JavaCore.VERSION_1_5;
} else if (desc.indexOf(JavaCore.VERSION_1_4) != -1) {
return JavaCore.VERSION_1_4;
}
return JavaCore.VERSION_1_3;
return JavaCore.getFirstJavaSourceVersionSupportedByCompiler();
}

/**
Expand Down
6 changes: 3 additions & 3 deletions org.eclipse.jdt.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,18 @@ Require-Bundle:
org.eclipse.core.filesystem;bundle-version="[1.2.0,2.0.0)",
org.eclipse.core.resources;bundle-version="[3.14.0,4.0.0)",
org.eclipse.core.variables;bundle-version="[3.2.200,4.0.0)",
org.eclipse.jdt.core;bundle-version="[3.37.0,4.0.0)",
org.eclipse.jdt.core;bundle-version="[3.39.0,4.0.0)",
org.eclipse.search;bundle-version="[3.10.0,4.0.0)",
org.eclipse.debug.core;bundle-version="[3.10.0,4.0.0)",
org.eclipse.debug.ui;bundle-version="[3.11.0,4.0.0)",
org.eclipse.jdt.launching;bundle-version="[3.19.400,4.0.0)",
org.eclipse.jdt.launching;bundle-version="[3.23.0,4.0.0)",
org.eclipse.compare;bundle-version="[3.5.0,4.0.0)",
org.eclipse.team.ui;bundle-version="[3.4.100,4.0.0)",
org.eclipse.team.core;bundle-version="[3.4.100,4.0.0)",
org.eclipse.jface.text;bundle-version="[3.20.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.117.0,4.0.0)",
org.eclipse.ui.console;bundle-version="[3.4.0,4.0.0)",
org.eclipse.ui.workbench;bundle-version="[3.131.0, 4.0.0)",
org.eclipse.ui.workbench;bundle-version="[3.131.0,4.0.0)",
org.eclipse.ui.workbench.texteditor;bundle-version="[3.10.0,4.0.0)",
org.eclipse.ui.ide;bundle-version="[3.15.0,4.0.0)",
org.eclipse.ui.views;bundle-version="[3.3.100,4.0.0)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.eclipse.swt.SWT;
Expand Down Expand Up @@ -154,8 +153,7 @@ private void createExtraOptionsGroup(Composite composite) {
fSourceCombo= createCombo(inner, SWT.NONE, fStore.getSource(), createGridData(1));
List<String> versions= new ArrayList<>();
versions.add("-"); //$NON-NLS-1$
versions.addAll(JavaCore.getAllVersions());
versions.removeAll(Arrays.asList(JavaCore.VERSION_CLDC_1_1, JavaCore.VERSION_1_1, JavaCore.VERSION_1_2));
versions.addAll(JavaCore.getAllJavaSourceVersionsSupportedByCompiler());
fSourceCombo.setItems(versions.toArray(new String[versions.size()]));

fSourceCombo.setText(fStore.getSource());
Expand Down
Loading

0 comments on commit 45fbd7b

Please sign in to comment.