On Wed, 21 Nov 2007 10:46:55 -0800
Scott M Stark <sstark(a)redhat.com> wrote:
By validating whether the parameter is used in any assignment
expressions in the class.
But this information is not easily retrievable from the class files,
unless the compiler does extensive bytecode analysis. And what happens
if you recompile the generic class and introduce an assignment?
I don't see how the Collection<Class> to a
Collection<Object> comparison is the same. This has a completely
different erasure for the collection element, where as Class<?> and
Class have the same erasure.
The lack of the parameter means, more or less, "any type", whereas
"?"
means "exactly one type but I don't know which one". They are not the
same thing.
Any variant of Class<...> will be treated like Class once everything is
compiled, so I guess I don't know what you mean by "different/same
erasure".
David M. Lloyd wrote:
> How would the compiler know that the parameter may be used for mutable
> operations? There's no way it could differentiate between the two
> cases.
>
> The "?" is treated differently from an unqualified type because an
> unqualified List can allow you to add any Object type, whereas "?"
> means there is *some* specific type required but you don't know what it
> is; therefore it is unsafe to make any assumptions regarding what can
> be accepted. This fails to compile for the same reason that casting
> from a Collection<Class> to a Collection<Object> fails. The compiler
> can't tell how you intend to make use of the parameter.
>
> I think this is an Eclipse bug, not a JDK bug.
>
> - DML
_______________________________________________
jboss-development mailing list
jboss-development(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-development