From becbdb6b100f2e34d36c7956b4e8a9f589ee68ed Mon Sep 17 00:00:00 2001 From: Andrey Loskutov Date: Tue, 18 Jun 2024 09:17:57 +0200 Subject: [PATCH] Remove old 1.x Java compiler versions support from PDE tests 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 https://github.com/eclipse-jdt/eclipse.jdt.core/issues/2536 --- .../META-INF/MANIFEST.MF | 2 +- .../org.eclipse.pde.api.tools.tests/pom.xml | 2 +- .../tools/builder/tests/ApiBuilderTest.java | 16 +++- .../builder/tests/ApiTestingEnvironment.java | 16 +--- .../tests/annotations/AnnotationTest.java | 2 +- .../builder/tests/leak/ClassExtendsLeak.java | 2 +- .../EnumIncrementalBuildTests.java | 2 +- .../tags/InvalidAnnotationFieldTagTests.java | 2 +- .../tags/InvalidAnnotationMethodTagTests.java | 2 +- .../tests/tags/InvalidAnnotationTagTests.java | 2 +- .../tests/tags/InvalidDuplicateTagsTests.java | 2 +- .../tags/InvalidEnumConstantTagTests.java | 2 +- .../tests/tags/InvalidEnumFieldTagTests.java | 2 +- .../tests/tags/InvalidEnumMethodTagTests.java | 2 +- .../tests/tags/InvalidEnumTagTests.java | 2 +- .../tests/tags/ValidAnnotationTagTests.java | 2 +- .../tests/tags/ValidEnumFieldTagTests.java | 2 +- .../tests/tags/ValidEnumMethodTagTests.java | 2 +- .../tests/usage/AnnotationUsageTests.java | 2 +- .../builder/tests/usage/ClassUsageTests.java | 15 +++- .../builder/tests/usage/EnumUsageTests.java | 2 +- .../tests/usage/FragmentUsageTests.java | 2 +- .../tests/usage/Java5ClassUsageTests.java | 2 +- .../tests/usage/Java5FieldUsageTests.java | 2 +- .../tests/usage/Java5MethodUsageTests.java | 2 +- .../builder/tests/usage/Java7UsageTest.java | 2 +- .../tools/model/tests/TagScannerTests.java | 6 +- .../api/tools/tests/util/ProjectUtils.java | 2 +- .../META-INF/MANIFEST.MF | 2 +- ui/org.eclipse.pde.ui.tests/plugin.xml | 6 +- ui/org.eclipse.pde.ui.tests/pom.xml | 2 +- ...OUND.profile => J2SE-1.8-NO-SOUND.profile} | 10 +-- .../tests/ee/EnvironmentAnalyzerDelegate.java | 2 +- .../tests/ee/ExecutionEnvironmentTests.java | 89 ++++++++++--------- .../pde/ui/tests/ee/ExportBundleTests.java | 17 ++-- 35 files changed, 120 insertions(+), 109 deletions(-) rename ui/org.eclipse.pde.ui.tests/profiles/{J2SE-1.3-NO-SOUND.profile => J2SE-1.8-NO-SOUND.profile} (89%) diff --git a/apitools/org.eclipse.pde.api.tools.tests/META-INF/MANIFEST.MF b/apitools/org.eclipse.pde.api.tools.tests/META-INF/MANIFEST.MF index 6b6abc18ac..92bed429d6 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/META-INF/MANIFEST.MF +++ b/apitools/org.eclipse.pde.api.tools.tests/META-INF/MANIFEST.MF @@ -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", diff --git a/apitools/org.eclipse.pde.api.tools.tests/pom.xml b/apitools/org.eclipse.pde.api.tools.tests/pom.xml index 7fd81f2d89..f51797f67f 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/pom.xml +++ b/apitools/org.eclipse.pde.api.tools.tests/pom.xml @@ -18,7 +18,7 @@ ../../ org.eclipse.pde.api.tools.tests - 1.3.500-SNAPSHOT + 1.3.600-SNAPSHOT eclipse-test-plugin true diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/ApiBuilderTest.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/ApiBuilderTest.java index 5e21b1b5e9..6f74e93458 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/ApiBuilderTest.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/ApiBuilderTest.java @@ -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; } /** @@ -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(); diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/ApiTestingEnvironment.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/ApiTestingEnvironment.java index b7d4cdda5f..a70bbc4e44 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/ApiTestingEnvironment.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/ApiTestingEnvironment.java @@ -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) { diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/annotations/AnnotationTest.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/annotations/AnnotationTest.java index 0fa5335358..32fecb2c65 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/annotations/AnnotationTest.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/annotations/AnnotationTest.java @@ -134,7 +134,7 @@ public static Test suite() { @Override protected String getTestCompliance() { - return JavaCore.VERSION_1_5; + return JavaCore.VERSION_1_8; } @Override diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/leak/ClassExtendsLeak.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/leak/ClassExtendsLeak.java index 37045365d9..9f849d254e 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/leak/ClassExtendsLeak.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/leak/ClassExtendsLeak.java @@ -59,7 +59,7 @@ public static Test suite() { @Override protected String getTestCompliance() { - return JavaCore.VERSION_1_5; + return JavaCore.VERSION_1_8; } /** diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/performance/EnumIncrementalBuildTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/performance/EnumIncrementalBuildTests.java index f24f8419d5..d8e2b85c14 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/performance/EnumIncrementalBuildTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/performance/EnumIncrementalBuildTests.java @@ -41,7 +41,7 @@ public EnumIncrementalBuildTests(String name) { @Override protected String getTestCompliance() { - return JavaCore.VERSION_1_5; + return JavaCore.VERSION_1_8; } /** diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidAnnotationFieldTagTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidAnnotationFieldTagTests.java index 6f4743a188..39af3ab812 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidAnnotationFieldTagTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidAnnotationFieldTagTests.java @@ -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() { diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidAnnotationMethodTagTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidAnnotationMethodTagTests.java index 1791804aa8..e215632070 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidAnnotationMethodTagTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidAnnotationMethodTagTests.java @@ -32,7 +32,7 @@ public InvalidAnnotationMethodTagTests(String name) { @Override protected String getTestCompliance() { - return JavaCore.VERSION_1_5; + return JavaCore.VERSION_1_8; } @Override diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidAnnotationTagTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidAnnotationTagTests.java index 34f693759a..fc7046f743 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidAnnotationTagTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidAnnotationTagTests.java @@ -52,7 +52,7 @@ protected int getDefaultProblemId() { @Override protected String getTestCompliance() { - return JavaCore.VERSION_1_5; + return JavaCore.VERSION_1_8; } public void testInvalidAnnotationTag3I() { diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidDuplicateTagsTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidDuplicateTagsTests.java index 2b60d1ebf2..3945648fca 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidDuplicateTagsTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidDuplicateTagsTests.java @@ -60,7 +60,7 @@ protected IPath getTestSourcePath() { @Override protected String getTestCompliance() { - return JavaCore.VERSION_1_5; + return JavaCore.VERSION_1_8; } /** diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidEnumConstantTagTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidEnumConstantTagTests.java index 1d46926cec..6ce59bbb33 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidEnumConstantTagTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidEnumConstantTagTests.java @@ -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() { diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidEnumFieldTagTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidEnumFieldTagTests.java index b22720ad59..f35cbf5be1 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidEnumFieldTagTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidEnumFieldTagTests.java @@ -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() { diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidEnumMethodTagTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidEnumMethodTagTests.java index 3a5d503afb..569e897fea 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidEnumMethodTagTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidEnumMethodTagTests.java @@ -32,7 +32,7 @@ public InvalidEnumMethodTagTests(String name) { @Override protected String getTestCompliance() { - return JavaCore.VERSION_1_5; + return JavaCore.VERSION_1_8; } @Override diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidEnumTagTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidEnumTagTests.java index 494077801c..6ae4b420e5 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidEnumTagTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidEnumTagTests.java @@ -52,7 +52,7 @@ protected int getDefaultProblemId() { @Override protected String getTestCompliance() { - return JavaCore.VERSION_1_5; + return JavaCore.VERSION_1_8; } public void testInvalidEnumTag1I() { diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/ValidAnnotationTagTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/ValidAnnotationTagTests.java index b1a85adf79..bc415f9e65 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/ValidAnnotationTagTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/ValidAnnotationTagTests.java @@ -41,7 +41,7 @@ protected IPath getTestSourcePath() { @Override protected String getTestCompliance() { - return JavaCore.VERSION_1_5; + return JavaCore.VERSION_1_8; } diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/ValidEnumFieldTagTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/ValidEnumFieldTagTests.java index ad024724d7..8647819ba6 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/ValidEnumFieldTagTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/ValidEnumFieldTagTests.java @@ -43,7 +43,7 @@ public static Test suite() { @Override protected String getTestCompliance() { - return JavaCore.VERSION_1_5; + return JavaCore.VERSION_1_8; } /** diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/ValidEnumMethodTagTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/ValidEnumMethodTagTests.java index f935ad33bf..a96264efe9 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/ValidEnumMethodTagTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/ValidEnumMethodTagTests.java @@ -31,7 +31,7 @@ public ValidEnumMethodTagTests(String name) { @Override protected String getTestCompliance() { - return JavaCore.VERSION_1_5; + return JavaCore.VERSION_1_8; } @Override diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/AnnotationUsageTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/AnnotationUsageTests.java index f6185f0025..3d9b32a63f 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/AnnotationUsageTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/AnnotationUsageTests.java @@ -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() { diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/ClassUsageTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/ClassUsageTests.java index fc3d3b5c9e..270257fc3a 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/ClassUsageTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/ClassUsageTests.java @@ -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$ }); @@ -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$ @@ -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$ diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/EnumUsageTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/EnumUsageTests.java index cb4f62b9b4..49cdc8f165 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/EnumUsageTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/EnumUsageTests.java @@ -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() { diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/FragmentUsageTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/FragmentUsageTests.java index aa20ac18b7..50ddb9bfeb 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/FragmentUsageTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/FragmentUsageTests.java @@ -36,7 +36,7 @@ protected int getDefaultProblemId() { @Override protected String getTestCompliance() { - return JavaCore.VERSION_1_5; + return JavaCore.VERSION_1_8; } /** diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java5ClassUsageTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java5ClassUsageTests.java index 7239561b01..9f53229420 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java5ClassUsageTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java5ClassUsageTests.java @@ -33,7 +33,7 @@ public Java5ClassUsageTests(String name) { @Override protected String getTestCompliance() { - return JavaCore.VERSION_1_5; + return JavaCore.VERSION_1_8; } /** diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java5FieldUsageTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java5FieldUsageTests.java index 6400f39735..e914174325 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java5FieldUsageTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java5FieldUsageTests.java @@ -39,7 +39,7 @@ public static Test suite() { @Override protected String getTestCompliance() { - return JavaCore.VERSION_1_5; + return JavaCore.VERSION_1_8; } @Override diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java5MethodUsageTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java5MethodUsageTests.java index 2aea6a9279..92983c8c50 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java5MethodUsageTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java5MethodUsageTests.java @@ -42,7 +42,7 @@ public static Test suite() { @Override protected String getTestCompliance() { - return JavaCore.VERSION_1_5; + return JavaCore.VERSION_1_8; } @Override diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java7UsageTest.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java7UsageTest.java index 19005591c6..a68f125c26 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java7UsageTest.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java7UsageTest.java @@ -42,7 +42,7 @@ public Java7UsageTest(String name) { @Override protected String getTestCompliance() { - return JavaCore.VERSION_1_7; + return JavaCore.VERSION_1_8; } @Override diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/model/tests/TagScannerTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/model/tests/TagScannerTests.java index 138448cf76..cd38de77a8 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/model/tests/TagScannerTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/model/tests/TagScannerTests.java @@ -1117,9 +1117,9 @@ public void testMethodInheritInvalidRestrictionInterface() { public void testEnumMethodWithNoReference() { IApiDescription manifest = newDescription(); Map 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$ } diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/tests/util/ProjectUtils.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/tests/util/ProjectUtils.java index ee3d65622c..20acc89db9 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/tests/util/ProjectUtils.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/tests/util/ProjectUtils.java @@ -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); diff --git a/ui/org.eclipse.pde.ui.tests/META-INF/MANIFEST.MF b/ui/org.eclipse.pde.ui.tests/META-INF/MANIFEST.MF index 7b6b867c18..8eee1e5ff9 100644 --- a/ui/org.eclipse.pde.ui.tests/META-INF/MANIFEST.MF +++ b/ui/org.eclipse.pde.ui.tests/META-INF/MANIFEST.MF @@ -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, diff --git a/ui/org.eclipse.pde.ui.tests/plugin.xml b/ui/org.eclipse.pde.ui.tests/plugin.xml index ae538c830f..5ec3966ca8 100644 --- a/ui/org.eclipse.pde.ui.tests/plugin.xml +++ b/ui/org.eclipse.pde.ui.tests/plugin.xml @@ -19,9 +19,9 @@ + description="Java 1.8 without sound APIs (PDE test suite)" + id="J2SE-1.8-NO-SOUND" + profileProperties="profiles/J2SE-1.8-NO-SOUND.profile"> ../../ org.eclipse.pde.ui.tests - 3.12.500-SNAPSHOT + 3.12.600-SNAPSHOT eclipse-test-plugin diff --git a/ui/org.eclipse.pde.ui.tests/profiles/J2SE-1.3-NO-SOUND.profile b/ui/org.eclipse.pde.ui.tests/profiles/J2SE-1.8-NO-SOUND.profile similarity index 89% rename from ui/org.eclipse.pde.ui.tests/profiles/J2SE-1.3-NO-SOUND.profile rename to ui/org.eclipse.pde.ui.tests/profiles/J2SE-1.8-NO-SOUND.profile index 75a8504a42..c5e94af3e5 100644 --- a/ui/org.eclipse.pde.ui.tests/profiles/J2SE-1.3-NO-SOUND.profile +++ b/ui/org.eclipse.pde.ui.tests/profiles/J2SE-1.8-NO-SOUND.profile @@ -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 diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/EnvironmentAnalyzerDelegate.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/EnvironmentAnalyzerDelegate.java index 004186ca6d..8eb3b68f18 100644 --- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/EnvironmentAnalyzerDelegate.java +++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/EnvironmentAnalyzerDelegate.java @@ -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 { diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/ExecutionEnvironmentTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/ExecutionEnvironmentTests.java index 8dbe328016..a3ce99a9b4 100644 --- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/ExecutionEnvironmentTests.java +++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/ExecutionEnvironmentTests.java @@ -36,6 +36,7 @@ import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.ToolFactory; import org.eclipse.jdt.core.util.IClassFileReader; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.launching.JavaRuntime; import org.eclipse.jdt.launching.environments.IExecutionEnvironment; import org.eclipse.pde.core.plugin.IPluginModelBase; @@ -134,9 +135,9 @@ public void testCustomEnvironment() throws Exception { IJavaProject project = ProjectUtils.createPluginProject("no.sound", env); assertTrue("Project was not created", project.exists()); - validateOption(project, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_3); - validateOption(project, JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); - validateOption(project, JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_3); + validateOption(project, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_8); + validateOption(project, JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_8); + validateOption(project, JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_8); validateOption(project, JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR); validateOption(project, JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR); @@ -147,39 +148,39 @@ public void testCustomEnvironment() throws Exception { waitForBuild(); IFile file = project.getProject().getFile("/bin/no/sound/Activator.class"); assertTrue("Activator class missing", file.exists()); - validateTargetLevel(file.getLocation().toOSString(), 47); + validateTargetLevel(file.getLocation().toOSString(), ClassFileConstants.MAJOR_VERSION_1_8); } finally { deleteProject("no.sound"); } } /** - * Creates a plug-in project with a J2SE-1.4 execution environment. + * Creates a plug-in project with a JavaSE-17 execution environment. * Validates that compiler compliance settings and build path are correct * and that class files are generated with correct target level. */ @Test - public void testJava4Environment() throws Exception { + public void testJava8Environment() throws Exception { try { - IExecutionEnvironment env = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("J2SE-1.4"); - IJavaProject project = ProjectUtils.createPluginProject("j2se14.plug", env); + IExecutionEnvironment env = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("JavaSE-1.8"); + IJavaProject project = ProjectUtils.createPluginProject("j2se18.plug", env); assertTrue("Project was not created", project.exists()); - validateOption(project, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2); - validateOption(project, JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); - validateOption(project, JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); - validateOption(project, JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.WARNING); - validateOption(project, JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.WARNING); + validateOption(project, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_8); + validateOption(project, JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_8); + validateOption(project, JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_8); + validateOption(project, JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR); + validateOption(project, JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR); validateSystemLibrary(project, JavaRuntime.newJREContainerPath(env)); project.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null); waitForBuild(); - IFile file = project.getProject().getFile("/bin/j2se14/plug/Activator.class"); + IFile file = project.getProject().getFile("/bin/j2se18/plug/Activator.class"); assertTrue("Activator class missing", file.exists()); - validateTargetLevel(file.getLocation().toOSString(), 46); + validateTargetLevel(file.getLocation().toOSString(), ClassFileConstants.MAJOR_VERSION_1_8); } finally { - deleteProject("j2se14.plug"); + deleteProject("j2se18.plug"); } } @@ -211,7 +212,7 @@ public void testNoEnvironment() throws Exception { } /** - * Creates a plug-in project with a J2SE-1.4 execution environment. + * Creates a plug-in project with a JavaSE-1.8 execution environment. * Validates that compiler compliance settings and build path are correct. * Modifies the compliance options and then updates the class path again. * Ensures that the enum and assert identifier options get overwritten with @@ -220,15 +221,15 @@ public void testNoEnvironment() throws Exception { @Test public void testMinimumComplianceOverwrite() throws Exception { try { - IExecutionEnvironment env = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("J2SE-1.4"); - IJavaProject project = ProjectUtils.createPluginProject("j2se14.ignore", env); + IExecutionEnvironment env = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("JavaSE-1.8"); + IJavaProject project = ProjectUtils.createPluginProject("j2se18.ignore", env); assertTrue("Project was not created", project.exists()); - validateOption(project, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2); - validateOption(project, JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); - validateOption(project, JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); - validateOption(project, JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.WARNING); - validateOption(project, JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.WARNING); + validateOption(project, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_8); + validateOption(project, JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_8); + validateOption(project, JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_8); + validateOption(project, JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR); + validateOption(project, JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR); validateSystemLibrary(project, JavaRuntime.newJREContainerPath(env)); @@ -238,23 +239,23 @@ public void testMinimumComplianceOverwrite() throws Exception { validateOption(project, JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.IGNORE); validateOption(project, JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.IGNORE); - // updating class path should increase severity to warning + // updating class path should increase severity to error IPluginModelBase model = PluginRegistry.findModel(project.getProject()); UpdateClasspathJob.scheduleFor(List.of(model), false).join(); // re-validate options - validateOption(project, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2); - validateOption(project, JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); - validateOption(project, JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); - validateOption(project, JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.WARNING); - validateOption(project, JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.WARNING); + validateOption(project, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_8); + validateOption(project, JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_8); + validateOption(project, JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_8); + validateOption(project, JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR); + validateOption(project, JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR); } finally { - deleteProject("j2se14.ignore"); + deleteProject("j2se18.ignore"); } } /** - * Creates a plug-in project with a J2SE-1.4 execution environment. + * Creates a plug-in project with a JavaSE-1.8 execution environment. * Validates that compiler compliance settings and build path are correct. * Modifies the compliance options and then updates the class path again. * Ensures that the enum and assert identifier options do not overwrite @@ -263,15 +264,15 @@ public void testMinimumComplianceOverwrite() throws Exception { @Test public void testMinimumComplianceNoOverwrite() throws Exception { try { - IExecutionEnvironment env = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("J2SE-1.4"); - IJavaProject project = ProjectUtils.createPluginProject("j2se14.error", env); + IExecutionEnvironment env = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("JavaSE-1.8"); + IJavaProject project = ProjectUtils.createPluginProject("j2se18.error", env); assertTrue("Project was not created", project.exists()); - validateOption(project, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2); - validateOption(project, JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); - validateOption(project, JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); - validateOption(project, JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.WARNING); - validateOption(project, JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.WARNING); + validateOption(project, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_8); + validateOption(project, JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_8); + validateOption(project, JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_8); + validateOption(project, JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR); + validateOption(project, JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR); validateSystemLibrary(project, JavaRuntime.newJREContainerPath(env)); @@ -281,19 +282,19 @@ public void testMinimumComplianceNoOverwrite() throws Exception { validateOption(project, JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR); validateOption(project, JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR); - // updating class path should increase severity to warning + // updating class path should increase severity to error IPluginModelBase model = PluginRegistry.findModel(project.getProject()); UpdateClasspathJob.scheduleFor(List.of(model), false).join(); // re-validate options - validateOption(project, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2); - validateOption(project, JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); - validateOption(project, JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); + validateOption(project, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_8); + validateOption(project, JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_8); + validateOption(project, JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_8); validateOption(project, JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR); validateOption(project, JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR); } finally { - deleteProject("j2se14.error"); + deleteProject("j2se18.error"); } } diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/ExportBundleTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/ExportBundleTests.java index dc84fd79de..82cb612218 100644 --- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/ExportBundleTests.java +++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/ExportBundleTests.java @@ -29,6 +29,7 @@ import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.ToolFactory; import org.eclipse.jdt.core.util.IClassFileReader; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.launching.JavaRuntime; import org.eclipse.jdt.launching.environments.IExecutionEnvironment; import org.eclipse.pde.core.plugin.PluginRegistry; @@ -130,7 +131,7 @@ public void testExportCustomEnvironment() throws Exception { } assertTrue("Missing exported bundle", Files.exists(path)); - validateTargetLevel(path.toString(), "no/sound/export/Activator.class", 47); + validateTargetLevel(path.toString(), "no/sound/export/Activator.class", ClassFileConstants.MAJOR_VERSION_1_8); } finally { TestUtils.waitForJobs(name.getMethodName(), 10, 5000); deleteProject("no.sound.export"); @@ -139,14 +140,14 @@ public void testExportCustomEnvironment() throws Exception { } /** - * Exports a plug-in project with a J2SE-1.4 execution environment and + * Exports a plug-in project with a JavaSE-1.8 execution environment and * validates class file target level. */ @Test - public void testExport14Environment() throws Exception { + public void testExport18Environment() throws Exception { try { - IExecutionEnvironment env = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("J2SE-1.4"); - IJavaProject project = ProjectUtils.createPluginProject("j2se14.export", env); + IExecutionEnvironment env = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("JavaSE-1.8"); + IJavaProject project = ProjectUtils.createPluginProject("j2se18.export", env); assertTrue("Project was not created", project.exists()); final FeatureExportInfo info = new FeatureExportInfo(); @@ -177,7 +178,7 @@ public void testExport14Environment() throws Exception { long l6 = System.currentTimeMillis(); // veriry exported bundle exists - Path path = EXPORT_PATH.resolve("plugins/j2se14.export_1.0.0.jar"); + Path path = EXPORT_PATH.resolve("plugins/j2se18.export_1.0.0.jar"); long l7 = System.currentTimeMillis(); TestUtils.processUIEvents(100); @@ -231,10 +232,10 @@ public void testExport14Environment() throws Exception { System.out.println("================================\nEnd of BUG 424597"); assertTrue("Missing exported bundle", Files.exists(path)); - validateTargetLevel(path.toString(), "j2se14/export/Activator.class", 46); + validateTargetLevel(path.toString(), "j2se18/export/Activator.class", ClassFileConstants.MAJOR_VERSION_1_8); } finally { TestUtils.waitForJobs(name.getMethodName(), 10, 5000); - deleteProject("j2se14.export"); + deleteProject("j2se18.export"); delete(EXPORT_PATH.toFile()); } }