summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorSatyam Kandula2012-05-25 08:38:26 (EDT)
committer Jayaprakash Arthanareeswaran2012-06-12 06:39:14 (EDT)
commitbf7f7505c8fbaf610dcfc16c3f38ab20112ea07c (patch)
treefd3144ae024cdae0be4ad4aa50cfa835c6fe888d
parent59758b3ac964ea48fbbbf5d314c8ed8b19dc60bb (diff)
downloadeclipse.jdt.core-bf7f7505c8fbaf610dcfc16c3f38ab20112ea07c.zip
eclipse.jdt.core-bf7f7505c8fbaf610dcfc16c3f38ab20112ea07c.tar.gz
eclipse.jdt.core-bf7f7505c8fbaf610dcfc16c3f38ab20112ea07c.tar.bz2
Added support to enable Java 8 work
-rw-r--r--org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java8
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/RunCompletionParserTests.java17
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java18
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java38
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java40
-rw-r--r--org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java48
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java14
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java8
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java11
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java10
10 files changed, 197 insertions, 15 deletions
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 b5b6873..2f5a412 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
@@ -5,6 +5,10 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -192,6 +196,10 @@ public void addClassFolder(IPath projectPath, IPath classFolderPath, boolean isE
requiredComplianceFlag = AbstractCompilerTest.F_1_7;
compilerVersion = CompilerOptions.VERSION_1_7;
}
+ else if ("1.8".equals(compliance)) {
+ requiredComplianceFlag = AbstractCompilerTest.F_1_8;
+ compilerVersion = CompilerOptions.VERSION_1_8;
+ }
else if (!"1.4".equals(compliance) && !"1.3".equals(compliance)) {
throw new UnsupportedOperationException("Test framework doesn't support compliance level: " + compliance);
}
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 f07295e..9d90885 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
@@ -1,9 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
+ *
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
@@ -110,6 +114,17 @@ public class RunCompletionParserTests extends junit.framework.TestCase {
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);
+ // 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_8, tests_1_8));
+ }
return all;
}
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 44d8b3c..2146092 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
@@ -1,10 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -128,6 +132,18 @@ public static Test suite() {
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);
+ tests_1_8.add(ParserTest1_7.class);
+ // 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_8, tests_1_8));
+ }
return all;
}
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 dda5915..3f863ef 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
@@ -5,6 +5,10 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann - Contributions for
@@ -108,6 +112,17 @@ public static Test suite() {
ArrayList since_1_6 = new ArrayList();
since_1_6.add(StackMapAttributeTest.class);
since_1_6.add(Compliance_1_6.class);
+
+ ArrayList since_1_7 = new ArrayList();
+ since_1_7.add(AssignmentTest_1_7.class);
+ since_1_7.add(BinaryLiteralTest.class);
+ since_1_7.add(UnderscoresInLiteralsTest.class);
+ since_1_7.add(TryStatement17Test.class);
+ since_1_7.add(TryWithResourcesStatementTest.class);
+ since_1_7.add(GenericsRegressionTest_1_7.class);
+ since_1_7.add(PolymorphicSignatureTest.class);
+ since_1_7.add(Compliance_1_7.class);
+
// Build final test suite
TestSuite all = new TestSuite(TestAll.class.getName());
@@ -170,14 +185,7 @@ public static Test suite() {
tests_1_7.addAll(since_1_4);
tests_1_7.addAll(since_1_5);
tests_1_7.addAll(since_1_6);
- tests_1_7.add(AssignmentTest_1_7.class);
- tests_1_7.add(BinaryLiteralTest.class);
- tests_1_7.add(UnderscoresInLiteralsTest.class);
- tests_1_7.add(TryStatement17Test.class);
- tests_1_7.add(TryWithResourcesStatementTest.class);
- tests_1_7.add(GenericsRegressionTest_1_7.class);
- tests_1_7.add(PolymorphicSignatureTest.class);
- tests_1_7.add(Compliance_1_7.class);
+ tests_1_7.addAll(since_1_7);
// Reset forgotten subsets tests
TestCase.TESTS_PREFIX = null;
TestCase.TESTS_NAMES = null;
@@ -186,6 +194,20 @@ public static Test suite() {
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)standardTests.clone();
+ tests_1_8.addAll(since_1_4);
+ tests_1_8.addAll(since_1_5);
+ tests_1_8.addAll(since_1_6);
+ tests_1_8.addAll(since_1_7);
+ // 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_8, tests_1_8));
+ }
all.addTest(new TestSuite(Jsr14Test.class));
return all;
}
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 0678867..40e9d8b 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
@@ -1,9 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
+ *
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
@@ -36,6 +40,7 @@ public class AbstractCompilerTest extends TestCase {
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 boolean RUN_JAVAC = CompilerOptions.ENABLED.equals(System.getProperty("run.javac"));
private static final int UNINITIALIZED = -1;
@@ -74,6 +79,9 @@ public class AbstractCompilerTest extends TestCase {
if ((complianceLevels & AbstractCompilerTest.F_1_7) != 0) {
suite.addTest(buildUniqueComplianceTestSuite(evaluationTestClass, ClassFileConstants.JDK1_7));
}
+ if ((complianceLevels & AbstractCompilerTest.F_1_8) != 0) {
+ suite.addTest(buildUniqueComplianceTestSuite(evaluationTestClass, ClassFileConstants.JDK1_8));
+ }
}
/**
@@ -104,6 +112,9 @@ public class AbstractCompilerTest extends TestCase {
if ((complianceLevels & AbstractCompilerTest.F_1_7) != 0) {
suite.addTest(buildComplianceTestSuite(testClasses, setupClass, ClassFileConstants.JDK1_7));
}
+ if ((complianceLevels & AbstractCompilerTest.F_1_8) != 0) {
+ suite.addTest(buildComplianceTestSuite(testClasses, setupClass, ClassFileConstants.JDK1_8));
+ }
return suite;
}
@@ -215,6 +226,14 @@ public class AbstractCompilerTest extends TestCase {
suite.addTest(buildUniqueComplianceTestSuite(evaluationTestClass, ClassFileConstants.JDK1_7));
}
}
+ int level18 = complianceLevels & AbstractCompilerTest.F_1_8;
+ if (level18 != 0) {
+ if (level18 < minimalCompliance) {
+ System.err.println("Cannot run "+evaluationTestClass.getName()+" at compliance "+CompilerOptions.versionFromJdkLevel(ClassFileConstants.JDK1_8)+"!");
+ } else {
+ suite.addTest(buildUniqueComplianceTestSuite(evaluationTestClass, ClassFileConstants.JDK1_8));
+ }
+ }
return suite;
}
@@ -259,6 +278,9 @@ public class AbstractCompilerTest extends TestCase {
*/
public static long highestComplianceLevels() {
int complianceLevels = AbstractCompilerTest.getPossibleComplianceLevels();
+ if ((complianceLevels & AbstractCompilerTest.F_1_8) != 0) {
+ return ClassFileConstants.JDK1_8;
+ }
if ((complianceLevels & AbstractCompilerTest.F_1_7) != 0) {
return ClassFileConstants.JDK1_7;
}
@@ -291,6 +313,8 @@ public class AbstractCompilerTest extends TestCase {
possibleComplianceLevels = F_1_6;
} else if (CompilerOptions.VERSION_1_7.equals(compliance)) {
possibleComplianceLevels = F_1_7;
+ } else if (CompilerOptions.VERSION_1_8.equals(compliance)) {
+ possibleComplianceLevels = F_1_8;
} else {
System.out.println("Invalid compliance specified (" + compliance + ")");
System.out.print("Use one of ");
@@ -298,7 +322,8 @@ public class AbstractCompilerTest extends TestCase {
System.out.print(CompilerOptions.VERSION_1_4 + ", ");
System.out.print(CompilerOptions.VERSION_1_5 + ", ");
System.out.print(CompilerOptions.VERSION_1_6 + ", ");
- System.out.println(CompilerOptions.VERSION_1_7);
+ System.out.print(CompilerOptions.VERSION_1_7 + ", ");
+ System.out.println(CompilerOptions.VERSION_1_8);
System.out.println("Defaulting to all possible compliances");
}
}
@@ -325,6 +350,10 @@ public class AbstractCompilerTest extends TestCase {
if (canRun1_7) {
possibleComplianceLevels |= F_1_7;
}
+ boolean canRun1_8 = canRun1_7 && !CompilerOptions.VERSION_1_7.equals(specVersion);
+ if (canRun1_8) {
+ possibleComplianceLevels |= F_1_8;
+ }
} else if ("1.0".equals(specVersion)
|| CompilerOptions.VERSION_1_1.equals(specVersion)
|| CompilerOptions.VERSION_1_2.equals(specVersion)
@@ -337,6 +366,9 @@ public class AbstractCompilerTest extends TestCase {
possibleComplianceLevels |= F_1_6;
if (!CompilerOptions.VERSION_1_6.equals(specVersion)) {
possibleComplianceLevels |= F_1_7;
+ if (!CompilerOptions.VERSION_1_7.equals(specVersion)) {
+ possibleComplianceLevels |= F_1_8;
+ }
}
}
}
@@ -465,6 +497,10 @@ public class AbstractCompilerTest extends TestCase {
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) {
+ 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/batch/org/eclipse/jdt/internal/compiler/batch/Main.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
index 8fb5ce1..1de6ac3 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
@@ -5,6 +5,10 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Tom Tromey - Contribution for bug 125961
@@ -1650,6 +1654,8 @@ private boolean checkVMVersion(long minimalSupportedVersion) {
return ClassFileConstants.JDK1_6 >= minimalSupportedVersion;
case 51 : // 1.7
return ClassFileConstants.JDK1_7 >= minimalSupportedVersion;
+ case 52 : // 1.8
+ return ClassFileConstants.JDK1_8 >= minimalSupportedVersion;
}
// unknown version
return false;
@@ -2017,6 +2023,16 @@ public void configure(String[] argv) {
mode = DEFAULT;
continue;
}
+ if (currentArg.equals("-1.8") || currentArg.equals("-8") || currentArg.equals("-8.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (didSpecifyCompliance) {
+ throw new IllegalArgumentException(
+ this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$
+ }
+ didSpecifyCompliance = true;
+ this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8);
+ mode = DEFAULT;
+ continue;
+ }
if (currentArg.equals("-d")) { //$NON-NLS-1$
if (this.destinationPath != null) {
StringBuffer errorMessage = new StringBuffer();
@@ -4404,6 +4420,24 @@ protected void validateOptions(boolean didSpecifyCompliance) {
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)) {
+ 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 (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8);
+ }
+ } else {
+ this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8);
+ if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8);
+ }
}
} else if (this.didSpecifySource) {
Object version = this.options.get(CompilerOptions.OPTION_Source);
@@ -4420,12 +4454,19 @@ protected void validateOptions(boolean didSpecifyCompliance) {
} 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 (!didSpecifyCompliance) this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8);
+ if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8);
}
}
final Object sourceVersion = this.options.get(CompilerOptions.OPTION_Source);
final Object compliance = this.options.get(CompilerOptions.OPTION_Compliance);
- if (sourceVersion.equals(CompilerOptions.VERSION_1_7)
+ if (sourceVersion.equals(CompilerOptions.VERSION_1_8)
+ && CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_8) {
+ // compliance must be 1.8 if source is 1.8
+ throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_8)); //$NON-NLS-1$
+ } else if (sourceVersion.equals(CompilerOptions.VERSION_1_7)
&& CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_7) {
// compliance must be 1.7 if source is 1.7
throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_7)); //$NON-NLS-1$
@@ -4460,6 +4501,11 @@ protected void validateOptions(boolean didSpecifyCompliance) {
throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForCldcTarget", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$
}
} 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", (String) 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){
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
index 074dd56..b2b2f9c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
@@ -5,6 +5,10 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -253,6 +257,11 @@ public class ClassFile implements TypeConstants, TypeIds {
} else {
this.codeStream = new CodeStream(this);
}
+ if (this.targetJDK == ClassFileConstants.JDK1_8) {
+ //TODO JAVA8: Version number is not yet updated in the java8 beta...
+ //Remove this after it is upgraded
+ this.targetJDK = ClassFileConstants.JDK1_7;
+ }
initByteArrays();
}
@@ -4152,6 +4161,11 @@ public class ClassFile implements TypeConstants, TypeIds {
this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3
this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP;
}
+ if (this.targetJDK == ClassFileConstants.JDK1_8) {
+ //TODO JAVA8: Version number is not yet updated in the java8 beta...
+ //Remove this after it is upgraded
+ this.targetJDK = ClassFileConstants.JDK1_7;
+ }
this.bytes = null;
this.constantPool.reset();
this.codeStream.reset(this);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java
index a21b681..c9b520b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java
@@ -1,10 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -84,6 +88,7 @@ public interface ClassFileConstants {
int MAJOR_VERSION_1_5 = 49;
int MAJOR_VERSION_1_6 = 50;
int MAJOR_VERSION_1_7 = 51;
+ int MAJOR_VERSION_1_8 = 52; //TODO JAVA8: This probably needs to change
int MINOR_VERSION_0 = 0;
int MINOR_VERSION_1 = 1;
@@ -100,6 +105,7 @@ public interface ClassFileConstants {
long JDK1_5 = ((long)ClassFileConstants.MAJOR_VERSION_1_5 << 16) + ClassFileConstants.MINOR_VERSION_0;
long JDK1_6 = ((long)ClassFileConstants.MAJOR_VERSION_1_6 << 16) + ClassFileConstants.MINOR_VERSION_0;
long JDK1_7 = ((long)ClassFileConstants.MAJOR_VERSION_1_7 << 16) + ClassFileConstants.MINOR_VERSION_0;
+ long JDK1_8 = ((long)ClassFileConstants.MAJOR_VERSION_1_8 << 16) + ClassFileConstants.MINOR_VERSION_0;
/*
* cldc1.1 is 45.3, but we modify it to be different from JDK1_1.
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
index 1a2b75f..ce3a678 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
@@ -5,6 +5,10 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Benjamin Muskalla - Contribution for bug 239066
@@ -177,6 +181,7 @@ public class CompilerOptions {
public static final String VERSION_1_5 = "1.5"; //$NON-NLS-1$
public static final String VERSION_1_6 = "1.6"; //$NON-NLS-1$
public static final String VERSION_1_7 = "1.7"; //$NON-NLS-1$
+ public static final String VERSION_1_8 = "1.8"; //$NON-NLS-1$
public static final String ERROR = "error"; //$NON-NLS-1$
public static final String WARNING = "warning"; //$NON-NLS-1$
public static final String IGNORE = "ignore"; //$NON-NLS-1$
@@ -658,6 +663,10 @@ public class CompilerOptions {
if (jdkLevel == ClassFileConstants.JDK1_7)
return VERSION_1_7;
break;
+ case ClassFileConstants.MAJOR_VERSION_1_8 :
+ if (jdkLevel == ClassFileConstants.JDK1_8)
+ return VERSION_1_8;
+ break;
}
return Util.EMPTY_STRING; // unknown version
}
@@ -682,6 +691,8 @@ public class CompilerOptions {
return ClassFileConstants.JDK1_6;
case '7':
return ClassFileConstants.JDK1_7;
+ case '8':
+ return ClassFileConstants.JDK1_8;
default:
return 0; // unknown
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
index a7431ad..aa8e183 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
@@ -1,9 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
+ *
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
@@ -147,6 +151,8 @@ public interface JavadocTagConstants {
{},
// since 1.7
{},
+ // since 1.8
+ {}
};
public static final char[][][] INLINE_TAGS = {
// since 1.0
@@ -165,6 +171,8 @@ public interface JavadocTagConstants {
{},
// since 1.7
{},
+ // since 1.8
+ {}
};
public final static int INLINE_TAGS_LENGTH = INLINE_TAGS.length;
public final static int BLOCK_TAGS_LENGTH = BLOCK_TAGS.length;