Unbounded wildcard passed to method?

This is due to capture conversion Internally, compiler converts the type of an expression Foo.

This is due to capture conversion. Internally, compiler converts the type of an expression Foo to Foo, where X is a specific albeit unknown type.

The compiler is free to infer anything that is compatible with the types of the arguments and return type. In your case it can always infer T as Object. Which turns the signature into static Object wildSub(ArrayList holder, Object arg) Which means it can take any ArrayList as first argument and anything as second.

Since you don't do anything with the return value, Object will be okay.

Thx. Now all this stuff makes sense. – borzoni Oct 17 '11 at 1:58.

Is used, it makes sense why it would compile. That is all there is to it. If you are doing any operations dependent on?

Being a certain class, you will get a cast exception at run time if the wrong class is passed in.

Thx, too. Rather simple. – borzoni Oct 17 '11 at 1:58.

As an addition to existing (correct) answers to make it more clear: ... Object result1 = ColTest. WildSub(list, lng); //compiles fine with Sun's javac // Long result2 = ColTest. WildSub(list, lng); //does not compile without explicit casting Long result2 = (Long) ColTest.

WildSub(list, lng); //compiles fine ...

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions