### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java,v retrieving revision 1.230 diff -u -r1.230 CompilerOptions.java --- compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 25 Feb 2010 19:17:04 -0000 1.230 +++ compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 6 Sep 2010 15:22:00 -0000 @@ -258,8 +258,18 @@ public int produceDebugAttributes; /** Compliance level for the compiler, refers to a JDK version, e.g. {link {@link ClassFileConstants#JDK1_4} */ public long complianceLevel; + /** Compliance level for the compiler, refers to a JDK version, e.g. {link {@link ClassFileConstants#JDK1_4}, + * Usually same as the field complianceLevel, though the latter could deviate to create temporary sandbox + * modes. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=323633 + */ + public long originalComplianceLevel; /** Java source level, refers to a JDK version, e.g. {link {@link ClassFileConstants#JDK1_4} */ public long sourceLevel; + /** Java source level, refers to a JDK version, e.g. {link {@link ClassFileConstants#JDK1_4} + * Usually same as the field sourceLevel, though the latter could deviate to create temporary sandbox + * modes. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=323633 + * */ + public long originalSourceLevel; /** VM target level, refers to a JDK version, e.g. {link {@link ClassFileConstants#JDK1_4} */ public long targetJDK; /** Source encoding format */ @@ -953,8 +963,8 @@ // by default only lines and source attributes are generated. this.produceDebugAttributes = ClassFileConstants.ATTR_SOURCE | ClassFileConstants.ATTR_LINES; - this.complianceLevel = ClassFileConstants.JDK1_4; // by default be compliant with 1.4 - this.sourceLevel = ClassFileConstants.JDK1_3; //1.3 source behavior by default + 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.defaultEncoding = null; // will use the platform default encoding @@ -1117,11 +1127,11 @@ } if ((optionValue = optionsMap.get(OPTION_Compliance)) != null) { long level = versionToJdkLevel(optionValue); - if (level != 0) this.complianceLevel = level; + if (level != 0) this.complianceLevel = this.originalComplianceLevel = level; } if ((optionValue = optionsMap.get(OPTION_Source)) != null) { long level = versionToJdkLevel(optionValue); - if (level != 0) this.sourceLevel = level; + if (level != 0) this.sourceLevel = this.originalSourceLevel = level; } if ((optionValue = optionsMap.get(OPTION_TargetPlatform)) != null) { long level = versionToJdkLevel(optionValue); Index: compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java,v retrieving revision 1.123 diff -u -r1.123 BinaryTypeBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 21 Sep 2009 23:37:04 -0000 1.123 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 6 Sep 2010 15:22:04 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -149,7 +149,7 @@ this.fPackage = packageBinding; this.fileName = binaryType.getFileName(); - char[] typeSignature = environment.globalOptions.sourceLevel >= ClassFileConstants.JDK1_5 ? binaryType.getGenericSignature() : null; + char[] typeSignature = environment.globalOptions.originalSourceLevel >= ClassFileConstants.JDK1_5 ? binaryType.getGenericSignature() : null; this.typeVariables = typeSignature != null && typeSignature.length > 0 && typeSignature[0] == '<' ? null // is initialized in cachePartsFrom (called from LookupEnvironment.createBinaryTypeFrom())... must set to null so isGenericType() answers true : Binding.NO_TYPE_VARIABLES; @@ -260,7 +260,7 @@ } } - long sourceLevel = this.environment.globalOptions.sourceLevel; + long sourceLevel = this.environment.globalOptions.originalSourceLevel; char[] typeSignature = null; if (sourceLevel >= ClassFileConstants.JDK1_5) { typeSignature = binaryType.getGenericSignature(); @@ -558,7 +558,7 @@ if (iMethods != null) { total = initialTotal = iMethods.length; boolean keepBridgeMethods = sourceLevel < ClassFileConstants.JDK1_5 - && this.environment.globalOptions.complianceLevel >= ClassFileConstants.JDK1_5; + && this.environment.globalOptions.originalComplianceLevel >= ClassFileConstants.JDK1_5; for (int i = total; --i >= 0;) { IBinaryMethod method = iMethods[i]; if ((method.getModifiers() & ClassFileConstants.AccSynthetic) != 0) { Index: model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java,v retrieving revision 1.67 diff -u -r1.67 SourceTypeConverter.java --- model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java 29 Jul 2010 09:15:19 -0000 1.67 +++ model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java 6 Sep 2010 15:22:05 -0000 @@ -293,7 +293,9 @@ // convert 1.5 specific constructs only if compliance is 1.5 or above TypeParameter[] typeParams = null; - if (this.has1_5Compliance) { + // Digest type parameters if compliance level of current project or its prerequisite is 1.5 + // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=323633 && https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259 + if (this.has1_5Compliance || this.problemReporter.options.complianceLevel >= ClassFileConstants.JDK1_5) { /* convert type parameters */ char[][] typeParameterNames = methodInfo.getTypeParameterNames(); if (typeParameterNames != null) { @@ -462,7 +464,10 @@ if (this.has1_5Compliance) { /* convert annotations */ type.annotations = convertAnnotations(typeHandle); - + } + // Digest type parameters if compliance level of current project or its prerequisite is 1.5 + // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=323633 && https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259 + if (this.has1_5Compliance || this.problemReporter.options.complianceLevel >= ClassFileConstants.JDK1_5) { /* convert type parameters */ char[][] typeParameterNames = typeInfo.getTypeParameterNames(); if (typeParameterNames.length > 0) { Index: model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java,v retrieving revision 1.4 diff -u -r1.4 TypeConverter.java --- model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java 9 Sep 2008 14:53:17 -0000 1.4 +++ model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java 6 Sep 2010 15:22:05 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 2010 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 @@ -40,7 +40,7 @@ protected TypeConverter(ProblemReporter problemReporter, char memberTypeSeparator) { this.problemReporter = problemReporter; - this.has1_5Compliance = problemReporter.options.complianceLevel >= ClassFileConstants.JDK1_5; + this.has1_5Compliance = problemReporter.options.originalComplianceLevel >= ClassFileConstants.JDK1_5; this.memberTypeSeparator = memberTypeSeparator; }