I suspect the multiple wildcards (?) in one type expression causing all that trouble.

probably an issue of the compiler and not of the language spec.

public class Test
{
  public static void main(String[] args)
  {
    bad(Derived.class); // ok
    bad(Base.class); // compile error
    good(Derived.class); // ok
    good(Base.class); // ok
  }

  public static void bad(Class<? extends Base<?>> clazz)
  { //                          ^^ two wildcards in one expression:
    //                             uh oh, calling for trouble!
  }

  public static <X extends Base<?>> void good(Class<X> clazz)
  {
    //
  }

  public static class Base<T>
  {
  }

  public static class Derived extends Base<Void>
  {
  }
}








Am 21.05.2008 um 10:38 schrieb Gerolf Seitz:

On Wed, May 21, 2008 at 10:30 AM, Johan Compagner <[EMAIL PROTECTED] >
wrote:

always strange that that works
If you just look at it then it seems to be the same thing :)


tbh, i would still like to get an explanation _why_ it works with
<S extends Component<?>> and not directly with <? extends Component<? >>.

 Gerolf

Reply via email to