Skip to content

Commit

Permalink
Remove old 1.x Java compiler versions support from PDE tests
Browse files Browse the repository at this point in the history
Basically moves tests that used various old 1.x JDK compiler settings to
use 1.8 target (only supported 1.x Java compiler target in the future).

See eclipse-jdt/eclipse.jdt.core#2536
  • Loading branch information
iloveeclipse committed Jun 18, 2024
1 parent c32168e commit 34453f9
Show file tree
Hide file tree
Showing 35 changed files with 120 additions and 109 deletions.
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: %Bundle-Name
Bundle-SymbolicName: org.eclipse.pde.api.tools.tests
Bundle-Version: 1.3.500.qualifier
Bundle-Version: 1.3.600.qualifier
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.pde.api.tools;bundle-version="1.0.600",
Expand Down
2 changes: 1 addition & 1 deletion apitools/org.eclipse.pde.api.tools.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<relativePath>../../</relativePath>
</parent>
<artifactId>org.eclipse.pde.api.tools.tests</artifactId>
<version>1.3.500-SNAPSHOT</version>
<version>1.3.600-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
<defaultSigning-excludeInnerJars>true</defaultSigning-excludeInnerJars>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ protected void createExistingProject(File projectDir, boolean importfiles, boole
* @return the default compiler compliance to use for the test
*/
protected String getTestCompliance() {
return JavaCore.VERSION_1_4;
return JavaCore.VERSION_1_8;
}

/**
Expand Down Expand Up @@ -449,7 +449,19 @@ protected void assertProblems(ApiProblem[] problems) {
String[] messageArgs = args[i];
int messageId = ApiProblemFactory.getProblemMessageId(expectedProblemIds[i]);
String message = ApiProblemFactory.getLocalizedMessage(messageId, messageArgs);
assertTrue("Missing expected problem: " + message, messages.remove(message)); //$NON-NLS-1$

boolean match = messages.remove(message);
if (!match) {
System.err.println("Observed problems:"); //$NON-NLS-1$
for (ApiProblem p : problems) {
System.err.println(p);
}
System.err.println("Expected massages:"); //$NON-NLS-1$
for (String p : messages) {
System.err.println(p);
}
}
assertTrue("Missing expected problem: " + message, match); //$NON-NLS-1$
}
if (messages.size() > 0) {
StringBuilder buffer = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,10 @@ public IPath addProject(String projectName, String compliance) throws Unsupporte
public void setProjectCompliance(IJavaProject project, String compliance) {
int requiredComplianceFlag = 0;
String compilerVersion = null;
if (JavaCore.VERSION_1_4.equals(compliance)) {
requiredComplianceFlag = AbstractCompilerTest.F_1_4;
compilerVersion = JavaCore.VERSION_1_4;
} else if (JavaCore.VERSION_1_5.equals(compliance)) {
requiredComplianceFlag = AbstractCompilerTest.F_1_5;
compilerVersion = JavaCore.VERSION_1_5;
} else if (JavaCore.VERSION_1_6.equals(compliance)) {
requiredComplianceFlag = AbstractCompilerTest.F_1_6;
compilerVersion = JavaCore.VERSION_1_6;
} else if (JavaCore.VERSION_1_7.equals(compliance)) {
requiredComplianceFlag = AbstractCompilerTest.F_1_7;
compilerVersion = JavaCore.VERSION_1_7;
} else if (JavaCore.VERSION_1_8.equals(compliance)) {
if (JavaCore.VERSION_1_8.equals(compliance)) {
requiredComplianceFlag = AbstractCompilerTest.F_1_8;
compilerVersion = JavaCore.VERSION_1_8;
} else if (!JavaCore.VERSION_1_4.equals(compliance) && !JavaCore.VERSION_1_3.equals(compliance)) {
} else {
throw new UnsupportedOperationException("Test framework doesn't support compliance level: " + compliance); //$NON-NLS-1$
}
if (requiredComplianceFlag != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static Test suite() {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static Test suite() {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public EnumIncrementalBuildTests(String name) {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static Test suite() {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

public void testInvalidAnnotationFieldTag1I() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public InvalidAnnotationMethodTagTests(String name) {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected int getDefaultProblemId() {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

public void testInvalidAnnotationTag3I() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected IPath getTestSourcePath() {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static Test suite() {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

public void testInvalidEnumConstantTag1I() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static Test suite() {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

public void testInvalidEnumFieldTag1I() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public InvalidEnumMethodTagTests(String name) {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected int getDefaultProblemId() {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

public void testInvalidEnumTag1I() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected IPath getTestSourcePath() {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static Test suite() {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public ValidEnumMethodTagTests(String name) {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected IPath getTestSourcePath() {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

public static Test suite() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,13 +336,17 @@ public void testLocalClassIllegalImplements1F() throws Exception {
private void x19(boolean inc) {
int localId = getProblemId(IApiProblem.ILLEGAL_IMPLEMENT, IApiProblem.LOCAL_TYPE);
int indId = getProblemId(IApiProblem.ILLEGAL_IMPLEMENT, IApiProblem.INDIRECT_LOCAL_REFERENCE);
setExpectedProblemIds(new int[] {localId, indId});
setExpectedProblemIds(new int[] {localId, indId, localId, indId});
String typename = "testC11"; //$NON-NLS-1$
setExpectedLineMappings(new LineMapping[] {
new LineMapping(24, localId, new String[] { "local3", "x.y.z.testC11.inner1.method2()", "INoImpl3" }), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new LineMapping(26, indId, new String[] { "local4", "x.y.z.testC11.inner1.method2()", "INoImpl6", "INoImpl2" }), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new LineMapping(32, localId, new String[] { "local1", "x.y.z.testC11.method1()", "INoImpl2" }), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new LineMapping(34, indId, new String[] { "local2", "x.y.z.testC11.method1()", "INoImpl5", "INoImpl2" }) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
});
setExpectedMessageArgs(new String[][] {
{"local3", "x.y.z.testC11.inner1.method2()", "INoImpl3"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
{"local4", "x.y.z.testC11.inner1.method2()", "INoImpl6", "INoImpl2"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
{"local1", "x.y.z.testC11.method1()", "INoImpl2"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
{"local2", "x.y.z.testC11.method1()", "INoImpl5", "INoImpl2"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
});
Expand Down Expand Up @@ -375,12 +379,15 @@ public void testLocalClassIllegalImplements2F() throws Exception {

private void x20(boolean inc) {
int indId = getProblemId(IApiProblem.ILLEGAL_IMPLEMENT, IApiProblem.INDIRECT_LOCAL_REFERENCE);
setExpectedProblemIds(new int[] {indId});
setExpectedProblemIds(new int[] {indId, indId});
setExpectedLineMappings(new LineMapping[] {
new LineMapping(21, indId,
new String[] { "local4", "x.y.z.testC12.inner1.method2()", "INoImpl5", "INoImpl2" }), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new LineMapping(27, indId,
new String[] { "local2", "x.y.z.testC12.method1()", "INoImpl5", "INoImpl2" }), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
});
setExpectedMessageArgs(new String[][] {
{"local4", "x.y.z.testC12.inner1.method2()", "INoImpl5", "INoImpl2"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
{"local2", "x.y.z.testC12.method1()", "INoImpl5", "INoImpl2"} //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
});
String typename = "testC12"; //$NON-NLS-1$
Expand Down Expand Up @@ -412,11 +419,13 @@ public void testAnonymousClassIllegalImplements1F() throws Exception {

private void x21(boolean inc) {
int indId = getProblemId(IApiProblem.ILLEGAL_IMPLEMENT, IApiProblem.ANONYMOUS_TYPE);
setExpectedProblemIds(new int[] {indId});
setExpectedProblemIds(new int[] { indId, indId });
setExpectedLineMappings(new LineMapping[] {
new LineMapping(22, indId, new String[] { "x.y.z.testC13.inner.method()", "INoImpl2" }), //$NON-NLS-1$ //$NON-NLS-2$
new LineMapping(28, indId, new String[] { "x.y.z.testC13.testC13()", "INoImpl2" }) //$NON-NLS-1$ //$NON-NLS-2$
});
setExpectedMessageArgs(new String[][] {
{ "x.y.z.testC13.inner.method()", "INoImpl2" }, //$NON-NLS-1$ //$NON-NLS-2$
{"x.y.z.testC13.testC13()", "INoImpl2"} //$NON-NLS-1$ //$NON-NLS-2$
});
String typename = "testC13"; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected IPath getTestSourcePath() {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

public static Test suite() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected int getDefaultProblemId() {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public Java5ClassUsageTests(String name) {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static Test suite() {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static Test suite() {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_5;
return JavaCore.VERSION_1_8;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public Java7UsageTest(String name) {

@Override
protected String getTestCompliance() {
return JavaCore.VERSION_1_7;
return JavaCore.VERSION_1_8;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1117,9 +1117,9 @@ public void testMethodInheritInvalidRestrictionInterface() {
public void testEnumMethodWithNoReference() {
IApiDescription manifest = newDescription();
Map<String, String> options = JavaCore.getDefaultOptions();
options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5);
options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_8);
options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_8);
options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_8);
doScan("a/b/c/TestMethod21.java", manifest, options); //$NON-NLS-1$
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public static IJavaProject createPluginProject(String projectName, String[] addi
description.setExtensionRegistry(true);
description.setEquinox(true);
description.setBundleVersion(new Version("1.0.0")); //$NON-NLS-1$
description.setExecutionEnvironments(new String[] { "J2SE-1.5" }); //$NON-NLS-1$
description.setExecutionEnvironments(new String[] { "JavaSE-1.8" }); //$NON-NLS-1$
description.apply(null);
AbstractApiTest.waitForAutoBuild();
return JavaCore.create(project);
Expand Down
2 changes: 1 addition & 1 deletion ui/org.eclipse.pde.ui.tests/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: PDE JUnit Tests
Bundle-SymbolicName: org.eclipse.pde.ui.tests; singleton:=true
Bundle-Version: 3.12.500.qualifier
Bundle-Version: 3.12.600.qualifier
Bundle-ClassPath: tests.jar
Bundle-Vendor: Eclipse.org
Require-Bundle: org.eclipse.pde.ui,
Expand Down
6 changes: 3 additions & 3 deletions ui/org.eclipse.pde.ui.tests/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<extension
point="org.eclipse.jdt.launching.executionEnvironments">
<environment
description="Java 1.3 without sound APIs (PDE test suite)"
id="J2SE-1.3-NO-SOUND"
profileProperties="profiles/J2SE-1.3-NO-SOUND.profile">
description="Java 1.8 without sound APIs (PDE test suite)"
id="J2SE-1.8-NO-SOUND"
profileProperties="profiles/J2SE-1.8-NO-SOUND.profile">
</environment>
<analyzer
class="org.eclipse.pde.ui.tests.ee.EnvironmentAnalyzerDelegate"
Expand Down
2 changes: 1 addition & 1 deletion ui/org.eclipse.pde.ui.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<relativePath>../../</relativePath>
</parent>
<artifactId>org.eclipse.pde.ui.tests</artifactId>
<version>3.12.500-SNAPSHOT</version>
<version>3.12.600-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ org.osgi.framework.executionenvironment = \
OSGi/Minimum-1.1,\
JRE-1.1,\
J2SE-1.2,\
J2SE-1.3-NO-SOUND
osgi.java.profile.name = J2SE-1.3-NO-SOUND
org.eclipse.jdt.core.compiler.compliance=1.3
org.eclipse.jdt.core.compiler.source=1.3
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.3
J2SE-1.8-NO-SOUND
osgi.java.profile.name = J2SE-1.8-NO-SOUND
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class EnvironmentAnalyzerDelegate implements IExecutionEnvironmentAnalyze
/**
* Environment identifier
*/
public static final String EE_NO_SOUND = "J2SE-1.3-NO-SOUND";
public static final String EE_NO_SOUND = "J2SE-1.8-NO-SOUND";

@Override
public CompatibleEnvironment[] analyze(IVMInstall vm, IProgressMonitor monitor) throws CoreException {
Expand Down
Loading

0 comments on commit 34453f9

Please sign in to comment.