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

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -