View | Details | Raw Unified | Return to bug 323633 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java (-4 / +14 lines)
Lines 258-265 Link Here
258
	public int produceDebugAttributes; 
258
	public int produceDebugAttributes; 
259
	/** Compliance level for the compiler, refers to a JDK version, e.g. {link {@link ClassFileConstants#JDK1_4} */
259
	/** Compliance level for the compiler, refers to a JDK version, e.g. {link {@link ClassFileConstants#JDK1_4} */
260
	public long complianceLevel;
260
	public long complianceLevel;
261
	/** Compliance level for the compiler, refers to a JDK version, e.g. {link {@link ClassFileConstants#JDK1_4},
262
	 *  Usually same as the field complianceLevel, though the latter could deviate to create temporary sandbox
263
	 *  modes. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=323633
264
	 */
265
	public long originalComplianceLevel;
261
	/** Java source level, refers to a JDK version, e.g. {link {@link ClassFileConstants#JDK1_4} */
266
	/** Java source level, refers to a JDK version, e.g. {link {@link ClassFileConstants#JDK1_4} */
262
	public long sourceLevel;
267
	public long sourceLevel;
268
	/** Java source level, refers to a JDK version, e.g. {link {@link ClassFileConstants#JDK1_4} 
269
	 *  Usually same as the field sourceLevel, though the latter could deviate to create temporary sandbox
270
	 *  modes. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=323633
271
	 * */
272
	public long originalSourceLevel;
263
	/** VM target level, refers to a JDK version, e.g. {link {@link ClassFileConstants#JDK1_4} */
273
	/** VM target level, refers to a JDK version, e.g. {link {@link ClassFileConstants#JDK1_4} */
264
	public long targetJDK;
274
	public long targetJDK;
265
	/** Source encoding format */
275
	/** Source encoding format */
Lines 953-960 Link Here
953
		
963
		
954
		// by default only lines and source attributes are generated.
964
		// by default only lines and source attributes are generated.
955
		this.produceDebugAttributes = ClassFileConstants.ATTR_SOURCE | ClassFileConstants.ATTR_LINES;
965
		this.produceDebugAttributes = ClassFileConstants.ATTR_SOURCE | ClassFileConstants.ATTR_LINES;
956
		this.complianceLevel = ClassFileConstants.JDK1_4; // by default be compliant with 1.4
966
		this.complianceLevel = this.originalComplianceLevel = ClassFileConstants.JDK1_4; // by default be compliant with 1.4
957
		this.sourceLevel = ClassFileConstants.JDK1_3; //1.3 source behavior by default
967
		this.sourceLevel = this.originalSourceLevel = ClassFileConstants.JDK1_3; //1.3 source behavior by default
958
		this.targetJDK = ClassFileConstants.JDK1_2; // default generates for JVM1.2
968
		this.targetJDK = ClassFileConstants.JDK1_2; // default generates for JVM1.2
959
969
960
		this.defaultEncoding = null; // will use the platform default encoding
970
		this.defaultEncoding = null; // will use the platform default encoding
Lines 1117-1127 Link Here
1117
		}
1127
		}
1118
		if ((optionValue = optionsMap.get(OPTION_Compliance)) != null) {
1128
		if ((optionValue = optionsMap.get(OPTION_Compliance)) != null) {
1119
			long level = versionToJdkLevel(optionValue);
1129
			long level = versionToJdkLevel(optionValue);
1120
			if (level != 0) this.complianceLevel = level;
1130
			if (level != 0) this.complianceLevel = this.originalComplianceLevel = level;
1121
		}
1131
		}
1122
		if ((optionValue = optionsMap.get(OPTION_Source)) != null) {
1132
		if ((optionValue = optionsMap.get(OPTION_Source)) != null) {
1123
			long level = versionToJdkLevel(optionValue);
1133
			long level = versionToJdkLevel(optionValue);
1124
			if (level != 0) this.sourceLevel = level;
1134
			if (level != 0) this.sourceLevel = this.originalSourceLevel = level;
1125
		}
1135
		}
1126
		if ((optionValue = optionsMap.get(OPTION_TargetPlatform)) != null) {
1136
		if ((optionValue = optionsMap.get(OPTION_TargetPlatform)) != null) {
1127
			long level = versionToJdkLevel(optionValue);
1137
			long level = versionToJdkLevel(optionValue);
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java (-4 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 149-155 Link Here
149
	this.fPackage = packageBinding;
149
	this.fPackage = packageBinding;
150
	this.fileName = binaryType.getFileName();
150
	this.fileName = binaryType.getFileName();
151
151
152
	char[] typeSignature = environment.globalOptions.sourceLevel >= ClassFileConstants.JDK1_5 ? binaryType.getGenericSignature() : null;
152
	char[] typeSignature = environment.globalOptions.originalSourceLevel >= ClassFileConstants.JDK1_5 ? binaryType.getGenericSignature() : null;
153
	this.typeVariables = typeSignature != null && typeSignature.length > 0 && typeSignature[0] == '<'
153
	this.typeVariables = typeSignature != null && typeSignature.length > 0 && typeSignature[0] == '<'
154
		? null // is initialized in cachePartsFrom (called from LookupEnvironment.createBinaryTypeFrom())... must set to null so isGenericType() answers true
154
		? null // is initialized in cachePartsFrom (called from LookupEnvironment.createBinaryTypeFrom())... must set to null so isGenericType() answers true
155
		: Binding.NO_TYPE_VARIABLES;
155
		: Binding.NO_TYPE_VARIABLES;
Lines 260-266 Link Here
260
			}
260
			}
261
		}
261
		}
262
262
263
		long sourceLevel = this.environment.globalOptions.sourceLevel;
263
		long sourceLevel = this.environment.globalOptions.originalSourceLevel;
264
		char[] typeSignature = null;
264
		char[] typeSignature = null;
265
		if (sourceLevel >= ClassFileConstants.JDK1_5) {
265
		if (sourceLevel >= ClassFileConstants.JDK1_5) {
266
			typeSignature = binaryType.getGenericSignature();
266
			typeSignature = binaryType.getGenericSignature();
Lines 558-564 Link Here
558
	if (iMethods != null) {
558
	if (iMethods != null) {
559
		total = initialTotal = iMethods.length;
559
		total = initialTotal = iMethods.length;
560
		boolean keepBridgeMethods = sourceLevel < ClassFileConstants.JDK1_5
560
		boolean keepBridgeMethods = sourceLevel < ClassFileConstants.JDK1_5
561
			&& this.environment.globalOptions.complianceLevel >= ClassFileConstants.JDK1_5;
561
			&& this.environment.globalOptions.originalComplianceLevel >= ClassFileConstants.JDK1_5;
562
		for (int i = total; --i >= 0;) {
562
		for (int i = total; --i >= 0;) {
563
			IBinaryMethod method = iMethods[i];
563
			IBinaryMethod method = iMethods[i];
564
			if ((method.getModifiers() & ClassFileConstants.AccSynthetic) != 0) {
564
			if ((method.getModifiers() & ClassFileConstants.AccSynthetic) != 0) {
(-)model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java (-2 / +7 lines)
Lines 293-299 Link Here
293
293
294
		// convert 1.5 specific constructs only if compliance is 1.5 or above
294
		// convert 1.5 specific constructs only if compliance is 1.5 or above
295
		TypeParameter[] typeParams = null;
295
		TypeParameter[] typeParams = null;
296
		if (this.has1_5Compliance) {
296
		// Digest type parameters if compliance level of current project or its prerequisite is 1.5
297
		// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=323633 && https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259
298
		if (this.has1_5Compliance || this.problemReporter.options.complianceLevel >= ClassFileConstants.JDK1_5) {
297
			/* convert type parameters */
299
			/* convert type parameters */
298
			char[][] typeParameterNames = methodInfo.getTypeParameterNames();
300
			char[][] typeParameterNames = methodInfo.getTypeParameterNames();
299
			if (typeParameterNames != null) {
301
			if (typeParameterNames != null) {
Lines 462-468 Link Here
462
		if (this.has1_5Compliance) {
464
		if (this.has1_5Compliance) {
463
			/* convert annotations */
465
			/* convert annotations */
464
			type.annotations = convertAnnotations(typeHandle);
466
			type.annotations = convertAnnotations(typeHandle);
465
467
		}
468
		// Digest type parameters if compliance level of current project or its prerequisite is 1.5
469
		// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=323633 && https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259
470
		if (this.has1_5Compliance || this.problemReporter.options.complianceLevel >= ClassFileConstants.JDK1_5) {
466
			/* convert type parameters */
471
			/* convert type parameters */
467
			char[][] typeParameterNames = typeInfo.getTypeParameterNames();
472
			char[][] typeParameterNames = typeInfo.getTypeParameterNames();
468
			if (typeParameterNames.length > 0) {
473
			if (typeParameterNames.length > 0) {
(-)model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
2
 * Copyright (c) 2008, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 40-46 Link Here
40
40
41
	protected TypeConverter(ProblemReporter problemReporter, char memberTypeSeparator) {
41
	protected TypeConverter(ProblemReporter problemReporter, char memberTypeSeparator) {
42
		this.problemReporter = problemReporter;
42
		this.problemReporter = problemReporter;
43
		this.has1_5Compliance = problemReporter.options.complianceLevel >= ClassFileConstants.JDK1_5;
43
		this.has1_5Compliance = problemReporter.options.originalComplianceLevel >= ClassFileConstants.JDK1_5;
44
		this.memberTypeSeparator = memberTypeSeparator;
44
		this.memberTypeSeparator = memberTypeSeparator;
45
	}
45
	}
46
46

Return to bug 323633