JDK-6176479 : Problem inferring types with wildcards
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2004-10-08
  • Updated: 2010-04-02
  • Resolved: 2004-10-26
Related Reports
Duplicate :  
Relates :  
Description
Javac cannot compile this program:

import java.util.EventListener;
import javax.swing.event.EventListenerList;

class Test {
    void test(String name, EventListenerList list, EventListener l)
	throws ClassNotFoundException
    {
	list.add((Class<? extends EventListener>)Class.forName(name), l);
    }
}
###@###.### 10/8/04 21:39 GMT

Comments
EVALUATION This appears to be a general problem with inferring types when wildcards are involved. We should try to address this in an update release. ###@###.### 10/8/04 21:42 GMT I think I had shut down my brain. This is not a compiler bug. See 6184376. ###@###.### 10/26/04 06:07 GMT
08-10-2004