Preparing for the 0.2 draft
Rémi Forax
forax at univ-mlv.fr
Sat Jan 30 06:31:03 PST 2010
Le 30/01/2010 14:38, Mark Thornton a écrit :
> Osvaldo Doederlein wrote:
>
>> 2010/1/30 Fredrik Öhrström<fredrik.ohrstrom at oracle.com>
>>
>>
>>
>>> Just because every piece of code in Java you have written so far, has
>>> been a method inside an object
>>>
>>>
>>>
>>>
>> Well, there is the enormous exception of all Java code inside static
>> methods, static initializers, and field-initializing expressions. (The
>> latter _is_ "code inside an object" because it's compiled into constructors;
>> but you can't use 'this' anyway.)
>>
> public class Init
> {
> private Init me = this;
> }
>
> Is legal. It is static contexts and the arguments of super that can't
> contain this (as far as I can recall).
>
It's an instance variable initializer (words from the JLS), it's not a
static context.
> Mark
>
Rémi
More information about the lambda-dev
mailing list