Date: Sat, 14 Jun 2003 18:55:24 -0400 (EDT)
From: C. Scott Ananian
To: jsr14-prototype-comments@sun.com
Subject: Regression: parameterizing library routines breaks compilation of
    existing nongeneric code.

If a constructor:
  C(List l, Comparator c)
is genericized to:
  C(List<Integer> l, Comparator<Integer> c)
then existing invocations of the form:
  Comparator cc = ...;
  new C(Arrays.asList(new Integer[0]), cc)
fail to compile.  These cases did not use to fail with the 1.3 compiler.
They do with both the variance and novariance versions of the 2.0
compiler.  See the attached file 'sunbug2.tgz' for more details.

A superficially related bug has been reported on the GJ forums:
   http://forum.java.sun.com/thread.jsp?forum=316&thread=409901
involving this code, which fails to compile with the GJ compiler:
  public class Test {
    public static void main(String[] args) {
      Class c = true ? Boolean.class : Object.class;
    }
  }
In this case, it is the conditional operator, rather than constructor
invocation which is at fault.  The underlying failure to implicitly cast
to the raw type seems to be similar.
 --scott

Waco, Texas blowfish East Timor AES FSF for Dummies supercomputer 
ammunition Sugar Grove immediate Philadelphia quiche Moscow smuggle 
                         ( http://cscott.net/ )

    [ Part 2, "Test case"  Application/OCTET-STREAM (Name: "sunbug2.tgz")  ]
    [ 1.5KB. ]

Valid XHTML 1.0!