javac failure
Dr Andrew John Hughes
ahughes at redhat.com
Fri Sep 10 09:58:42 PDT 2010
When running the attached test case (thanks to Deepak Bhole) through javac, we found it fails with:
Test.java:14: incompatible types; inferred type argument(s) java.lang.Object do not conform to bounds of type variable(s) T
found : <T>java.util.ArrayList<java.lang.String>
required: java.util.ArrayList<java.lang.String>
ArrayList<String> l = test(new ArrayList<String>());
^
1 error
On both the proprietary Oracle JDK and OpenJDK7, this file compiles.
By backporting the following changesets:
changeset: 298:22872b24d38c
user: mcimadamore
date: Tue Jun 16 10:46:37 2009 +0100
summary: 6638712: Inference with wildcard types causes selection of inapplicable method
changeset: 395:dda7e13f09fb
user: mcimadamore
date: Tue Sep 01 14:53:39 2009 +0100
summary: 6650759: Inference of formal type parameter (unused in formal parameters) is not performed
(6650759 is dependent on the changes in 6638712)
we managed to get the file to compile.
A webrev of 6638712 is available at:
http://cr.openjdk.java.net/~andrew/6638712/webrev.01/
and 6650759 will follow if appropriate.
The following minor changes had to be made to 6638712 to work with current OpenJDK javac:
* The use of Types.createErrorType was replaced with Types.errType as in other cases in that file.
This avoids the need to backport:
changeset: 109:91eea580fbe9
parent: 106:5a9b808557b6
user: jjg
date: Tue Sep 09 10:28:21 2008 -0700
summary: 6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
but that can be done too if necessary.
* The final variable invalidInstanceException was initialised.
* The test case output was changed to match that output by patched OpenJDK6 (which is similar but not identical).
* The test case code files were updated as in:
changeset: 383:ed31953ca025
user: jjg
date: Thu Aug 27 11:08:27 2009 -0700
summary: 6875336: some tests should use /nodynamiccopyright/
so as to avoid introducing Sun copyright headers.
Ok to push this backport to OpenJDK6? Or do you have a simpler solution for fixing this issue?
Thanks,
--
Andrew :)
Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)
Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint = F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.java
Type: text/x-java
Size: 303 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/jdk6-dev/attachments/20100910/7b77fcbc/attachment.bin
More information about the jdk6-dev
mailing list