### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/core/JavaCore.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v retrieving revision 1.556 diff -u -r1.556 JavaCore.java --- model/org/eclipse/jdt/core/JavaCore.java 23 Nov 2006 17:27:18 -0000 1.556 +++ model/org/eclipse/jdt/core/JavaCore.java 27 Nov 2006 19:26:37 -0000 @@ -103,6 +103,8 @@ import org.eclipse.jdt.core.search.SearchEngine; import org.eclipse.jdt.core.search.SearchPattern; import org.eclipse.jdt.core.search.TypeNameRequestor; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.util.SuffixConstants; import org.eclipse.jdt.internal.core.*; import org.eclipse.jdt.internal.core.builder.JavaBuilder; @@ -998,6 +1000,12 @@ /** * Possible configurable option value. * @see #getDefaultOptions() + * @since 3.3 + */ + public static final String VERSION_1_7 = "1.7"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions() * @since 2.0 */ public static final String ABORT = "abort"; //$NON-NLS-1$ @@ -1738,7 +1746,7 @@ * Select the compliance level for the compiler. In "1.3" mode, source and target settings * should not go beyond "1.3" level. * - option id: "org.eclipse.jdt.core.compiler.compliance" - * - possible values: { "1.3", "1.4", "1.5", "1.6" } + * - possible values: { "1.3", "1.4", "1.5", "1.6", "1.7" } * - default: "1.4" * * COMPILER / Setting Source Compatibility Mode @@ -1750,16 +1758,19 @@ * and the compliance mode should be "1.5". * Source level 1.6 is necessary to enable the computation of stack map tables. Once toggled, the target * VM level should be set to "1.6" and the compliance mode should be "1.6". + * Once the source level 1.7 is toggled, the target VM level should be set to "1.7" and the compliance mode + * should be "1.7". * - option id: "org.eclipse.jdt.core.compiler.source" - * - possible values: { "1.3", "1.4", "1.5", "1.6" } + * - possible values: { "1.3", "1.4", "1.5", "1.6", "1.7" } * - default: "1.3" * * COMPILER / Defining Target Java Platform * For binary compatibility reason, .class files can be tagged to with certain VM versions and later. * Note that "1.4" target requires to toggle compliance mode to "1.4", "1.5" target requires - * to toggle compliance mode to "1.5" and "1.6" target requires to toggle compliance mode to "1.6". + * to toggle compliance mode to "1.5", "1.6" target requires to toggle compliance mode to "1.6" and + * "1.7" target requires to toggle compliance mode to "1.7". * - option id: "org.eclipse.jdt.core.compiler.codegen.targetPlatform" - * - possible values: { "1.1", "1.2", "1.3", "1.4", "1.5", "1.6" } + * - possible values: { "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7" } * - default: "1.2" * * COMPILER / Generating Local Variable Debug Attribute @@ -4204,15 +4215,78 @@ } /** - * Sets the current table of options. All and only the options explicitly included in the given table - * are remembered; all previous option settings are forgotten, including ones not explicitly - * mentioned. - *
- * For a complete description of the configurable options, see getDefaultOptions
.
+ * Sets the default's compiler options inside the given options map according
+ * to the given compliance.
+ *
+ *
The given compliance must be one of the compliance supported by the compiler. + * Check {@link #getDefaultOptions()} for a list of compliance values.
+ * + *The list of modified options is:
+ *If the given compliance is unknown, the given map is unmodified.
+ * + * @param compliance the given compliance + * @param options the given options map + */ + public static void setCompilanceOptions(String compliance, Map options) { + switch((int) (CompilerOptions.versionToJdkLevel(compliance) >>> 16)) { + case ClassFileConstants.MAJOR_VERSION_1_3: + options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_3); + options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); + options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_1); + options.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.IGNORE); + options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.IGNORE); + break; + case ClassFileConstants.MAJOR_VERSION_1_4: + options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); + options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); + options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2); + options.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.WARNING); + options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.WARNING); + break; + case ClassFileConstants.MAJOR_VERSION_1_5: + options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); + options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); + options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5); + options.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR); + options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR); + break; + case ClassFileConstants.MAJOR_VERSION_1_6: + options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_6); + options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_6); + options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_6); + options.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR); + options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR); + break; + case ClassFileConstants.MAJOR_VERSION_1_7: + options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_7); + options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_7); + options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_7); + options.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR); + options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR); + } + } + + /** + * Sets the current table of options. All and only the options explicitly + * included in the given table are remembered; all previous option settings + * are forgotten, including ones not explicitly mentioned. + *
+ * For a complete description of the configurable options, see
+ * getDefaultOptions
.
*
String
; value type: String
),
- * or null
to reset all options to their default values
+ * @param newOptions
+ * the new options (key type: String
; value type:
+ * String
), or null
to reset all
+ * options to their default values
* @see JavaCore#getDefaultOptions()
* @see JavaCorePreferenceInitializer for changing default settings
*/
Index: buildnotes_jdt-core.html
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/buildnotes_jdt-core.html,v
retrieving revision 1.5582
diff -u -r1.5582 buildnotes_jdt-core.html
--- buildnotes_jdt-core.html 27 Nov 2006 16:34:11 -0000 1.5582
+++ buildnotes_jdt-core.html 27 Nov 2006 19:26:36 -0000
@@ -51,6 +51,11 @@
(cvs).
org.eclipse.jdt.core.JavaCore#VERSION_1_7
. It can be used to set the compliance, the source or the
+target platform values. This has no impact right now beside setting the major version inside .class file to
+org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants#MAJOR_VERSION_1_7
.org.eclipse.jdt.core.JavaCore#setCompilanceOptions(String, Map)
to set the compiler's
+options relative to a given compiler's compliance.