Confusing javac error :)

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Nov 30 04:21:37 PST 2012


On 30/11/12 12:08, Peter Levart wrote:
> On 11/30/2012 11:45 AM, Remi Forax wrote:
>> On 11/30/2012 11:30 AM, Remi Forax wrote:
>>> On 11/30/2012 11:06 AM, David Holmes wrote:
>>>> On 30/11/2012 5:15 PM, Remi Forax wrote:
>>>>> Yes, the default version should be 8.
>>>> ?? I specified:
>>>>
>>>> -source 8
>>>>
>>>> ;-) Hence the confusion regarding the error.
>>>>
>>>> David
>>> doh, I see really weird.
>>>
>>> Rémi
>> Ok, got it,
>> The version of the compiler shipped with b65 has lambda disabled with a
>> non standard flag
>>      /usr/jdk/jdk1.8.0/bin/javac -XDallowLambda Test.java
>>
>> changeset 01c9d4161882 enable lambda by default:
>> http://hg.openjdk.java.net/jdk8/jdk8/langtools/diff/01c9d4161882/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
>> so b66 will have lambda enabled by default.
>>
>> Rémi
> Hi Remi,
>
> Do you happen to know the switch for default methods too?
>
> java: default methods are not supported in -source 1.8
>     (use -source 8 or higher to enable default methods)
>
> Regards, Peter
Please do not rely on those internal flags. There's a reason why 
lambda/default methods are not enabled by default in b65 - first and 
foremost because hotspot and JDK changes are not there yet. Let's all 
wait for next promotion, or use the lambda repo, shall we? ;-)

Maurizio
>
>>
>>>>> Rémi
>>>>>
>>>>> Sent from my Phone
>>>>>
>>>>> ----- Reply message -----
>>>>> From: "David Holmes" <david.holmes at oracle.com>
>>>>> To: "lambda-dev at openjdk.java.net" <lambda-dev at openjdk.java.net>
>>>>> Subject: Confusing javac error :)
>>>>> Date: Fri, Nov 30, 2012 05:09
>>>>>
>>>>>
>>>>> javac -J-showversion -source 8 TestLambda.java
>>>>> java version "1.8.0-ea"
>>>>> Java(TM) SE Runtime Environment (build 1.8.0-ea-b65)
>>>>> Java HotSpot(TM) Client VM (build 25.0-b09, mixed mode)
>>>>>
>>>>> TestLambda.java:13: error: lambda expressions are not supported in
>>>>> -source 1.8
>>>>> Runnable r = () -> System.out.println("Run") ;
>>>>> ^
>>>>> (use -source 8 or higher to enable lambda expressions)
>>>>> 1 error
>>>>>
>>>>> ----
>>>>>
>>>>> This is a mainline build of jdk8-b65 so this may already be fixed.
>>>>>
>>>>> David
>>>>>
>



More information about the lambda-dev mailing list