Primitives in Generics (+ the meaning of this)
brian.goetz at oracle.com
Fri Jul 16 10:07:15 PDT 2010
> Regardless of that, do you aggree that the statistical evidence, prepared by some members of this list, showed that usage of explicit and implicit "this" inside anonymous inner SAM subclass creation expressions is practically non-existent and is actualy "in the way" of using outer.this and/or outer instance members (even a cause of bugs in JDK itself)?
No, I don't agree with this. What we have is, basically, arguments over which
use cases are more important and which error modes are worse, which are almost
always just opinion contests, just like syntax discussions about which
alternative "looks more like Java". Issues such as the one Josh raised (where
TimerTask wants to call cancel()) come up with some frequency; so do
accidental shadowing of methods like toString() in inner classes. This
generally just comes down to a "which error would you rather have" question.
And, given that inner classes *already* suffer from the accidental shadowing
problem, creating a mechanism that goes the other way (even if the other way
is absolutely right!) is even more confusing for Java developers, who now have
to keep track of two separate and inconsistent bits of puzzlerhood.
That said, the questions you raise here (and in your next e-mail) are fair and
we've already planned to devote some thought to it -- but not now, because
we've got other things that demand our attention more urgently, such as
refining and implementing the features that are already in the must-have column.
More information about the lambda-dev