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

Unboxing, arrays, and type variables doesn't work

XMLWordPrintable

    • b71
    • generic
    • generic
    • Verified

      public class Tester {
          public static <E extends Integer> void doit ( final E[] a ) {
      System.out.println ( a[0] / 4 ) ;
          }
          public static void main ( final String[] args ) {
      Tester.doit ( new Integer[] { 2 , 3 , 4 } ) ;
          }
      }

      Tester.java:3: cannot find symbol
      symbol : method intValue()
      location: bound of type variable E
              System.out.println ( a[0] / 4 ) ;
                                    ^
      Fatal Error: Unable to find method intValue

      ###@###.### 2005-03-15 02:24:25 GMT

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: