< prev index next >
test/compiler/runtime/cr8015436/Test8015436.java
Print this page
rev 11557 : 8132919: use package in compiler tests
Reviewed-by: duke
@@ -23,12 +23,12 @@
/*
* @test
* @bug 8015436
* @summary the IK _initial_method_idnum value must be adjusted if overpass methods are added
- * @run main Test8015436
*
+ * @run main compiler.runtime.cr8015436.Test8015436
*/
/*
* The test checks that a MemberName for the defaultMethod() is cached in
* the class MemberNameTable without a crash in the VM fastdebug mode.
@@ -36,20 +36,16 @@
* not adjusted properly when the overpass methods are added to the class.
* The expected/correct behavior: The test does not crash nor throw any exceptions.
* All the invocations of the defaultMethod() must be completed successfully.
*/
-import java.lang.invoke.*;
+package compiler.runtime.cr8015436;
-interface InterfaceWithDefaultMethod {
- public void someMethod();
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
- default public void defaultMethod(String str){
- System.out.println("defaultMethod() " + str);
- }
-}
-
public class Test8015436 implements InterfaceWithDefaultMethod {
@Override
public void someMethod() {
System.out.println("someMethod() invoked");
}
@@ -64,10 +60,17 @@
MethodHandle mh = lookup.findVirtual(Test8015436.class, "defaultMethod", mt);
mh.invokeExact(testObj, "invoked via a MethodHandle");
}
}
+interface InterfaceWithDefaultMethod {
+ public void someMethod();
+
+ default public void defaultMethod(String str){
+ System.out.println("defaultMethod() " + str);
+ }
+}
/*
* A successful execution gives the output:
* someMethod() invoked
* defaultMethod() invoked directly
* defaultMethod() invoked via a MethodHandle
< prev index next >