Project: JDT
Bug 92982 [1.5][compiler] Bounds and erasure of capture and type variable bindings
Reported: 2005-04-27 14:58:24 | Status: verified fixed

I20050426-1700 I'm a bit confused about bounds and erasure of capture, type variable and wildcard bindings. Consider this example: public class Try<T extends Collection> { void m() { List<? extends Collection> wild= null; Collection c= wild.get(0); List<T> var= null; Collection c2= var.get(0); } Calling ITypeBinding#getBounds() on the type bindings of expressions wild.get(0) and var.get(0) currently returns java.lang.Object as first bound of the capture / type variable bindings. => Why is the first bound not Collection (as in JLS3 / java.lang.reflect)? ITypeBinding#getErasure() says it "returns the binding for the erasure of the leftmost bound ...", but for the bindings from above, it returns Collection. => Javadoc and implementation not in sync.

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/typeconstraints/TypeEnvironmentTests.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/typeconstraints/types/AbstractTypeVariable.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/typeconstraints/types/CaptureType.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/typeconstraints/types/SuperWildcardType.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/typeconstraints/types/TType.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/typeconstraints/types/TypeEnvironment.java