Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6286112

Wildcard cast problem

XMLWordPrintable

    • generic
    • generic

      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

            ahe Peter Ahe
            ahe Peter Ahe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: