View | Details | Raw Unified | Return to bug 111222
Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java (+2 lines)
Lines 43-48 Link Here
43
	int MAJOR_VERSION_1_3 = 47;
43
	int MAJOR_VERSION_1_3 = 47;
44
	int MAJOR_VERSION_1_4 = 48;
44
	int MAJOR_VERSION_1_4 = 48;
45
	int MAJOR_VERSION_1_5 = 49; 
45
	int MAJOR_VERSION_1_5 = 49; 
46
	int MAJOR_VERSION_1_6 = 50; 
46
	
47
	
47
	int MINOR_VERSION_0 = 0;
48
	int MINOR_VERSION_0 = 0;
48
	int MINOR_VERSION_1 = 1;
49
	int MINOR_VERSION_1 = 1;
Lines 56-61 Link Here
56
	long JDK1_3 =  ((long)ClassFileConstants.MAJOR_VERSION_1_3 << 16) + ClassFileConstants.MINOR_VERSION_0;
57
	long JDK1_3 =  ((long)ClassFileConstants.MAJOR_VERSION_1_3 << 16) + ClassFileConstants.MINOR_VERSION_0;
57
	long JDK1_4 = ((long)ClassFileConstants.MAJOR_VERSION_1_4 << 16) + ClassFileConstants.MINOR_VERSION_0;
58
	long JDK1_4 = ((long)ClassFileConstants.MAJOR_VERSION_1_4 << 16) + ClassFileConstants.MINOR_VERSION_0;
58
	long JDK1_5 = ((long)ClassFileConstants.MAJOR_VERSION_1_5 << 16) + ClassFileConstants.MINOR_VERSION_0;	
59
	long JDK1_5 = ((long)ClassFileConstants.MAJOR_VERSION_1_5 << 16) + ClassFileConstants.MINOR_VERSION_0;	
60
	long JDK1_6 = ((long)ClassFileConstants.MAJOR_VERSION_1_6 << 16) + ClassFileConstants.MINOR_VERSION_0;	
59
	
61
	
60
	// jdk level used to denote future releases: optional behavior is not enabled for now, but may become so. In order to enable these,
62
	// jdk level used to denote future releases: optional behavior is not enabled for now, but may become so. In order to enable these,
61
	// search for references to this constant, and change it to one of the official JDT constants above.
63
	// search for references to this constant, and change it to one of the official JDT constants above.
(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (-7 / +49 lines)
Lines 1406-1412 Link Here
1406
				this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
1406
				this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
1407
				mode = Default;
1407
				mode = Default;
1408
				continue;
1408
				continue;
1409
			}			
1409
			}
1410
			if (currentArg.equals("-1.6") || currentArg.equals("-6") || currentArg.equals("-6.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1411
				if (didSpecifyCompliance) {
1412
					throw new InvalidInputException(
1413
						Main.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$
1414
				}
1415
				didSpecifyCompliance = true;
1416
				this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_6);
1417
				mode = Default;
1418
				continue;
1419
			}
1410
			if (currentArg.equals("-d")) { //$NON-NLS-1$
1420
			if (currentArg.equals("-d")) { //$NON-NLS-1$
1411
				if (this.destinationPath != null)
1421
				if (this.destinationPath != null)
1412
					throw new InvalidInputException(
1422
					throw new InvalidInputException(
Lines 1978-1983 Link Here
1978
						throw new InvalidInputException(Main.bind("configure.incompatibleComplianceForTarget", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_5)); //$NON-NLS-1$
1988
						throw new InvalidInputException(Main.bind("configure.incompatibleComplianceForTarget", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_5)); //$NON-NLS-1$
1979
					}
1989
					}
1980
					this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
1990
					this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
1991
				} else if (currentArg.equals("1.6") || currentArg.equals("6") || currentArg.equals("6.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
1992
					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6);
1993
					if (didSpecifyCompliance && CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_Compliance)) < ClassFileConstants.JDK1_6) {
1994
						throw new InvalidInputException(Main.bind("configure.incompatibleComplianceForTarget", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_6)); //$NON-NLS-1$
1995
					}
1996
					this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_6);
1981
				} else {
1997
				} else {
1982
					throw new InvalidInputException(Main.bind("configure.targetJDK", currentArg)); //$NON-NLS-1$
1998
					throw new InvalidInputException(Main.bind("configure.targetJDK", currentArg)); //$NON-NLS-1$
1983
				}
1999
				}
Lines 2026-2031 Link Here
2026
					this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
2042
					this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
2027
				} else if (currentArg.equals("1.5") || currentArg.equals("5") || currentArg.equals("5.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
2043
				} else if (currentArg.equals("1.5") || currentArg.equals("5") || currentArg.equals("5.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
2028
					this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
2044
					this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
2045
				} else if (currentArg.equals("1.6") || currentArg.equals("6") || currentArg.equals("6.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
2046
					this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6);
2029
				} else {
2047
				} else {
2030
					throw new InvalidInputException(Main.bind("configure.source", currentArg)); //$NON-NLS-1$
2048
					throw new InvalidInputException(Main.bind("configure.source", currentArg)); //$NON-NLS-1$
2031
				}
2049
				}
Lines 2366-2371 Link Here
2366
			} else if (CompilerOptions.VERSION_1_5.equals(version)) {
2384
			} else if (CompilerOptions.VERSION_1_5.equals(version)) {
2367
				if (!didSpecifySource) this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
2385
				if (!didSpecifySource) this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
2368
				if (!didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
2386
				if (!didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
2387
			} else if (CompilerOptions.VERSION_1_6.equals(version)) {
2388
				if (!didSpecifySource) this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6);
2389
				if (!didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6);
2369
			}
2390
			}
2370
		}
2391
		}
2371
		if (didSpecifySource) {
2392
		if (didSpecifySource) {
Lines 2376-2386 Link Here
2376
			} else if (CompilerOptions.VERSION_1_5.equals(version)) {
2397
			} else if (CompilerOptions.VERSION_1_5.equals(version)) {
2377
				if (!didSpecifyCompliance) this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
2398
				if (!didSpecifyCompliance) this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
2378
				if (!didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
2399
				if (!didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
2400
			} else if (CompilerOptions.VERSION_1_6.equals(version)) {
2401
				if (!didSpecifyCompliance) this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_6);
2402
				if (!didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6);
2379
			}
2403
			}
2380
		}
2404
		}
2381
2405
2382
		// check and set compliance/source/target compatibilities
2406
		// check and set compliance/source/target compatibilities
2383
		if (didSpecifyTarget) {
2407
		if (didSpecifyTarget) {
2408
			// target must be 1.6 if source is 1.6
2409
			if (CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_Source)) >= ClassFileConstants.JDK1_6
2410
					&& CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_TargetPlatform)) < ClassFileConstants.JDK1_6){ 
2411
				throw new InvalidInputException(Main.bind("configure.incompatibleTargetForSource", (String)this.options.get(CompilerOptions.OPTION_TargetPlatform), CompilerOptions.VERSION_1_6)); //$NON-NLS-1$
2412
			}
2384
			// target must be 1.5 if source is 1.5
2413
			// target must be 1.5 if source is 1.5
2385
			if (CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_Source)) >= ClassFileConstants.JDK1_5
2414
			if (CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_Source)) >= ClassFileConstants.JDK1_5
2386
					&& CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_TargetPlatform)) < ClassFileConstants.JDK1_5){ 
2415
					&& CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_TargetPlatform)) < ClassFileConstants.JDK1_5){ 
Lines 2397-2411 Link Here
2397
			}
2426
			}
2398
		}
2427
		}
2399
2428
2400
		// compliance must be 1.5 if source is 1.5
2429
		if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_6)
2401
		if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_5)
2430
				&& CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_Compliance)) < ClassFileConstants.JDK1_6) {
2431
			// compliance must be 1.6 if source is 1.6
2432
			throw new InvalidInputException(Main.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_6)); //$NON-NLS-1$
2433
		} else if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_5)
2402
				&& CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_Compliance)) < ClassFileConstants.JDK1_5) {
2434
				&& CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_Compliance)) < ClassFileConstants.JDK1_5) {
2435
			// compliance must be 1.5 if source is 1.5
2403
			throw new InvalidInputException(Main.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_5)); //$NON-NLS-1$
2436
			throw new InvalidInputException(Main.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_5)); //$NON-NLS-1$
2404
		} else 
2437
		} else if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_4)
2438
				&& CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_Compliance)) < ClassFileConstants.JDK1_4) {
2405
			// compliance must be 1.4 if source is 1.4
2439
			// compliance must be 1.4 if source is 1.4
2406
			if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_4)
2440
			throw new InvalidInputException(Main.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_4)); //$NON-NLS-1$
2407
					&& CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_Compliance)) < ClassFileConstants.JDK1_4) { 
2408
				throw new InvalidInputException(Main.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_4)); //$NON-NLS-1$
2409
		}
2441
		}
2410
		// set default target according to compliance & sourcelevel.
2442
		// set default target according to compliance & sourcelevel.
2411
		if (!didSpecifyTarget) {
2443
		if (!didSpecifyTarget) {
Lines 2425-2430 Link Here
2425
				} else if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_5)) {
2457
				} else if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_5)) {
2426
					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
2458
					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
2427
				}
2459
				}
2460
			} else if (this.options.get(CompilerOptions.OPTION_Compliance).equals(CompilerOptions.VERSION_1_6)) {
2461
				if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_3)) {
2462
					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_2);
2463
				} else if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_4)) {
2464
					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4);
2465
				} else if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_5)) {
2466
					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
2467
				} else if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_6)) {
2468
					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6);
2469
				}
2428
			}
2470
			}
2429
		}
2471
		}
2430
		this.logger.logCommandLineArguments(newCommandLineArgs);
2472
		this.logger.logCommandLineArguments(newCommandLineArgs);
(-)model/org/eclipse/jdt/core/JavaCore.java (+6 lines)
Lines 899-904 Link Here
899
	/**
899
	/**
900
	 * Possible  configurable option value.
900
	 * Possible  configurable option value.
901
	 * @see #getDefaultOptions()
901
	 * @see #getDefaultOptions()
902
	 * @since 3.2
903
	 */
904
	public static final String VERSION_1_6 = "1.6"; //$NON-NLS-1$
905
	/**
906
	 * Possible  configurable option value.
907
	 * @see #getDefaultOptions()
902
	 * @since 2.0
908
	 * @since 2.0
903
	 */
909
	 */
904
	public static final String ABORT = "abort"; //$NON-NLS-1$
910
	public static final String ABORT = "abort"; //$NON-NLS-1$
(-)compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java (+1 lines)
Lines 123-128 Link Here
123
	public static final String VERSION_1_3 = "1.3"; //$NON-NLS-1$
123
	public static final String VERSION_1_3 = "1.3"; //$NON-NLS-1$
124
	public static final String VERSION_1_4 = "1.4"; //$NON-NLS-1$
124
	public static final String VERSION_1_4 = "1.4"; //$NON-NLS-1$
125
	public static final String VERSION_1_5 = "1.5"; //$NON-NLS-1$
125
	public static final String VERSION_1_5 = "1.5"; //$NON-NLS-1$
126
	public static final String VERSION_1_6 = "1.6"; //$NON-NLS-1$	
126
	public static final String ERROR = "error"; //$NON-NLS-1$
127
	public static final String ERROR = "error"; //$NON-NLS-1$
127
	public static final String WARNING = "warning"; //$NON-NLS-1$
128
	public static final String WARNING = "warning"; //$NON-NLS-1$
128
	public static final String IGNORE = "ignore"; //$NON-NLS-1$
129
	public static final String IGNORE = "ignore"; //$NON-NLS-1$

Return to bug 111222