JDK-6286112 : Wildcard cast problem
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2005-06-15
  • Updated: 2010-04-02
  • Resolved: 2005-08-05
Related Reports
Duplicate :  
Description
This program should compile:

public class Test {
	public void saveA (AbstractClass<?> busObj) {
		// Error here
		ConcreteClass sqlA = (ConcreteClass) busObj;
	}
}
 
abstract class AbstractClass<B> {
	public abstract void doSomething (B b);
}
 
class ConcreteClass extends AbstractClass<String> {
	public void doSomething (String b) {
	}
}

See http://forum.java.sun.com/thread.jspa?threadID=636425&tstart=0

###@###.### 2005-06-15 18:03:19 GMT