Community
Participate
Working Groups
Compile this example: class Outer { void foo() { Comparable<String> c = (java.util.List)bar(5, 5.0); } <T> T bar(T t1, T t2) { return t1; } } produces this error: ---------- 1. ERROR in Y.java (at line 0) ^ Internal compiler error java.lang.ClassCastException: org.eclipse.jdt.internal.compiler.lookup.WildcardB inding at org.eclipse.jdt.internal.compiler.ast.Expression.checkCastTypesCompat ibility(Expression.java:328) at org.eclipse.jdt.internal.compiler.ast.CastExpression.resolveType(Cast Expression.java:382) at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalD eclaration.java:199) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resol veStatements(AbstractMethodDeclaration.java:415) at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatem ents(MethodDeclaration.java:171) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resol ve(AbstractMethodDeclaration.java:393) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDec laration.java:1063) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDec laration.java:1112) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.reso lve(CompilationUnitDeclaration.java:305) at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:504) at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:329) at org.eclipse.jdt.internal.compiler.batch.Main.performCompilation(Main. java:2652) at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1151) at org.eclipse.jdt.internal.compiler.batch.Main.main(Main.java:1056) ---------- 1 problem (1 error)
Added GenericTypeTest#test715.
Wildcards/intersection types were sharing type variable code for reaching upper bound through a cast. Fixed
Verified for 3.1 RC2 using build N20050607-0010 + JDT/Core HEAD
Verified for 3.1 RC2 using build I20050610-0010