8012556: Implement lambda methods on interfaces as static

8006140: Javac NPE compiling Lambda expression on initialization expression of static field in interface

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
This commit is contained in:
Robert Field 2013-05-14 11:11:09 -07:00
parent 997db01200
commit c51505263f
5 changed files with 47 additions and 6 deletions

View file

@ -26,6 +26,7 @@
/**
* @test
* @bug 8003639
* @ignore 8013875: Incorrect vtable index being set during methodHandle creation for static
* @summary convert lambda testng tests to jtreg and add them
* @run testng InInterface
*/