error vs. warning for casting Class<? extends Collection<?>>
nradov at axolotl.com
nradov at axolotl.com
Sat Nov 21 18:09:15 PST 2009
This code fails to compile using javac 1.6 or 1.7 beta.
import java.util.Collection;
import java.util.Set;
class Test {
Class<? extends Collection<?>> x = (Class<? extends Collection<?>>)
Set.class;
}
Here is the error.
C:\>javac Test.java
Test.java:5: inconvertible types
Class<? extends Collection<?>> x = (Class<? extends Collection<?>>)
Set.class;
^
required: Class<? extends Collection<?>>
found: Class<Set>
However the same code produces only a warning in the Eclipse Galileo
compiler.
Type safety: Unchecked cast from Class<Set> to Class<? extends
Collection<?>>
So there's a bug in one of the compilers but I can't figure out which is
wrong. Is this the same as Bug ID: 6557279 <
http://bugs.sun.com/view_bug.do?bug_id=6557279> or is it something
different?
Nick Radov | Director, Research & Development | Axolotl Corp
Health Information Exchange—It’s About Time.
160 West Santa Clara Street, Suite 1000 | San Jose, CA 95113
Phone: 408.920.0800 x116 | Fax: 408.920.0880 | www.axolotl.com
The information contained in this e-mail transmission may contain
confidential information. It is intended for the use of the addressee. If
you are not the intended recipient, any disclosure, copying, or
distribution of this information is strictly prohibited. If you receive
this message in error, please inform the sender immediately and remove any
record of this message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20091121/8d6a87e6/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 2991 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20091121/8d6a87e6/attachment.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 1212 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20091121/8d6a87e6/attachment-0001.gif
More information about the compiler-dev
mailing list