### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java,v retrieving revision 1.115 diff -u -r1.115 ParameterizedTypeBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 20 Oct 2010 05:46:47 -0000 1.115 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 20 Oct 2010 09:46:44 -0000 @@ -15,7 +15,6 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ast.TypeReference; import org.eclipse.jdt.internal.compiler.ast.Wildcard; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; /** * A parameterized type encapsulates a type with type arguments, @@ -858,19 +857,28 @@ this.arguments[i] = resolveType; this.tagBits |= resolvedType.tagBits & TagBits.ContainsNestedTypeReferences; } - // arity check - TypeVariableBinding[] refTypeVariables = resolvedType.typeVariables(); - if (refTypeVariables == Binding.NO_TYPE_VARIABLES) { // check generic - // Below 1.5, we should have already complained about the use of type parameters. - boolean isCompliant15 = this.environment.globalOptions.originalSourceLevel >= ClassFileConstants.JDK1_5; - if (isCompliant15 && (resolvedType.tagBits & TagBits.HasMissingType) == 0) { - this.environment.problemReporter.nonGenericTypeCannotBeParameterized(0, null, resolvedType, this.arguments); - } - return this; - } else if (argLength != refTypeVariables.length) { // check arity - this.environment.problemReporter.incorrectArityForParameterizedType(null, resolvedType, this.arguments); - return this; // cannot reach here as AbortCompilation is thrown - } + /* https://bugs.eclipse.org/bugs/show_bug.cgi?id=186565, Removed generic check + and arity check since we are dealing with binary types here and the fact that + the compiler produced class files for these types at all is proof positive that + the generic check and the arity check passed in the build environment that produced + these class files. Otherwise we don't handle mixed 1.5 and 1.4 projects correctly. + Just as with bounds check below, incremental build will propagate the change and + detect problems in source. + */ + +// // arity check +// TypeVariableBinding[] refTypeVariables = resolvedType.typeVariables(); +// if (refTypeVariables == Binding.NO_TYPE_VARIABLES) { // check generic +// // Below 1.5, we should have already complained about the use of type parameters. +// boolean isCompliant15 = this.environment.globalOptions.originalSourceLevel >= ClassFileConstants.JDK1_5; +// if (isCompliant15 && (resolvedType.tagBits & TagBits.HasMissingType) == 0) { +// this.environment.problemReporter.nonGenericTypeCannotBeParameterized(0, null, resolvedType, this.arguments); +// } +// return this; +// } else if (argLength != refTypeVariables.length) { // check arity +// this.environment.problemReporter.incorrectArityForParameterizedType(null, resolvedType, this.arguments); +// return this; // cannot reach here as AbortCompilation is thrown +// } // check argument type compatibility... REMOVED for now since incremental build will propagate change & detect in source // for (int i = 0; i < argLength; i++) { // TypeBinding resolvedArgument = this.arguments[i]; #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v retrieving revision 1.215 diff -u -r1.215 BatchCompilerTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 6 Oct 2010 13:57:31 -0000 1.215 +++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 20 Oct 2010 09:46:53 -0000 @@ -11860,4 +11860,60 @@ System.setProperty("user.dir", javaUserDir); } } +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=186565 +public void test0308(){ + String outputDirName = OUTPUT_DIR + File.separator + "d", + metaInfDirName = outputDirName + File.separator + "META-INF", + jarFileName = outputDirName + File.separator + "classB15.jar"; + this.runConformTest( + new String[] { + "d/B.java", + "public class B extends A {\n" + + "}", + "d/A.java", + "public class A {\n" + + "}", + }, + "\"" + outputDirName + "\"" + + " -1.5 -g -preserveAllLocals" + + " -d \"" + outputDirName + "\"", + "", + "", + true /* flush output directory */); + File outputDirectory = new File(outputDirName); + File metaInfDirectory = new File(metaInfDirName); + metaInfDirectory.mkdirs(); + try { + Util.createFile(metaInfDirName + File.separator + "MANIFEST.MF", + "Manifest-Version: 1.0\n" + + "Class-Path: ../d/classB15.jar\n"); + } catch (IOException e) { + fail("could not create manifest file"); + } + Util.delete(outputDirName + File.separator + "A.class"); + Util.delete(outputDirName + File.separator + "A.java"); + try { + Util.zip(outputDirectory, jarFileName); + } catch (IOException e) { + fail("could not create jar file"); + } + Util.delete(outputDirName + File.separator + "B.class"); + Util.delete(outputDirName + File.separator + "B.java"); + this.runConformTest( + new String[] { + "d/A.java", + "public class A {\n" + + "}", + "d/C.java", + "public class C extends B {\n" + + "}", + }, + "\"" + outputDirName + "\"" + + " -1.5 -g -preserveAllLocals" + + " -cp \"" + jarFileName + "\"" + + " -d \"" + OUTPUT_DIR + "\"", + "", + "", + false /* do not flush output directory */); +} }