About wildcard

Дмитрий Бундин bundin10 at rambler.ru
Mon Oct 28 05:09:17 PDT 2013


Hello! I want to ask the following question: Let we have code List<? extends
Number> nums= new ArrayList<Integer>(); nums.add(4); with compile time error.
Fragment of error description is Integer cannot convert to CAP#1. What is the
CAP#1 type? If we consider package javax.lang.model.type we have that intreface
NullType inherited from ReferenceType. And we can add to nums null only.
Question: Is it true that CAP#1 just is NullType for compiler?

Best regards,

Dmitrii,

Junior Java Developer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20131028/3efcd462/attachment-0001.html 


More information about the hotspot-compiler-dev mailing list