< prev index next >

test/jdk/java/lang/invoke/SpecialInterfaceCall.java

Print this page
rev 50604 : imported patch jep181-rev1


   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @bug 8200167
  27  * @summary Test direct and MethodHandle access to interface methods using invokespecial semantics
  28  * @compile SpecialInterfaceCall.java

  29  * @compile SpecialInterfaceCallI4.jasm
  30  * @run main/othervm -Xint SpecialInterfaceCall
  31  * @run main/othervm -Xbatch -XX:+TieredCompilation -XX:TieredStopAtLevel=1 SpecialInterfaceCall
  32  * @run main/othervm -Xbatch -XX:-TieredCompilation SpecialInterfaceCall
  33  */
  34 
  35 import java.lang.invoke.*;
  36 
  37 public class SpecialInterfaceCall {
  38     interface I1 {
  39         default void pub_m() {};
  40         private void priv_m() {};
  41     }
  42     interface I2 extends I1 {
  43         // This needs to be a public method to avoid access control issues,
  44         // but logically we treat it as private and emulate invokespecial
  45         // using MethodHandles.
  46         default void pub_m() {};
  47 
  48         private void priv_m() {};




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @bug 8200167 8010319
  27  * @summary Test direct and MethodHandle access to interface methods using invokespecial semantics
  28  * @comment This must be compiled so invokespecial is used
  29  * @compile -XDdisableVirtualizedPrivateInvoke SpecialInterfaceCall.java
  30  * @compile SpecialInterfaceCallI4.jasm
  31  * @run main/othervm -Xint SpecialInterfaceCall
  32  * @run main/othervm -Xbatch -XX:+TieredCompilation -XX:TieredStopAtLevel=1 SpecialInterfaceCall
  33  * @run main/othervm -Xbatch -XX:-TieredCompilation SpecialInterfaceCall
  34  */
  35 
  36 import java.lang.invoke.*;
  37 
  38 public class SpecialInterfaceCall {
  39     interface I1 {
  40         default void pub_m() {};
  41         private void priv_m() {};
  42     }
  43     interface I2 extends I1 {
  44         // This needs to be a public method to avoid access control issues,
  45         // but logically we treat it as private and emulate invokespecial
  46         // using MethodHandles.
  47         default void pub_m() {};
  48 
  49         private void priv_m() {};


< prev index next >