Primitives in Generics (+ the meaning of this)
Joshua Bloch
jjb at google.com
Fri Jul 16 09:27:26 PDT 2010
Peter,
On Fri, Jul 16, 2010 at 8:28 AM, Peter Levart <peter.levart at marand.si>wrote:
>
>
> 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)?
>
I don't remember the details of the statistical evidence, but it seems
suspect. It's not uncommon for periodic TimerTasks to cancel themselves or
(as illustrated in the TimerTask documentation) to call their own
scheduledExecutionTime()method from their single abstract method (run). It
may be the case that it's much more common to want to access enclosing
instances, but I don't believe that intentional access to the function
object from within its body is "practically non-existent."
Josh
P.S. It took me ten seconds of searching to find this example:
www.google.com/codesearch/p?hl=en#xJfZyRTTR4E/trunk/src/com/bwepow/wwj/awt/KeyPollTimer.java&q=TimerTask%20scheduledExecutionTime&sa=N&cd=27&ct=rc&l=118
More information about the lambda-dev
mailing list