News for hackers. Stuff that matters.
Re:Java Generics FAQs by twic on Friday April 17, 2015 @03:44AM (#9392747)
> Actually, it's not in general decidable whether f.test(f) is safe because f gets read twice and the value might change in the meantime.

Might it? I can't see any way that actions in the current thread can change the value of f in between those two uses. Actions in another thread can be ignored until the receiving end of a happens-before relationship is encountered, and there isn't such a point inside that expression.

More generally, yes, two uses of the same wildcarded variable in one method might not yield objects with the same actual type argument. But in this case i think it's safe.

Re:Java Generics FAQs by plesner on Saturday April 18, 2015 @12:20AM (#9398288)
What I said didn't really make sense -- f.test(f) is a concrete example so how am I generalizing? What I meant was: in the general case of expressions that contain multiple references to the same variable it might, for instance

f.testTwo(f = newF, f)