List.class must be of type Class<List<?>> and (not) Class<List>

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Duplicate
    • Priority: P4
    • None
    • Affects Version/s: 6
    • Component/s: specification
    • x86
    • linux

      A DESCRIPTION OF THE REQUEST :
      Class literals should contain be parametrized with a wildcard. There should be an analogy between an array creation and a class literal:

      ArrayList<?> list=new ArrayList<?>[5];

      Class<ArrayList<?>> listClass=ArrayList.class;

      Software developers must go back to raw types when they want to use class literals. This feature must be enabled until generics work without erasure.


      JUSTIFICATION :
      When I want to implement this interface

      public interface Transformator<A,B> {
      Class<? extends A> inputProblem();
      Class<? extends B> outputProblem();
      }

      I can only do it now by

      public class Foo implements Transformator<List,Map>

      and not by

      public class Foo implements Transformator<List<?,Map<?,?>>

      which forces me to use raw types everywhere.

      It doesn't make sence that wildcard arrays are allowed and wildcard class literals not.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Class literals should be only, additionally or castable to a wildcarded type.
      ACTUAL -
      Class literals are of unparametrized types.

      CUSTOMER SUBMITTED WORKAROUND :
      No real workaround exists. Only a drawback: Working with raw types.

            Assignee:
            Unassigned
            Reporter:
            Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: