java - More relaxed restriction in wildcard instantiations than in declaration -
consider following class:
class a<t extends number> { } i wonder why line compile successfully?
a<? extends object> = new a<integer>(); while piece of code not
class b { static <t extends object> void m(a<t> a) {} } in both cases compiler "knows" range ? extends object on range ? extends number declaration of type a accepts 1st , rejects 2nd.
is there in java language or jvm specifications?
Comments
Post a Comment