javac erroneously throws up rawtypes warning for use of diamond operator

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed May 26 10:11:53 PDT 2010


On 26/05/10 18:02, Joe Darcy wrote:
> Andrew John Hughes wrote:
>> Building with the latest http://hg.openjdk.java.net/jdk7/jdk7 checkout
>> (b94) with either OpenJDK6 or OpenJDK7 and JAVAC_MAX_WARNINGS:
>>
>> # Running javac:
>> /home/andrew/build/icedtea7/bin/java -XX:-PrintVMOptions
>> -XX:+UnlockDiagnosticVMOptions -XX:-LogVMOutput -Xmx896m -Xms128m
>> -XX:PermSize=32m -XX:MaxPermSize=160m
>> -Xbootclasspath/p:/mnt/builder/jdk7/langtools/dist/bootstrap/lib/javac.jar 
>>
>> -jar /mnt/builder/jdk7/langtools/dist/bootstrap/lib/javac.jar
>> -Xlint:all -source 7 -target 7 -encoding ascii
>> -Xbootclasspath:/mnt/builder/jdk7/classes -Xlint:serial,-deprecation
>> -Werror -sourcepath
>> /mnt/builder/jdk7/gensrc:../../../src/solaris/classes:../../../src/share/classes 
>>
>> -d /mnt/builder/jdk7/classes
>> @/mnt/builder/jdk7/tmp/sun/sun.nio/.classes.list.filtered
>> ../../../src/share/classes/sun/io/CharacterEncoding.java:57: warning:
>> [rawtypes] found raw type: HashMap
>>         aliasTable = new HashMap<>(460, 1.0f);                    /* 
>> MDA */
>>                                 ^
>>
>
> [snip]
>> Note: Some input files use or override a deprecated API.
>> Note: Recompile with -Xlint:deprecation for details.
>> 1 error
>> 6 warnings
>>
>> When:
>>
>> changeset:   2116:7dadd2951a8b
>> user:        andrew
>> date:        Tue Feb 02 10:55:07 2010 +0000
>> summary:     6921740: Eliminate warnings from sun.io converters and
>> allow compiling with JAVAC_MAX_WARNINGS=true
>>
>> was first applied to add these diamond operators and remove the
>> original raw types, javac could compile these classes successfully.
>> So javac seems to have regressed since then.
>
> I believe the fix for 6951833 "latest diamond implementation generates 
> spurious raw type warnings" will address this problem:
> http://hg.openjdk.java.net/jdk7/tl/langtools/rev/1d587ef8bf56
>
> The fix is currently in TL, but not yet in the master.
I confirm that you hit 6951833; I'm afraid the only option would be to 
temporarily disable rawtypes warnings using -Xlint:-rawtypes. As Joe 
said, a fix in on the way.

Thanks
Maurizio
>
> -Joe




More information about the compiler-dev mailing list