diff --git a/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerInvocationTests.java b/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerInvocationTests.java index 91572fd3e34..743ef724222 100644 --- a/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerInvocationTests.java +++ b/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerInvocationTests.java @@ -57,7 +57,7 @@ public CompilerInvocationTests(String name) { super(name); } public static Test suite() { - return buildUniqueComplianceTestSuite(CompilerInvocationTests.class, ClassFileConstants.JDK1_6); + return buildUniqueComplianceTestSuite(CompilerInvocationTests.class, ClassFileConstants.JDK1_8); } public static Class testClass() { return CompilerInvocationTests.class; @@ -81,7 +81,7 @@ protected void checkClassFiles(String[] fileNames) { fail("IO exception for file " + fileNames[i]); } assertNotNull("Could not read " + fileNames[i], reader); - assertEquals("Wrong Java version for " + fileNames[i], ClassFileConstants.JDK1_6, reader.getVersion()); + assertEquals("Wrong Java version for " + fileNames[i], ClassFileConstants.JDK1_8, reader.getVersion()); } } void runTest( @@ -96,7 +96,7 @@ void runTest( String[] classFileNames) { List opt = options == null ? new ArrayList<>() : new ArrayList<>(options); opt.add("-source"); - opt.add("1.6"); + opt.add("1.8"); super.runTest( shouldCompileOK, sourceFiles, diff --git a/org.eclipse.jdt.core.compiler.batch/META-INF/MANIFEST.MF b/org.eclipse.jdt.core.compiler.batch/META-INF/MANIFEST.MF index f5d4321072b..fde7acdde60 100644 --- a/org.eclipse.jdt.core.compiler.batch/META-INF/MANIFEST.MF +++ b/org.eclipse.jdt.core.compiler.batch/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Main-Class: org.eclipse.jdt.internal.compiler.batch.Main Bundle-ManifestVersion: 2 Bundle-Name: Eclipse Compiler for Java(TM) Bundle-SymbolicName: org.eclipse.jdt.core.compiler.batch -Bundle-Version: 3.38.100.qualifier +Bundle-Version: 3.39.0.qualifier Bundle-ClassPath: . Bundle-Vendor: Eclipse.org Automatic-Module-Name: org.eclipse.jdt.core.compiler.batch diff --git a/org.eclipse.jdt.core.compiler.batch/pom.xml b/org.eclipse.jdt.core.compiler.batch/pom.xml index cc44700614e..0c7d48b0039 100644 --- a/org.eclipse.jdt.core.compiler.batch/pom.xml +++ b/org.eclipse.jdt.core.compiler.batch/pom.xml @@ -17,7 +17,7 @@ 4.33.0-SNAPSHOT org.eclipse.jdt.core.compiler.batch - 3.38.100-SNAPSHOT + 3.39.0-SNAPSHOT eclipse-plugin diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/core/compiler/IProblem.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/core/compiler/IProblem.java index d7a0139da84..9b8f00dc827 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/core/compiler/IProblem.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/core/compiler/IProblem.java @@ -2183,6 +2183,8 @@ public interface IProblem { int FeatureNotSupported = Compliance + 1107; /** @since 3.26*/ int PreviewAPIUsed = Compliance + 1108; + /** @since 3.39*/ + int JavaVersionNotSupported = Compliance + 1109; /** @since 3.13 */ int UnlikelyCollectionMethodArgumentType = 1200; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/Compiler.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/Compiler.java index d6086073abe..5732d80f57e 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/Compiler.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/Compiler.java @@ -818,11 +818,31 @@ private void abortIfPreviewNotAllowed(ICompilationUnit[] sourceUnits, int maxUn throw a; } } + + private void abortIfVersionNotAllowed(ICompilationUnit[] sourceUnits, int maxUnits) { + try { + long firstSupportedJdkLevel = CompilerOptions.getFirstSupportedJdkLevel(); + if (this.options.sourceLevel < firstSupportedJdkLevel + || this.options.targetJDK < firstSupportedJdkLevel + || this.options.complianceLevel < firstSupportedJdkLevel) { + long badVersion = Math.min(this.options.complianceLevel, Math.min(this.options.sourceLevel, this.options.targetJDK)); + this.problemReporter.abortDueToNotSupportedJavaVersion(CompilerOptions.versionFromJdkLevel(badVersion), + CompilerOptions.getFirstSupportedJavaVersion()); + } + } catch (AbortCompilation a) { + // best effort to find a way for reporting this problem: report on the first source + if (a.compilationResult == null) { + a.compilationResult = new CompilationResult(sourceUnits[0], 0, maxUnits, this.options.maxProblemsPerUnit); + } + throw a; + } + } /** * Add the initial set of compilation units into the loop * -> build compilation unit declarations, their bindings and record their results. */ protected void internalBeginToCompile(ICompilationUnit[] sourceUnits, int maxUnits) { + abortIfVersionNotAllowed(sourceUnits,maxUnits); abortIfPreviewNotAllowed(sourceUnits,maxUnits); if (!this.useSingleThread && maxUnits >= ReadManager.THRESHOLD) this.parser.readManager = new ReadManager(sourceUnits, maxUnits); diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/Main.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/Main.java index cd1e843ec6b..28a2d1591c9 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/Main.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/Main.java @@ -2614,22 +2614,11 @@ public void configure(String[] argv) { this.bind("configure.unsupportedWithRelease", "-target"));//$NON-NLS-1$ //$NON-NLS-2$ } this.didSpecifyTarget = true; - if (currentArg.equals("1.1")) { //$NON-NLS-1$ - this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_1); - } else if (currentArg.equals("1.2")) { //$NON-NLS-1$ - this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_2); - } else if (currentArg.equals("jsr14")) { //$NON-NLS-1$ - this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_JSR14); - } else if (currentArg.equals("cldc1.1")) { //$NON-NLS-1$ - this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_CLDC1_1); - this.options.put(CompilerOptions.OPTION_InlineJsr, CompilerOptions.ENABLED); + String targetVersion = optionStringToVersion(currentArg); + if (targetVersion != null) { + this.options.put(CompilerOptions.OPTION_TargetPlatform, targetVersion); } else { - String version = optionStringToVersion(currentArg); - if (version != null) { - this.options.put(CompilerOptions.OPTION_TargetPlatform, version); - } else { - throw new IllegalArgumentException(this.bind("configure.targetJDK", currentArg)); //$NON-NLS-1$ - } + throw new IllegalArgumentException(this.bind("configure.targetJDK", currentArg)); //$NON-NLS-1$ } mode = DEFAULT; continue; @@ -3080,23 +3069,10 @@ public void configure(String[] argv) { this.pendingErrors = null; } } -/** Translates any supported standard version starting at 1.3 up-to latest into the corresponding constant from CompilerOptions */ +/** Translates any supported standard version starting at {@link CompilerOptions#getFirstSupportedJavaVersion()} + * up-to latest into the corresponding constant from CompilerOptions */ private String optionStringToVersion(String currentArg) { switch (currentArg) { - case "1.3": return CompilerOptions.VERSION_1_3; //$NON-NLS-1$ - case "1.4": return CompilerOptions.VERSION_1_4; //$NON-NLS-1$ - case "1.5": //$NON-NLS-1$ - case "5": //$NON-NLS-1$ - case "5.0": //$NON-NLS-1$ - return CompilerOptions.VERSION_1_5; - case "1.6": //$NON-NLS-1$ - case "6": //$NON-NLS-1$ - case "6.0": //$NON-NLS-1$ - return CompilerOptions.VERSION_1_6; - case "1.7": //$NON-NLS-1$ - case "7": //$NON-NLS-1$ - case "7.0": //$NON-NLS-1$ - return CompilerOptions.VERSION_1_7; case "1.8": //$NON-NLS-1$ case "8": //$NON-NLS-1$ case "8.0": //$NON-NLS-1$ @@ -5316,76 +5292,23 @@ protected void validateOptions(boolean didSpecifyCompliance) { throw new IllegalArgumentException( this.bind("configure.unsupportedWithRelease", version));//$NON-NLS-1$ } - if (CompilerOptions.VERSION_1_3.equals(version)) { - if (!this.didSpecifySource) this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3); - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_1); - } else if (CompilerOptions.VERSION_1_4.equals(version)) { + if(CompilerOptions.UNSUPPORTED_VERSIONS.contains(version)) { if (this.didSpecifySource) { - Object source = this.options.get(CompilerOptions.OPTION_Source); - if (CompilerOptions.VERSION_1_3.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_2); - } else if (CompilerOptions.VERSION_1_4.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4); - } - } else { - this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3); - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_2); + throw new IllegalArgumentException(this.bind("configure.unsupportedSourceVersion", //$NON-NLS-1$ + this.options.get(CompilerOptions.OPTION_Source), CompilerOptions.getFirstSupportedJavaVersion())); } - } else if (CompilerOptions.VERSION_1_5.equals(version)) { - if (this.didSpecifySource) { - Object source = this.options.get(CompilerOptions.OPTION_Source); - if (CompilerOptions.VERSION_1_3.equals(source) - || CompilerOptions.VERSION_1_4.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4); - } else if (CompilerOptions.VERSION_1_5.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); - } - } else { - this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); + if (this.didSpecifyTarget) { + throw new IllegalArgumentException(this.bind("configure.unsupportedTargetVersion", //$NON-NLS-1$ + this.options.get(CompilerOptions.OPTION_TargetPlatform), CompilerOptions.getFirstSupportedJavaVersion())); } - } else if (CompilerOptions.VERSION_1_6.equals(version)) { - if (this.didSpecifySource) { - Object source = this.options.get(CompilerOptions.OPTION_Source); - if (CompilerOptions.VERSION_1_3.equals(source) - || CompilerOptions.VERSION_1_4.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4); - } else if (CompilerOptions.VERSION_1_5.equals(source) - || CompilerOptions.VERSION_1_6.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6); - } - } else { - this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6); - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6); - } - } else if (CompilerOptions.VERSION_1_7.equals(version)) { - if (this.didSpecifySource) { - Object source = this.options.get(CompilerOptions.OPTION_Source); - if (CompilerOptions.VERSION_1_3.equals(source) - || CompilerOptions.VERSION_1_4.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4); - } else if (CompilerOptions.VERSION_1_5.equals(source) - || CompilerOptions.VERSION_1_6.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6); - } else if (CompilerOptions.VERSION_1_7.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_7); - } - } else { - this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7); - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_7); - } - } else if (CompilerOptions.VERSION_1_8.equals(version)) { + throw new IllegalArgumentException(this.bind("configure.unsupportedComplianceVersion", //$NON-NLS-1$ + this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.getFirstSupportedJavaVersion())); + } + + if (CompilerOptions.VERSION_1_8.equals(version)) { if (this.didSpecifySource) { Object source = this.options.get(CompilerOptions.OPTION_Source); - if (CompilerOptions.VERSION_1_3.equals(source) - || CompilerOptions.VERSION_1_4.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4); - } else if (CompilerOptions.VERSION_1_5.equals(source) - || CompilerOptions.VERSION_1_6.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6); - } else if (CompilerOptions.VERSION_1_7.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_7); - } else if (CompilerOptions.VERSION_1_8.equals(source)) { + if (CompilerOptions.VERSION_1_8.equals(source)) { if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); } } else { @@ -5395,15 +5318,7 @@ protected void validateOptions(boolean didSpecifyCompliance) { } else if (CompilerOptions.VERSION_9.equals(version)) { if (this.didSpecifySource) { Object source = this.options.get(CompilerOptions.OPTION_Source); - if (CompilerOptions.VERSION_1_3.equals(source) - || CompilerOptions.VERSION_1_4.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4); - } else if (CompilerOptions.VERSION_1_5.equals(source) - || CompilerOptions.VERSION_1_6.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6); - } else if (CompilerOptions.VERSION_1_7.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_7); - } else if (CompilerOptions.VERSION_1_8.equals(source)) { + if (CompilerOptions.VERSION_1_8.equals(source)) { if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); } else if (CompilerOptions.VERSION_9.equals(source)) { if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_9); @@ -5415,15 +5330,7 @@ protected void validateOptions(boolean didSpecifyCompliance) { } else if (CompilerOptions.VERSION_10.equals(version)) { if (this.didSpecifySource) { Object source = this.options.get(CompilerOptions.OPTION_Source); - if (CompilerOptions.VERSION_1_3.equals(source) - || CompilerOptions.VERSION_1_4.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4); - } else if (CompilerOptions.VERSION_1_5.equals(source) - || CompilerOptions.VERSION_1_6.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6); - } else if (CompilerOptions.VERSION_1_7.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_7); - } else if (CompilerOptions.VERSION_1_8.equals(source)) { + if (CompilerOptions.VERSION_1_8.equals(source)) { if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); } else if (CompilerOptions.VERSION_9.equals(source)) { if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_9); @@ -5438,16 +5345,10 @@ protected void validateOptions(boolean didSpecifyCompliance) { if (!this.didSpecifyTarget) { if (this.didSpecifySource) { String source = this.options.get(CompilerOptions.OPTION_Source); - if (CompilerOptions.VERSION_1_3.equals(source) - || CompilerOptions.VERSION_1_4.equals(source)) { - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4); - } else if (CompilerOptions.VERSION_1_5.equals(source) - || CompilerOptions.VERSION_1_6.equals(source)) { - this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6); - } else { - // 1.3 is the lowest version that can be specified as -source + { + // 1.8 is the lowest version that can be specified as -source // The following check will ensure '0' is ignored. - if (CompilerOptions.versionToJdkLevel(source) >= ClassFileConstants.JDK1_7) + if (CompilerOptions.versionToJdkLevel(source) >= ClassFileConstants.JDK1_8) this.options.put(CompilerOptions.OPTION_TargetPlatform, source); } } else { @@ -5461,20 +5362,12 @@ protected void validateOptions(boolean didSpecifyCompliance) { } else if (this.didSpecifySource) { String version = this.options.get(CompilerOptions.OPTION_Source); - // default is source 1.3 target 1.2 and compliance 1.4 - if (CompilerOptions.VERSION_1_4.equals(version)) { - if (!didSpecifyCompliance) this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4); - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4); - } else if (CompilerOptions.VERSION_1_5.equals(version)) { - if (!didSpecifyCompliance) this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); - } else if (CompilerOptions.VERSION_1_6.equals(version)) { - if (!didSpecifyCompliance) this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_6); - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6); - } else if (CompilerOptions.VERSION_1_7.equals(version)) { - if (!didSpecifyCompliance) this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_7); - if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_7); - } else if (CompilerOptions.VERSION_1_8.equals(version)) { + if(CompilerOptions.UNSUPPORTED_VERSIONS.contains(version)) { + throw new IllegalArgumentException(this.bind("configure.unsupportedSourceVersion", //$NON-NLS-1$ + this.options.get(CompilerOptions.OPTION_Source), CompilerOptions.getFirstSupportedJavaVersion())); + } + // default is source 1.8 target 1.8 and compliance 1.8 + if (CompilerOptions.VERSION_1_8.equals(version)) { if (!didSpecifyCompliance) this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8); if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); } else if (CompilerOptions.VERSION_9.equals(version)) { @@ -5508,22 +5401,6 @@ protected void validateOptions(boolean didSpecifyCompliance) { && this.complianceLevel < ClassFileConstants.JDK1_8) { // compliance must be 1.8 if source is 1.8 throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_8)); //$NON-NLS-1$ - } else if (sourceVersion.equals(CompilerOptions.VERSION_1_7) - && this.complianceLevel < ClassFileConstants.JDK1_7) { - // compliance must be 1.7 if source is 1.7 - throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_7)); //$NON-NLS-1$ - } else if (sourceVersion.equals(CompilerOptions.VERSION_1_6) - && this.complianceLevel < ClassFileConstants.JDK1_6) { - // compliance must be 1.6 if source is 1.6 - throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_6)); //$NON-NLS-1$ - } else if (sourceVersion.equals(CompilerOptions.VERSION_1_5) - && this.complianceLevel < ClassFileConstants.JDK1_5) { - // compliance must be 1.5 if source is 1.5 - throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_5)); //$NON-NLS-1$ - } else if (sourceVersion.equals(CompilerOptions.VERSION_1_4) - && this.complianceLevel < ClassFileConstants.JDK1_4) { - // compliance must be 1.4 if source is 1.4 - throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_4)); //$NON-NLS-1$ } else { long ver = CompilerOptions.versionToJdkLevel(sourceVersion); if(this.complianceLevel < ver) @@ -5536,45 +5413,15 @@ protected void validateOptions(boolean didSpecifyCompliance) { // check and set compliance/source/target compatibilities if (this.didSpecifyTarget) { final String targetVersion = this.options.get(CompilerOptions.OPTION_TargetPlatform); - // tolerate jsr14 target - if (CompilerOptions.VERSION_JSR14.equals(targetVersion)) { - // expecting source >= 1.5 - if (CompilerOptions.versionToJdkLevel(sourceVersion) < ClassFileConstants.JDK1_5) { - throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForGenericSource", targetVersion, sourceVersion)); //$NON-NLS-1$ - } - } else if (CompilerOptions.VERSION_CLDC1_1.equals(targetVersion)) { - if (this.didSpecifySource && CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_4) { - throw new IllegalArgumentException(this.bind("configure.incompatibleSourceForCldcTarget", targetVersion, sourceVersion)); //$NON-NLS-1$ - } - if (this.complianceLevel >= ClassFileConstants.JDK1_5) { - throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForCldcTarget", targetVersion, sourceVersion)); //$NON-NLS-1$ - } + if(CompilerOptions.UNSUPPORTED_VERSIONS.contains(targetVersion)) { + throw new IllegalArgumentException(this.bind("configure.unsupportedTargetVersion", //$NON-NLS-1$ + this.options.get(CompilerOptions.OPTION_TargetPlatform), CompilerOptions.getFirstSupportedJavaVersion())); } else { // target must be 1.8 if source is 1.8 if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_8 && CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_8){ throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForSource", targetVersion, CompilerOptions.VERSION_1_8)); //$NON-NLS-1$ } - // target must be 1.7 if source is 1.7 - if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_7 - && CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_7){ - throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForSource", targetVersion, CompilerOptions.VERSION_1_7)); //$NON-NLS-1$ - } - // target must be 1.6 if source is 1.6 - if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_6 - && CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_6){ - throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForSource", targetVersion, CompilerOptions.VERSION_1_6)); //$NON-NLS-1$ - } - // target must be 1.5 if source is 1.5 - if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_5 - && CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_5){ - throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForSource", targetVersion, CompilerOptions.VERSION_1_5)); //$NON-NLS-1$ - } - // target must be 1.4 if source is 1.4 - if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_4 - && CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_4){ - throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForSource", targetVersion, CompilerOptions.VERSION_1_4)); //$NON-NLS-1$ - } // target cannot be greater than compliance level if (this.complianceLevel < CompilerOptions.versionToJdkLevel(targetVersion)){ throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForTarget", this.options.get(CompilerOptions.OPTION_Compliance), targetVersion)); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/messages.properties b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/messages.properties index ca945c719a8..5f9ad994134 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/messages.properties +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/messages.properties @@ -61,7 +61,7 @@ compile.severalClassFilesGenerated = [{0} .class files generated] compile.failOnWarning = error: warnings found and -failOnWarning specified ### configure -configure.requiresJDK1.2orAbove = Need to use a JVM >= 1.2 +configure.requiresJDK1.2orAbove = Need to use a JVM >= 1.8 configure.duplicateLog = duplicate log specification: {0} configure.duplicateRepeat = duplicate repeat specification: {0} configure.duplicateMaxProblems = duplicate max problems specification: {0} @@ -71,7 +71,10 @@ configure.duplicateTarget = duplicate target compliance setting specification: { configure.unsupportedReleaseOption = option --release is supported only when run with JDK 9 or above configure.unsupportedWithRelease = option {0} is not supported when --release is used configure.unsupportedReleaseVersion = release version {0} is not supported -configure.source = source level should be in ''1.1''...''1.8'',''9''...''22'' (or ''5.0''..''22.0''): {0} +configure.unsupportedComplianceVersion = compliance option {0} is no longer supported. Use {1} or later. +configure.unsupportedSourceVersion = source option {0} is no longer supported. Use {1} or later. +configure.unsupportedTargetVersion = target option {0} is no longer supported. Use {1} or later. +configure.source = source level should be in ''1.8'',''9''...''22'' (or ''5.0''..''22.0''): {0} configure.invalidSystem = invalid location for system libraries: {0} configure.unsupportedOption = option {0} not supported at compliance level 9 and above configure.duplicateOutputPath = duplicate output path specification: {0} @@ -89,9 +92,9 @@ configure.invalidDebugOption = invalid debug option: {0} configure.invalidWarningConfiguration = invalid warning configuration: ''{0}'' configure.invalidWarning = invalid warning token: ''{0}''. Ignoring warning and compiling configure.invalidWarningOption = invalid warning option: ''{0}''. Must specify a warning token -configure.targetJDK = target level should be in ''1.1''...''1.8'',''9''...''22'' (or ''5.0''..''22.0'') or cldc1.1: {0} +configure.targetJDK = target level should be in ''1.8'',''9''...''22'' (or ''8.0''..''22.0''): {0} configure.incompatibleTargetForSource = Target level ''{0}'' is incompatible with source level ''{1}''. A target level ''{1}'' or better is required -configure.incompatibleTargetForGenericSource = Target level ''{0}'' is incompatible with source level ''{1}''. A source level ''1.5'' or better is required +configure.incompatibleTargetForGenericSource = Target level ''{0}'' is incompatible with source level ''{1}''. A source level ''1.8'' or better is required configure.incompatibleComplianceForSource = Compliance level ''{0}'' is incompatible with source level ''{1}''. A compliance level ''{1}'' or better is required configure.incompatibleComplianceForTarget = Compliance level ''{0}'' is incompatible with target level ''{1}''. A compliance level ''{1}'' or better is required configure.repetition = repetition must be a positive integer: {0} @@ -135,9 +138,7 @@ configure.invalidClassName = invalid class name: {0} configure.invalidModuleName = invalid module name: {0} configure.packageConflict = The package {0} is accessible from more than one module: {1}, {2} configure.unavailableAPT = Unable to load annotation processing manager {0} from classpath. -configure.incorrectVMVersionforAPT = Annotation processing got disabled, since it requires a 1.6 compliant JVM -configure.incompatibleSourceForCldcTarget=Target level ''{0}'' is incompatible with source level ''{1}''. A source level ''1.3'' or lower is required -configure.incompatibleComplianceForCldcTarget=Target level ''{0}'' is incompatible with compliance level ''{1}''. A compliance level ''1.4''or lower is required +configure.incorrectVMVersionforAPT = Annotation processing got disabled, since it requires a 1.8 compliant JVM configure.invalidClasspathSection = invalid Class-Path header in manifest of jar file: {0} configure.multipleClasspathSections = multiple Class-Path headers in manifest of jar file: {0} configure.missingwarningspropertiesfile=properties file {0} does not exist @@ -243,13 +244,8 @@ misc.usage = {1} {2}\n\ \ --release compile for a specific VM version\n\ \ \n\ \ Compliance options:\n\ -\ -1.3 use 1.3 compliance (-source 1.3 -target 1.1)\n\ -\ -1.4 + use 1.4 compliance (-source 1.3 -target 1.2)\n\ -\ -1.5 -5 -5.0 use 1.5 compliance (-source 1.5 -target 1.5)\n\ -\ -1.6 -6 -6.0 use 1.6 compliance (-source 1.6 -target 1.6)\n\ -\ -1.7 -7 -7.0 use 1.7 compliance (-source 1.7 -target 1.7)\n\ \ -1.8 -8 -8.0 use 1.8 compliance (-source 1.8 -target 1.8)\n\ -\ -1.9 -9 -9.0 use 1.9 compliance (-source 1.9 -target 1.9)\n\ +\ -1.9 -9 -9.0 use 9 compliance (-source 9 -target 9)\n\ \ -10 -10.0 use 10 compliance (-source 10 -target 10)\n\ \ -11 -11.0 use 11 compliance (-source 11 -target 11)\n\ \ -12 -12.0 use 12 compliance (-source 12 -target 12)\n\ @@ -263,12 +259,10 @@ misc.usage = {1} {2}\n\ \ -20 -20.0 use 20 compliance (-source 20 -target 20)\n\ \ -21 -21.0 use 21 compliance (-source 21 -target 21)\n\ \ -22 -22.0 use 22 compliance (-source 22 -target 22)\n\ -\ -source set source level: 1.3 to 1.9, 10 to 22\n\ -\ (or 6, 6.0, etc)\n\ -\ -target set classfile target: 1.3 to 1.9, 10 to 22\n\ -\ (or 6, 6.0, etc)\n\ -\ cldc1.1 can also be used to generate the StackMap\n\ -\ attribute\n\ +\ -source set source level: 1.8, 9 to 22\n\ +\ (or 8.0, 9.0, etc)\n\ +\ -target set classfile target: 1.8, 9 to 22\n\ +\ (or 8.0, 9.0, etc)\n\ \ --enable-preview enable support for preview features of the\n\ \ latest Java release\n\ \ \n\ @@ -311,7 +305,7 @@ misc.usage = {1} {2}\n\ \ -preserveAllLocals preserve unused local vars for debug purpose\n\ \ \n\ \ Annotation processing options:\n\ -\ These options are meaningful only in a 1.6 environment.\n\ +\ These options are meaningful only in a 1.8 environment.\n\ \ -Akey[=value] options that are passed to annotation processors\n\ \ -processorpath \n\ \ specify locations where to find annotation processors.\n\ @@ -348,7 +342,7 @@ misc.usage = {1} {2}\n\ \ -noExit do not call System.exit(n) at end of compilation (n==0\n\ \ if no error)\n\ \ -repeat repeat compilation process times for perf analysis\n\ -\ -inlineJSR inline JSR bytecode (implicit if target >= 1.5)\n\ +\ -inlineJSR inline JSR bytecode (implicit if target >= 1.8)\n\ \ -enableJavadoc consider references in javadoc\n\ \ -parameters generate method parameters attribute (for target >= 1.8)\n\ \ -genericsignature generate generic signature for lambda expressions\n\ diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java index e0c2618ee24..18ad8a4fffa 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java @@ -35,6 +35,7 @@ import java.io.UnsupportedEncodingException; import java.util.HashMap; import java.util.Map; +import java.util.Set; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.Compiler; @@ -258,6 +259,25 @@ public class CompilerOptions { * Note: Whenever a new version is added, make sure getLatestVersion() * is updated with it. */ + + /** + * Unsupported JLS versions + */ + /* + * Note: Whenever a new version is obsoleted, make sure getFirstVersion() is updated. + */ + public static Set UNSUPPORTED_VERSIONS = Set.of( + VERSION_1_1, + VERSION_1_2, + VERSION_1_3, + VERSION_1_4, + VERSION_JSR14, + VERSION_CLDC1_1, + VERSION_1_5, + VERSION_1_6, + VERSION_1_7 + ); + public static final String ERROR = "error"; //$NON-NLS-1$ public static final String WARNING = "warning"; //$NON-NLS-1$ public static final String INFO = "info"; //$NON-NLS-1$ @@ -647,6 +667,18 @@ public CompilerOptions(Map settings, boolean parseLiteralExpress this.parseLiteralExpressionsAsConstants = parseLiteralExpressionsAsConstants; } + /** + * Return the first (oldest) Java language version supported by the Eclipse compiler + */ + public static String getFirstSupportedJavaVersion() { + return VERSION_1_8; + } + /** + * Return the first (oldest) Java language level supported by the Eclipse compiler + */ + public static long getFirstSupportedJdkLevel() { + return ClassFileConstants.JDK1_8; + } /** * Return the latest Java language version supported by the Eclipse compiler */ @@ -1545,9 +1577,9 @@ protected void resetDefaults() { // by default only lines and source attributes are generated. this.produceDebugAttributes = ClassFileConstants.ATTR_SOURCE | ClassFileConstants.ATTR_LINES; - this.complianceLevel = this.originalComplianceLevel = ClassFileConstants.JDK1_4; // by default be compliant with 1.4 - this.sourceLevel = this.originalSourceLevel = ClassFileConstants.JDK1_3; //1.3 source behavior by default - this.targetJDK = ClassFileConstants.JDK1_2; // default generates for JVM1.2 + this.complianceLevel = this.originalComplianceLevel = ClassFileConstants.JDK1_8; // by default be compliant with 1.8 + this.sourceLevel = this.originalSourceLevel = ClassFileConstants.JDK1_8; //1.8 source behavior by default + this.targetJDK = ClassFileConstants.JDK1_8; // default generates for JVM1.8 this.defaultEncoding = null; // will use the platform default encoding diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java index 76a37691cef..383a3f86e67 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java @@ -913,6 +913,16 @@ public void abortDueToPreviewEnablingNotAllowed(String sourceLevel, String expec 0, 0); } +public void abortDueToNotSupportedJavaVersion(String notSupportedVersion, String firstSupportedVersion) { + String[] args = new String[] {notSupportedVersion, firstSupportedVersion}; + this.handle( + IProblem.JavaVersionNotSupported, + args, + args, + ProblemSeverities.Error | ProblemSeverities.Abort | ProblemSeverities.Fatal, + 0, + 0); +} public void abstractMethodCannotBeOverridden(SourceTypeBinding type, MethodBinding concreteMethod) { this.handle( diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/messages.properties b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/messages.properties index 11ec07df00a..18509336bd0 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/messages.properties +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/messages.properties @@ -287,9 +287,9 @@ 264 = Invalid high surrogate: must be within 0xD800 and 0xDBFF 265 = Unnecessary $NON-NLS$ tag 266 = Invalid binary literal number (only '0' and '1' are expected) -267 = Binary literals can only be used with source level 1.7 or greater +267 = Binary literals can only be used with source level 1.8 or greater 268 = Underscores have to be located within digits -269 = Underscores can only be used with source level 1.7 or greater +269 = Underscores can only be used with source level 1.8 or greater 271 = This lambda expression refers to the missing type {0} 272 = Text block is not properly closed with the delimiter @@ -441,8 +441,8 @@ 433 = Too many methods for type {0}. Maximum is 65535 434 = The synthetic method created to access {0}({1}) of type {2} has too many parameters -440 = 'assert' should not be used as an identifier, since it is a reserved keyword from source level 1.4 on -441 = 'enum' should not be used as an identifier, since it is a reserved keyword from source level 1.5 on +440 = 'assert' should not be used as an identifier, since it is a reserved keyword from source level 1.8 on +441 = 'enum' should not be used as an identifier, since it is a reserved keyword from source level 1.8 on 442 = Enum constants cannot be surrounded by parenthesis 443 = '_' should not be used as an identifier, since it is a reserved keyword from source level 1.8 on 444 = The uninterned types {0} and {1} should not be compared using ==/!= operators. @@ -594,14 +594,14 @@ 585 = Type safety: Elements of type {0} need unchecked conversion to conform to {1} ### SOURCE LEVEL -590 = Syntax error, type parameters are only available if source level is 1.5 or greater -591 = Syntax error, static imports are only available if source level is 1.5 or greater -592 = Syntax error, 'for each' statements are only available if source level is 1.5 or greater -593 = Syntax error, parameterized types are only available if source level is 1.5 or greater -594 = Syntax error, enum declarations are only available if source level is 1.5 or greater -595 = Syntax error, varargs are only available if source level is 1.5 or greater -596 = Syntax error, annotations are only available if source level is 1.5 or greater -597 = Syntax error, annotation declarations are only available if source level is 1.5 or greater +590 = Syntax error, type parameters are only available if source level is 1.8 or greater +591 = Syntax error, static imports are only available if source level is 1.8 or greater +592 = Syntax error, 'for each' statements are only available if source level is 1.8 or greater +593 = Syntax error, parameterized types are only available if source level is 1.8 or greater +594 = Syntax error, enum declarations are only available if source level is 1.8 or greater +595 = Syntax error, varargs are only available if source level is 1.8 or greater +596 = Syntax error, annotations are only available if source level is 1.8 or greater +597 = Syntax error, annotation declarations are only available if source level is 1.8 or greater 598 = Syntax error, annotation declaration cannot have type parameters 599 = Syntax error, enum declaration cannot have type parameters @@ -905,6 +905,7 @@ 1106 = Preview features enabled at an invalid source release level {0}, preview can be enabled only at source level {1} 1107 = The Java feature ''{0}'' is only available with source level {1} and above 1108 = You are using an API that is part of a preview feature and may be removed in future +1109 = The Java version ''{0}'' is no longer supported. Use {1} or later. # more programming problems: 1200 = Unlikely argument type {0} for {1} on a {2} 1201 = Unlikely argument type for equals(): {0} seems to be unrelated to {2} diff --git a/org.eclipse.jdt.core.tests.builder/pom.xml b/org.eclipse.jdt.core.tests.builder/pom.xml index f05759e2486..c335b1b7351 100644 --- a/org.eclipse.jdt.core.tests.builder/pom.xml +++ b/org.eclipse.jdt.core.tests.builder/pom.xml @@ -60,7 +60,7 @@ - --add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,17 + --add-modules ALL-SYSTEM -Dcompliance=1.8,17 @@ -81,7 +81,7 @@ - --add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,21 + --add-modules ALL-SYSTEM -Dcompliance=1.8,21 @@ -102,7 +102,7 @@ - --add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,21,22 + --add-modules ALL-SYSTEM -Dcompliance=1.8,21,22 diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuilderTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuilderTests.java index eceb87cca67..c5b79bad4f0 100644 --- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuilderTests.java +++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuilderTests.java @@ -548,13 +548,11 @@ private static Class[] getAllTestClasses() { LeakTestsBefore9.class, }; List> list = new ArrayList<>(Arrays.asList(classes)); - if (matchesCompliance(F_1_5)) { + if (matchesCompliance(F_1_8)) { list.add(Java50Tests.class); list.add(PackageInfoTest.class); list.add(ParticipantBuildTests.class); list.add(AnnotationDependencyTests.class); - } - if (matchesCompliance(F_1_8)) { list.add(Bug544921Test.class); } if (matchesCompliance(F_9)) { diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java index e5192c47824..30854f39544 100644 --- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java +++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java @@ -34,7 +34,6 @@ import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.compiler.CategorizedProblem; -import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; import org.eclipse.jdt.core.tests.util.Util; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.core.JavaModel; @@ -993,37 +992,6 @@ public void testMissingOptionalProject() throws JavaModelException { env.removeProject(project2Path); } -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=160132 -public void test0100() throws JavaModelException { - if (!AbstractCompilerTest.isJRELevel(AbstractCompilerTest.F_1_5)) { - // expected to run only in 1.5 mode on top of a jre 1.5 or above - return; - } - IPath projectPath = env.addProject("P", "1.5"); - IPath defaultPackagePath = env.addPackage(projectPath, ""); - env.addExternalJars(projectPath, Util.getJavaClassLibs()); - env.addClass(defaultPackagePath, "X", - "public interface X {\n" + - " interface Entry {\n" + - " interface Internal extends Entry {\n" + - " Internal createEntry();\n" + - " }\n" + - " }\n" + - "}" - ); - fullBuild(); - expectingNoProblems(); - env.addClass(defaultPackagePath, "Y", - "public class Y implements X.Entry.Internal {\n" + - " public Internal createEntry() {\n" + - " return null;\n" + - " }\n" + - "}"); - incrementalBuild(); - expectingNoProblems(); - env.removeProject(projectPath); -} - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=143025 public void testMissingOutputFolder() throws JavaModelException { IPath projectPath = env.addProject("P"); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/DependencyTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/DependencyTests.java index 8c5354ee834..b858f68c2ee 100644 --- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/DependencyTests.java +++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/DependencyTests.java @@ -1145,9 +1145,9 @@ public void testTypeVisibility2() throws JavaModelException { } public void testTypeVariable() throws JavaModelException { - if ((AbstractCompilerTest.getPossibleComplianceLevels() & AbstractCompilerTest.F_1_5) == 0) return; + if ((AbstractCompilerTest.getPossibleComplianceLevels() & AbstractCompilerTest.F_1_8) == 0) return; - IPath projectPath = env.addProject("Project", "1.5"); //$NON-NLS-1$ + IPath projectPath = env.addProject("Project", "1.8"); //$NON-NLS-1$ env.addExternalJars(projectPath, Util.getJavaClassLibs()); // remove old package fragment root so that names don't collide diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java index f4b96498911..231a73317f1 100644 --- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java +++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java @@ -185,7 +185,7 @@ public void addProject(IProject project){ } public IPath addProject(String projectName){ - return addProject(projectName, "1.4"); + return addProject(projectName, "1.8"); } public IPath addProject(String projectName, String compliance){ @@ -193,19 +193,7 @@ public IPath addProject(String projectName, String compliance){ IProject project = createProject(projectName); int requiredComplianceFlag = 0; String compilerVersion = null; - if ("1.5".equals(compliance)) { - requiredComplianceFlag = AbstractCompilerTest.F_1_5; - compilerVersion = CompilerOptions.VERSION_1_5; - } - else if ("1.6".equals(compliance)) { - requiredComplianceFlag = AbstractCompilerTest.F_1_6; - compilerVersion = CompilerOptions.VERSION_1_6; - } - else if ("1.7".equals(compliance)) { - requiredComplianceFlag = AbstractCompilerTest.F_1_7; - compilerVersion = CompilerOptions.VERSION_1_7; - } - else if ("1.8".equals(compliance)) { + if ("1.8".equals(compliance)) { requiredComplianceFlag = AbstractCompilerTest.F_1_8; compilerVersion = CompilerOptions.VERSION_1_8; } @@ -245,7 +233,7 @@ else if ("12".equals(compliance)) { } else if ("19".equals(compliance)) { requiredComplianceFlag = AbstractCompilerTest.F_19; compilerVersion = CompilerOptions.VERSION_19; - } else if (!"1.4".equals(compliance) && !"1.3".equals(compliance)) { + } else { throw new UnsupportedOperationException("Test framework doesn't support compliance level: " + compliance); } if (requiredComplianceFlag != 0) { diff --git a/org.eclipse.jdt.core.tests.compiler/pom.xml b/org.eclipse.jdt.core.tests.compiler/pom.xml index 0cdf0485769..b897b753f34 100644 --- a/org.eclipse.jdt.core.tests.compiler/pom.xml +++ b/org.eclipse.jdt.core.tests.compiler/pom.xml @@ -62,7 +62,7 @@ - --add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,14,17 + --add-modules ALL-SYSTEM -Dcompliance=1.8,14,17 @@ -83,7 +83,7 @@ - --add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,15,18 + --add-modules ALL-SYSTEM -Dcompliance=1.8,15,18 @@ -104,7 +104,7 @@ - --add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,17,19 + --add-modules ALL-SYSTEM -Dcompliance=1.8,17,19 @@ -125,7 +125,7 @@ - --add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,17,20 + --add-modules ALL-SYSTEM -Dcompliance=1.8,17,20 @@ -146,7 +146,7 @@ - --add-modules ALL-SYSTEM -Dcompliance=1.4,1.8,17,19,21 + --add-modules ALL-SYSTEM -Dcompliance=1.8,17,19,21 diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationDietRecoveryTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationDietRecoveryTest.java index 40589f6b455..87cdbdc0c12 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationDietRecoveryTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationDietRecoveryTest.java @@ -40,13 +40,13 @@ public class AnnotationDietRecoveryTest extends AbstractCompilerTest { private static final boolean CHECK_ALL_PARSE = true; public static boolean optimizeStringLiterals = false; - public static long sourceLevel = ClassFileConstants.JDK1_3; //$NON-NLS-1$ + public static long sourceLevel = ClassFileConstants.JDK1_8; //$NON-NLS-1$ public AnnotationDietRecoveryTest(String testName){ super(testName); } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_5); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public static Class testClass() { return AnnotationDietRecoveryTest.class; @@ -57,9 +57,9 @@ public static Class testClass() { @Override protected Map getCompilerOptions() { Map options = super.getCompilerOptions(); - options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); - options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); - options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); + options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); return options; } diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest1_7.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest1_7.java index 2afedae706d..f98b33f2ece 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest1_7.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest1_7.java @@ -43,7 +43,7 @@ public static Class testClass() { return ParserTest1_7.class; } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_7); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public ParserTest1_7(String testName){ super(testName); diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/RunCompletionParserTests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/RunCompletionParserTests.java index 94bc5590246..adfe1ba55a9 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/RunCompletionParserTests.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/RunCompletionParserTests.java @@ -61,59 +61,6 @@ public static Test suite() { TestSuite all = new TestSuite(TestAll.class.getName()); int possibleComplianceLevels = AbstractCompilerTest.getPossibleComplianceLevels(); - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_3) != 0) { - ArrayList tests_1_3 = (ArrayList)testClasses.clone(); - // Reset forgotten subsets tests - TestCase.TESTS_PREFIX = null; - TestCase.TESTS_NAMES = null; - TestCase.TESTS_NUMBERS= null; - TestCase.TESTS_RANGE = null; - TestCase.RUN_ONLY_ID = null; - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.JDK1_3, tests_1_3)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_4) != 0) { - ArrayList tests_1_4 = (ArrayList)testClasses.clone(); - // Reset forgotten subsets tests - TestCase.TESTS_PREFIX = null; - TestCase.TESTS_NAMES = null; - TestCase.TESTS_NUMBERS= null; - TestCase.TESTS_RANGE = null; - TestCase.RUN_ONLY_ID = null; - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.JDK1_4, tests_1_4)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_5) != 0) { - ArrayList tests_1_5 = (ArrayList)testClasses.clone(); - tests_1_5.addAll(TEST_CLASSES_1_5); - // Reset forgotten subsets tests - TestCase.TESTS_PREFIX = null; - TestCase.TESTS_NAMES = null; - TestCase.TESTS_NUMBERS= null; - TestCase.TESTS_RANGE = null; - TestCase.RUN_ONLY_ID = null; - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.JDK1_5, tests_1_5)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_6) != 0) { - ArrayList tests_1_6 = (ArrayList)testClasses.clone(); - tests_1_6.addAll(TEST_CLASSES_1_5); - // Reset forgotten subsets tests - TestCase.TESTS_PREFIX = null; - TestCase.TESTS_NAMES = null; - TestCase.TESTS_NUMBERS= null; - TestCase.TESTS_RANGE = null; - TestCase.RUN_ONLY_ID = null; - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.JDK1_6, tests_1_6)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_7) != 0) { - ArrayList tests_1_7 = (ArrayList)testClasses.clone(); - tests_1_7.addAll(TEST_CLASSES_1_5); - // Reset forgotten subsets tests - TestCase.TESTS_PREFIX = null; - TestCase.TESTS_NAMES = null; - TestCase.TESTS_NUMBERS= null; - TestCase.TESTS_RANGE = null; - TestCase.RUN_ONLY_ID = null; - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.JDK1_7, tests_1_7)); - } if ((possibleComplianceLevels & AbstractCompilerTest.F_1_8) != 0) { ArrayList tests_1_8 = (ArrayList)testClasses.clone(); tests_1_8.addAll(TEST_CLASSES_1_5); diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java index 2d560be188b..fda7e00a706 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java @@ -83,37 +83,9 @@ public static TestSuite getTestSuite(boolean addComplianceDiagnoseTest) { TestSuite all = new TestSuite(TestAll.class.getName()); int possibleComplianceLevels = AbstractCompilerTest.getPossibleComplianceLevels(); - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_3) != 0) { - ArrayList tests_1_3 = (ArrayList)testClasses.clone(); - TestCase.resetForgottenFilters(tests_1_3); - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.JDK1_3, tests_1_3)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_4) != 0) { - ArrayList tests_1_4 = (ArrayList)testClasses.clone(); - TestCase.resetForgottenFilters(tests_1_4); - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.JDK1_4, tests_1_4)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_5) != 0) { - ArrayList tests_1_5 = (ArrayList)testClasses.clone(); - tests_1_5.addAll(TEST_CLASSES_1_5); - TestCase.resetForgottenFilters(tests_1_5); - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.JDK1_5, tests_1_5)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_6) != 0) { - ArrayList tests_1_6 = (ArrayList)testClasses.clone(); - tests_1_6.addAll(TEST_CLASSES_1_5); - TestCase.resetForgottenFilters(tests_1_6); - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.JDK1_6, tests_1_6)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_7) != 0) { - ArrayList tests_1_7 = (ArrayList)testClasses.clone(); - tests_1_7.addAll(TEST_CLASSES_1_5); - tests_1_7.add(ParserTest1_7.class); - TestCase.resetForgottenFilters(tests_1_7); - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.JDK1_7, tests_1_7)); - } if ((possibleComplianceLevels & AbstractCompilerTest.F_1_8) != 0) { ArrayList tests_1_8 = (ArrayList)testClasses.clone(); + tests_1_8.add(ParserTest1_7.class); tests_1_8.addAll(TEST_CLASSES_1_5); addJava1_8Tests(tests_1_8); TestCase.resetForgottenFilters(tests_1_8); diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractComparableTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractComparableTest.java index 48504c3e61f..8d693bdc692 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractComparableTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractComparableTest.java @@ -97,7 +97,7 @@ public class AbstractComparableTest extends AbstractRegressionTest { "}"; public static Test buildComparableTestSuite(Class evaluationTestClass) { - Test suite = buildMinimalComplianceTestSuite(evaluationTestClass, F_1_5); + Test suite = buildMinimalComplianceTestSuite(evaluationTestClass, F_1_8); TESTS_COUNTERS.put(evaluationTestClass.getName(), Integer.valueOf(suite.countTestCases())); return suite; } diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssertionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssertionTest.java index d151a04b531..11277f5ffb9 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssertionTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssertionTest.java @@ -31,7 +31,7 @@ public AssertionTest(String name) { } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_4); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public static Class testClass() { diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest_1_5.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest_1_5.java index fb8a22161c0..778491d4027 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest_1_5.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest_1_5.java @@ -42,7 +42,7 @@ protected Map getCompilerOptions() { // TESTS_RANGE = new int[] { 11, -1 }; } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_5); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=277450 public void test1() { diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest_1_7.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest_1_7.java index a49aa3f0d12..d4b7f50ed4c 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest_1_7.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest_1_7.java @@ -42,7 +42,7 @@ protected Map getCompilerOptions() { // TESTS_RANGE = new int[] { 11, -1 }; } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_7); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } /* * no effect assignment bug diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java index d3583e905ac..2112a3d638d 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java @@ -85,7 +85,7 @@ public BatchCompilerTest(String name) { * @see TestAll */ public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_5); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public static Class testClass() { return BatchCompilerTest.class; diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BinaryLiteralTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BinaryLiteralTest.java index 954bfd9b64a..4b8399dac3a 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BinaryLiteralTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BinaryLiteralTest.java @@ -25,7 +25,7 @@ public BinaryLiteralTest(String name) { super(name); } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_7); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public static Class testClass() { diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BootstrapMethodAttributeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BootstrapMethodAttributeTest.java index c4bd218e5b5..13702d6f327 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BootstrapMethodAttributeTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BootstrapMethodAttributeTest.java @@ -40,7 +40,7 @@ public static Class testClass() { // TESTS_RANGE = new int[] { 23 -1,}; } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_7); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public void test001() throws Exception { diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_4.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_4.java index 978347aca25..1acd596e2e7 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_4.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_4.java @@ -29,7 +29,7 @@ public class ClassFileReaderTest_1_4 extends AbstractRegressionTest { } public static Test suite() { - return buildUniqueComplianceTestSuite(testClass(), ClassFileConstants.JDK1_4); + return buildUniqueComplianceTestSuite(testClass(), ClassFileConstants.JDK1_8); } public static Class testClass() { return ClassFileReaderTest_1_4.class; @@ -2604,7 +2604,7 @@ public void test069() throws Exception { "public interface I {\n" + "}"; String expectedOutput = - "// Compiled from I.java (version 1.2 : 46.0, no super bit)\n" + + "// Compiled from I.java (version 1.8 : 52.0, no super bit)\n" + "public abstract interface I {\n" + " Constant pool:\n" + " constant #1 class: #2 I\n" + diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_5.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_5.java index 092de4cacb6..9466ae94dbd 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_5.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_5.java @@ -35,7 +35,7 @@ public class ClassFileReaderTest_1_5 extends AbstractRegressionTest { } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_5); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public static Class testClass() { return ClassFileReaderTest_1_5.class; diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_3.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_3.java index 07544df301b..a7ae9ca4c69 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_3.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_3.java @@ -50,7 +50,7 @@ protected Map getCompilerOptions() { return options; } public static Test suite() { - return buildUniqueComplianceTestSuite(testClass(), ClassFileConstants.JDK1_3); + return buildUniqueComplianceTestSuite(testClass(), ClassFileConstants.JDK1_8); } public static Class testClass() { return Compliance_1_3.class; diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_4.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_4.java index e5f7e6df34f..27c95ffe2ff 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_4.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_4.java @@ -47,7 +47,7 @@ protected Map getCompilerOptions() { return options; } public static Test suite() { - return buildUniqueComplianceTestSuite(testClass(), ClassFileConstants.JDK1_4); + return buildUniqueComplianceTestSuite(testClass(), ClassFileConstants.JDK1_8); } public static Class testClass() { return Compliance_1_4.class; diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_5.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_5.java index cb4e20cae9c..d9a9d783ded 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_5.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_5.java @@ -16,15 +16,14 @@ import java.io.File; import java.util.Map; -import junit.framework.Test; - import org.eclipse.jdt.core.ToolFactory; -import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; import org.eclipse.jdt.core.tests.util.Util; import org.eclipse.jdt.core.util.ClassFileBytesDisassembler; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import junit.framework.Test; + @SuppressWarnings({ "unchecked", "rawtypes" }) public class Compliance_1_5 extends AbstractComparableTest { boolean docSupport = false; @@ -3004,28 +3003,7 @@ public void test087() { ); } public void test088() { - String errorMessage = - "----------\n" + - "1. WARNING in p\\X.java (at line 4)\n" + - " public class X extends Date implements Runnable{\n" + - " ^\n" + - "The serializable class X does not declare a static final serialVersionUID field of type long\n" + - "----------\n" + - "2. ERROR in p\\X.java (at line 12)\n" + - " this.super();\n" + - " ^^^^\n" + - "Illegal enclosing instance specification for type Object\n" + - "----------\n" + - "3. WARNING in p\\X.java (at line 39)\n" + - " Method _getMethod = c.getMethod(\"d\",null);\n" + - " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Type null of the last argument to method getMethod(String, Class...) doesn't exactly match the vararg parameter type. Cast to Class[] to confirm the non-varargs invocation, or pass individual arguments of type Class for a varargs invocation.\n" + - "----------\n"; - String javaVersion = System.getProperty("java.version"); - int allPossibleLevels = getPossibleComplianceLevels(); - boolean isLevelGreaterThan5 = (allPossibleLevels & ~(F_1_3 | F_1_4 | F_1_5)) != 0; - if (isLevelGreaterThan5 - || (allPossibleLevels == AbstractCompilerTest.F_1_5 && javaVersion.indexOf("1.5") == -1)) { + String errorMessage; errorMessage = "----------\n" + "1. WARNING in p\\X.java (at line 4)\n" + @@ -3048,7 +3026,6 @@ public void test088() { " ^^^^^^^^^^^^^^^^^^^^^\n" + "Type safety: The method getMethod(String, Class...) belongs to the raw type Class. References to generic type Class should be parameterized\n" + "----------\n"; - } this.runNegativeTest( new String[] { "p/X.java", diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_6.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_6.java index 14ace54a060..e4e1c92caba 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_6.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_6.java @@ -26,7 +26,7 @@ public Compliance_1_6(String name) { super(name); } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_6); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } // Use this static initializer to specify subset for tests // All specified tests which does not belong to the class are skipped... @@ -41,9 +41,9 @@ public static Test suite() { //https://bugs.eclipse.org/bugs/show_bug.cgi?id=283225 public void test1() { Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_6); - options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); - options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); + options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); this.runConformTest( new String[] { "Test.java", diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_7.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_7.java index 654f9bae4ed..a818a0c4510 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_7.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_7.java @@ -29,7 +29,7 @@ public Compliance_1_7(String name) { super(name); } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_7); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } static { // Names of tests to run: can be "testBugXXXX" or "BugXXXX") @@ -85,9 +85,9 @@ public void test2() { // regular case public void testBug390889_a() { Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_7); - options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7); - options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_7); + options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); this.runConformTest( new String[] { "MyComp.java", @@ -130,9 +130,9 @@ public void testBug390889_b() { }); Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_7); - options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7); - options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_7); + options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); this.runConformTest( new String[] { "C1.java", @@ -160,9 +160,9 @@ public void testBug390889_c() { }); Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_7); - options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7); - options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_7); + options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); this.runConformTest( new String[] { "CI.java", @@ -186,9 +186,9 @@ public void testBug490988() { if (this.complianceLevel < ClassFileConstants.JDK1_8) return; Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_7); - options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7); - options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_7); + options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); this.runNegativeTest( new String[] { "Thing.java", diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_CLDC.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_CLDC.java index 56f06b69b44..4a85c5fcd48 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_CLDC.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_CLDC.java @@ -34,13 +34,13 @@ public Compliance_CLDC(String name) { @Override protected Map getCompilerOptions() { Map options = super.getCompilerOptions(); - options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_3); - options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_CLDC1_1); - options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3); + options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); return options; } public static Test suite() { - return buildUniqueComplianceTestSuite(testClass(), ClassFileConstants.JDK1_3); + return buildUniqueComplianceTestSuite(testClass(), ClassFileConstants.JDK1_8); } public static Class testClass() { return Compliance_CLDC.class; @@ -231,7 +231,7 @@ public void test003() throws Exception { "true"); String expectedOutput = - "// Compiled from X.java (version 1.1 : 45.3, super bit)\n" + + "// Compiled from X.java (version 1.8 : 52.0, super bit)\n" + "public class X {\n" + " \n" + " // Method descriptor #6 ()V\n" + @@ -261,8 +261,8 @@ public void test003() throws Exception { " [pc: 17, line: 5]\n" + " Local variable table:\n" + " [pc: 0, pc: 18] local: args index: 0 type: java.lang.String[]\n" + - " Stack map : number of frames 2\n" + - " [pc: 13, full, stack: {java.io.PrintStream}, locals: {java.lang.String[]}]\n" + + " Stack map table: number of frames 2\n" + + " [pc: 13, same_locals_1_stack_item, stack: {java.io.PrintStream}]\n" + " [pc: 14, full, stack: {java.io.PrintStream, int}, locals: {java.lang.String[]}]\n" + "}"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConcurrentBatchCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConcurrentBatchCompilerTest.java index 202ee51af25..d56c30932f5 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConcurrentBatchCompilerTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConcurrentBatchCompilerTest.java @@ -27,7 +27,7 @@ public class ConcurrentBatchCompilerTest extends BatchCompilerTest { public static Test suite() { - return buildUniqueComplianceTestSuite(testClass(), ClassFileConstants.JDK1_6); + return buildUniqueComplianceTestSuite(testClass(), ClassFileConstants.JDK1_8); } public static Class testClass() { return ConcurrentBatchCompilerTest.class; @@ -147,7 +147,7 @@ public void run() { "" }, "\"" + OUTPUT_DIR + File.separator + "org/eclipse/jdt/internal/launching/CompositeId.java\"" - + " -1.5 -g -preserveAllLocals" + + " -1.8 -g -preserveAllLocals" + " -proceedOnError -d \"" + OUTPUT_DIR + "\"", "", "", @@ -189,7 +189,7 @@ public void run() { "}\n" }, "\"" + OUTPUT_DIR + File.separator + "test01/X.java\"" - + " -1.5 -g -preserveAllLocals -err:+resource" + + " -1.8 -g -preserveAllLocals -err:+resource" + " -proceedOnError -d \"" + OUTPUT_DIR + "\"", "", errorOutput.toString(), diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated15Test.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated15Test.java index 96ded31931a..f1db90cc3f7 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated15Test.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated15Test.java @@ -29,7 +29,7 @@ public Deprecated15Test(String name) { super(name); } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_5); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public void test001() { Map options = getCompilerOptions(); diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ExternalizeStringLiteralsTest_1_5.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ExternalizeStringLiteralsTest_1_5.java index 31cc9e40e33..f55782665b4 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ExternalizeStringLiteralsTest_1_5.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ExternalizeStringLiteralsTest_1_5.java @@ -32,7 +32,7 @@ public ExternalizeStringLiteralsTest_1_5(String name) { super(name); } public static Test suite() { - return buildUniqueComplianceTestSuite(testClass(), ClassFileConstants.JDK1_5); + return buildUniqueComplianceTestSuite(testClass(), ClassFileConstants.JDK1_8); } public void test001() { diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeSignatureTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeSignatureTest.java index cc6c220490d..f625dfb1078 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeSignatureTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeSignatureTest.java @@ -79,7 +79,7 @@ public void run() { // TESTS_RANGE = new int[] { 21, 50 }; // } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_5); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public static Class testClass() { diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java index b98bc07988d..29a1794df15 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java @@ -38,7 +38,7 @@ public GenericsRegressionTest_1_7(String name) { super(name); } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_7); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public void test001() { this.runConformTest( @@ -2600,7 +2600,7 @@ public void test0059() { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=351965 public void test0060() { Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4); + customOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); this.runNegativeTest( new String[] { "X.java", @@ -2631,7 +2631,7 @@ public void test0060() { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=351965 public void test0060a() { Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4); + customOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); this.runNegativeTest( new String[] { "X.java", diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerClass15Test.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerClass15Test.java index fca62f6f3b4..70022dec3c9 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerClass15Test.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerClass15Test.java @@ -29,7 +29,7 @@ public InnerClass15Test(String name) { //TESTS_NAMES = new String[] {"testBug520874"}; } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_5); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } @Override protected Map getCompilerOptions() { diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest_1_5.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest_1_5.java index c27db471e6b..e6885cf6079 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest_1_5.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest_1_5.java @@ -29,7 +29,7 @@ public InnerEmulationTest_1_5(String name) { super(name); } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_5); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=275381 public void test1() throws Exception { diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InternalHexFloatTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InternalHexFloatTest.java index d5bd8473563..ef89eb2c305 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InternalHexFloatTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InternalHexFloatTest.java @@ -45,7 +45,7 @@ public InternalHexFloatTest(String name) { super(name); } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_5); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public static Class testClass() { diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java index aa44a2d748a..2ac3334f0b9 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java @@ -74,14 +74,10 @@ public static Test suite() { testSuite.addTest(suite); } int complianceLevels = AbstractCompilerTest.getPossibleComplianceLevels(); - if ((complianceLevels & AbstractCompilerTest.F_1_3) != 0) { - testSuite.addTest(buildUniqueComplianceTestSuite(JavadocTest_1_3.class, ClassFileConstants.JDK1_3)); - } - if ((complianceLevels & AbstractCompilerTest.F_1_4) != 0) { - testSuite.addTest(buildUniqueComplianceTestSuite(JavadocTest_1_4.class, ClassFileConstants.JDK1_4)); - } - if ((complianceLevels & AbstractCompilerTest.F_1_5) != 0) { - testSuite.addTest(buildUniqueComplianceTestSuite(JavadocTest_1_5.class, ClassFileConstants.JDK1_5)); + if ((complianceLevels & AbstractCompilerTest.F_1_8) != 0) { + testSuite.addTest(buildUniqueComplianceTestSuite(JavadocTest_1_3.class, ClassFileConstants.JDK1_8)); + testSuite.addTest(buildUniqueComplianceTestSuite(JavadocTest_1_4.class, ClassFileConstants.JDK1_8)); + testSuite.addTest(buildUniqueComplianceTestSuite(JavadocTest_1_5.class, ClassFileConstants.JDK1_8)); } if ((complianceLevels & AbstractCompilerTest.F_9) != 0) { testSuite.addTest(buildUniqueComplianceTestSuite(JavadocTestForModule.class, ClassFileConstants.JDK9)); diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_3.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_3.java index c15236a43bd..400deeab09c 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_3.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_3.java @@ -47,7 +47,7 @@ public static Class testClass() { // TESTS_RANGE = new int[] { 21, 50 }; } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_3); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } @Override diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_4.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_4.java index 75d97648f26..19d2cf1da46 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_4.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_4.java @@ -48,7 +48,7 @@ public static Class testClass() { // TESTS_RANGE = new int[] { 21, 50 }; } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_4); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } @Override diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_5.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_5.java index 24393eb8ffc..4ff8ce01945 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_5.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_5.java @@ -47,7 +47,7 @@ public static Class testClass() { // TESTS_RANGE = new int[] { 23, -1 }; } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_5); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } @Override diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Jsr14Test.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Jsr14Test.java index 308c972c969..114c68152af 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Jsr14Test.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Jsr14Test.java @@ -29,9 +29,9 @@ public Jsr14Test(String name) { @Override protected Map getCompilerOptions() { Map options = super.getCompilerOptions(); - options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); - options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); - options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4); + options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); return options; } // Static initializer to specify tests subset using TESTS_* static variables @@ -42,7 +42,7 @@ protected Map getCompilerOptions() { // TESTS_RANGE = new int[] { 11, -1 }; } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_4); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=277450 public void test1() throws Exception { diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodHandleTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodHandleTest.java index 8787aa15310..f37a0b8cbf8 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodHandleTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodHandleTest.java @@ -28,7 +28,7 @@ public MethodHandleTest(String name) { super(name); } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_7); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public static Class testClass() { diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationBatchCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationBatchCompilerTest.java index a3362d05133..599ff41d043 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationBatchCompilerTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationBatchCompilerTest.java @@ -114,7 +114,7 @@ public class NullAnnotationBatchCompilerTest extends AbstractBatchCompilerTest { * @see TestAll */ public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_5); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public static Class testClass() { @@ -165,7 +165,7 @@ public void test314_warn_options() { }, "\"" + OUTPUT_DIR + File.separator + "p" + File.separator + "X.java\"" + " -sourcepath \"" + OUTPUT_DIR + "\"" - + " -1.5" + + " -1.8" + " -err:+nullAnnot -warn:-null -err:+nonnullNotRepeated -proc:none -d \"" + OUTPUT_DIR + "\"", "", "----------\n" + @@ -220,7 +220,7 @@ public void test315_warn_options() { }, "\"" + OUTPUT_DIR + File.separator + "p" + File.separator + "X.java\"" + " -sourcepath \"" + OUTPUT_DIR + "\"" - + " -1.5" + + " -1.8" + " -warn:+nullAnnot -warn:+null -missingNullDefault -proc:none -d \"" + OUTPUT_DIR + "\"", "", "", @@ -246,7 +246,7 @@ public void test315_warn_options_a() { }, "\"" + OUTPUT_DIR + File.separator + "p1" + File.separator + "X1.java\"" + " -sourcepath \"" + OUTPUT_DIR + "\"" - + " -1.5" + + " -1.8" + " -warn:+nullAnnot -warn:+null -missingNullDefault -proc:none -d \"" + OUTPUT_DIR + "\"", "", "----------\n" + @@ -277,7 +277,7 @@ public void test315_warn_options_b() { }, "\"" + OUTPUT_DIR + File.separator + "X1.java\"" + " -sourcepath \"" + OUTPUT_DIR + "\"" - + " -1.5" + + " -1.8" + " -warn:+nullAnnot -warn:+null -missingNullDefault -proc:none -d \"" + OUTPUT_DIR + "\"", "", "----------\n" + @@ -315,7 +315,7 @@ public void test316_warn_options() { }, "\"" + OUTPUT_DIR + File.separator + "p" + File.separator + "X.java\"" + " -sourcepath \"" + OUTPUT_DIR + "\"" - + " -1.5" + + " -1.8" + " -warn:+nullAnnot(foo|bar) -warn:+null -nonNullByDefault -proc:none -d \"" + OUTPUT_DIR + "\"", "", "Token nullAnnot(foo|bar) is not in the expected format \"nullAnnot( | | )\"\n", @@ -348,7 +348,7 @@ public void test316b_warn_options() { }, "\"" + OUTPUT_DIR + File.separator + "p" + File.separator + "X.java\"" + " -sourcepath \"" + OUTPUT_DIR + "\"" - + " -1.5" + + " -1.8" + " -warn:+nullAnnot -warn:+null,syntacticAnalysis -proc:none -d \"" + OUTPUT_DIR + "\"", "", "", @@ -381,7 +381,7 @@ public void test313_warn_options() { }, "\"" + OUTPUT_DIR + File.separator + "p" + File.separator + "X.java\"" + " -sourcepath \"" + OUTPUT_DIR + "\"" - + " -1.5" + + " -1.8" + " -warn:+nullAnnot -warn:-null -proc:none -d \"" + OUTPUT_DIR + "\"", "", "----------\n" + @@ -432,7 +432,7 @@ public void test320_warn_options() { }, "\"" + OUTPUT_DIR + File.separator + "p" + File.separator + "Sub.java\"" + " -sourcepath \"" + OUTPUT_DIR + "\"" - + " -1.5" + + " -1.8" + " -err:+nullAnnot,+null,+inheritNullAnnot -proc:none -d \"" + OUTPUT_DIR + "\"", "", "----------\n" + @@ -479,7 +479,7 @@ public void testBug466291() { "}" }, "\"" + OUTPUT_DIR + File.separator + "p" + File.separator + "X.java\"" - + " -1.5" + + " -1.8" + " -warn:+nullAnnot(p.Nullable|p.NonNull|p.NonNullByDefault) -warn:+null -warn:-nullUncheckedConversion " + "-proc:none -d \"" + OUTPUT_DIR + "\"", "", @@ -509,7 +509,7 @@ public void testBug466291() { "\"" + OUTPUT_DIR + File.separator + "p2" + File.separator + "X2.java\"" + " -sourcepath \"" + OUTPUT_DIR + "\"" + " -classpath \"" + OUTPUT_DIR + "\"" - + " -1.5" + + " -1.8" + " -warn:+nullAnnot(org.eclipse.jdt.annotation.Nullable|org.eclipse.jdt.annotation.NonNull|org.eclipse.jdt.annotation.NonNullByDefault)" + " -warn:+nullAnnot(p.Nullable||p.NonNullByDefault) -warn+null -proc:none -d \"" + OUTPUT_DIR + "\"", // nonnull remains unset for secondaries "", @@ -561,7 +561,7 @@ public void testBug466291b() { "}" }, "\"" + OUTPUT_DIR + File.separator + "p" + File.separator + "X.java\"" - + " -1.5" + + " -1.8" + " -warn:+nullAnnot(p.Nullable|p.NonNull|p.NonNullByDefault) -warn:+null -warn:-nullUncheckedConversion " + "-proc:none -d \"" + OUTPUT_DIR + "\"", "", @@ -593,7 +593,7 @@ public void testBug466291b() { "\"" + OUTPUT_DIR + File.separator + "p2" + File.separator + "X2.java\"" + " -sourcepath \"" + OUTPUT_DIR + "\"" + " -classpath \"" + OUTPUT_DIR + "\"" - + " -1.5" + + " -1.8" + " -warn:+nullAnnot(org.eclipse.jdt.annotation.Nullable|org.eclipse.jdt.annotation.NonNull|org.eclipse.jdt.annotation.NonNullByDefault)" + " -warn:+nullAnnot(|x.AbsentNonNull|) " + " -warn:+nullAnnot(p.Nullable||p.NonNullByDefault) " @@ -641,7 +641,7 @@ public void testBug375366c() throws IOException { }, "\"" + OUTPUT_DIR + File.separator + "p" + File.separator + "X.java\"" + " -sourcepath \"" + OUTPUT_DIR + "\"" - + " -1.5" + + " -1.8" + " -properties " + OUTPUT_DIR + File.separator +".settings" + File.separator + "org.eclipse.jdt.core.prefs " + " -d \"" + OUTPUT_DIR + "\"", "", @@ -695,7 +695,7 @@ public void testBug375366d() throws IOException { }, "\"" + OUTPUT_DIR + File.separator + "p" + File.separator + "X.java\"" + " -sourcepath \"" + OUTPUT_DIR + "\"" - + " -1.5" + + " -1.8" + " -properties " + OUTPUT_DIR + File.separator +".settings" + File.separator + "org.eclipse.jdt.core.prefs " + " -d \"" + OUTPUT_DIR + "\"", "", diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PolymorphicSignatureTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PolymorphicSignatureTest.java index 4c70a46b62e..d12d96ec569 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PolymorphicSignatureTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PolymorphicSignatureTest.java @@ -24,7 +24,7 @@ public PolymorphicSignatureTest(String name) { super(name); } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_7); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public static Class testClass() { return PolymorphicSignatureTest.class; diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakAnnotatedTests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakAnnotatedTests.java index ec95894afe5..371de8e4b49 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakAnnotatedTests.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakAnnotatedTests.java @@ -39,7 +39,7 @@ public ResourceLeakAnnotatedTests(String name) { public static Test suite() { TestSuite suite = new TestSuite(ResourceLeakAnnotatedTests.class.getName()); // argument 'inheritedDepth' is not exposed in original API, therefore these helpers are copied below with this arg added - buildMinimalComplianceTestSuite(F_1_7, 1, suite, ResourceLeakAnnotatedTests.class); + buildMinimalComplianceTestSuite(F_1_8, 1, suite, ResourceLeakAnnotatedTests.class); return suite; } diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java index 4f7dbc42316..bed9f3bf3a6 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java @@ -47,7 +47,7 @@ public static Class testClass() { // TESTS_RANGE = new int[] { 23 -1,}; } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_6); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public void test001() throws Exception { this.runConformTest( @@ -7145,7 +7145,7 @@ public void test055a() throws Exception { } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=366999 public void test056() throws Exception { - if (this.complianceLevel < ClassFileConstants.JDK1_7) return; + if (this.complianceLevel < ClassFileConstants.JDK1_8) return; this.runConformTest( new String[] { "X.java", @@ -7793,7 +7793,7 @@ public void testBug380313() throws Exception { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=380313 // Verify the generated code does not have same branch target for the 2 return statements public void testBug380313b() throws Exception { - if (this.complianceLevel < ClassFileConstants.JDK1_7) + if (this.complianceLevel < ClassFileConstants.JDK1_8) return; this.runConformTest( new String[] { @@ -8254,7 +8254,7 @@ public void test394718() throws Exception { // https://bugs.eclipse.org/412203 public void testBug412203_a() throws Exception { - if (this.complianceLevel < ClassFileConstants.JDK1_7) return; // using <> + if (this.complianceLevel < ClassFileConstants.JDK1_8) return; // using <> Map options = getCompilerOptions(); options.put(JavaCore.COMPILER_ANNOTATION_NULL_ANALYSIS, JavaCore.ENABLED); options.put(JavaCore.COMPILER_PB_NULL_REFERENCE, JavaCore.ERROR); @@ -8320,7 +8320,7 @@ public void testBug412203_a() throws Exception { "}\n", }, "", - getLibsWithNullAnnotations(ClassFileConstants.JDK1_7), + getLibsWithNullAnnotations(ClassFileConstants.JDK1_8), true/*flush*/, null/*vmArgs*/, options, @@ -8442,7 +8442,7 @@ public void testBug412203_b() throws Exception { "}\n", }, "", - getLibsWithNullAnnotations(ClassFileConstants.JDK1_7), + getLibsWithNullAnnotations(ClassFileConstants.JDK1_8), true/*flush*/, null/*vmArgs*/, options, @@ -8559,7 +8559,7 @@ public void testBug412203_c() throws Exception { "}\n", }, "", - getLibsWithNullAnnotations(ClassFileConstants.JDK1_7), + getLibsWithNullAnnotations(ClassFileConstants.JDK1_8), true/*flush*/, null/*vmArgs*/, options, diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SuppressWarningsTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SuppressWarningsTest.java index 95d6ff97a2f..c68f8a723d3 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SuppressWarningsTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SuppressWarningsTest.java @@ -25,7 +25,7 @@ public SuppressWarningsTest(String name) { } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_5); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public static Class testClass() { @@ -56,7 +56,7 @@ public void testSimpleSuppressWarnings() { }, "\"" + OUTPUT_DIR + File.separator + "p/SuppressTest.java\"" + " -warn:+unused -warn:+boxing " - + " -1.5 -g -preserveAllLocals" + + " -1.8 -g -preserveAllLocals" + " -d \"" + OUTPUT_DIR + "\" ", "", "", true, null); } @@ -77,7 +77,7 @@ public void testNestedSuppressWarnings() { }, "\"" + OUTPUT_DIR + File.separator + "p/SuppressTest.java\"" + " -warn:+unused -warn:+boxing " - + " -1.5 -g -preserveAllLocals" + + " -1.8 -g -preserveAllLocals" + " -d \"" + OUTPUT_DIR + "\" ", "", "", true, null); } @@ -97,7 +97,7 @@ public void testUnrelatedSuppressWarnings() { }, "\"" + OUTPUT_DIR + File.separator + "p/SuppressTest.java\"" + " -warn:+unused -warn:+boxing " - + " -1.5 -g -preserveAllLocals" + + " -1.8 -g -preserveAllLocals" + " -d \"" + OUTPUT_DIR + "\" ", "", "----------\n" + diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java index 99ff634539f..f8ab57e37a9 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java @@ -259,49 +259,15 @@ public static Test suite() { all.addTest(new TestSuite(HashtableOfObjectTest.class)); all.addTest(new TestSuite(JrtUtilTest.class)); int possibleComplianceLevels = AbstractCompilerTest.getPossibleComplianceLevels(); - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_3) != 0) { - ArrayList tests_1_3 = (ArrayList)standardTests.clone(); - tests_1_3.add(Compliance_1_3.class); - tests_1_3.add(JavadocTest_1_3.class); - tests_1_3.add(Compliance_CLDC.class); - TestCase.resetForgottenFilters(tests_1_3); - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.JDK1_3, tests_1_3)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_4) != 0) { - ArrayList tests_1_4 = (ArrayList)standardTests.clone(); - tests_1_4.addAll(since_1_4); - tests_1_4.add(Compliance_1_4.class); - tests_1_4.add(ClassFileReaderTest_1_4.class); - tests_1_4.add(JavadocTest_1_4.class); - TestCase.resetForgottenFilters(tests_1_4); - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.JDK1_4, tests_1_4)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_5) != 0) { - ArrayList tests_1_5 = (ArrayList)standardTests.clone(); - tests_1_5.addAll(since_1_4); - tests_1_5.addAll(since_1_5); - TestCase.resetForgottenFilters(tests_1_5); - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.JDK1_5, tests_1_5)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_6) != 0) { - ArrayList tests_1_6 = (ArrayList)standardTests.clone(); - tests_1_6.addAll(since_1_4); - tests_1_6.addAll(since_1_5); - tests_1_6.addAll(since_1_6); - TestCase.resetForgottenFilters(tests_1_6); - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.JDK1_6, tests_1_6)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_7) != 0) { - ArrayList tests_1_7 = (ArrayList)standardTests.clone(); - tests_1_7.addAll(since_1_4); - tests_1_7.addAll(since_1_5); - tests_1_7.addAll(since_1_6); - tests_1_7.addAll(since_1_7); - TestCase.resetForgottenFilters(tests_1_7); - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.JDK1_7, tests_1_7)); - } + if ((possibleComplianceLevels & AbstractCompilerTest.F_1_8) != 0) { ArrayList tests_1_8 = (ArrayList)standardTests.clone(); + tests_1_8.add(Compliance_1_3.class); + tests_1_8.add(JavadocTest_1_3.class); + tests_1_8.add(Compliance_CLDC.class); + tests_1_8.add(Compliance_1_4.class); + tests_1_8.add(ClassFileReaderTest_1_4.class); + tests_1_8.add(JavadocTest_1_4.class); tests_1_8.addAll(since_1_4); tests_1_8.addAll(since_1_5); tests_1_8.addAll(since_1_6); diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryStatement17Test.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryStatement17Test.java index ffad02ae8ac..2a53279e10c 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryStatement17Test.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryStatement17Test.java @@ -29,7 +29,7 @@ public TryStatement17Test(String name) { super(name); } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_7); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public void test001() { this.runNegativeTest( diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryWithResourcesStatementTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryWithResourcesStatementTest.java index 6ac0148c4d0..57099214065 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryWithResourcesStatementTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryWithResourcesStatementTest.java @@ -36,7 +36,7 @@ public TryWithResourcesStatementTest(String name) { super(name); } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_7); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } // Test resource type related errors public void test001() { @@ -3153,9 +3153,9 @@ public void test048() { public void test049() { Runner runner = new Runner(); runner.customOptions = getCompilerOptions(); - runner.customOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); - runner.customOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); - runner.customOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); + runner.customOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8); + runner.customOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); + runner.customOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); runner.testFiles = new String[] { "X.java", @@ -3185,7 +3185,7 @@ public void test049() { " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Resource specification not allowed here for source level below 1.7\n" + "----------\n"; - runner.javacTestOptions = JavacTestOptions.forRelease("5"); + runner.javacTestOptions = JavacTestOptions.forRelease("8"); runner.runNegativeTest(); } public void test050() { @@ -3259,9 +3259,9 @@ public void test051() { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=348406 public void test052() { Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); - options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); - options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); + options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); + options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); this.runNegativeTest( new String[] { "X.java", diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UnderscoresInLiteralsTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UnderscoresInLiteralsTest.java index 098dd3fbe67..ddcac8b5c4b 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UnderscoresInLiteralsTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UnderscoresInLiteralsTest.java @@ -28,7 +28,7 @@ public UnderscoresInLiteralsTest(String name) { super(name); } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_7); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public static Class testClass() { @@ -394,9 +394,9 @@ public void test021() { } public void test022() { Map customedOptions = getCompilerOptions(); - customedOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_6); - customedOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6); - customedOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6); + customedOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8); + customedOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); + customedOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); this.runNegativeTest( new String[] { "X.java", diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/XLargeTest2.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/XLargeTest2.java index 20162535196..6f5e3481e9c 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/XLargeTest2.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/XLargeTest2.java @@ -27,7 +27,7 @@ public XLargeTest2(String name) { } public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_5); + return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public static Class testClass() { diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java index 2678a9dbee2..0de20840455 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java @@ -35,11 +35,6 @@ @SuppressWarnings({ "unchecked", "rawtypes" }) public class AbstractCompilerTest extends TestCase { - public static final int F_1_3 = 0x01; - public static final int F_1_4 = 0x02; - public static final int F_1_5 = 0x04; - public static final int F_1_6 = 0x08; - public static final int F_1_7 = 0x10; public static final int F_1_8 = 0x20; public static final int F_9 = 0x40; public static final int F_10 = 0x80; @@ -82,11 +77,6 @@ public class AbstractCompilerTest extends TestCase { protected static boolean reflectNestedClassUseDollar; public static int[][] complianceTestLevelMapping = new int[][] { - new int[] {F_1_3, ClassFileConstants.MAJOR_VERSION_1_3}, - new int[] {F_1_4, ClassFileConstants.MAJOR_VERSION_1_4}, - new int[] {F_1_5, ClassFileConstants.MAJOR_VERSION_1_5}, - new int[] {F_1_6, ClassFileConstants.MAJOR_VERSION_1_6}, - new int[] {F_1_7, ClassFileConstants.MAJOR_VERSION_1_7}, new int[] {F_1_8, ClassFileConstants.MAJOR_VERSION_1_8}, new int[] {F_9, ClassFileConstants.MAJOR_VERSION_9}, new int[] {F_10, ClassFileConstants.MAJOR_VERSION_10}, @@ -267,16 +257,6 @@ else if (highestLevel == ClassFileConstants.JDK9) complianceString = "9"; else if (highestLevel == ClassFileConstants.JDK1_8) complianceString = "1.8"; - else if (highestLevel == ClassFileConstants.JDK1_7) - complianceString = "1.7"; - else if (highestLevel == ClassFileConstants.JDK1_6) - complianceString = "1.6"; - else if (highestLevel == ClassFileConstants.JDK1_5) - complianceString = "1.5"; - else if (highestLevel == ClassFileConstants.JDK1_4) - complianceString = "1.4"; - else if (highestLevel == ClassFileConstants.JDK1_3) - complianceString = "1.3"; else { highestLevel = ClassFileConstants.getLatestJDKLevel(); if (highestLevel > 0) { @@ -310,7 +290,7 @@ public static long highestComplianceLevels() { return ClassFileConstants.getComplianceLevelForJavaVersion(map[1]); } } - return ClassFileConstants.JDK1_3; + return ClassFileConstants.JDK1_8; } static void initReflectionVersion() { @@ -371,15 +351,9 @@ public static int getPossibleComplianceLevels() { if (compliances != null) { possibleComplianceLevels = 0; for (String compliance : compliances.split(",")) { - if (CompilerOptions.VERSION_1_3.equals(compliance)) { - possibleComplianceLevels |= RUN_JAVAC ? NONE : F_1_3; - } else if (CompilerOptions.VERSION_1_4.equals(compliance)) { - possibleComplianceLevels |= RUN_JAVAC ? NONE : F_1_4; - } boolean versionValid = false; for(int i = 0; i < complianceTestLevelMapping.length; i++) { int[] versionMap = complianceTestLevelMapping[i]; - if (versionMap[0] < F_1_5) continue; long jdkLevel = ClassFileConstants.getComplianceLevelForJavaVersion(versionMap[1]); String versionString = CompilerOptions.versionFromJdkLevel(jdkLevel); if (versionString.equals(compliance)) { @@ -391,12 +365,6 @@ public static int getPossibleComplianceLevels() { if (!versionValid) { System.out.println("Ignoring invalid compliance (" + compliance + ")"); System.out.print("Use one of "); - System.out.print(CompilerOptions.VERSION_1_3 + ", "); - System.out.print(CompilerOptions.VERSION_1_4 + ", "); - System.out.print(CompilerOptions.VERSION_1_5 + ", "); - System.out.print(CompilerOptions.VERSION_1_6 + ", "); - System.out.print(CompilerOptions.VERSION_1_7 + ", "); - System.out.print(CompilerOptions.VERSION_1_8 + ", "); System.out.print(CompilerOptions.VERSION_1_8 + ", "); System.out.print(CompilerOptions.VERSION_9 + ", "); System.out.print(CompilerOptions.VERSION_10 + ", "); @@ -421,18 +389,11 @@ public static int getPossibleComplianceLevels() { } if (possibleComplianceLevels == UNINITIALIZED) { if (!RUN_JAVAC) { - possibleComplianceLevels = F_1_3; - boolean canRunPrevious = !"1.0".equals(specVersion) - && !CompilerOptions.VERSION_1_1.equals(specVersion) - && !CompilerOptions.VERSION_1_2.equals(specVersion) - && !CompilerOptions.VERSION_1_3.equals(specVersion); - if (canRunPrevious) { - possibleComplianceLevels |= F_1_4; - } + possibleComplianceLevels = F_1_8; + boolean canRunPrevious = true; String previousVersion = CompilerOptions.VERSION_1_4; for(int i = 0; i < complianceTestLevelMapping.length; i++) { int[] versionMap = complianceTestLevelMapping[i]; - if (versionMap[0] < F_1_5) continue; long jdkLevel = ClassFileConstants.getComplianceLevelForJavaVersion(versionMap[1]); String versionString = CompilerOptions.versionFromJdkLevel(jdkLevel); boolean canRunNext = canRunPrevious && !previousVersion.equals(specVersion); @@ -443,16 +404,9 @@ public static int getPossibleComplianceLevels() { } previousVersion = versionString; } - } else if ("1.0".equals(specVersion) - || CompilerOptions.VERSION_1_1.equals(specVersion) - || CompilerOptions.VERSION_1_2.equals(specVersion) - || CompilerOptions.VERSION_1_3.equals(specVersion) - || CompilerOptions.VERSION_1_4.equals(specVersion)) { - possibleComplianceLevels = NONE; } else { for(int i = 0; i < complianceTestLevelMapping.length; i++) { int[] versionMap = complianceTestLevelMapping[i]; - if (versionMap[0] < F_1_5) continue; long jdkLevel = ClassFileConstants.getComplianceLevelForJavaVersion(versionMap[1]); String versionString = CompilerOptions.versionFromJdkLevel(jdkLevel); if (versionString.equals(specVersion)) { @@ -474,16 +428,6 @@ public static int getPossibleComplianceLevels() { */ public static Test suite(String suiteName, Class setupClass, ArrayList testClasses) { TestSuite all = new TestSuite(suiteName); - int complianceLevels = AbstractCompilerTest.getPossibleComplianceLevels(); - if ((complianceLevels & AbstractCompilerTest.F_1_3) != 0) { - all.addTest(suiteForComplianceLevel(ClassFileConstants.JDK1_3, setupClass, testClasses)); - } - if ((complianceLevels & AbstractCompilerTest.F_1_4) != 0) { - all.addTest(suiteForComplianceLevel(ClassFileConstants.JDK1_4, setupClass, testClasses)); - } - if ((complianceLevels & AbstractCompilerTest.F_1_5) != 0) { - all.addTest(suiteForComplianceLevel(ClassFileConstants.JDK1_5, setupClass, testClasses)); - } return all; } @@ -575,27 +519,7 @@ public AbstractCompilerTest(String name) { protected Map getCompilerOptions() { Map options = new CompilerOptions().getMap(); options.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.IGNORE); - if (this.complianceLevel == ClassFileConstants.JDK1_3) { - options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_3); - options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3); - options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_1); - } else if (this.complianceLevel == ClassFileConstants.JDK1_4) { - options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4); - options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4); - options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4); - } else if (this.complianceLevel == ClassFileConstants.JDK1_5) { - options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); - options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); - options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); - } else if (this.complianceLevel == ClassFileConstants.JDK1_6) { - options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_6); - options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6); - options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6); - } else if (this.complianceLevel == ClassFileConstants.JDK1_7) { - options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_7); - options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7); - options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_7); - } else if (this.complianceLevel == ClassFileConstants.JDK1_8) { + if (this.complianceLevel == ClassFileConstants.JDK1_8) { options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8); options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); diff --git a/org.eclipse.jdt.core.tests.compiler/test.xml b/org.eclipse.jdt.core.tests.compiler/test.xml index 5d62db0411c..b787c2eecfa 100644 --- a/org.eclipse.jdt.core.tests.compiler/test.xml +++ b/org.eclipse.jdt.core.tests.compiler/test.xml @@ -57,7 +57,7 @@ diff --git a/org.eclipse.jdt.core.tests.model/pom.xml b/org.eclipse.jdt.core.tests.model/pom.xml index 30ecbbd2767..3e026231776 100644 --- a/org.eclipse.jdt.core.tests.model/pom.xml +++ b/org.eclipse.jdt.core.tests.model/pom.xml @@ -90,7 +90,7 @@ - --add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,14,17 + --add-modules ALL-SYSTEM -Dcompliance=1.8,14,17 @@ -111,7 +111,7 @@ - --add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,15,18 + --add-modules ALL-SYSTEM -Dcompliance=1.8,15,18 @@ -132,7 +132,7 @@ - --add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,17,19 + --add-modules ALL-SYSTEM -Dcompliance=1.8,17,19 @@ -153,7 +153,7 @@ - --add-modules ALL-SYSTEM -Dcompliance=1.4,1.8,17,19,21 + --add-modules ALL-SYSTEM -Dcompliance=1.8,17,19,21 diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java index c75b4f84211..c5beba388cd 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java @@ -2578,11 +2578,6 @@ protected String[] getJCL15PlusLibraryIfNeeded(String compliance) throws JavaMod setUpJCLClasspathVariables("1.8"); return new String[] {getExternalJCLPathString("1.8")}; } - if (compliance.charAt(compliance.length()-1) >= '5' && (AbstractCompilerTest.getPossibleComplianceLevels() & AbstractCompilerTest.F_1_5) != 0) { - // ensure that the JCL 15 lib is setup (i.e. that the jclMin15.jar is copied) - setUpJCLClasspathVariables("1.5"); - return new String[] {getExternalJCLPathString("1.5")}; - } return null; } /** diff --git a/org.eclipse.jdt.core/META-INF/MANIFEST.MF b/org.eclipse.jdt.core/META-INF/MANIFEST.MF index 2dfff3fc7c8..37a6c4351ed 100644 --- a/org.eclipse.jdt.core/META-INF/MANIFEST.MF +++ b/org.eclipse.jdt.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.jdt.core; singleton:=true -Bundle-Version: 3.38.100.qualifier +Bundle-Version: 3.39.0.qualifier Bundle-Activator: org.eclipse.jdt.core.JavaCore Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -47,7 +47,7 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.18.0,4.0.0)", org.eclipse.core.filesystem;bundle-version="[1.7.0,2.0.0)", org.eclipse.text;bundle-version="[3.6.0,4.0.0)", org.eclipse.team.core;bundle-version="[3.1.0,4.0.0)";resolution:=optional, - org.eclipse.jdt.core.compiler.batch;bundle-version="3.38.0";visibility:=reexport + org.eclipse.jdt.core.compiler.batch;bundle-version="3.39.0";visibility:=reexport Bundle-RequiredExecutionEnvironment: JavaSE-17 Eclipse-ExtensibleAPI: true Bundle-ActivationPolicy: lazy diff --git a/org.eclipse.jdt.core/pom.xml b/org.eclipse.jdt.core/pom.xml index a72549fd659..dea58410b7c 100644 --- a/org.eclipse.jdt.core/pom.xml +++ b/org.eclipse.jdt.core/pom.xml @@ -17,7 +17,7 @@ 4.33.0-SNAPSHOT org.eclipse.jdt.core - 3.38.100-SNAPSHOT + 3.39.0-SNAPSHOT eclipse-plugin