[PATCH] 8148100: Convert lambda most specific positive tests to check runtime behavior

bsrbnd bsrbnd at gmail.com
Sat Sep 17 17:16:44 UTC 2016


Hi,

I just wrote a partial patch for issue 8148100.
This is an updated version of
test/tools/javac/lambda/MostSpecific10.java that verifies if the
most-specific method is run with respect to JLS 15.12.2 (and also as
explained in the issue description).
I've not checked the 8 other tests yet...

Regards,
Bernard

diff --git a/test/tools/javac/lambda/MostSpecific10.java
b/test/tools/javac/lambda/MostSpecific10.java
--- a/test/tools/javac/lambda/MostSpecific10.java
+++ b/test/tools/javac/lambda/MostSpecific10.java
@@ -26,8 +26,9 @@
  * @bug 8034223
  * @summary Structural most-specific logic for lambdas, method refs,
parens, and conditionals
  * @compile MostSpecific10.java
+ * @run main MostSpecific10
  */
-class MostSpecific10 {
+public class MostSpecific10 {

     interface GetInt {
         int get();
@@ -38,7 +39,7 @@
     }

     void m(GetInt getter) {}
-    void m(GetInteger getter) {}
+    void m(GetInteger getter) {throw new
RuntimeException("Less-specific method invocation: " +
getter.getClass());}

     void test(boolean cond) {
         m(() -> 23);
@@ -50,5 +51,9 @@
         m(cond ? (() -> 23) : ("abc"::length) );
         m(( cond ? () -> 23 : cond ? ("abc"::length) : (() -> 23) ));
     }
+
+    public static void main(String[] args) {
+        new MostSpecific10().test(true);
+    }

 }


More information about the compiler-dev mailing list