Community
Participate
Working Groups
I200409140800 In the following code, I get 2 errors which I think are both wrong: void takeAbstract(AbstractList<? extends InetAddress> arg) { } void takeList(List<? extends InetAddress> arg) { } void construct() { AbstractList<InetAddress> a= new ArrayList<InetAddress>(); takeAbstract(a); takeAbstract(new ArrayList<InetAddress>()); // a inlined: error 1: //The method takeAbstract(AbstractList<? extends InetAddress>) in the type A // is not applicable for the arguments (ArrayList<InetAddress>) List<InetAddress> l= new ArrayList<InetAddress>(); takeList(l); takeList(new ArrayList<InetAddress>()); // l inlined: ok ArrayList<? extends InetAddress> aw= new ArrayList<InetAddress>(); takeAbstract(aw); takeAbstract(new ArrayList<Inet6Address>()); // aw inlined: error 2: //The method takeAbstract(AbstractList<? extends InetAddress>) in the type A // is not applicable for the arguments (ArrayList<Inet6Address>) takeList(aw); takeList(new ArrayList<Inet6Address>()); //aw inlined: ok }
Should consider changing ReferenceBinding.isSuperclassOf() to: public boolean isSuperclassOf(ReferenceBinding otherType) { while ((otherType = otherType.superclass()) != null) { if (otherType.isEquivalentTo(this)) return true; } return false; } This maintains the order of receiver vs. otherType for calls to isEquivalentTo (). We pass all of our GenericTypeTests with this change.
Indeed this fixes the problem. Added regression GenericTypeTest#test313. Fixed
*** Bug 76729 has been marked as a duplicate of this bug. ***
*** Bug 77078 has been marked as a duplicate of this bug. ***
Verified for 3.1M3 with build I200411040100