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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java (-14 / +22 lines)
Lines 15-21 Link Here
15
import org.eclipse.jdt.core.compiler.CharOperation;
15
import org.eclipse.jdt.core.compiler.CharOperation;
16
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
16
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
17
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
17
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
18
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
19
18
20
/**
19
/**
21
 * A parameterized type encapsulates a type with type arguments,
20
 * A parameterized type encapsulates a type with type arguments,
Lines 858-876 Link Here
858
				this.arguments[i] = resolveType;
857
				this.arguments[i] = resolveType;
859
				this.tagBits |= resolvedType.tagBits & TagBits.ContainsNestedTypeReferences;
858
				this.tagBits |= resolvedType.tagBits & TagBits.ContainsNestedTypeReferences;
860
			}
859
			}
861
			// arity check
860
			/* https://bugs.eclipse.org/bugs/show_bug.cgi?id=186565, Removed generic check
862
			TypeVariableBinding[] refTypeVariables = resolvedType.typeVariables();
861
			   and arity check since we are dealing with binary types here and the fact that
863
			if (refTypeVariables == Binding.NO_TYPE_VARIABLES) { // check generic
862
			   the compiler produced class files for these types at all is proof positive that
864
				// Below 1.5, we should have already complained about the use of type parameters.
863
			   the generic check and the arity check passed in the build environment that produced
865
				boolean isCompliant15 = this.environment.globalOptions.originalSourceLevel >= ClassFileConstants.JDK1_5;
864
			   these class files. Otherwise we don't handle mixed 1.5 and 1.4 projects correctly.
866
				if (isCompliant15 && (resolvedType.tagBits & TagBits.HasMissingType) == 0) {
865
			   Just as with bounds check below, incremental build will propagate the change and
867
					this.environment.problemReporter.nonGenericTypeCannotBeParameterized(0, null, resolvedType, this.arguments);
866
			   detect problems in source.
868
				}
867
			 */
869
				return this;
868
			
870
			} else if (argLength != refTypeVariables.length) { // check arity
869
//			// arity check
871
				this.environment.problemReporter.incorrectArityForParameterizedType(null, resolvedType, this.arguments);
870
//			TypeVariableBinding[] refTypeVariables = resolvedType.typeVariables();
872
				return this; // cannot reach here as AbortCompilation is thrown
871
//			if (refTypeVariables == Binding.NO_TYPE_VARIABLES) { // check generic
873
			}
872
//				// Below 1.5, we should have already complained about the use of type parameters.
873
//				boolean isCompliant15 = this.environment.globalOptions.originalSourceLevel >= ClassFileConstants.JDK1_5;
874
//				if (isCompliant15 && (resolvedType.tagBits & TagBits.HasMissingType) == 0) {
875
//					this.environment.problemReporter.nonGenericTypeCannotBeParameterized(0, null, resolvedType, this.arguments);
876
//				}
877
//				return this;
878
//			} else if (argLength != refTypeVariables.length) { // check arity
879
//				this.environment.problemReporter.incorrectArityForParameterizedType(null, resolvedType, this.arguments);
880
//				return this; // cannot reach here as AbortCompilation is thrown
881
//			}
874
			// check argument type compatibility... REMOVED for now since incremental build will propagate change & detect in source
882
			// check argument type compatibility... REMOVED for now since incremental build will propagate change & detect in source
875
//			for (int i = 0; i < argLength; i++) {
883
//			for (int i = 0; i < argLength; i++) {
876
//			    TypeBinding resolvedArgument = this.arguments[i];
884
//			    TypeBinding resolvedArgument = this.arguments[i];
(-)src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (+56 lines)
Lines 11860-11863 Link Here
11860
		System.setProperty("user.dir", javaUserDir);
11860
		System.setProperty("user.dir", javaUserDir);
11861
	}
11861
	}
11862
}
11862
}
11863
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=186565
11864
public void test0308(){
11865
	String outputDirName = OUTPUT_DIR + File.separator + "d",
11866
	  metaInfDirName = outputDirName + File.separator + "META-INF",
11867
	  jarFileName = outputDirName + File.separator + "classB15.jar";
11868
	this.runConformTest(
11869
		new String[] {
11870
			"d/B.java",
11871
			"public class B<T> extends A<T> {\n" +
11872
			"}",
11873
			"d/A.java",
11874
			"public class A<T> {\n" +
11875
			"}",
11876
			},
11877
	    "\"" + outputDirName + "\""
11878
	    + " -1.5 -g -preserveAllLocals"
11879
	    + " -d \"" + outputDirName + "\"",
11880
		"",
11881
		"",
11882
		true /* flush output directory */);
11883
	File outputDirectory = new File(outputDirName);
11884
	File metaInfDirectory = new File(metaInfDirName);
11885
	metaInfDirectory.mkdirs();
11886
	try {
11887
		Util.createFile(metaInfDirName + File.separator + "MANIFEST.MF",
11888
			"Manifest-Version: 1.0\n" +
11889
			"Class-Path: ../d/classB15.jar\n");
11890
	} catch (IOException e) {
11891
		fail("could not create manifest file");
11892
	}
11893
	Util.delete(outputDirName + File.separator + "A.class");
11894
	Util.delete(outputDirName + File.separator + "A.java");
11895
	try {
11896
		Util.zip(outputDirectory, jarFileName);
11897
	} catch (IOException e) {
11898
		fail("could not create jar file");
11899
	}
11900
	Util.delete(outputDirName + File.separator + "B.class");
11901
	Util.delete(outputDirName + File.separator + "B.java");
11902
	this.runConformTest(
11903
		new String[] {
11904
			"d/A.java",
11905
			"public class A {\n" +
11906
			"}",
11907
			"d/C.java",
11908
			"public class C extends B<String> {\n" +
11909
			"}",
11910
			},
11911
	    "\"" + outputDirName + "\""
11912
	    + " -1.5 -g -preserveAllLocals"
11913
	    + " -cp \"" + jarFileName + "\""
11914
	    + " -d \"" + OUTPUT_DIR + "\"",
11915
		"",
11916
		"",
11917
		false /* do not flush output directory */);
11918
}
11863
}
11919
}

Return to bug 186565