hg: jdk8/tl/langtools: 8012556: Implement lambda methods on interfaces as static; ...

robert.field at oracle.com robert.field at oracle.com
Tue May 14 11:11:56 PDT 2013


Changeset: c09b7234cded
Author:    rfield
Date:      2013-05-14 11:11 -0700
URL:       http://hg.openjdk.java.net/jdk8/tl/langtools/rev/c09b7234cded

8012556: Implement lambda methods on interfaces as static
8006140: Javac NPE compiling Lambda expression on initialization expression of static field in interface
Summary: Lambdas occurring in static contexts or those not needing instance information should be generated into static methods.  This has long been the case for classes.  However, as a work-around to the lack of support for statics on interfaces, interface lambda methods have been generated into default methods.  For lambdas in interface static contexts (fields and static methods) this causes an NPE in javac because there is no 'this'.  MethodHandles now support static methods on interfaces.  This changeset allows lambda methods to be generated as static interface methods.  An existing bug in Hotspot (8013875) is exposed in a test when the "-esa" flag is used.  This test and another test that already exposed this bug have been marked with @ignore.
Reviewed-by: mcimadamore

! src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
+ test/tools/javac/lambda/LambdaInterfaceStaticField.java
! test/tools/javac/lambda/MethodReference66.java
! test/tools/javac/lambda/bytecode/TestLambdaBytecode.java
! test/tools/javac/lambda/lambdaExecution/InInterface.java



More information about the compiler-dev mailing list