< prev index next >

test/langtools/tools/javac/lambda/bytecode/TestLambdaBytecode.java

Print this page
rev 58565 : 8238358: Implementation of JEP 371: Hidden Classes
Reviewed-by: duke
Contributed-by: mandy.chung@oracle.com, lois.foltan@oracle.com, david.holmes@oracle.com, harold.seigel@oracle.com, serguei.spitsyn@oracle.com, alex.buckley@oracle.com, jamsheed.c.m@oracle.com
rev 58568 : [mq]: hidden-class-4

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -21,12 +21,13 @@
  * questions.
  */
 
 /*
  * @test
- * @bug 8009649 8129962
- * @summary Lambda back-end should generate invokespecial for method handles referring to private instance methods
+ * @bug 8009649 8129962 8238358
+ * @summary Lambda back-end should generate invokevirtual for method handles referring to
+ *          private instance methods as lambda proxy is a nestmate of the target clsas
  * @library /tools/javac/lib
  * @modules jdk.jdeps/com.sun.tools.classfile
  *          jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.util

@@ -267,18 +268,18 @@
                     (CONSTANT_MethodHandle_info)cf.constant_pool.get(bsm_spec.bootstrap_arguments[1]);
 
             boolean kindOK;
             switch (mh.reference_kind) {
                 case REF_invokeStatic: kindOK = mk2.isStatic(); break;
-                case REF_invokeSpecial: kindOK = !mk2.isStatic(); break;
+                case REF_invokeVirtual: kindOK = !mk2.isStatic() && !mk2.inInterface(); break;
                 case REF_invokeInterface: kindOK = mk2.inInterface(); break;
                 default:
                     kindOK = false;
             }
 
             if (!kindOK) {
-                fail("Bad invoke kind in implementation method handle");
+                fail("Bad invoke kind in implementation method handle: " + mh.reference_kind);
                 return;
             }
 
             if (!mh.getCPRefInfo().getNameAndTypeInfo().getType().toString().equals(MH_SIG)) {
                 fail("Type mismatch in implementation method handle");
< prev index next >