Community
Participate
Working Groups
Consider the following code fragment: ArrayList<? super Integer> al = new ArrayList<Object>(); al.add(new Integer(1)); // (1) Integer i = al.get(0); // (2) (1) gives you a compiler error. This is not correct because the list al contains elements of an unknown type, but the type must be a superclass of Integer Therefore its completely legal to add an Integer (2) compiles, but is not legal. The list can contain any type, so a cast to Integer is not save! Using Eclipse 3.0M9 with Cheetah 0.0.6
Lower bound check was indeed not properly implemented. Now tolerates invocation of method/constructor when parameter type is a wildcard with lower bound (similar evolution for assignment). Also tuned the compatibility check for lower bounded wildcard to only use upper bound (i.e. variable) instead of considering bound. Added regression tests: GenericTypeTest#test220-222.
Fixed
Verified for 3.1 using build I20050627-1435.