8199255: [TESTBUG] Open source VM testbase default methods tests
Open sourced default method tests Reviewed-by: ccheung, iignatyev, erikj
This commit is contained in:
parent
24d75d940a
commit
6b45a75b88
@ -74,6 +74,11 @@ NSK_SHARE_JNI_INCLUDES := \
|
|||||||
-I$(VM_TESTBASE_DIR)/nsk/share/native \
|
-I$(VM_TESTBASE_DIR)/nsk/share/native \
|
||||||
-I$(VM_TESTBASE_DIR)/nsk/share/jni
|
-I$(VM_TESTBASE_DIR)/nsk/share/jni
|
||||||
|
|
||||||
|
RUNTIME_DEFMETH_INCLUDES := \
|
||||||
|
-I$(TOPDIR)/test/hotspot/jtreg/vmTestbase/nsk/share/jni \
|
||||||
|
-I$(TOPDIR)/test/hotspot/jtreg/vmTestbase/nsk/share/native \
|
||||||
|
-I$(TOPDIR)/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti
|
||||||
|
|
||||||
NSK_SHARE_LOCKS_INCLUDES := \
|
NSK_SHARE_LOCKS_INCLUDES := \
|
||||||
-I$(VM_TESTBASE_DIR)/nsk/share/native \
|
-I$(VM_TESTBASE_DIR)/nsk/share/native \
|
||||||
-I$(VM_TESTBASE_DIR)/nsk/share/locks
|
-I$(VM_TESTBASE_DIR)/nsk/share/locks
|
||||||
@ -124,6 +129,8 @@ BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libRecursiveMonitoringThread := $(NSK_MONIT
|
|||||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libLockingThreads := $(NSK_MONITORING_INCLUDES)
|
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libLockingThreads := $(NSK_MONITORING_INCLUDES)
|
||||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libStackTraceController := $(NSK_MONITORING_INCLUDES)
|
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libStackTraceController := $(NSK_MONITORING_INCLUDES)
|
||||||
|
|
||||||
|
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libredefineClasses := $(RUNTIME_DEFMETH_INCLUDES)
|
||||||
|
|
||||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libforceEarlyReturn005a := $(NSK_JDI_INCLUDES)
|
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libforceEarlyReturn005a := $(NSK_JDI_INCLUDES)
|
||||||
|
|
||||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libMonitorEnterExecutor := $(NSK_SHARE_JDI_INCLUDES)
|
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libMonitorEnterExecutor := $(NSK_SHARE_JDI_INCLUDES)
|
||||||
@ -183,6 +190,7 @@ ifeq ($(OPENJDK_TARGET_OS), linux)
|
|||||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rwx := -z execstack
|
BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rwx := -z execstack
|
||||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libstepBreakPopReturn := -lpthread
|
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libstepBreakPopReturn := -lpthread
|
||||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libIndyRedefineClass := -lpthread
|
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libIndyRedefineClass := -lpthread
|
||||||
|
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libredefineClasses := -lpthread
|
||||||
BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exeinvoke := -ljvm -lpthread
|
BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exeinvoke := -ljvm -lpthread
|
||||||
BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exestack-gap := -ljvm -lpthread
|
BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exestack-gap := -ljvm -lpthread
|
||||||
BUILD_TEST_exeinvoke_exeinvoke.c_OPTIMIZATION := NONE
|
BUILD_TEST_exeinvoke_exeinvoke.c_OPTIMIZATION := NONE
|
||||||
|
@ -588,6 +588,12 @@ vmTestbase_nsk_monitoring_quick = \
|
|||||||
vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_proxy_default/TestDescription.java \
|
vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_proxy_default/TestDescription.java \
|
||||||
vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_proxy_custom/TestDescription.java
|
vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_proxy_custom/TestDescription.java
|
||||||
|
|
||||||
|
|
||||||
|
# Tests for default method implementation
|
||||||
|
vmTestbase_vm_defmeth = \
|
||||||
|
vmTestbase/vm/runtime/defmeth
|
||||||
|
|
||||||
|
|
||||||
# JDI tests
|
# JDI tests
|
||||||
vmTestbase_nsk_jdi = \
|
vmTestbase_nsk_jdi = \
|
||||||
vmTestbase/nsk/jdi
|
vmTestbase/nsk/jdi
|
||||||
@ -1283,4 +1289,3 @@ vmTestbase_vm_heapdump_quick = \
|
|||||||
# JDB tests
|
# JDB tests
|
||||||
vmTestbase_nsk_jdb = \
|
vmTestbase_nsk_jdb = \
|
||||||
vmTestbase/nsk/jdb
|
vmTestbase/nsk/jdb
|
||||||
|
|
||||||
|
@ -0,0 +1,408 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vm.runtime.defmeth;
|
||||||
|
|
||||||
|
import nsk.share.test.TestBase;
|
||||||
|
import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||||
|
import vm.runtime.defmeth.shared.DefMethTest;
|
||||||
|
import vm.runtime.defmeth.shared.data.*;
|
||||||
|
import vm.runtime.defmeth.shared.data.method.body.EmptyBody;
|
||||||
|
import vm.runtime.defmeth.shared.builder.TestBuilder;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test allowed combinations of access flags on methods in interfaces.
|
||||||
|
* Based on assertions from JVMS8.
|
||||||
|
*/
|
||||||
|
public class AccessibilityFlagsTest extends DefMethTest {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
TestBase.runTest(new AccessibilityFlagsTest(), args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ====================================================================== */
|
||||||
|
|
||||||
|
// Methods of interfaces may set any of the flags in Table 4.5 except
|
||||||
|
// ACC_PROTECTED, ACC_FINAL, ACC_NATIVE, and ACC_SYNCHRONIZED (9.4);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { protected void m(); }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") ==> ClassFormatError
|
||||||
|
*/
|
||||||
|
public void testProtectedMethodAbstract() {
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodInterface(ACC_PROTECTED));
|
||||||
|
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodInterface(ACC_PROTECTED | ACC_PUBLIC));
|
||||||
|
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodInterface(ACC_PROTECTED | ACC_PRIVATE));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { protected void m() default {}; }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") ==> ClassFormatError
|
||||||
|
*/
|
||||||
|
public void testProtectedMethodDefault() {
|
||||||
|
expectClassFormatError(
|
||||||
|
createDefaultMethodInterface(ACC_PROTECTED));
|
||||||
|
|
||||||
|
expectClassFormatError(
|
||||||
|
createDefaultMethodInterface(ACC_PROTECTED | ACC_PUBLIC));
|
||||||
|
|
||||||
|
expectClassFormatError(
|
||||||
|
createDefaultMethodInterface(ACC_PROTECTED | ACC_PRIVATE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { final void m() default {}; }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") ==> ClassFormatError
|
||||||
|
*/
|
||||||
|
public void testFinalMethodDefault() {
|
||||||
|
expectClassFormatError(
|
||||||
|
createDefaultMethodInterface(ACC_FINAL));
|
||||||
|
|
||||||
|
expectClassFormatError(
|
||||||
|
createDefaultMethodInterface(ACC_FINAL | ACC_PUBLIC));
|
||||||
|
|
||||||
|
expectClassFormatError(
|
||||||
|
createDefaultMethodInterface(ACC_FINAL | ACC_PRIVATE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { native void m() default {}; }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") ==> ClassFormatError
|
||||||
|
*/
|
||||||
|
public void testNativeMethodDefault() {
|
||||||
|
expectClassFormatError(
|
||||||
|
createDefaultMethodInterface(ACC_NATIVE));
|
||||||
|
|
||||||
|
expectClassFormatError(
|
||||||
|
createDefaultMethodInterface(ACC_NATIVE | ACC_PUBLIC));
|
||||||
|
|
||||||
|
expectClassFormatError(
|
||||||
|
createDefaultMethodInterface(ACC_NATIVE | ACC_PRIVATE));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { synchronized void m(); }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") ==> ClassFormatError
|
||||||
|
*/
|
||||||
|
public void testSynchronizedMethodAbstract() {
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodInterface(ACC_SYNCHRONIZED));
|
||||||
|
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodInterface(ACC_SYNCHRONIZED | ACC_PUBLIC));
|
||||||
|
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodInterface(ACC_SYNCHRONIZED | ACC_PRIVATE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { synchronized void m() default {}; }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") ==> ClassFormatError
|
||||||
|
*/
|
||||||
|
public void testSynchronizedMethodDefault() {
|
||||||
|
expectClassFormatError(
|
||||||
|
createDefaultMethodInterface(ACC_SYNCHRONIZED));
|
||||||
|
|
||||||
|
expectClassFormatError(
|
||||||
|
createDefaultMethodInterface(ACC_SYNCHRONIZED | ACC_PUBLIC));
|
||||||
|
|
||||||
|
expectClassFormatError(
|
||||||
|
createDefaultMethodInterface(ACC_SYNCHRONIZED | ACC_PRIVATE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===================================================================== */
|
||||||
|
|
||||||
|
// [methods of interfaces] must have exactly one of the ACC_PUBLIC or ACC_PRIVATE flags set.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { private void m() default {}; }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") == succeeds
|
||||||
|
*/
|
||||||
|
public void testPrivateMethodDefault() {
|
||||||
|
loadClass(
|
||||||
|
createDefaultMethodInterface(ACC_PRIVATE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { public void m(); }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") == succeeds
|
||||||
|
*/
|
||||||
|
public void testPublicMethodAbstract() {
|
||||||
|
loadClass(
|
||||||
|
createAbstractMethodInterface(ACC_PUBLIC));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { public void m() default {}; }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void testPublicMethodDefault() {
|
||||||
|
loadClass(
|
||||||
|
createDefaultMethodInterface(ACC_PUBLIC));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { private public void m(); }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") ==> ClassFormatError
|
||||||
|
*/
|
||||||
|
public void testPrivatePublicMethodAbstract() {
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodInterface(ACC_PUBLIC | ACC_PRIVATE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { private public void m() default {}; }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") ==> ClassFormatError
|
||||||
|
*/
|
||||||
|
public void testPrivatePublicMethodDefault() {
|
||||||
|
expectClassFormatError(
|
||||||
|
createDefaultMethodInterface(ACC_PUBLIC | ACC_PRIVATE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===================================================================== */
|
||||||
|
|
||||||
|
// Methods of classes may set any of the flags in Table 4.5 except
|
||||||
|
// ACC_PROTECTED, ACC_FINAL, ACC_NATIVE, and ACC_SYNCHRONIZED (9.4);
|
||||||
|
// they must have exactly one of the ACC_PUBLIC or ACC_PRIVATE flags set.
|
||||||
|
//
|
||||||
|
// The following flags are allowed:
|
||||||
|
// ACC_PUBLIC 0x0001 Declared public; may be accessed from outside its package.
|
||||||
|
// ACC_PRIVATE 0x0002 Declared private; accessible only within the defining class.
|
||||||
|
// ACC_STATIC 0x0008 Declared static.
|
||||||
|
// ACC_BRIDGE 0x0040 A bridge method, generated by the compiler.
|
||||||
|
// ACC_VARARGS 0x0080 Declared with variable number of arguments.
|
||||||
|
// ACC_STRICT 0x0800 Declared strictfp; floating-point mode is FP-strict.
|
||||||
|
// ACC_SYNTHETIC 0x1000 Declared synthetic; not present in the source code.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { static void m() default {}; }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") == succeeds
|
||||||
|
*/
|
||||||
|
public void testStaticMethodDefault() {
|
||||||
|
loadClass(
|
||||||
|
createDefaultMethodInterface(ACC_STATIC | ACC_PUBLIC));
|
||||||
|
loadClass(
|
||||||
|
createDefaultMethodInterface(ACC_STATIC | ACC_PRIVATE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { strictfp void m() default {}; }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") == succeeds
|
||||||
|
*/
|
||||||
|
public void testStrictFPMethodDefault() {
|
||||||
|
loadClass(
|
||||||
|
createDefaultMethodInterface(ACC_STRICT | ACC_PUBLIC));
|
||||||
|
loadClass(
|
||||||
|
createDefaultMethodInterface(ACC_STRICT | ACC_PRIVATE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* =============================================================================== */
|
||||||
|
|
||||||
|
// If a specific method of a class or interface has its ACC_ABSTRACT flag set,
|
||||||
|
// it must not have any of its ACC_FINAL, ACC_NATIVE, ACC_PRIVATE, ACC_STATIC, ACC_STRICT,
|
||||||
|
// or ACC_SYNCHRONIZED flags set (8.4.3.1, 8.4.3.3, 8.4.3.4).
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { final void m(); }
|
||||||
|
* abstract class C { abstract final void m(); }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") ==> ClassFormatError
|
||||||
|
* TEST: ClassLoader.loadClass("C") ==> ClassFormatError
|
||||||
|
*/
|
||||||
|
public void testFinalMethodAbstract() {
|
||||||
|
/* interface I */
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodInterface(ACC_FINAL));
|
||||||
|
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodInterface(ACC_FINAL | ACC_PUBLIC));
|
||||||
|
|
||||||
|
/* abstract class C */
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodClass(ACC_FINAL));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { native void m(); }
|
||||||
|
* interface K { native void m() default {}; }
|
||||||
|
* abstract class C { abstract native m(); }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") ==> ClassFormatError
|
||||||
|
* TEST: ClassLoader.loadClass("K") ==> ClassFormatError
|
||||||
|
* TEST: ClassLoader.loadClass("C") ==> ClassFormatError
|
||||||
|
*/
|
||||||
|
public void testNativeMethodAbstract() {
|
||||||
|
/* interface I */
|
||||||
|
expectClassFormatError(
|
||||||
|
createDefaultMethodInterface(ACC_NATIVE));
|
||||||
|
|
||||||
|
expectClassFormatError(
|
||||||
|
createDefaultMethodInterface(ACC_NATIVE | ACC_PUBLIC));
|
||||||
|
|
||||||
|
/* interface K */
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodInterface(ACC_NATIVE));
|
||||||
|
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodInterface(ACC_NATIVE | ACC_PUBLIC));
|
||||||
|
|
||||||
|
/* abstract class C */
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodClass(ACC_NATIVE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { private void m(); }
|
||||||
|
* abstract class C { abstract private void m(); }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") ==> ClassFormatError
|
||||||
|
* TEST: ClassLoader.loadClass("C") ==> ClassFormatError
|
||||||
|
*/
|
||||||
|
public void testPrivateMethodAbstract() {
|
||||||
|
/* interface I */
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodInterface(ACC_PRIVATE));
|
||||||
|
|
||||||
|
/* abstract class C */
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodClass(ACC_PRIVATE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { static void m(); }
|
||||||
|
* abstract class C { abstract static void m(); }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") ==> ClassFormatError
|
||||||
|
* TEST: ClassLoader.loadClass("C") ==> ClassFormatError
|
||||||
|
*/
|
||||||
|
public void testStaticMethodAbstract() {
|
||||||
|
/* interface I */
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodInterface(ACC_STATIC));
|
||||||
|
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodInterface(ACC_STATIC | ACC_PUBLIC));
|
||||||
|
|
||||||
|
/* abstract class C */
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodClass(ACC_STATIC));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { strictfp void m(); }
|
||||||
|
* abstract class C { abstract strictfp void m(); }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") ==> ClassFormatError
|
||||||
|
* TEST: ClassLoader.loadClass("C") ==> ClassFormatError
|
||||||
|
*/
|
||||||
|
public void testStrictFPMethodAbstract() {
|
||||||
|
/* interface I */
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodInterface(ACC_STRICT));
|
||||||
|
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodInterface(ACC_STRICT | ACC_PUBLIC));
|
||||||
|
|
||||||
|
/* abstract class C */
|
||||||
|
expectClassFormatError(
|
||||||
|
createAbstractMethodClass(ACC_STRICT));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* =============================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I { abstract void m() default {}; }
|
||||||
|
*
|
||||||
|
* TEST: ClassLoader.loadClass("I") ==> ClassFormatError
|
||||||
|
*/
|
||||||
|
public void testAbstractMethodDefault() {
|
||||||
|
expectClassFormatError(
|
||||||
|
createDefaultMethodInterface(ACC_ABSTRACT));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ====================================================================== */
|
||||||
|
|
||||||
|
// Helper methods
|
||||||
|
private Interface createAbstractMethodInterface(int acc) {
|
||||||
|
return factory.getBuilder()
|
||||||
|
.intf("I")
|
||||||
|
.abstractMethod("m", "()V").flags(acc)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Clazz createAbstractMethodClass(int acc) {
|
||||||
|
return factory.getBuilder()
|
||||||
|
.clazz("I")
|
||||||
|
.abstractMethod("m", "()V").flags(acc)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Interface createDefaultMethodInterface(int acc) {
|
||||||
|
return factory.getBuilder()
|
||||||
|
.intf("I")
|
||||||
|
.defaultMethod("m", "()V").flags(acc)
|
||||||
|
.body(new EmptyBody())
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void expectException(Clazz clz, Class<? extends Throwable> exc) {
|
||||||
|
TestBuilder b = factory.getBuilder()
|
||||||
|
.register(clz);
|
||||||
|
|
||||||
|
b.test().loadClass(clz).throws_(exc).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadClass(Clazz clz) {
|
||||||
|
TestBuilder b = factory.getBuilder()
|
||||||
|
.register(clz);
|
||||||
|
|
||||||
|
b.test().loadClass(clz).ignoreResult().done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void expectClassFormatError(Clazz clz) {
|
||||||
|
expectException(clz, ClassFormatError.class);
|
||||||
|
}
|
||||||
|
}
|
381
test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/BasicTest.java
Normal file
381
test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/BasicTest.java
Normal file
@ -0,0 +1,381 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vm.runtime.defmeth;
|
||||||
|
|
||||||
|
import nsk.share.TestFailure;
|
||||||
|
import nsk.share.test.TestBase;
|
||||||
|
import vm.runtime.defmeth.shared.MemoryClassLoader;
|
||||||
|
import vm.runtime.defmeth.shared.annotation.KnownFailure;
|
||||||
|
import vm.runtime.defmeth.shared.annotation.NotApplicableFor;
|
||||||
|
import vm.runtime.defmeth.shared.builder.TestBuilder;
|
||||||
|
import vm.runtime.defmeth.shared.data.*;
|
||||||
|
import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||||
|
import vm.runtime.defmeth.shared.DefMethTest;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static vm.runtime.defmeth.shared.ExecutionMode.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic tests on some of the assertions from JVMS.
|
||||||
|
*/
|
||||||
|
public class BasicTest extends DefMethTest {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
TestBase.runTest(new BasicTest(), args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JVMS 6.5 invokevirtual
|
||||||
|
*
|
||||||
|
* ...
|
||||||
|
*
|
||||||
|
* Runtime Exceptions
|
||||||
|
*
|
||||||
|
* Otherwise, if the resolved method is not signature polymorphic:
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ...
|
||||||
|
*
|
||||||
|
* If the resolved method is declared in an interface and the class of
|
||||||
|
* objectref does not implement the resolved interface, invokevirtual throws
|
||||||
|
* an IncompatibleClassChangeError.
|
||||||
|
*/
|
||||||
|
@KnownFailure(modes = {
|
||||||
|
REFLECTION, // throws IAE
|
||||||
|
INVOKE_GENERIC, INVOKE_WITH_ARGS}) // throws ClassCastException
|
||||||
|
public void testInterfaceNotImplemented() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()V").emptyBody().build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").build();
|
||||||
|
|
||||||
|
Class expectedClass;
|
||||||
|
if (factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
expectedClass = IllegalArgumentException.class;
|
||||||
|
} else if (factory.getExecutionMode().equals("INVOKE_WITH_ARGS")) {
|
||||||
|
// Notes from JDK-8029926 which details reasons behind CCE.
|
||||||
|
// The code below demonstrates the use of a MethodHandle
|
||||||
|
// of kind REF_invokeInterface pointing to method I.m.
|
||||||
|
// Because 'invoke' is called, this MethodHandle is effectively
|
||||||
|
// wrapped in the type adaptations necessary to accept a C
|
||||||
|
// as the first argument. ***Before we even get to the point
|
||||||
|
// of the invokeinterface call to I.m***, the adaptation
|
||||||
|
// code must run, and that is where the ClassCastException occurs.
|
||||||
|
// This exception can be thrown from code that is cleanly
|
||||||
|
// compiled and does no bytecode generation, so an ICCE would
|
||||||
|
// be inappropriate since no classes are changed.
|
||||||
|
expectedClass = ClassCastException.class;
|
||||||
|
} else {
|
||||||
|
expectedClass = IncompatibleClassChangeError.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()V").throws_(expectedClass).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ...
|
||||||
|
*
|
||||||
|
* Otherwise, if no method matching the resolved name and descriptor is
|
||||||
|
* selected, invokevirtual throws an NoSuchMethodError.
|
||||||
|
*
|
||||||
|
* ...
|
||||||
|
*/
|
||||||
|
@KnownFailure(modes = {
|
||||||
|
DIRECT, REFLECTION, INVOKE_WITH_ARGS, // NSME, instead of AME
|
||||||
|
INVOKE_EXACT, INVOKE_GENERIC, INDY}) // IncompatibleClassChangeError, instead of AME
|
||||||
|
public void testNoMatch() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "(Ljava/lang/Object;)V").emptyBody().build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().callSite(C, C, "m", "()I").throws_(NoSuchMethodError.class).done()
|
||||||
|
.test().callSite(C, C, "m1", "()V").throws_(NoSuchMethodError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "(I)V").throws_(NoSuchMethodError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ...
|
||||||
|
*
|
||||||
|
* 8025604: Updated specification text for both 5.4.3.3 and 5.4.4.4
|
||||||
|
* "Otherwise, if any superinterface of C declares a method with the name and
|
||||||
|
* descriptor specified by the method reference that has set neither
|
||||||
|
* its ACC_PRIVATE flag nor its ACC_STATIC flag, one of these is arbitrarily
|
||||||
|
* chosen and method lookup succeeds."
|
||||||
|
* If method lookup fails, method resolution throws a NoSuchMethodError
|
||||||
|
*
|
||||||
|
* ...
|
||||||
|
*/
|
||||||
|
public void testNonPublic() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m1", "()V").private_().emptyBody().build()
|
||||||
|
.defaultMethod("m2", "()I").private_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().callSite(C, C, "m1", "()V").throws_(NoSuchMethodError.class).done()
|
||||||
|
.test().callSite(C, C, "m2", "()I").throws_(NoSuchMethodError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Default method override w/ non-public concrete method
|
||||||
|
*
|
||||||
|
* interface I { void m() default {} }
|
||||||
|
* class C implements I {
|
||||||
|
* [private/package-private/protected]
|
||||||
|
* void m() {}
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@KnownFailure(modes = {INVOKE_EXACT, INVOKE_GENERIC, INVOKE_WITH_ARGS, INDY}) // NPE, instead of IAE
|
||||||
|
public void testNonPublicOverride() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m","()V").emptyBody().build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I)
|
||||||
|
.concreteMethod("m", "()V").private_().emptyBody().build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass D = b.clazz("D").implement(I)
|
||||||
|
.concreteMethod("m", "()V").protected_().emptyBody().build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass E = b.clazz("E").implement(I)
|
||||||
|
.concreteMethod("m", "()V").package_private().emptyBody().build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()V").throws_(IllegalAccessError.class).done()
|
||||||
|
.test().callSite(I, D, "m", "()V").throws_(IllegalAccessError.class).done()
|
||||||
|
.test().callSite(I, E, "m", "()V").throws_(IllegalAccessError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I {
|
||||||
|
* static { throw new RE()}
|
||||||
|
* public default void m() {}
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C implements I {}
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); ==> LinkageError
|
||||||
|
* Static initialization of class C will trigger
|
||||||
|
* I's static initialization due to I's default method.
|
||||||
|
*/
|
||||||
|
public void testStaticInit() throws ClassNotFoundException {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("<clinit>", "()V")
|
||||||
|
.flags(ACC_STATIC)
|
||||||
|
.throw_(RuntimeException.class)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
.defaultMethod("m", "()V")
|
||||||
|
.emptyBody().build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()V").throws_(LinkageError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I {
|
||||||
|
* static { throw new RE()}
|
||||||
|
* private default void m() {}
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C implements I {}
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); ==> LinkageError
|
||||||
|
* Static initialization of class C will trigger
|
||||||
|
* I's static initialization due to I's private concrete method.
|
||||||
|
*/
|
||||||
|
public void testStaticInitPrivate() throws ClassNotFoundException {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("<clinit>", "()V")
|
||||||
|
.flags(ACC_STATIC)
|
||||||
|
.throw_(RuntimeException.class)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
.defaultMethod("m", "()V")
|
||||||
|
.flags(ACC_PRIVATE)
|
||||||
|
.emptyBody().build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
Class expectedClass;
|
||||||
|
if (factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
expectedClass = NoSuchMethodException.class;
|
||||||
|
} else {
|
||||||
|
expectedClass = LinkageError.class;
|
||||||
|
}
|
||||||
|
b.test().callSite(I, C, "m", "()V").throws_(expectedClass).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface I {
|
||||||
|
* static { throw new RE()}
|
||||||
|
* }
|
||||||
|
* interface J {
|
||||||
|
* public default int m() { return 1}
|
||||||
|
*
|
||||||
|
* class C implements I,J {}
|
||||||
|
*
|
||||||
|
* TEST: C c = new C()
|
||||||
|
* c.m() returns 1
|
||||||
|
* Static initialization of class C will not trigger
|
||||||
|
* I's static initialization since I has no concrete methods.
|
||||||
|
*/
|
||||||
|
public void testNotStaticInitNoDefault() throws ClassNotFoundException {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("<clinit>", "()V")
|
||||||
|
.flags(ACC_STATIC)
|
||||||
|
.throw_(RuntimeException.class)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I,J).build();
|
||||||
|
|
||||||
|
b.test().callSite(C, C, "m", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Example A.10
|
||||||
|
*
|
||||||
|
* Let L1 and L2 be class loaders with different interpretations of the type "A".
|
||||||
|
*
|
||||||
|
* Loaded by L1:
|
||||||
|
* public interface I { public default A m() { return null; } }
|
||||||
|
*
|
||||||
|
* Loaded by L2:
|
||||||
|
* public class C implements I {}
|
||||||
|
*
|
||||||
|
* TEST: I o = new C(); o.m() ==> LinkageError;
|
||||||
|
* TEST: C o = new C(); o.m() ==> LinkageError;
|
||||||
|
*/
|
||||||
|
// disabling this test for REFLECTION and INVOKE for now until
|
||||||
|
// loader constraint issue associated with those modes has been resolved
|
||||||
|
@NotApplicableFor(modes = { REFLECTION, INVOKE_WITH_ARGS, INVOKE_EXACT, INVOKE_GENERIC, INDY })
|
||||||
|
public void testLoaderConstraint() throws Exception{
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
ConcreteClass A = b.clazz("A").build();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()LA;").returnsNewInstance(A).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()LA;").throws_(LinkageError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()LA;").throws_(LinkageError.class).done()
|
||||||
|
|
||||||
|
.prepare(new TestBuilder.LoaderConstructor() {
|
||||||
|
@Override
|
||||||
|
public MemoryClassLoader construct(Map<String, byte[]> classFiles) {
|
||||||
|
final byte[] cfI = classFiles.get("I");
|
||||||
|
final byte[] cfC = classFiles.get("C");
|
||||||
|
final byte[] cfA = classFiles.get("A");
|
||||||
|
final byte[] cfT1 = classFiles.get("Test1_I_C_m");
|
||||||
|
final byte[] cfT2 = classFiles.get("Test2_C_C_m");
|
||||||
|
|
||||||
|
final ClassLoader l1 = new ClassLoader() {
|
||||||
|
@Override
|
||||||
|
protected Class<?> findClass(String name) throws ClassNotFoundException {
|
||||||
|
switch (name) {
|
||||||
|
case "I":
|
||||||
|
return defineClass(name, cfI, 0, cfI.length);
|
||||||
|
case "A":
|
||||||
|
return defineClass(name, cfA, 0, cfA.length);
|
||||||
|
default:
|
||||||
|
throw new ClassNotFoundException(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
final MemoryClassLoader l2 = new MemoryClassLoader(classFiles) {
|
||||||
|
@Override
|
||||||
|
public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
|
||||||
|
if ("I".equals(name)) {
|
||||||
|
return l1.loadClass(name);
|
||||||
|
} else {
|
||||||
|
return super.loadClass(name, resolve);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Need to preload classes, otherwise A will be resolved in the same loader
|
||||||
|
l1.loadClass("A"); l1.loadClass("I");
|
||||||
|
l2.loadClass("A"); l2.loadClass("C");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new TestFailure(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return l2;
|
||||||
|
}
|
||||||
|
}).run();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,590 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vm.runtime.defmeth;
|
||||||
|
|
||||||
|
import nsk.share.test.TestBase;
|
||||||
|
import vm.runtime.defmeth.shared.DefMethTest;
|
||||||
|
import vm.runtime.defmeth.shared.annotation.KnownFailure;
|
||||||
|
import vm.runtime.defmeth.shared.annotation.NotApplicableFor;
|
||||||
|
import vm.runtime.defmeth.shared.data.*;
|
||||||
|
import static vm.runtime.defmeth.shared.data.method.body.CallMethod.Invoke.*;
|
||||||
|
import static vm.runtime.defmeth.shared.data.method.body.CallMethod.IndexbyteOp.*;
|
||||||
|
import vm.runtime.defmeth.shared.builder.TestBuilder;
|
||||||
|
import static vm.runtime.defmeth.shared.ExecutionMode.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests on conflicting defaults.
|
||||||
|
*
|
||||||
|
* It is allowable to inherit a default through multiple paths (such as
|
||||||
|
* through a diamond-shaped interface hierarchy), but the resolution procedure
|
||||||
|
* is looking for a unique, most specific default-providing interface.
|
||||||
|
*
|
||||||
|
* If one default shadows another (where a subinterface provides a different
|
||||||
|
* default for an extension method declared in a superinterface), then the less
|
||||||
|
* specific interface is pruned from consideration no matter where it appears
|
||||||
|
* in the inheritance hierarchy. If two or more extended interfaces provide
|
||||||
|
* default implementations, and one is not a superinterface of the other, then
|
||||||
|
* neither is used and a linkage exception is thrown indicating conflicting
|
||||||
|
* default implementations.
|
||||||
|
*/
|
||||||
|
public class ConflictingDefaultsTest extends DefMethTest {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
TestBase.runTest(new ConflictingDefaultsTest(), args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Conflict
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J { int m() default { return 2; } }
|
||||||
|
* class C implements I, J {}
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); c.m() ==> ICCE
|
||||||
|
*/
|
||||||
|
public void testConflict() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I,J).build();
|
||||||
|
|
||||||
|
b.test().callSite(C, C, "m","()I")
|
||||||
|
.throws_(IncompatibleClassChangeError.class)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Maximally-specific Default (0.6.3 spec change)
|
||||||
|
*
|
||||||
|
* interface I { int m(); }
|
||||||
|
* interface J { int m() default { return 2; } }
|
||||||
|
* class C implements I, J {}
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); c.m() return 2
|
||||||
|
*/
|
||||||
|
public void testMaximallySpecificDefault() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I,J).build();
|
||||||
|
|
||||||
|
b.test().callSite(C, C, "m","()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reabstract
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J extends I { int m(); }
|
||||||
|
* class C implements J {}
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); c.m() ==> AME
|
||||||
|
*/
|
||||||
|
public void testReabstract() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J).build();
|
||||||
|
|
||||||
|
b.test().callSite(C, C, "m","()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reabstract2
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J extends I { int m(); }
|
||||||
|
* class C implements J {}
|
||||||
|
* class D extends C { callSuper C.m}
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); c.m() ==> AME
|
||||||
|
* TEST: J j = new C(); j.m() ==> AME
|
||||||
|
* TEST: I i = new C(); i.m() ==> AME
|
||||||
|
* TEST: D d = new D(); d.m() ==> callSuper C.m ==> AME
|
||||||
|
*/
|
||||||
|
public void testReabstract2() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J).build();
|
||||||
|
ConcreteClass D = b.clazz("D").extend(C)
|
||||||
|
.concreteMethod("m", "()I").callSuper(C, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(C, C, "m","()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
.test().callSite(J, C, "m","()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
.test().callSite(I, C, "m","()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
.test().callSite(D, D, "m","()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ReabstractConflictingDefaults
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J { int m() default { return 2; } }
|
||||||
|
* interface K extends I,J { int m(); }
|
||||||
|
* class A implements I,J {}
|
||||||
|
* class C extends A implements K {}
|
||||||
|
*
|
||||||
|
* TEST: A c = new C(); c.m() ==> AME
|
||||||
|
*/
|
||||||
|
public void testReabstractConflictingDefaults() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface K = b.intf("K").extend(I,J)
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass A = b.clazz("A").implement(I,J).build();
|
||||||
|
ConcreteClass C = b.clazz("C").extend(A).implement(K).build();
|
||||||
|
|
||||||
|
b.test().callSite(A, C, "m","()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ReabstractConflictingDefaultsInvokeInterface
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J { int m() default { return 2; } }
|
||||||
|
* interface K extends I,J { int m(); }
|
||||||
|
* interface L extends K { }
|
||||||
|
* class A implements I,J {}
|
||||||
|
* class C extends A implements K {}
|
||||||
|
* class D extends C implements L {}
|
||||||
|
*
|
||||||
|
* TEST: I i = new A(); i.m() ==> ICCE
|
||||||
|
* TEST: K k = new C(); k.m() ==> AME
|
||||||
|
* TEST: L l = new D(); l.m() ==> AME
|
||||||
|
*/
|
||||||
|
public void testReabstractConflictingDefaultsInvokeInterface() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface K = b.intf("K").extend(I,J)
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface L = b.intf("L").extend(K)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass A = b.clazz("A").implement(I,J).build();
|
||||||
|
ConcreteClass C = b.clazz("C").extend(A).implement(K).build();
|
||||||
|
ConcreteClass D = b.clazz("D").extend(C).implement(L).build();
|
||||||
|
|
||||||
|
b.test().callSite(I, A, "m","()I")
|
||||||
|
.throws_(IncompatibleClassChangeError.class)
|
||||||
|
.done()
|
||||||
|
.test().callSite(K, C, "m","()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
.test().callSite(L, D, "m","()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ReabstractConflictingDefaultsSuper
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J { int m() default { return 2; } }
|
||||||
|
* interface K extends I,J { int m(); }
|
||||||
|
* interface L extends K { }
|
||||||
|
* class A implements I,J {}
|
||||||
|
* class C extends A implements K {}
|
||||||
|
* class D extends C implements L {int m() {callSuper A.m }
|
||||||
|
*
|
||||||
|
* TEST: I i = new A(); i.m() ==> ICCE
|
||||||
|
* TEST: K k = new C(); CallSuper k.m() ==> AME
|
||||||
|
* TEST: L l = new D(); l.m() ==> AME
|
||||||
|
*/
|
||||||
|
public void testReabstractConflictingDefaultsSuper() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface K = b.intf("K").extend(I,J)
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface L = b.intf("L").extend(K)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass A = b.clazz("A").implement(I,J).build();
|
||||||
|
ConcreteClass C = b.clazz("C").extend(A).implement(K).build();
|
||||||
|
ConcreteClass D = b.clazz("D").extend(C).implement(L)
|
||||||
|
.concreteMethod("m", "()I").callSuper(A, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(I, A, "m","()I")
|
||||||
|
.throws_(IncompatibleClassChangeError.class)
|
||||||
|
.done()
|
||||||
|
.test().callSite(L, D, "m","()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testReabstractResolveMethod00705m2
|
||||||
|
*
|
||||||
|
* Test case for JDK-8027804: JCK resolveMethod test fails expecting AME
|
||||||
|
*
|
||||||
|
* This test is an extension of the JCK test resolveMethod00705m2
|
||||||
|
* with additional invoke* bytecodes specified for testing purposes.
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J implements I { int m(); }
|
||||||
|
* class A implements J,I {}
|
||||||
|
* class C extends A {}
|
||||||
|
*
|
||||||
|
* TEST: A a = new C(); a.m() ==> AME (invokevirtual)
|
||||||
|
* C c = new C(); c.m() ==> AME (invokevirtual)
|
||||||
|
* J j = new C(); j.m() ==> AME (invokeinterface)
|
||||||
|
* I i = new C(); i.m() ==> AME (invokeinterface)
|
||||||
|
* c.test_Cmethod_ISMR(); c.super.m() ==> AME (invokespecial MR)
|
||||||
|
* a.test_Amethod_ISIMR(); j.super.m() ==> AME (invokespecial IMR)
|
||||||
|
*
|
||||||
|
* For ver > 49, error will be AME
|
||||||
|
* For ver = 49, error will be VE
|
||||||
|
*/
|
||||||
|
|
||||||
|
@NotApplicableFor(modes = { REDEFINITION }) // Can't redefine a class that gets error during loading
|
||||||
|
public void testReabstractResolveMethod00705m2() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass A = b.clazz("A").implement(J,I)
|
||||||
|
.concreteMethod("test_Amethod_ISIMR", "()V")
|
||||||
|
.invoke(SPECIAL, b.clazzByName("J"), b.clazzByName("A"),
|
||||||
|
"m", "()I", INTERFACEMETHODREF)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").extend(A)
|
||||||
|
.concreteMethod("test_Cmethod_ISMR", "()V")
|
||||||
|
.invoke(SPECIAL, b.clazzByName("C"), b.clazzByName("C"),
|
||||||
|
"m", "()I", CALLSITE)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Class expectedError1, expectedError2;
|
||||||
|
if (factory.getVer() >=52) {
|
||||||
|
expectedError1 = expectedError2 = AbstractMethodError.class;
|
||||||
|
} else {
|
||||||
|
expectedError1 = expectedError2 = VerifyError.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
b.test().callSite(A, C, "m", "()I")
|
||||||
|
.throws_(expectedError2)
|
||||||
|
.done()
|
||||||
|
.test().callSite(C, C, "m", "()I")
|
||||||
|
.throws_(expectedError2)
|
||||||
|
.done()
|
||||||
|
.test().callSite(J, C, "m", "()I")
|
||||||
|
.throws_(expectedError1)
|
||||||
|
.done()
|
||||||
|
.test().callSite(I, C, "m", "()I")
|
||||||
|
.throws_(expectedError1)
|
||||||
|
.done()
|
||||||
|
.test().callSite(C, C, "test_Cmethod_ISMR", "()V")
|
||||||
|
.throws_(expectedError2)
|
||||||
|
.done()
|
||||||
|
.test().callSite(A, C, "test_Amethod_ISIMR", "()V")
|
||||||
|
.throws_(expectedError2)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Shadow
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J extends I { int m() default { return 2; } }
|
||||||
|
* class C implements J {}
|
||||||
|
*
|
||||||
|
* TEST: [I|J|C] c = new C(); c.m() == 2;
|
||||||
|
*/
|
||||||
|
public void testShadow() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J).build();
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m","()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(J, C, "m","()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m","()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Disqualified
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J extends I { int m() default { return 2; } }
|
||||||
|
* class C implements I, J {}
|
||||||
|
*
|
||||||
|
* TEST: [I|J|C] c = new C(); c.m() == 2;
|
||||||
|
*/
|
||||||
|
public void testDisqualified() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I,J).build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(I, C, "m","()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(J, C, "m","()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m","()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Mixed arity
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J { int m(int i) default { return 2; } }
|
||||||
|
* class C implements I, J {}
|
||||||
|
*
|
||||||
|
* TEST: I i = new C(); i.m() == 1; i.m(0) ==> NSME
|
||||||
|
* TEST: J j = new C(); j.m() ==> NSME; j.m(0) == 2
|
||||||
|
* TEST: C c = new C(); c.m() == 1; c.m(0) == 2
|
||||||
|
*/
|
||||||
|
@KnownFailure(modes = { INVOKE_EXACT, INVOKE_GENERIC, INDY }) // IncompatibleClassChangeError instead of NoSuchMethodError
|
||||||
|
public void testMixedArity1() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "(I)I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I,J).build();
|
||||||
|
|
||||||
|
// I i = new C(); ...
|
||||||
|
b.test()
|
||||||
|
.callSite(I, C, "m","()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(I, C, "m","(I)I")
|
||||||
|
.params(0)
|
||||||
|
.throws_(NoSuchMethodError.class)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
// J j = new C(); ...
|
||||||
|
.test()
|
||||||
|
.callSite(J, C, "m","()I")
|
||||||
|
.throws_(NoSuchMethodError.class)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(J, C, "m","(I)I")
|
||||||
|
.params(0)
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
// C c = new C(); ...
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m","()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m","(I)I")
|
||||||
|
.params(0)
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Mixed arity
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J { int m() default { return 2; } }
|
||||||
|
* class C implements I, J { int m(int i) { return 3; }}
|
||||||
|
*
|
||||||
|
* TEST: I i = new C(); i.m() ==> ICCE
|
||||||
|
* TEST: J j = new C(); j.m() ==> ICCE
|
||||||
|
* TEST: C c = new C(); c.m() ==> ICCE; c.m(0) == 3
|
||||||
|
*/
|
||||||
|
public void testMixedArity2() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I,J)
|
||||||
|
.concreteMethod("m", "(I)I").returns(3).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// I i = new C(); ...
|
||||||
|
b.test()
|
||||||
|
.callSite(I, C, "m","()I")
|
||||||
|
.throws_(IncompatibleClassChangeError.class)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
// J j = new C(); ...
|
||||||
|
.test()
|
||||||
|
.callSite(J, C, "m","()I")
|
||||||
|
.throws_(IncompatibleClassChangeError.class)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
// C c = new C(); ...
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m","()I")
|
||||||
|
.throws_(IncompatibleClassChangeError.class)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m","(I)I")
|
||||||
|
.params(0)
|
||||||
|
.returns(3)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,526 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vm.runtime.defmeth;
|
||||||
|
|
||||||
|
import nsk.share.test.TestBase;
|
||||||
|
import vm.runtime.defmeth.shared.DefMethTest;
|
||||||
|
import vm.runtime.defmeth.shared.annotation.KnownFailure;
|
||||||
|
import vm.runtime.defmeth.shared.data.*;
|
||||||
|
import vm.runtime.defmeth.shared.data.method.param.NewInstanceParam;
|
||||||
|
import vm.runtime.defmeth.shared.builder.TestBuilder;
|
||||||
|
import static vm.runtime.defmeth.shared.ExecutionMode.*;
|
||||||
|
import static vm.runtime.defmeth.shared.data.method.body.CallMethod.Invoke.*;
|
||||||
|
import static vm.runtime.defmeth.shared.data.method.body.CallMethod.IndexbyteOp.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests on interaction of default methods with abstract methods
|
||||||
|
*
|
||||||
|
* The rule: "the superclass always wins."
|
||||||
|
*
|
||||||
|
* In searching the superclass hierarchy, a declaration in a superclass is
|
||||||
|
* preferred to a default in an interface. This preference includes abstract
|
||||||
|
* methods in superclasses as well; the defaults are only considered when
|
||||||
|
* the entire implementation hierarchy is silent on the status of the method
|
||||||
|
* in question.
|
||||||
|
*/
|
||||||
|
public class DefaultVsAbstractTest extends DefMethTest {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
TestBase.runTest(new DefaultVsAbstractTest(), args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* interface I { public int m() default { return 1; } }
|
||||||
|
* class C implements I { public abstract int m(); }
|
||||||
|
*
|
||||||
|
* TEST: new C() throws InstantiationError
|
||||||
|
*/
|
||||||
|
public void test0() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I)
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(I, C, "m", "()I")
|
||||||
|
.throws_(InstantiationError.class)
|
||||||
|
.done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* interface I {
|
||||||
|
* public int m() default { return 1; }
|
||||||
|
* }
|
||||||
|
* class C implements I {
|
||||||
|
* public abstract int m();
|
||||||
|
* }
|
||||||
|
* class D extends C {}
|
||||||
|
*
|
||||||
|
* TEST: I i = new D(); i.m() ==> AME
|
||||||
|
* TEST: C c = new D(); c.m() ==> AME
|
||||||
|
* TEST: D d = new D(); d.m() ==> AME
|
||||||
|
*/
|
||||||
|
@KnownFailure(modes = {INVOKE_EXACT, INVOKE_GENERIC, INVOKE_WITH_ARGS, INDY }) // Test1_I_D_m: NPE instead of AME
|
||||||
|
// Test3_D_D_m: AME => IAE => ICCE instead of AME
|
||||||
|
public void test1() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I)
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass D = b.clazz("D").extend(C).build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(I, D, "m", "()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, D, "m", "()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(D, D, "m", "()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* interface I {
|
||||||
|
* default public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
* class C {
|
||||||
|
* abstract public int m();
|
||||||
|
* }
|
||||||
|
* class D extends C implements I {}
|
||||||
|
*
|
||||||
|
* TEST: I o = new D(); o.m()I throws AME
|
||||||
|
* TEST: C o = new D(); o.m()I throws AME
|
||||||
|
* TEST: D o = new D(); o.m()I throws AME
|
||||||
|
*/
|
||||||
|
@KnownFailure(modes = { INVOKE_EXACT, INVOKE_GENERIC, INVOKE_WITH_ARGS, INDY }) // Test1_I_D_m: NPE instead of AME
|
||||||
|
// Test3_D_D_m: AME => IAE => ICCE instead of AME
|
||||||
|
public void test2() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C")
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass D = b.clazz("D").extend(C).implement(I).build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(I, D, "m", "()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, D, "m", "()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(D, D, "m", "()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* interface I {
|
||||||
|
* default public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
* class C {
|
||||||
|
* abstract public int m();
|
||||||
|
* }
|
||||||
|
* class D extends C implements I {
|
||||||
|
* public int m() { return 2; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* TEST: I o = new D(); o.m()I == 2
|
||||||
|
* TEST: C o = new D(); o.m()I == 2
|
||||||
|
* TEST: D o = new D(); o.m()I == 2
|
||||||
|
*/
|
||||||
|
public void test3() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C")
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass D = b.clazz("D").extend(C).implement(I)
|
||||||
|
.concreteMethod("m", "()I").returns(2)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test() // I i = new D(); ...
|
||||||
|
.callSite(I, D, "m", "()I").returns(2)
|
||||||
|
.done()
|
||||||
|
.test() // C c = new D(); ...
|
||||||
|
.callSite(C, D, "m", "()I").returns(2)
|
||||||
|
.done()
|
||||||
|
.test() // D d = new C(); ...
|
||||||
|
.callSite(D, D, "m", "()I").returns(2)
|
||||||
|
.done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* interface I {
|
||||||
|
* default public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
* class E {
|
||||||
|
* abstract public int m();
|
||||||
|
* }
|
||||||
|
* class D extends E {}
|
||||||
|
* class C extends D implements I {}
|
||||||
|
*
|
||||||
|
* TEST: I o = new C(); o.m()I throws AME
|
||||||
|
* TEST: E o = new C(); o.m()I throws AME
|
||||||
|
* TEST: D o = new C(); o.m()I throws AME
|
||||||
|
* TEST: C o = new C(); o.m()I throws AME
|
||||||
|
*/
|
||||||
|
@KnownFailure(modes = {
|
||||||
|
INVOKE_EXACT, INVOKE_GENERIC, INVOKE_WITH_ARGS, INDY // Test1_I_C_m: NPE instead of AME
|
||||||
|
// Test3_D_C_m: AME => IAE => ICCE instead of AME
|
||||||
|
// Test4_C_C_m: AME => IAE => ICCE instead of AME
|
||||||
|
})
|
||||||
|
public void test4() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass E = b.clazz("E")
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass D = b.clazz("D").extend(E).build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").extend(D).implement(I).build();
|
||||||
|
|
||||||
|
b.test() // I i = new C(); ...
|
||||||
|
.callSite(I, C, "m", "()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
.test() // E e = new C(); ...
|
||||||
|
.callSite(E, C, "m", "()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
.test() // D d = new C(); ...
|
||||||
|
.callSite(D, C, "m", "()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
.test() // C c = new C(); ...
|
||||||
|
.callSite(C, C, "m", "()I")
|
||||||
|
.throws_(AbstractMethodError.class)
|
||||||
|
.done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* interface I {
|
||||||
|
* default public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
* class E {
|
||||||
|
* abstract public int m();
|
||||||
|
* }
|
||||||
|
* class D extends E {
|
||||||
|
* public int m() { return 2; }
|
||||||
|
* }
|
||||||
|
* class C extends D implements I {}
|
||||||
|
*
|
||||||
|
* TEST: I o = new C(); o.m()I == 2
|
||||||
|
* TEST: I o = new C(); o.m()I == 2
|
||||||
|
* TEST: I o = new C(); o.m()I == 2
|
||||||
|
* TEST: I o = new C(); o.m()I == 2
|
||||||
|
*/
|
||||||
|
public void test5() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass E = b.clazz("E")
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass D = b.clazz("D").extend(E)
|
||||||
|
.concreteMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").extend(D).implement(I).build();
|
||||||
|
|
||||||
|
b.test() // I i = new C(); ...
|
||||||
|
.callSite(I, C, "m", "()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
.test() // E e = new C(); ...
|
||||||
|
.callSite(I, C, "m", "()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
.test() // D d = new C(); ...
|
||||||
|
.callSite(I, C, "m", "()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
.test() // C c = new C(); ...
|
||||||
|
.callSite(I, C, "m", "()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* interface I {
|
||||||
|
* default public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
* interface J {
|
||||||
|
* default public int m() { return 2; }
|
||||||
|
* }
|
||||||
|
* class E {
|
||||||
|
* abstract public int m();
|
||||||
|
* }
|
||||||
|
* class D extends E {
|
||||||
|
* public int m() { return 3; }
|
||||||
|
* }
|
||||||
|
* class C extends D implements I, J {}
|
||||||
|
*
|
||||||
|
* TEST: I o = new C(); o.m()I == 3
|
||||||
|
* TEST: J o = new C(); o.m()I == 3
|
||||||
|
* TEST: E o = new C(); o.m()I == 3
|
||||||
|
* TEST: D o = new C(); o.m()I == 3
|
||||||
|
* TEST: J o = new C(); o.m()I == 3
|
||||||
|
*/
|
||||||
|
public void test6() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass E = b.clazz("E")
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass D = b.clazz("D").extend(E)
|
||||||
|
.concreteMethod("m", "()I").returns(3).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").extend(D).implement(I, J).build();
|
||||||
|
|
||||||
|
|
||||||
|
b.test() // I i = new C(); ...
|
||||||
|
.callSite(I, C, "m", "()I").returns(3)
|
||||||
|
.done()
|
||||||
|
.test() // J j = new C(); ...
|
||||||
|
.callSite(J, C, "m", "()I").returns(3)
|
||||||
|
.done()
|
||||||
|
.test() // E e = new C(); ...
|
||||||
|
.callSite(E, C, "m", "()I").returns(3)
|
||||||
|
.done()
|
||||||
|
.test() // D d = new C(); ...
|
||||||
|
.callSite(D, C, "m", "()I").returns(3)
|
||||||
|
.done()
|
||||||
|
.test() // C c = new C(); ...
|
||||||
|
.callSite(J, C, "m", "()I").returns(3)
|
||||||
|
.done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* interface I {
|
||||||
|
* abstract public int m();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* interface J {
|
||||||
|
* default public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class A implements I;
|
||||||
|
*
|
||||||
|
* class B extends A implements J;
|
||||||
|
*
|
||||||
|
* TEST: A o = new B(); o.m()I
|
||||||
|
* returns 1 for REFLECTION and INVOKE_WITH_ARGS
|
||||||
|
* ICCE for other modes
|
||||||
|
*/
|
||||||
|
public void testInvokeInterfaceClassDefaultMethod() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.extend(I)
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass A = b.clazz("A").implement(I).build();
|
||||||
|
|
||||||
|
ConcreteClass B = b.clazz("B").extend(A).implement(J).build();
|
||||||
|
|
||||||
|
String exeMode = factory.getExecutionMode();
|
||||||
|
|
||||||
|
// the test passes in the reflection mode because there's no way to
|
||||||
|
// express invokeinterface on a class using Reflection API
|
||||||
|
// In the test generator, vm.runtime.defmeth.shared.executor.ReflectionTest,
|
||||||
|
// the invokeinterface is switched to invokevirtual.
|
||||||
|
//
|
||||||
|
// the test passes in the INVOKE_WITH_ARGS mode due to the fix for
|
||||||
|
// JDK-8032010 to conform with the removal of the following check
|
||||||
|
// during method resolution in JVMS-5.4.3.3 Method Resolution
|
||||||
|
// "If method lookup succeeds and the method is abstract, but C is not
|
||||||
|
// abstract, method resolution throws an AbstractMethodError."
|
||||||
|
if (exeMode.equals("REFLECTION") ||
|
||||||
|
exeMode.equals("INVOKE_WITH_ARGS")) {
|
||||||
|
b.test().interfaceCallSite(A, B, "m", "()I")
|
||||||
|
.returns(1).done()
|
||||||
|
.run();
|
||||||
|
} else {
|
||||||
|
// ICCE in other modes due to
|
||||||
|
// JVMS-5.4.3.4. Interface Method Resolution
|
||||||
|
// When resolving an interface method reference:
|
||||||
|
// If C is not an interface, interface method resolution throws an IncompatibleClassChangeError.
|
||||||
|
b.test().interfaceCallSite(A, B, "m", "()I")
|
||||||
|
.throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* interface I {
|
||||||
|
* abstract public int m();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* interface J {
|
||||||
|
* abstract public int m();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class A implements I;
|
||||||
|
*
|
||||||
|
* class B extends A implements J;
|
||||||
|
*
|
||||||
|
* TEST: A o = new B(); o.m()I
|
||||||
|
* ICCE for DIRECT mode
|
||||||
|
* AME for REFLECTION and INVOKE_WITH_ARGS modes
|
||||||
|
* IAE for other modes
|
||||||
|
*/
|
||||||
|
public void testInvokeInterfaceClassAbstractMethod() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass A = b.clazz("A").implement(I).build();
|
||||||
|
|
||||||
|
ConcreteClass B = b.clazz("B").extend(A).implement(J).build();
|
||||||
|
|
||||||
|
String exeMode = factory.getExecutionMode();
|
||||||
|
|
||||||
|
// ICCE in direct mode due to
|
||||||
|
// JVMS-5.4.3.4. Interface Method Resolution
|
||||||
|
// When resolving an interface method reference:
|
||||||
|
// If C is not an interface, interface method resolution throws an IncompatibleClassChangeError.
|
||||||
|
Class expectedError = IncompatibleClassChangeError.class;;
|
||||||
|
|
||||||
|
b.test().interfaceCallSite(A, B, "m", "()I")
|
||||||
|
.throws_(expectedError).done()
|
||||||
|
.run();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* interface I {
|
||||||
|
* public int m() default { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* interface J {
|
||||||
|
* public int m() default { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class A implements I;
|
||||||
|
*
|
||||||
|
* class B extends A implements J;
|
||||||
|
*
|
||||||
|
* TEST: A o = new B(); o.m()I
|
||||||
|
* ICCE for all modes
|
||||||
|
*/
|
||||||
|
public void testInvokeInterfaceMultipleDefinedClassDefaultMethod() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass A = b.clazz("A").implement(I).build();
|
||||||
|
|
||||||
|
ConcreteClass B = b.clazz("B").extend(A).implement(J).build();
|
||||||
|
|
||||||
|
String exeMode = factory.getExecutionMode();
|
||||||
|
|
||||||
|
// ICCE in direct mode due to
|
||||||
|
// JVMS-5.4.3.4. Interface Method Resolution
|
||||||
|
// When resolving an interface method reference:
|
||||||
|
// If C is not an interface, interface method resolution throws an IncompatibleClassChangeError.
|
||||||
|
Class expectedError = IncompatibleClassChangeError.class;
|
||||||
|
|
||||||
|
b.test().interfaceCallSite(A, B, "m", "()I")
|
||||||
|
.throws_(expectedError).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,904 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vm.runtime.defmeth;
|
||||||
|
|
||||||
|
import nsk.share.test.TestBase;
|
||||||
|
import vm.runtime.defmeth.shared.annotation.KnownFailure;
|
||||||
|
import vm.runtime.defmeth.shared.data.*;
|
||||||
|
import vm.runtime.defmeth.shared.data.method.param.*;
|
||||||
|
import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||||
|
import vm.runtime.defmeth.shared.DefMethTest;
|
||||||
|
import vm.runtime.defmeth.shared.builder.TestBuilder;
|
||||||
|
import static vm.runtime.defmeth.shared.ExecutionMode.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests on method resolution in presence of default methods in the hierarchy.
|
||||||
|
*
|
||||||
|
* Because default methods reside in interfaces, and interfaces do not have
|
||||||
|
* the constraint of being single-inheritance, it is possible to inherit
|
||||||
|
* multiple conflicting default methods, or even inherit the same default method
|
||||||
|
* from many different inheritance paths.
|
||||||
|
*
|
||||||
|
* There is an algorithm to select which method to use in the case that a
|
||||||
|
* concrete class does not provide an implementation. Informally, the algorithm
|
||||||
|
* works as follows:
|
||||||
|
*
|
||||||
|
* (1) If there is a adequate implementation in the class itself or in a
|
||||||
|
* superclass (not an interface), then that implementation should be used
|
||||||
|
* (i.e., class methods always "win").
|
||||||
|
*
|
||||||
|
* (2) Failing that, create the set of methods consisting of all methods in the
|
||||||
|
* type hierarchy which satisfy the slot to be filled, where in this case
|
||||||
|
* 'satisfy' means that the methods have the same name, the same language-
|
||||||
|
* level representation of the parameters, and covariant return values. Both
|
||||||
|
* default methods and abstract methods will be part of this set.
|
||||||
|
*
|
||||||
|
* (3) Remove from this set, any method which has a "more specific" version
|
||||||
|
* anywhere in the hierarchy. That is, if C implements I,J and I extends J,
|
||||||
|
* then if both I and J have a suitable methods, J's method is eliminated
|
||||||
|
* from the set since I is a subtype of J -- there exist a more specific
|
||||||
|
* method than J's method, so that is eliminated.
|
||||||
|
*
|
||||||
|
* (4) If the remaining set contains only a single entry, then that method is
|
||||||
|
* selected. Note that the method may be abstract, in which case an
|
||||||
|
* IncompatibleClassChangeError is thrown when/if the method is called. If there are
|
||||||
|
* multiple entries in the set, or no entries, then this also results in an
|
||||||
|
* IncompatibleClassChangeError when called.
|
||||||
|
*/
|
||||||
|
public class MethodResolutionTest extends DefMethTest {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
TestBase.runTest(new MethodResolutionTest(), args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Basic
|
||||||
|
*
|
||||||
|
* interface I { int m(); }
|
||||||
|
* class C implements I { public int m() { return 1; } }
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); c.m() == 1;
|
||||||
|
* TEST: I i = new C(); i.m() == 1;
|
||||||
|
*/
|
||||||
|
public void testBasic() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I =
|
||||||
|
b.intf("I")
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C =
|
||||||
|
b.clazz("C").implement(I)
|
||||||
|
.concreteMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(I, C, "m", "()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m", "()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Basic Default
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* class C implements I {}
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); c.m() == 1;
|
||||||
|
* TEST: I i = new C(); i.m() == 1;
|
||||||
|
*/
|
||||||
|
public void testBasicDefault() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I =
|
||||||
|
b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C =
|
||||||
|
b.clazz("C").implement(I)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(I, C, "m", "()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test().callSite(C, C, "m", "()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Far Default
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J extends I {}
|
||||||
|
* interface K extends J {}
|
||||||
|
* class C implements K {}
|
||||||
|
*
|
||||||
|
* TEST: [I|J|K|C] i = new C(); i.m() == 1;
|
||||||
|
*/
|
||||||
|
@KnownFailure(modes = { INVOKE_EXACT, INVOKE_GENERIC, INVOKE_WITH_ARGS, INDY }) // Test2_J_C_m, Test3_K_C_m: AME => IAE => ICCE instead of successful call
|
||||||
|
public void testFarDefault() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I =
|
||||||
|
b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I).build();
|
||||||
|
Interface K = b.intf("K").extend(J).build();
|
||||||
|
|
||||||
|
ConcreteClass C =
|
||||||
|
b.clazz("C").implement(K)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(I, C, "m", "()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test().callSite(J, C, "m", "()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test().callSite(K, C, "m", "()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test().callSite(C, C, "m", "()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Override Abstract
|
||||||
|
*
|
||||||
|
* interface I { int m(); }
|
||||||
|
* interface J extends I { int m() default { return 1; } }
|
||||||
|
* interface K extends J {}
|
||||||
|
* class C implements K {}
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); c.m() == 1;
|
||||||
|
* TEST: K k = new C(); k.m() == 1;
|
||||||
|
*/
|
||||||
|
@KnownFailure(modes = { INVOKE_EXACT, INVOKE_GENERIC, INVOKE_WITH_ARGS, INDY }) // Test3_K_C_m: AME => IAE => ICCE instead of successful call
|
||||||
|
public void testOverrideAbstract() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface K = b.intf("K").extend(J).build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(K).build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(I, C, "m", "()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(J, C, "m", "()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(K, C, "m", "()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m", "()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Default vs Concrete
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* class C implements I { public int m() { return 2; } }
|
||||||
|
*
|
||||||
|
* TEST: [C|I] c = new C(); c.m() == 2;
|
||||||
|
*/
|
||||||
|
public void testDefaultVsConcrete() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I)
|
||||||
|
.concreteMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(I, C, "m", "()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m", "()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* InheritedDefault
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* class B implements I {}
|
||||||
|
* class C extends B {}
|
||||||
|
*
|
||||||
|
* TEST: [I|B|C] v = new C(); v.m() == 1;
|
||||||
|
*/
|
||||||
|
public void testInheritedDefault() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass B = b.clazz("B").implement(I).build();
|
||||||
|
ConcreteClass C = b.clazz("C").extend(B).build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(I, C, "m","()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(B, C, "m","()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m","()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ExistingInherited
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* class B { public int m() { return 2; } }
|
||||||
|
* class C extends B implements I {}
|
||||||
|
*
|
||||||
|
* TEST: [I|B|C] v = new C(); v.m() == 2;
|
||||||
|
*/
|
||||||
|
public void testExistingInherited() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass B = b.clazz("B")
|
||||||
|
.concreteMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").extend(B).implement(I).build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(I, C, "m","()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(B, C, "m","()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m","()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ExistingInheritedOverride
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* class B implements I { public int m() { return 2; } }
|
||||||
|
* class C extends B { public int m() { return 3; } }
|
||||||
|
*
|
||||||
|
* TEST: [I|B|D] v = new C(); v.m() == 3;
|
||||||
|
*/
|
||||||
|
public void testExistingInheritedOverride() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass B = b.clazz("B").implement(I)
|
||||||
|
.concreteMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").extend(B)
|
||||||
|
.concreteMethod("m", "()I").returns(3).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(I, C, "m","()I")
|
||||||
|
.returns(3)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(B, C, "m","()I")
|
||||||
|
.returns(3)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m","()I")
|
||||||
|
.returns(3)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ExistingInheritedPlusDefault
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 11; } }
|
||||||
|
* interface J { int m() default { return 12; } }
|
||||||
|
* class C implements I { public int m() { return 21; } }
|
||||||
|
* class D extends C { public int m() { return 22; } }
|
||||||
|
* class E extends D implements J {}
|
||||||
|
*
|
||||||
|
* TEST: [I|J|C|D|J] v = new E(); v.m() == 22;
|
||||||
|
*/
|
||||||
|
public void testExistingInheritedPlusDefault() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(11).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "()I").returns(12).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I)
|
||||||
|
.concreteMethod("m","()I").returns(21).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass D = b.clazz("D").extend(C)
|
||||||
|
.concreteMethod("m", "()I").returns(22).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass E = b.clazz("E").extend(D).implement(J)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(I, E, "m","()I")
|
||||||
|
.returns(22)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(J, E, "m","()I")
|
||||||
|
.returns(22)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, E, "m","()I")
|
||||||
|
.returns(22)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(D, E, "m","()I")
|
||||||
|
.returns(22)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(E, E, "m","()I")
|
||||||
|
.returns(22)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* InheritedWithConcrete
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* class B implements I {}
|
||||||
|
* class C extends B { public int m() { return 2; } }
|
||||||
|
*
|
||||||
|
* TEST: [I|B|C] v = new C(); v.m() == 2;
|
||||||
|
*/
|
||||||
|
public void testInheritedWithConcrete() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass B = b.clazz("B").implement(I).build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").extend(B)
|
||||||
|
.concreteMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(I, C, "m","()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(B, C, "m","()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m","()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* InheritedWithConcreteAndImpl
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* class B implements I {}
|
||||||
|
* class C extends B implements I { public int m() { return 2; } }
|
||||||
|
*
|
||||||
|
* TEST: [I|B|C] v = new C(); v.m() == 2;
|
||||||
|
*/
|
||||||
|
public void testInheritedWithConcreteAndImpl() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass B = b.clazz("B").implement(I).build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").extend(B)
|
||||||
|
.concreteMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(I, C, "m","()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(B, C, "m","()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m","()I")
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Diamond
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J extends I {}
|
||||||
|
* interface K extends I {}
|
||||||
|
* class C implements J, K {}
|
||||||
|
*
|
||||||
|
* TEST: [I|J|K|C] c = new C(); c.m() == 99
|
||||||
|
*/
|
||||||
|
@KnownFailure(modes = { INVOKE_EXACT, INVOKE_GENERIC, INVOKE_WITH_ARGS, INDY }) // Test2_J_C_m, Test3_K_C_m: AME => IAE => ICCE instead of successful call
|
||||||
|
public void testDiamond() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I).build();
|
||||||
|
Interface K = b.intf("K").extend(I).build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J,K)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(I, C, "m","()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(J, C, "m","()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(K, C, "m","()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m","()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ExpandedDiamond
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J extends I {}
|
||||||
|
* interface K extends I {}
|
||||||
|
* interface L extends I {}
|
||||||
|
* interface M extends I {}
|
||||||
|
* class C implements J, K, L, M {}
|
||||||
|
*
|
||||||
|
* TEST: [I|J|K|L|M|C] c = new C(); c.m() == 1
|
||||||
|
*/
|
||||||
|
@KnownFailure(modes = { INVOKE_EXACT, INVOKE_GENERIC, INVOKE_WITH_ARGS, INDY }) // Test2_J_C_m, Test3_K_C_m, Test4_L_C_m, Test5_M_C_m:
|
||||||
|
// AME => IAE => ICCE instead of successful call
|
||||||
|
public void testExpandedDiamond() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I).build();
|
||||||
|
Interface K = b.intf("K").extend(I).build();
|
||||||
|
Interface L = b.intf("L").extend(I).build();
|
||||||
|
Interface M = b.intf("M").extend(I).build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J,K,L,M)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(I, C, "m","()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(J, C, "m","()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(K, C, "m","()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(L, C, "m","()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(M, C, "m","()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m","()I")
|
||||||
|
.returns(1)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SelfFill w/ explicit bridge
|
||||||
|
*
|
||||||
|
* interface I<T> { int m(T t) default { return 1; } }
|
||||||
|
* class C implements I<C> {
|
||||||
|
* public int m(C s) { return 2; }
|
||||||
|
* public int m(Object o) { ... }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* TEST: I i = new C(); i.m((Object)null) == 2;
|
||||||
|
* TEST: C c = new C(); c.m((Object)null) == 2;
|
||||||
|
* TEST: C c = new C(); c.m((C)null) == 2;
|
||||||
|
*/
|
||||||
|
public void testSelfFillWithExplicitBridge() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
/* interface I<T> { ... */
|
||||||
|
Interface I = b.intf("I").sig("<T:Ljava/lang/Object;>Ljava/lang/Object;")
|
||||||
|
/* default int m(T t) { return 1; } */
|
||||||
|
.defaultMethod("m", "(Ljava/lang/Object;)I")
|
||||||
|
.sig("(TT;)I")
|
||||||
|
.returns(1)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
/* class C implements I<C> { ... */
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I)
|
||||||
|
.sig("Ljava/lang/Object;LI<LC;>;")
|
||||||
|
|
||||||
|
/* public int m(I i) { return 2; } */
|
||||||
|
.concreteMethod("m","(LC;)I").returns(2).build()
|
||||||
|
|
||||||
|
/* bridge method for m(LI;)I */
|
||||||
|
.concreteMethod("m","(Ljava/lang/Object;)I")
|
||||||
|
.flags(ACC_PUBLIC | ACC_BRIDGE | ACC_SYNTHETIC)
|
||||||
|
.returns(2)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// I i = new C(); ...
|
||||||
|
b.test()
|
||||||
|
.callSite(I, C, "m", "(Ljava/lang/Object;)I")
|
||||||
|
.params(new NullParam())
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
// C c = new C(); ...
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m", "(Ljava/lang/Object;)I")
|
||||||
|
.params(new NullParam())
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
.test()
|
||||||
|
.callSite(C, C, "m", "(LC;)I")
|
||||||
|
.params(new NullParam())
|
||||||
|
.returns(2)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* class C implements I { int m(int i) { return 2; } }
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); c.m(0) == 2;
|
||||||
|
* TEST: I i = new C(); i.m() == 1;
|
||||||
|
*/
|
||||||
|
public void testMixedArity() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I =
|
||||||
|
b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C =
|
||||||
|
b.clazz("C").implement(I)
|
||||||
|
.concreteMethod("m", "(I)I").returns(2)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()I")
|
||||||
|
.returns(1)
|
||||||
|
.build();
|
||||||
|
b.test().callSite(C, C, "m", "(I)I").params(ICONST_0)
|
||||||
|
.returns(2)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J { int m(int i) default { return 2; } }
|
||||||
|
* class C implements I, J {}
|
||||||
|
*
|
||||||
|
* TEST: I i = new C(); i.m() == 1; i.m(0) ==> NSME
|
||||||
|
* TEST: J j = new C(); j.m() ==> NSME; j.m(0) == 2
|
||||||
|
* TEST: C c = new C(); c.m() == 1; c.m(0) == 2
|
||||||
|
*/
|
||||||
|
@KnownFailure(modes = { INVOKE_EXACT, INVOKE_GENERIC, INDY }) //Test2_I_C_m, Test3_J_C_m: NSMError => NSMException => ICCE instead of NSME
|
||||||
|
public void testConflictingDefaultMixedArity1() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "(I)I").returns(2)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I,J).build();
|
||||||
|
|
||||||
|
|
||||||
|
// I i = new C(); ...
|
||||||
|
b.test().callSite(I, C, "m", "()I")
|
||||||
|
.returns(1)
|
||||||
|
.build();
|
||||||
|
b.test().callSite(I, C, "m", "(I)I").params(ICONST_0)
|
||||||
|
.throws_(NoSuchMethodError.class)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// J j = new C(); ...
|
||||||
|
b.test().callSite(J, C, "m", "()I")
|
||||||
|
.throws_(NoSuchMethodError.class)
|
||||||
|
.build();
|
||||||
|
b.test().callSite(J, C, "m", "(I)I").params(ICONST_0)
|
||||||
|
.returns(2)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// C c = new C(); ...
|
||||||
|
b.test().callSite(C, C, "m", "()I")
|
||||||
|
.returns(1)
|
||||||
|
.build();
|
||||||
|
b.test().callSite(C, C, "m", "(I)I").params(ICONST_0)
|
||||||
|
.returns(2)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J { int m() default { return 2; } }
|
||||||
|
* class C implements I, J {
|
||||||
|
* int m(int i) { return 3; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* TEST: I i = new C(); i.m(0) ==> ICCE
|
||||||
|
* TEST: J j = new C(); j.m(0) ==> ICCE
|
||||||
|
* TEST: C c = new C(); c.m() ==> ICCE; c.m(0) == 3
|
||||||
|
*/
|
||||||
|
@KnownFailure(modes = { INVOKE_EXACT, INVOKE_GENERIC, INDY })
|
||||||
|
//Test2_I_C_m, Test3_J_C_m: NSMError => NSMException => ICCE instead of NSME
|
||||||
|
public void testConflictingDefaultMixedArity2() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "()I").returns(2)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I, J)
|
||||||
|
.concreteMethod("m", "(I)I").returns(3)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// I i = new C(); ...
|
||||||
|
b.test().callSite(I, C, "m", "()I")
|
||||||
|
.throws_(IncompatibleClassChangeError.class)
|
||||||
|
.build();
|
||||||
|
b.test().callSite(I, C, "m", "(I)I").params(ICONST_0)
|
||||||
|
.throws_(NoSuchMethodError.class)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// J j = new C(); ...
|
||||||
|
b.test().callSite(J, C, "m", "()I")
|
||||||
|
.throws_(IncompatibleClassChangeError.class)
|
||||||
|
.build();
|
||||||
|
b.test().callSite(J, C, "m", "(I)I").params(ICONST_0)
|
||||||
|
.throws_(NoSuchMethodError.class)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// C c = new C(); ...
|
||||||
|
b.test().callSite(C, C, "m", "()I")
|
||||||
|
.throws_(IncompatibleClassChangeError.class)
|
||||||
|
.build();
|
||||||
|
b.test().callSite(C, C, "m", "(I)I").params(ICONST_0)
|
||||||
|
.returns(3)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* In package1:
|
||||||
|
* package p1;
|
||||||
|
* interface I {
|
||||||
|
* default int m() { return 10; };
|
||||||
|
* }
|
||||||
|
* public interface J extends I {};
|
||||||
|
*
|
||||||
|
* In package2:
|
||||||
|
* class A implements p1.J {}
|
||||||
|
* A myA = new A;
|
||||||
|
* myA.m(); // should return 10 except for reflect mode,
|
||||||
|
* // throw IllegalAccessException with reflect mode
|
||||||
|
* B myB = new B; // not related
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void testMethodResolvedInDifferentPackage() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
Interface I = b.intf("p1.I").flags(~ACC_PUBLIC & ACC_PUBLIC) // make it package private
|
||||||
|
.defaultMethod("m", "()I").returns(10)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("p1.J").extend(I)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass myA = b.clazz("p2.A").implement(J)
|
||||||
|
.build();
|
||||||
|
if (!factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
b.test()
|
||||||
|
.callSite(myA, myA, "m", "()I")
|
||||||
|
.returns(10)
|
||||||
|
.done()
|
||||||
|
.run();
|
||||||
|
// -mode reflect will fail with IAE as expected
|
||||||
|
} else {
|
||||||
|
b.test()
|
||||||
|
.callSite(myA, myA, "m", "()I")
|
||||||
|
.throws_(IllegalAccessException.class)
|
||||||
|
.done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
ConcreteClass myB = b.clazz("p2.B").build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* In package p1:
|
||||||
|
* package p1;
|
||||||
|
* interface I {
|
||||||
|
* public default int m() { return 12; };
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* public class A implements I {}
|
||||||
|
*
|
||||||
|
* In package p2:
|
||||||
|
* package p2;
|
||||||
|
* public interface J { int m(); }
|
||||||
|
*
|
||||||
|
* public class B extends p1.A implements J {
|
||||||
|
* public int m() { return 13; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* Then:
|
||||||
|
* A myA = new B;
|
||||||
|
* myA.m(); // should return 13, not throw IllegalAccessError
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void testMethodResolvedInLocalFirst() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
Interface I = b.intf("p1.I")
|
||||||
|
.defaultMethod("m", "()I").returns(12)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass myA = b.clazz("p1.A").implement(I)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("p2.J").abstractMethod("m", "()I")
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass myB = b.clazz("p2.B").extend(myA).implement(J)
|
||||||
|
.concreteMethod("m", "()I").returns(13)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test()
|
||||||
|
.callSite(myB, myB, "m", "()I")
|
||||||
|
.returns(13)
|
||||||
|
.done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,246 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vm.runtime.defmeth;
|
||||||
|
|
||||||
|
import nsk.share.TestFailure;
|
||||||
|
import nsk.share.test.TestBase;
|
||||||
|
import vm.runtime.defmeth.shared.DefMethTest;
|
||||||
|
import vm.runtime.defmeth.shared.data.*;
|
||||||
|
import static vm.runtime.defmeth.shared.data.method.body.CallMethod.Invoke.*;
|
||||||
|
import static vm.runtime.defmeth.shared.data.method.body.CallMethod.IndexbyteOp.*;
|
||||||
|
import vm.runtime.defmeth.shared.data.method.body.*;
|
||||||
|
import vm.runtime.defmeth.shared.builder.TestBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that default methods don't override methods inherited from Object class.
|
||||||
|
*/
|
||||||
|
public class ObjectMethodOverridesTest extends DefMethTest {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
TestBase.runTest(new ObjectMethodOverridesTest(), args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* protected Object clone() */
|
||||||
|
public void testClone() throws Exception {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("clone", "()Ljava/lang/Object;")
|
||||||
|
.throw_(TestFailure.class)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I)
|
||||||
|
.concreteMethod("m", "()V")
|
||||||
|
// force an invokevirtual MR
|
||||||
|
.invoke(CallMethod.Invoke.VIRTUAL,
|
||||||
|
b.clazzByName("C"), b.clazzByName("C"),
|
||||||
|
"clone", "()Ljava/lang/Object;", METHODREF)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(C, C, "m", "()V")
|
||||||
|
.throws_(CloneNotSupportedException.class)
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* boolean equals(Object obj) */
|
||||||
|
public void testEquals() throws Exception {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("equals", "(Ljava/lang/Object;)Z")
|
||||||
|
.throw_(TestFailure.class)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
ClassLoader cl = b.build();
|
||||||
|
Object c = cl.loadClass("C").newInstance();
|
||||||
|
|
||||||
|
c.equals(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* void finalize() */
|
||||||
|
public void testFinalize() throws Exception {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("finalize", "()V")
|
||||||
|
.throw_(TestFailure.class)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I)
|
||||||
|
.concreteMethod("m", "()V")
|
||||||
|
// force an invokevirtual MR
|
||||||
|
.invoke(CallMethod.Invoke.VIRTUAL,
|
||||||
|
b.clazzByName("C"), b.clazzByName("C"), "finalize", "()V", METHODREF)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(C, C, "m", "()V")
|
||||||
|
.ignoreResult()
|
||||||
|
.done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* final Class<?> getClass() */
|
||||||
|
public void testGetClass() throws Exception {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("getClass", "()Ljava/lang/Class;")
|
||||||
|
.sig("()Ljava/lang/Class<*>;")
|
||||||
|
.throw_(TestFailure.class)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().loadClass(I).throws_(VerifyError.class).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* int hashCode() */
|
||||||
|
public void testHashCode() throws Exception {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("hashCode", "()I")
|
||||||
|
.throw_(TestFailure.class)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
ClassLoader cl = b.build();
|
||||||
|
Object c = cl.loadClass("C").newInstance();
|
||||||
|
|
||||||
|
c.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* final void notify() */
|
||||||
|
public void testNotify() throws Exception {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("notify", "()V")
|
||||||
|
.throw_(TestFailure.class)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().loadClass(I).throws_(VerifyError.class).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* void notifyAll() */
|
||||||
|
public void testNotifyAll() throws Exception {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("notifyAll", "()V")
|
||||||
|
.throw_(TestFailure.class)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().loadClass(I).throws_(VerifyError.class).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* String toString() */
|
||||||
|
public void testToString() throws Exception {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("toString()", "()Ljava/lang/String;")
|
||||||
|
.throw_(TestFailure.class)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
ClassLoader cl = b.build();
|
||||||
|
Object c = cl.loadClass("C").newInstance();
|
||||||
|
|
||||||
|
c.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* final void wait() */
|
||||||
|
public void testWait() throws Exception {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("wait", "()V")
|
||||||
|
.throw_(TestFailure.class)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().loadClass(I).throws_(VerifyError.class).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* final void wait(long timeout) */
|
||||||
|
public void testTimedWait() throws Exception {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("wait", "(J)V")
|
||||||
|
.throw_(TestFailure.class)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().loadClass(I).throws_(VerifyError.class).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* final void wait(long timeout, int nanos) */
|
||||||
|
public void testTimedWait1() throws Exception {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("wait", "(JI)V")
|
||||||
|
.throw_(TestFailure.class)
|
||||||
|
.build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().loadClass(I).throws_(VerifyError.class).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,814 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vm.runtime.defmeth;
|
||||||
|
|
||||||
|
import nsk.share.test.TestBase;
|
||||||
|
import vm.runtime.defmeth.shared.DefMethTest;
|
||||||
|
import vm.runtime.defmeth.shared.annotation.Crash;
|
||||||
|
import vm.runtime.defmeth.shared.annotation.KnownFailure;
|
||||||
|
import vm.runtime.defmeth.shared.annotation.NotApplicableFor;
|
||||||
|
import vm.runtime.defmeth.shared.data.*;
|
||||||
|
import static vm.runtime.defmeth.shared.data.method.body.CallMethod.Invoke.*;
|
||||||
|
import static vm.runtime.defmeth.shared.data.method.body.CallMethod.IndexbyteOp.*;
|
||||||
|
import vm.runtime.defmeth.shared.builder.TestBuilder;
|
||||||
|
import static vm.runtime.defmeth.shared.ExecutionMode.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scenarios on private methods in interfaces.
|
||||||
|
*/
|
||||||
|
public class PrivateMethodsTest extends DefMethTest {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
TestBase.runTest(new PrivateMethodsTest(), args);
|
||||||
|
}
|
||||||
|
|
||||||
|
// invokevirtual & invokeinterface from same/subintf
|
||||||
|
// Spec change July 2013 to not allow invokevirtual or invokeinterface
|
||||||
|
// to even see an interface private method
|
||||||
|
// Throw ICCE if method resolution returns interface private method
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testPrivateInvokeVirtual
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default private int privateM() { return 1; }
|
||||||
|
* default public int m() { return (I)this.privateM(); } // invokevirtual
|
||||||
|
* }
|
||||||
|
* class C implements I {}
|
||||||
|
*
|
||||||
|
* TEST: I o = new C(); o.m()I throws VerifyError
|
||||||
|
* TEST: C o = new C(); o.m()I throws VerifyError
|
||||||
|
*/
|
||||||
|
@NotApplicableFor(modes = { REDEFINITION }) // Can't redefine a class that gets error during loading
|
||||||
|
public void testPrivateInvokeVirtual() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("privateM", "()I")
|
||||||
|
.private_().returns(1).build()
|
||||||
|
|
||||||
|
// force an invokevirtual of an IMR to test verification code
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.invoke(VIRTUAL, b.intfByName("I"), null, "privateM", "()I", INTERFACEMETHODREF).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()I").throws_(VerifyError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(VerifyError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testPrivateInvokeIntf
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default private int privateM() { return 1; }
|
||||||
|
* default public int m() { return (I)this.privateM(); } // invokeinterface
|
||||||
|
* }
|
||||||
|
* class C implements I {}
|
||||||
|
*
|
||||||
|
* TEST: I o = new C(); o.m()I throws IncompatibleClassChangeError
|
||||||
|
* TEST: C o = new C(); o.m()I throws IncompatibleClassChangeError
|
||||||
|
*/
|
||||||
|
public void testPrivateInvokeIntf() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("privateM", "()I")
|
||||||
|
.private_().returns(1).build()
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.invoke(INTERFACE, b.intfByName("I"), null, "privateM", "()I", CALLSITE).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testPrivateInvokeStatic
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default private int privateM() { return 1; }
|
||||||
|
* default public int m() { return I.privateM(); } // invokestatic
|
||||||
|
* }
|
||||||
|
* class C implements I {}
|
||||||
|
*
|
||||||
|
* TEST: I o = new C(); o.m()I throws LinkageError
|
||||||
|
* TEST: C o = new C(); o.m()I throws LinkageError
|
||||||
|
*/
|
||||||
|
public void testPrivateInvokeStatic() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("privateM", "()I")
|
||||||
|
.private_().returns(1).build()
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.invoke(STATIC, b.intfByName("I"), null, "privateM", "()I", CALLSITE).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()I").throws_(LinkageError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(LinkageError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
// call from another default method in the same interface
|
||||||
|
/*
|
||||||
|
* testPrivateCallSameClass
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default private privateM()I { return 1; }
|
||||||
|
* default public int m() { return I.super.privateM(); }
|
||||||
|
* }
|
||||||
|
* class C implements I {}
|
||||||
|
*
|
||||||
|
* TEST: { I o = new C(); o.m()I == 1; }
|
||||||
|
* TEST: { C o = new C(); o.m()I == 1; }
|
||||||
|
*/
|
||||||
|
public void testPrivateCallSameClass() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("privateM", "()I")
|
||||||
|
.private_().returns(1).build()
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.invokeSpecial(b.intfByName("I"), "privateM", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testPrivateCallSubIntf
|
||||||
|
*
|
||||||
|
* Attempt to call from subinterface fails
|
||||||
|
|
||||||
|
* interface I {
|
||||||
|
* default private privateM()I { return 1; }
|
||||||
|
* }
|
||||||
|
* J, K, L use invokespecial
|
||||||
|
* interface J extends I {
|
||||||
|
* default public int m() { return I.super.privateM(); }
|
||||||
|
* }
|
||||||
|
* interface K extends I {
|
||||||
|
* default public int m() { return K.super.privateM(); }
|
||||||
|
* }
|
||||||
|
* interface L extends J {
|
||||||
|
* default public int m() { return I.super.privateM(); }
|
||||||
|
* }
|
||||||
|
* class C implements J {}
|
||||||
|
* class D implements K {}
|
||||||
|
* class E implements L {}
|
||||||
|
*
|
||||||
|
* TEST: { J o = new C(); o.m()I throws IAE; }
|
||||||
|
* TEST: { C o = new C(); o.m()I throws IAE; }
|
||||||
|
* TEST: { K o = new D(); o.m()I throws NSME; } // does not see
|
||||||
|
* TEST: { D o = new D(); o.m()I throws NSME; }
|
||||||
|
* TEST: { L o = new E(); o.m()I throws VerifyError; } // VerifyError intfmethodref
|
||||||
|
* TEST: { E o = new E(); o.m()I throws VerifyError; }
|
||||||
|
*/
|
||||||
|
@NotApplicableFor(modes = { REDEFINITION }) // Can't redefine a class that gets error during loading
|
||||||
|
public void testPrivateCallSubIntf() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("privateM", "()I")
|
||||||
|
.private_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.invokeSpecial(I, "privateM", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface K = b.intf("K").extend(J)
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.invokeSpecial(b.intfByName("K"), "privateM", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// L.privateM -> J -> L (I.privateM call)
|
||||||
|
Interface L = b.intf("L").extend(J)
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.invokeSpecial(I, "privateM", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J).build();
|
||||||
|
|
||||||
|
ConcreteClass D = b.clazz("D").implement(K).build();
|
||||||
|
|
||||||
|
ConcreteClass E = b.clazz("E").implement(L).build();
|
||||||
|
|
||||||
|
b.test().callSite(J, C, "m", "()I").throws_(IllegalAccessError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(IllegalAccessError.class).done()
|
||||||
|
|
||||||
|
.test().callSite(K, D, "m", "()I").throws_(NoSuchMethodError.class).done()
|
||||||
|
.test().callSite(D, D, "m", "()I").throws_(NoSuchMethodError.class).done()
|
||||||
|
|
||||||
|
.test().callSite(L, E, "m", "()I").throws_(VerifyError.class).done()
|
||||||
|
.test().callSite(E, E, "m", "()I").throws_(VerifyError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Attempt to call from subclass fails
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default private privateM()I { return 1; }
|
||||||
|
* }
|
||||||
|
* class C implements I {
|
||||||
|
* public int m() { return I.super.privateM(); }
|
||||||
|
* }
|
||||||
|
* class D extends C {
|
||||||
|
* public int m() { return I.super.privateM(); }
|
||||||
|
* }
|
||||||
|
* class E extends C {
|
||||||
|
* public int m() { return C.super.privateM(); }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* TEST: { C o = new C(); o.m()I throws LinkageError }
|
||||||
|
* TEST: { D o = new D(); o.m()I throws LinkageError }
|
||||||
|
* TEST: { E o = new E(); o.m()I throws NoSuchMethodError; }
|
||||||
|
*/
|
||||||
|
@NotApplicableFor(modes = { REDEFINITION }) // Can't redefine a class that gets error during loading
|
||||||
|
public void testPrivateCallImplClass() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("privateM", "()I")
|
||||||
|
.private_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I)
|
||||||
|
.concreteMethod("m", "()I")
|
||||||
|
.invokeSpecial(I, "privateM", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass D = b.clazz("D").extend(C)
|
||||||
|
.concreteMethod("m", "()I")
|
||||||
|
.invokeSpecial(I, "privateM", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass E = b.clazz("E").extend(C)
|
||||||
|
.concreteMethod("m", "()I")
|
||||||
|
.invokeSpecial(C, "privateM", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Class eeExpectedClass;
|
||||||
|
if (factory.getVer() >= 52) {
|
||||||
|
eeExpectedClass = NoSuchMethodError.class;
|
||||||
|
} else {
|
||||||
|
// The test gets a VerifyError in this case due to an
|
||||||
|
// invokespecial IMR bytecode. This was not allowed
|
||||||
|
// until class file version 52. (See 8030249.)
|
||||||
|
eeExpectedClass = VerifyError.class;
|
||||||
|
}
|
||||||
|
b.test().callSite(C, C, "m", "()I").throws_(LinkageError.class).done()
|
||||||
|
.test().callSite(D, D, "m", "()I").throws_(LinkageError.class).done()
|
||||||
|
.test().callSite(E, E, "m", "()I").throws_(eeExpectedClass).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
// doesn't participate in default method analysis
|
||||||
|
// method overriding
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testPrivateDefault
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default private int m() { return 1; }
|
||||||
|
* }
|
||||||
|
* class C implements I {}
|
||||||
|
*
|
||||||
|
* TEST: { I o = new C(); o.m()I throws IllegalAccessError; }
|
||||||
|
* -mode reflect throws NoSuchMethodException
|
||||||
|
* TEST: { C o = new C(); o.m()I throws java/lang/NoSuchMethodError; }
|
||||||
|
*/
|
||||||
|
public void testPrivateDefault() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.private_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
Class expectedClass;
|
||||||
|
if (factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
expectedClass = NoSuchMethodException.class;
|
||||||
|
} else {
|
||||||
|
expectedClass = IllegalAccessError.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()I").throws_(expectedClass).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(NoSuchMethodError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testPrivateDefaultVsConcrete
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default private int m() { return 1; }
|
||||||
|
* }
|
||||||
|
* class C implements I {
|
||||||
|
* public int m() { return 2; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* TEST: { I o = new C(); o.m()I == IllegalAccessError; }
|
||||||
|
* -mode reflect throws NoSuchMethodException
|
||||||
|
* TEST: { C o = new C(); o.m()I == 2; }
|
||||||
|
*/
|
||||||
|
public void testPrivateDefaultVsConcrete() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.private_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I)
|
||||||
|
.concreteMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Class expectedClass;
|
||||||
|
if (factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
expectedClass = NoSuchMethodException.class;
|
||||||
|
} else {
|
||||||
|
expectedClass = IllegalAccessError.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()I").throws_(expectedClass).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(2).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testPublicOverridePrivate
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default private int m() { return 1; }
|
||||||
|
* }
|
||||||
|
* interface J extends I {
|
||||||
|
* default public int m() { return 2; }
|
||||||
|
* }
|
||||||
|
* class C implements J {}
|
||||||
|
*
|
||||||
|
* TEST: { I o = new C(); o.m()I throws IllegalAccessError; }
|
||||||
|
* -mode reflect throws NoSuchMethodException
|
||||||
|
* TEST: { J o = new C(); o.m()I == 2; }
|
||||||
|
* TEST: { C o = new C(); o.m()I == 2; }
|
||||||
|
*/
|
||||||
|
public void testPublicOverridePrivate() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.private_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J).build();
|
||||||
|
|
||||||
|
Class expectedClass;
|
||||||
|
if (factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
expectedClass = NoSuchMethodException.class;
|
||||||
|
} else {
|
||||||
|
expectedClass = IllegalAccessError.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()I").throws_(expectedClass).done()
|
||||||
|
.test().callSite(J, C, "m", "()I").returns(2).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(2).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testPrivateOverrideDefault
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
* interface J extends I {
|
||||||
|
* default private int m() { return 2; }
|
||||||
|
* }
|
||||||
|
* class C implements J {}
|
||||||
|
*
|
||||||
|
* TEST: { I o = new C(); o.m()I == 1; }
|
||||||
|
* TEST: { J o = new C(); o.m()I == IllegalAccessError; } II J.m priv
|
||||||
|
* TEST: { C o = new C(); o.m()I == 1; }
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
|
||||||
|
REFLECTION:
|
||||||
|
Test2_J_C_m : FAILED
|
||||||
|
nsk.share.TestFailure: Caught exception as expected, but its type is wrong:
|
||||||
|
expected: java.lang.IllegalAccessError;
|
||||||
|
actual: java.lang.NoSuchMethodException.
|
||||||
|
*/
|
||||||
|
public void testPrivateOverrideDefault() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.private_().returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J).build();
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()I").returns(1).done()
|
||||||
|
.test().privateCallSite(J, C, "m", "()I").throws_(IllegalAccessError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testPrivateReabstract
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default private int m() { return 1; }
|
||||||
|
* }
|
||||||
|
* interface J extends I {
|
||||||
|
* abstract public int m();
|
||||||
|
* }
|
||||||
|
* class C implements J {}
|
||||||
|
*
|
||||||
|
* TEST: { I o = new C(); o.m()I throws IllegalAccessError; } II I.m
|
||||||
|
* -mode reflect throws NoSuchMethodException
|
||||||
|
* TEST: { J o = new C(); o.m()I throws java/lang/AbstractMethodError; }
|
||||||
|
* TEST: { C o = new C(); o.m()I throws java/lang/AbstractMethodError; }
|
||||||
|
*/
|
||||||
|
public void testPrivateReabstract() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.private_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J).build();
|
||||||
|
|
||||||
|
Class expectedClass;
|
||||||
|
if (factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
expectedClass = NoSuchMethodException.class;
|
||||||
|
} else {
|
||||||
|
expectedClass = IllegalAccessError.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()I").throws_(expectedClass).done()
|
||||||
|
.test().callSite(J, C, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testPrivateOverrideAbstract
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* abstract public int m();
|
||||||
|
* }
|
||||||
|
* interface J extends I {
|
||||||
|
* default private int m() { return 1; }
|
||||||
|
* }
|
||||||
|
* class C implements J {}
|
||||||
|
*
|
||||||
|
* TEST: { I o = new C(); o.m()I throws AbstractMethodError }
|
||||||
|
* TEST: { J o = new C(); o.m()I throws IncompatibleClassChangeError }
|
||||||
|
* TEST: { C o = new C(); o.m()I throws AbstractMethodError }
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
REFLECTION:
|
||||||
|
Test1_I_C_m : FAILED
|
||||||
|
nsk.share.TestFailure: No exception was thrown: java.lang.AbstractMethodError
|
||||||
|
Test2_J_C_m : FAILED
|
||||||
|
nsk.share.TestFailure: No exception was thrown: java.lang.AbstractMethodError
|
||||||
|
Test3_C_C_m : FAILED
|
||||||
|
nsk.share.TestFailure: No exception was thrown: java.lang.AbstractMethodError
|
||||||
|
*/
|
||||||
|
public void testPrivateOverrideAbstract() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.private_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J).build();
|
||||||
|
|
||||||
|
Class expectedClass;
|
||||||
|
if (factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
expectedClass = IllegalAccessException.class;
|
||||||
|
} else {
|
||||||
|
expectedClass = IncompatibleClassChangeError.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
.test().privateCallSite(J, C, "m", "()I").throws_(expectedClass).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testPrivateInheritedDefault
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default private int m() { return 1; }
|
||||||
|
* }
|
||||||
|
* class B implements I {}
|
||||||
|
* class C extends B {}
|
||||||
|
*
|
||||||
|
* TEST: { I o = new C(); o.m()I throws IllegalAccessError } II I.m
|
||||||
|
* -mode reflect throws NoSuchMethodException
|
||||||
|
* TEST: { B o = new C(); o.m()I throws NoSuchMethodError }
|
||||||
|
* TEST: { C o = new C(); o.m()I throws NoSuchMethodError }
|
||||||
|
*/
|
||||||
|
public void testPrivateInheritedDefault() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.private_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass B = b.clazz("B").implement(I).build();
|
||||||
|
ConcreteClass C = b.clazz("C").extend(B).build();
|
||||||
|
|
||||||
|
Class expectedClass;
|
||||||
|
if (factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
expectedClass = NoSuchMethodException.class;
|
||||||
|
} else {
|
||||||
|
expectedClass = IllegalAccessError.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m","()I").throws_(expectedClass).done()
|
||||||
|
.test().callSite(B, C, "m","()I").throws_(NoSuchMethodError.class).done()
|
||||||
|
.test().callSite(C, C, "m","()I").throws_(NoSuchMethodError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testPrivateDefaultVsConcreteInherited
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default private int m() { return 1; }
|
||||||
|
* }
|
||||||
|
* class B {
|
||||||
|
* public int m() { return 2; }
|
||||||
|
* }
|
||||||
|
* class C extends B implements I {}
|
||||||
|
*
|
||||||
|
* TEST: { I o = new C(); o.m()I == throws IllegalAccessError; }
|
||||||
|
* -mode reflect throws NoSuchMethodException
|
||||||
|
* TEST: { B o = new C(); o.m()I == 2; }
|
||||||
|
* TEST: { C o = new C(); o.m()I == 2; }
|
||||||
|
*/
|
||||||
|
public void testPrivateDefaultVsConcreteInherited() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.private_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass B = b.clazz("B")
|
||||||
|
.concreteMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").extend(B).implement(I).build();
|
||||||
|
|
||||||
|
Class expectedClass;
|
||||||
|
if (factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
expectedClass = NoSuchMethodException.class;
|
||||||
|
} else {
|
||||||
|
expectedClass = IllegalAccessError.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m","()I").throws_(expectedClass).done()
|
||||||
|
.test().callSite(B, C, "m","()I").returns(2).done()
|
||||||
|
.test().callSite(C, C, "m","()I").returns(2).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testPrivateConflict
|
||||||
|
*
|
||||||
|
* Conflicting default methods
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default private int m() { return 1; }
|
||||||
|
* }
|
||||||
|
* interface J {
|
||||||
|
* default public int m() { return 2; }
|
||||||
|
* }
|
||||||
|
* class C implements I, J {}
|
||||||
|
*
|
||||||
|
* TEST: { I o = new C(); o.m()I throws IllegalAccessError; }
|
||||||
|
* -mode reflect throws NoSuchMethodException
|
||||||
|
* TEST: { J o = new C(); o.m()I == 2; }
|
||||||
|
* TEST: { C o = new C(); o.m()I == 2; }
|
||||||
|
*/
|
||||||
|
public void testPrivateConflict() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").private_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I,J).build();
|
||||||
|
|
||||||
|
Class expectedClass;
|
||||||
|
if (factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
expectedClass = NoSuchMethodException.class;
|
||||||
|
} else {
|
||||||
|
expectedClass = IllegalAccessError.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()I").throws_(expectedClass).done()
|
||||||
|
.test().callSite(J, C, "m", "()I").returns(2).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(2).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* testPrivateSuperClassMethodNoDefaultMethod
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* public int m();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* public class A {
|
||||||
|
* private int m() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* public class B extends A implements I {}
|
||||||
|
*
|
||||||
|
* public class C extends B {
|
||||||
|
* public int m() { return 2; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* TEST: { B b = new C(); b.m()I throws IllegalAccessError; }
|
||||||
|
*/
|
||||||
|
public void testPrivateSuperClassMethodNoDefaultMethod() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
ConcreteClass A = b.clazz("A")
|
||||||
|
.concreteMethod("m", "()I").private_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.abstractMethod("m", "()I").public_().build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass B = b.clazz("B").extend(A).implement(I).build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").extend(B)
|
||||||
|
.concreteMethod("m", "()I").public_().returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().privateCallSite(B, C, "m", "()I").throws_(IllegalAccessError.class).done()
|
||||||
|
.run();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testPrivateSuperClassMethodDefaultMethod
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* public default int m() { return 3; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* public class A {
|
||||||
|
* private int m() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* public class B extends A implements I {}
|
||||||
|
*
|
||||||
|
* public class C extends B {
|
||||||
|
* public int m() { return 2; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* TEST: { B b = new C(); b.m()I throws IllegalAccessError; }
|
||||||
|
*/
|
||||||
|
public void testPrivateSuperClassMethodDefaultMethod() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
ConcreteClass A = b.clazz("A")
|
||||||
|
.concreteMethod("m", "()I").private_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").public_().returns(3).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass B = b.clazz("B").extend(A).implement(I).build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").extend(B)
|
||||||
|
.concreteMethod("m", "()I").public_().returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().privateCallSite(B, C, "m", "()I").throws_(IllegalAccessError.class).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testPrivateSuperClassMethodDefaultMethodNoOverride
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* public default int m() { return 3; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* public class A {
|
||||||
|
* private int m() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* public class B extends A implements I {}
|
||||||
|
*
|
||||||
|
* public class C extends B { }
|
||||||
|
*
|
||||||
|
* TEST: { B b = new C(); b.m()I throws IllegalAccessError; }
|
||||||
|
*/
|
||||||
|
public void testPrivateSuperClassMethodDefaultMethodNoOverride() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
ConcreteClass A = b.clazz("A")
|
||||||
|
.concreteMethod("m", "()I").private_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").public_().returns(3).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass B = b.clazz("B").extend(A).implement(I).build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").extend(B).build();
|
||||||
|
|
||||||
|
b.test().privateCallSite(B, C, "m", "()I").throws_(IllegalAccessError.class).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
261
test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/README
Normal file
261
test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/README
Normal file
@ -0,0 +1,261 @@
|
|||||||
|
Copyright (c) 2014, 2018, 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.
|
||||||
|
|
||||||
|
This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
accompanied this code).
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License version
|
||||||
|
2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
or visit www.oracle.com if you need additional information or have any
|
||||||
|
questions.
|
||||||
|
|
||||||
|
|
||||||
|
ABOUT
|
||||||
|
|
||||||
|
Once published, it is impossible to add methods to an interface without
|
||||||
|
breaking existing implementations (specifically, adding a method to an
|
||||||
|
interface is not a source-compatible change). The longer the time since a
|
||||||
|
library has been published, the more likely it is that this restriction will
|
||||||
|
cause grief for its maintainers.
|
||||||
|
|
||||||
|
The addition of closures to the Java language in JDK 8 place additional stress
|
||||||
|
on the aging Collection interfaces; one of the most significant benefits of
|
||||||
|
closures is that it enables the development of more powerful libraries. It
|
||||||
|
would be disappointing to add a language feature that enables better libraries
|
||||||
|
while at the same time not extending the core libraries to take advantage of
|
||||||
|
that feature.
|
||||||
|
|
||||||
|
A mechanism for adding new methods to existing interfaces is proposed, which is
|
||||||
|
called virtual extension (or default) methods. Existing interfaces can be
|
||||||
|
augmented without compromising backward compatibility by adding extension
|
||||||
|
methods to the interface, whose declaration would contain instructions for
|
||||||
|
finding the default implementation in the event that implementers do not
|
||||||
|
provide a method body. A key characteristic of extension methods is that they
|
||||||
|
are virtual methods just like other interface methods, but provide a default
|
||||||
|
implementation in the event that the implementing class does not provide a
|
||||||
|
method body.
|
||||||
|
|
||||||
|
VM support is necessary to implement virtual extension methods.
|
||||||
|
|
||||||
|
|
||||||
|
OVERVIEW
|
||||||
|
|
||||||
|
The test suite is organized in the following manner.
|
||||||
|
|
||||||
|
The tests rely on a framework to generate class hierarchies and tests
|
||||||
|
directly in bytecode from a pseudo-code in Java. Pseudo-code is written
|
||||||
|
using builder pattern and fluent coding style.
|
||||||
|
|
||||||
|
The framework is located in src/vm/runtime/defmeth/shared and divided into
|
||||||
|
/data and /builder sections.
|
||||||
|
|
||||||
|
As an example, the following code:
|
||||||
|
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I)
|
||||||
|
.concreteMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()I").returns(2).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(2).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
|
||||||
|
translates into bytecode equivalent of:
|
||||||
|
|
||||||
|
2-class hierarchy:
|
||||||
|
|
||||||
|
interface I {
|
||||||
|
int m() default { return 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
class C implements I {
|
||||||
|
public int m() { return 2; }
|
||||||
|
}
|
||||||
|
|
||||||
|
and 2 tests:
|
||||||
|
|
||||||
|
Test1_I_C_m {
|
||||||
|
static void test() {
|
||||||
|
I i = new C();
|
||||||
|
if (i.m() != 2) throw new TestFailure();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Test2_C_C_m {
|
||||||
|
static void test() {
|
||||||
|
C c = new C();
|
||||||
|
if (c.m() != 2) throw new TestFailure();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TestBuilder.run() calls Test1_I_C_m.test() and Test2_C_C_m.test() and
|
||||||
|
performs failure reporting, if necessary.
|
||||||
|
|
||||||
|
All tests are located in src/vm/runtime/defmeth and are grouped according
|
||||||
|
to the area they excercise. The test groups are:
|
||||||
|
- AccessibilityFlagsTest
|
||||||
|
- BasicTest
|
||||||
|
- ConflictingDefaultsTest
|
||||||
|
- DefaultVsAbstractTest
|
||||||
|
- MethodResolutionTest
|
||||||
|
- ObjectMethodOverridesTest
|
||||||
|
- PrivateMethodsTest
|
||||||
|
- RedefineTest
|
||||||
|
- StaticMethodsTest
|
||||||
|
- StressTest
|
||||||
|
- SuperCallTest
|
||||||
|
|
||||||
|
Each test group can be executed in different modes. For each mode there's a
|
||||||
|
corresponding scenario in src/vm/runtime/defmeth/scenarios.
|
||||||
|
|
||||||
|
Scenarios are organized in the following manner:
|
||||||
|
|
||||||
|
.../scenarios/[test_group]_[majorVer]_[methodFlags]_[invocationType]_[shouldRedefine]
|
||||||
|
|
||||||
|
where
|
||||||
|
|
||||||
|
majorVer - major version of class files for generated concrete classes
|
||||||
|
values: ver49, ver50, ver51, ver52
|
||||||
|
|
||||||
|
methodFlags - additional access flags for methods in generated classes
|
||||||
|
values:
|
||||||
|
none == no additional flags
|
||||||
|
sync == ACC_SYNCHRONIZED
|
||||||
|
strict == ACC_STRICT
|
||||||
|
syncstrict == ACC_SYNCHRONIZED | ACC_STRICT
|
||||||
|
|
||||||
|
invocationType - how methods in test hiearchies are invoked during testing
|
||||||
|
values:
|
||||||
|
direct - using invoke* bytecodes
|
||||||
|
reflect - using Reflection API
|
||||||
|
invoke - using invokedynamic & java.lang.invoke API (MethodHandles/JSR292)
|
||||||
|
|
||||||
|
redefine - whether to preload and redefine classes before running individual tests
|
||||||
|
values: redefine, noredefine
|
||||||
|
|
||||||
|
testGroup - name of test group being used
|
||||||
|
values: BasicTests/BridgeMethod/etc
|
||||||
|
|
||||||
|
|
||||||
|
STRESS TESTING
|
||||||
|
|
||||||
|
Stress test differs from other scenarios - it has only 2 modes: redefine and noredefine.
|
||||||
|
|
||||||
|
Stress scenario is the following:
|
||||||
|
- in multiple threads (5 by default)...
|
||||||
|
- ... continuously run random vm.runtime.defmeth.* tests ...
|
||||||
|
- ... in random configurations ...
|
||||||
|
- ... until predefined period of time is over...
|
||||||
|
- ... or any failures occured.
|
||||||
|
|
||||||
|
|
||||||
|
HOW TO RUN
|
||||||
|
|
||||||
|
Directly from command-line:
|
||||||
|
|
||||||
|
$ java -cp ${VMTESTBASE}/bin/classes vm.runtime.defmeth.shared.DefMethTest
|
||||||
|
|
||||||
|
Specify testing mode:
|
||||||
|
-flags <int>
|
||||||
|
additional access flags on default methods (default: 0)
|
||||||
|
|
||||||
|
-ver <int>
|
||||||
|
class file major version (default: 52)
|
||||||
|
|
||||||
|
-redefine <boolean>
|
||||||
|
redefine classes during execution (default: false)
|
||||||
|
|
||||||
|
-mode [direct|reflect|invoke]
|
||||||
|
specify method invocation mechanism (default: direct):
|
||||||
|
- direct - invoke* instructions in bytecode
|
||||||
|
- reflect - Reflection API
|
||||||
|
- invoke - invokedynamic & MethodHandle.invoke*
|
||||||
|
|
||||||
|
-execMode [DIRECT|REFLECTION|INVOKE_EXACT|INVOKE_GENERIC|INVOKE_WITH_ARGS|INDY]
|
||||||
|
specify concrete execution mode
|
||||||
|
|
||||||
|
Execution-specific flags:
|
||||||
|
-list <boolean>
|
||||||
|
list available tests
|
||||||
|
|
||||||
|
-filter <regex>
|
||||||
|
filter tests by name
|
||||||
|
(default: .* )
|
||||||
|
|
||||||
|
If you run tests directly from command line, in order to make "-redefine true",
|
||||||
|
StressTest or RedefineTest work, additional steps are necessary:
|
||||||
|
add -agentlib:redefineClasses to JVM options
|
||||||
|
set correct LD_LIBRARY_PATH:
|
||||||
|
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${VM_TESTBASE}/bin/lib/${PLATFORM}/vm/runtime/defmeth/shared/
|
||||||
|
|
||||||
|
Also, it is possible to run any test group directly:
|
||||||
|
|
||||||
|
$ java -cp ${VMTESTBASE}/bin/classes vm.runtime.defmeth.BasicTest
|
||||||
|
|
||||||
|
StressTest has some specific options:
|
||||||
|
-stressTime <long>
|
||||||
|
Stress execution time in seconds (default: 60)
|
||||||
|
|
||||||
|
-stressThreadsFactor <int>
|
||||||
|
Stress threads factor (default: 1)
|
||||||
|
|
||||||
|
-seed <int>
|
||||||
|
force deterministic behavior (default: 0)
|
||||||
|
|
||||||
|
-redefine <boolean>
|
||||||
|
use scenarios w/ class redefinition (default: false)
|
||||||
|
|
||||||
|
-ver <int>
|
||||||
|
minimum class file version to be used in the tests (default: 49)
|
||||||
|
|
||||||
|
-ignoreTestFailures
|
||||||
|
ignore failures of individual tests
|
||||||
|
|
||||||
|
To simplify failure analysis, the framework has some additional flags to produce
|
||||||
|
diagnostics output:
|
||||||
|
|
||||||
|
-Dvm.runtime.defmeth.printTests
|
||||||
|
print pseudo-code for each test;
|
||||||
|
|
||||||
|
-Dvm.runtime.defmeth.printAssembly
|
||||||
|
print bytecode assembly for all generated class files;
|
||||||
|
|
||||||
|
-Dvm.runtime.defmeth.printASMify
|
||||||
|
print "asmified" version of generated class files;
|
||||||
|
very useful when preparing reduced test cases.
|
||||||
|
|
||||||
|
-Dvm.runtime.defmeth.dumpClasses
|
||||||
|
dump class files under DUMP_CLASS_FILES in <test_name> folder
|
||||||
|
|
||||||
|
-Dvm.runtime.defmeth.printStackTrace
|
||||||
|
print full stack traces for all errors and test failures
|
||||||
|
|
||||||
|
-Dvm.runtime.defmeth.traceClassRedefinition
|
||||||
|
trace class redefinition during testing
|
||||||
|
|
||||||
|
LINKS
|
||||||
|
|
||||||
|
[1] "Design and Implementation of Default Methods in Hotspot JVM", by Keith McGuigan, 09/18/2012
|
||||||
|
http://cr.openjdk.java.net/~kamg/default_methods_in_hotspot.txt
|
||||||
|
|
||||||
|
[2] "Featherweight Defenders: A formal model for virtual extension methods in Java", by Brian Goetz, Robert Field, 03/27/2012
|
||||||
|
http://cr.openjdk.java.net/~briangoetz/lambda/featherweight-defenders.pdf
|
||||||
|
|
||||||
|
[3] "Interface evolution via virtual extension methods", by Brian Goetz, 4th draft, 06/2011
|
||||||
|
http://cr.openjdk.java.net/~briangoetz/lambda/Defender%20Methods%20v4.pdf
|
@ -0,0 +1,235 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vm.runtime.defmeth;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import nsk.share.Pair;
|
||||||
|
import nsk.share.TestFailure;
|
||||||
|
import nsk.share.test.TestBase;
|
||||||
|
import vm.runtime.defmeth.shared.DefMethTest;
|
||||||
|
import vm.runtime.defmeth.shared.DefMethTestFailure;
|
||||||
|
import vm.runtime.defmeth.shared.MemoryClassLoader;
|
||||||
|
import vm.runtime.defmeth.shared.annotation.NotApplicableFor;
|
||||||
|
import vm.runtime.defmeth.shared.builder.TestBuilder;
|
||||||
|
import vm.runtime.defmeth.shared.executor.TestExecutor;
|
||||||
|
import vm.runtime.defmeth.shared.data.Clazz;
|
||||||
|
import vm.runtime.defmeth.shared.data.ConcreteClass;
|
||||||
|
import vm.runtime.defmeth.shared.data.Interface;
|
||||||
|
import vm.runtime.defmeth.shared.data.Tester;
|
||||||
|
import static vm.runtime.defmeth.shared.ExecutionMode.*;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Basic scenarios on class redefinition.
|
||||||
|
*/
|
||||||
|
public class RedefineTest extends DefMethTest {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
TestBase.runTest(new RedefineTest(), args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure() {
|
||||||
|
// There are no testers being generated for reflection-based scenarios,
|
||||||
|
// so scenarios on class redefinition don't work
|
||||||
|
String mode = factory.getExecutionMode();
|
||||||
|
if ( "REFLECTION".equals(mode) || "INVOKE_WITH_ARGS".equals(mode)) {
|
||||||
|
throw new TestFailure("RedefineTest isn't applicable to reflection-based execution scenario " +
|
||||||
|
"(REDEFINE & INVOKE_WITH_ARGS).");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run test {@code b1} w/ redefined {@code classes} from {@code b2}.
|
||||||
|
*
|
||||||
|
* @param b1
|
||||||
|
* @param b2
|
||||||
|
* @param classes
|
||||||
|
*/
|
||||||
|
private void redefineAndRun(TestBuilder b1, TestBuilder b2, Clazz... classes) {
|
||||||
|
TestExecutor executor = b1.prepare();
|
||||||
|
|
||||||
|
getLog().info("Before");
|
||||||
|
List<Pair<Tester,Throwable>> errorsBefore =
|
||||||
|
executor.run(); // run b1
|
||||||
|
|
||||||
|
// redefine in b1
|
||||||
|
MemoryClassLoader cl = executor.getLoader(); // b1.cl
|
||||||
|
Map<String,byte[]> cf = b2.produce(); //
|
||||||
|
Map<String,byte[]> forRedef = new HashMap<>();
|
||||||
|
for (Clazz clz : classes) {
|
||||||
|
String name = clz.name();
|
||||||
|
forRedef.put(name, cf.get(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
cl.modifyClasses(forRedef, factory.isRetransformClasses());
|
||||||
|
|
||||||
|
getLog().info("After");
|
||||||
|
List<Pair<Tester,Throwable>> errorsAfter =
|
||||||
|
executor.run();
|
||||||
|
|
||||||
|
if (!errorsBefore.isEmpty()) {
|
||||||
|
throw new DefMethTestFailure(errorsBefore);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!errorsAfter.isEmpty()) {
|
||||||
|
throw new DefMethTestFailure(errorsAfter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Before redefinition:
|
||||||
|
* interface I { public int m() { return 1; } }
|
||||||
|
* class C extends I { public int m() { return 2; } }
|
||||||
|
*
|
||||||
|
* TEST: I i = new C(); i.m() == 2
|
||||||
|
* TEST: C c = new C(); c.m() == 2
|
||||||
|
*
|
||||||
|
* After redefinition:
|
||||||
|
* interface I { public int m() { return 1; } }
|
||||||
|
* class C extends I { public int m() { return 3; } }
|
||||||
|
*
|
||||||
|
* TEST: I i = new C(); i.m() == 3
|
||||||
|
* TEST: C c = new C(); c.m() == 3
|
||||||
|
*/
|
||||||
|
@NotApplicableFor(modes = { REFLECTION, INVOKE_WITH_ARGS }) // reflection-based scenarios rely on checks in bytecode
|
||||||
|
public void testRedefineConcreteMethod() {
|
||||||
|
TestBuilder before = factory.getBuilder();
|
||||||
|
{ // Before redefinition
|
||||||
|
Interface I = before.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
ConcreteClass C = before.clazz("C").implement(I)
|
||||||
|
.concreteMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
before.test().callSite(I, C, "m", "()I").returns(2).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(2).done();
|
||||||
|
}
|
||||||
|
|
||||||
|
{ // After redefinition
|
||||||
|
TestBuilder after = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = after.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
ConcreteClass C = after.clazz("C").implement(I)
|
||||||
|
.concreteMethod("m", "()I").returns(3).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Tester T1 = after.test().callSite(I, C, "m", "()I").returns(3).build();
|
||||||
|
Tester T2 = after.test().callSite(C, C, "m", "()I").returns(3).build();
|
||||||
|
|
||||||
|
redefineAndRun(before, after, C, T1, T2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Before redefinition:
|
||||||
|
* interface I { public int m() { return 1; } }
|
||||||
|
* class C extends I { public int m() { return 2; } }
|
||||||
|
*
|
||||||
|
* TEST: I i = new C(); i.m() == 2
|
||||||
|
* TEST: C c = new C(); c.m() == 2
|
||||||
|
*
|
||||||
|
* After redefinition:
|
||||||
|
* interface I { public int m() { return 3; } }
|
||||||
|
* class C extends I { public int m() { return 2; } }
|
||||||
|
*
|
||||||
|
* TEST: I i = new C(); i.m() == 2
|
||||||
|
* TEST: C c = new C(); c.m() == 2
|
||||||
|
*/
|
||||||
|
@NotApplicableFor(modes = { REFLECTION, INVOKE_WITH_ARGS }) // reflection-based scenarios rely on checks in bytecode
|
||||||
|
public void testRedefineDefaultMethod() {
|
||||||
|
TestBuilder before = factory.getBuilder();
|
||||||
|
{ // Before redefinition
|
||||||
|
Interface I = before.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
ConcreteClass C = before.clazz("C").implement(I)
|
||||||
|
.concreteMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
before.test().callSite(I, C, "m", "()I").returns(2).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(2).done();
|
||||||
|
}
|
||||||
|
|
||||||
|
{ // After redefinition
|
||||||
|
TestBuilder after = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = after.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(3).build()
|
||||||
|
.build();
|
||||||
|
ConcreteClass C = after.clazz("C").implement(I)
|
||||||
|
.concreteMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
redefineAndRun(before, after, C);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Before redefinition:
|
||||||
|
* interface I { public int m() { return 1; } }
|
||||||
|
* class C extends I {}
|
||||||
|
*
|
||||||
|
* TEST: I i = new C(); i.m() == 1
|
||||||
|
* TEST: C c = new C(); c.m() == 1
|
||||||
|
*
|
||||||
|
* After redefinition:
|
||||||
|
* interface I { public int m() { return 2; } }
|
||||||
|
* class C extends I {}
|
||||||
|
*
|
||||||
|
* TEST: I i = new C(); i.m() == 2
|
||||||
|
* TEST: C c = new C(); c.m() == 2
|
||||||
|
*/
|
||||||
|
@NotApplicableFor(modes = { REFLECTION, INVOKE_WITH_ARGS }) // reflection-based scenarios rely on checks in bytecode
|
||||||
|
public void testRedefineDefMethInConcreteClass() {
|
||||||
|
TestBuilder before = factory.getBuilder();
|
||||||
|
{ // Before redefinition
|
||||||
|
Interface I = before.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
ConcreteClass C = before.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
before.test().callSite(I, C, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(1).done();
|
||||||
|
}
|
||||||
|
|
||||||
|
{ // After redefinition
|
||||||
|
TestBuilder after = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = after.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
ConcreteClass C = after.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
Tester T1 = after.test().callSite(I, C, "m", "()I").returns(2).build();
|
||||||
|
Tester T2 = after.test().callSite(C, C, "m", "()I").returns(2).build();
|
||||||
|
|
||||||
|
redefineAndRun(before, after, I, T1, T2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,838 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vm.runtime.defmeth;
|
||||||
|
|
||||||
|
import nsk.share.test.TestBase;
|
||||||
|
import vm.runtime.defmeth.shared.DefMethTest;
|
||||||
|
import vm.runtime.defmeth.shared.annotation.Crash;
|
||||||
|
import vm.runtime.defmeth.shared.data.*;
|
||||||
|
import vm.runtime.defmeth.shared.builder.TestBuilder;
|
||||||
|
import vm.runtime.defmeth.shared.annotation.NotApplicableFor;
|
||||||
|
import static vm.runtime.defmeth.shared.data.method.body.CallMethod.Invoke.*;
|
||||||
|
import static vm.runtime.defmeth.shared.data.method.body.CallMethod.IndexbyteOp.*;
|
||||||
|
import static vm.runtime.defmeth.shared.ExecutionMode.*;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Scenarios on static methods in interfaces.
|
||||||
|
*/
|
||||||
|
public class StaticMethodsTest extends DefMethTest {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
TestBase.runTest(new StaticMethodsTest(), args);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static method in interface
|
||||||
|
/*
|
||||||
|
* testStaticMethod
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default static public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C implements I {}
|
||||||
|
*/
|
||||||
|
public void testStaticMethod() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.static_().public_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().staticCallSite(I, "m", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
// invoke[virtual|interface|special] from same/subintf
|
||||||
|
/*
|
||||||
|
* testInvokeVirtual
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default static public int staticM() { return 1; }
|
||||||
|
* default public int m() { return ((I)this).staticM(); }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C implements I {}
|
||||||
|
*/
|
||||||
|
public void testInvokeVirtual() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("staticM", "()I")
|
||||||
|
.static_().public_().returns(1).build()
|
||||||
|
|
||||||
|
// force an invokevirtual MR of staticM()
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.invoke(VIRTUAL, b.intfByName("I"), null, "staticM", "()I", METHODREF).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().staticCallSite(I, "staticM", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.test().callSite(I, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testInvokeIntf
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default static public int staticM() { return 1; }
|
||||||
|
* default public int m() { return ((I)this).staticM(); }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C implements I {}
|
||||||
|
*/
|
||||||
|
public void testInvokeIntf() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("staticM", "()I")
|
||||||
|
.static_().public_().returns(1).build()
|
||||||
|
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.invoke(INTERFACE, b.intfByName("I"), null, "staticM", "()I", CALLSITE).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().staticCallSite(I, "staticM", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.test().callSite(I, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testInvokeSpecial
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default static public int staticM() { return 1; }
|
||||||
|
* default public int m() { return I.super.staticM(); }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C implements I {}
|
||||||
|
*/
|
||||||
|
public void testInvokeSpecial() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("staticM", "()I")
|
||||||
|
.static_().public_().returns(1).build()
|
||||||
|
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.invoke(SPECIAL, b.intfByName("I"), null, "staticM", "()I", CALLSITE).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().staticCallSite(I, "staticM", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.test().callSite(I, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testStaticVsDefault
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default static public int m() { return 1; }
|
||||||
|
* default public int m() { return 2; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C implements I {}
|
||||||
|
*/
|
||||||
|
public void testStaticVsDefault() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.static_().public_().returns(1).build()
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.public_().returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().staticCallSite(I, "m", "()I").throws_(ClassFormatError.class).done()
|
||||||
|
|
||||||
|
// FIXME: throws exception during an attempt to lookup Test2.test() method
|
||||||
|
|
||||||
|
// Invalid test. ClassFormatError is thrown at verification time, rather
|
||||||
|
// than execution time.
|
||||||
|
// .test().callSite(I, C, "m", "()I").throws_(ClassFormatError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(ClassFormatError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
// call static method from default method
|
||||||
|
/*
|
||||||
|
* testInvokeFromDefaultMethod
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default static public int staticPublicM() { return 1; }
|
||||||
|
* default public int invokePublic() { return I.staticPublicM(); }
|
||||||
|
* default static private int staticPrivateM() { return 1; }
|
||||||
|
* default public int invokePrivate() { return I.staticPrivateM(); }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C implements I {}
|
||||||
|
*/
|
||||||
|
public void testInvokeFromDefaultMethod() throws Exception {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("staticPublicM", "()I")
|
||||||
|
.static_().public_().returns(1).build()
|
||||||
|
.defaultMethod("invokePublic", "()I")
|
||||||
|
.invokeStatic(b.intfByName("I"), "staticPublicM", "()I").build()
|
||||||
|
|
||||||
|
.defaultMethod("staticPrivateM", "()I")
|
||||||
|
.static_().private_().returns(1).build()
|
||||||
|
.defaultMethod("invokePrivate", "()I")
|
||||||
|
.invokeStatic(b.intfByName("I"), "staticPrivateM", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
Class expectedClass;
|
||||||
|
if (factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
expectedClass = NoSuchMethodException.class;
|
||||||
|
} else {
|
||||||
|
expectedClass = IllegalAccessError.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
// call static method from another class
|
||||||
|
b.test().staticCallSite(I, "staticPublicM", "()I").returns(1).done()
|
||||||
|
.test().staticCallSite(I, "staticPrivateM", "()I").throws_(expectedClass).done()
|
||||||
|
|
||||||
|
// call public static method from default method
|
||||||
|
.test().callSite(I, C, "invokePublic", "()I").returns(1).done()
|
||||||
|
.test().callSite(C, C, "invokePublic", "()I").returns(1).done()
|
||||||
|
|
||||||
|
// call private static method from default method
|
||||||
|
.test().callSite(I, C, "invokePrivate", "()I").returns(1).done()
|
||||||
|
.test().callSite(C, C, "invokePrivate", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
// call static method from implementing subclass
|
||||||
|
/*
|
||||||
|
* testInvokeFromSubclass
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default static public int staticPublicM() { return 1; }
|
||||||
|
* default static private int staticPrivateM() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C implements I {
|
||||||
|
* public int invokePublic() { return I.staticPublicM(); }
|
||||||
|
* public int invokePrivate() { return I.staticPublicM(); }
|
||||||
|
*
|
||||||
|
* I.staticPublicM(); ==> returns 1;
|
||||||
|
* I.staticPrivateM(); ==> Either NSME or IAE depending on execution mode
|
||||||
|
* C c = new C(); c.invokePublic(); ==> returns 1 or if -ver < 52 IAE or VerifyError
|
||||||
|
* C c = new C(); c.invokePrivate() ==> IAE or if -ver < 52, IAE or VerifyError
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
|
@NotApplicableFor(modes = { REDEFINITION }) // Can't redefine a class that gets error during loading
|
||||||
|
public void testInvokeFromSubclass() throws Exception {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("staticPublicM", "()I")
|
||||||
|
.static_().public_().returns(1).build()
|
||||||
|
|
||||||
|
.defaultMethod("staticPrivateM", "()I")
|
||||||
|
.static_().private_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I)
|
||||||
|
.concreteMethod("invokePublic", "()I")
|
||||||
|
.invokeStatic(b.intfByName("I"), "staticPublicM", "()I").build()
|
||||||
|
.concreteMethod("invokePrivate", "()I")
|
||||||
|
.invokeStatic(b.intfByName("I"), "staticPrivateM", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Class expectedError1;
|
||||||
|
if (factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
expectedError1 = NoSuchMethodException.class;
|
||||||
|
} else {
|
||||||
|
expectedError1 = IllegalAccessError.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adjust for -ver < 52
|
||||||
|
if (factory.getVer() >=52) {
|
||||||
|
// call static method from another class
|
||||||
|
b.test().staticCallSite(I, "staticPublicM", "()I").returns(1).done()
|
||||||
|
.test().staticCallSite(I, "staticPrivateM", "()I").throws_(expectedError1).done()
|
||||||
|
|
||||||
|
// call static method from implementing subclass
|
||||||
|
.test().callSite(C, C, "invokePublic", "()I").returns(1).done()
|
||||||
|
.test().callSite(C, C, "invokePrivate", "()I").throws_(IllegalAccessError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
} else {
|
||||||
|
// call static method from another class
|
||||||
|
b.test().staticCallSite(I, "staticPublicM", "()I").returns(1).done()
|
||||||
|
.test().staticCallSite(I, "staticPrivateM", "()I").throws_(expectedError1).done()
|
||||||
|
|
||||||
|
// call static method from implementing subclass
|
||||||
|
// invokestatic IMR - not supported for ver < 52
|
||||||
|
.test().callSite(C, C, "invokePublic", "()I").throws_(VerifyError.class).done()
|
||||||
|
.test().callSite(C, C, "invokePrivate", "()I").throws_(VerifyError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// static method doesn't participate in default method analysis:
|
||||||
|
// method overriding
|
||||||
|
/*
|
||||||
|
* testNotInherited
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default static public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C implements I {}
|
||||||
|
*/
|
||||||
|
public void testNotInherited() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.static_().public_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
if (!factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
b.test().staticCallSite(I, "m", "()I").returns(1).done()
|
||||||
|
// invokeinterface to static method ==> ICCE
|
||||||
|
.test().callSite(I, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(NoSuchMethodError.class).done()
|
||||||
|
.run();
|
||||||
|
} else {
|
||||||
|
b.test().staticCallSite(I, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(I, C, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(NoSuchMethodError.class).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testDefaultVsConcrete
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default static public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C implements I {
|
||||||
|
* public int m() { return 2; }
|
||||||
|
* }
|
||||||
|
* TEST: I o = new C(); o.m()I throws ICCE
|
||||||
|
* TEST: C o = new C(); o.m()I == 2
|
||||||
|
*/
|
||||||
|
public void testDefaultVsConcrete() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.static_().public_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I)
|
||||||
|
.concreteMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
if (!factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
// invokeinterface to static method ==> ICCE
|
||||||
|
b.test().callSite(I, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(2).done().run();
|
||||||
|
} else {
|
||||||
|
b.test().callSite(I, C, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(2).done().run();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TEST: StaticMethodsTest.testOverrideStatic
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default static public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* interface J extends I {
|
||||||
|
* default public int m() { return 2; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C implements J {
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
public void testOverrideStatic() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.static_().public_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J).build();
|
||||||
|
|
||||||
|
if (!factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
b.test().staticCallSite(I, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(I, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(J, C, "m", "()I").returns(2).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(2).done()
|
||||||
|
.run();
|
||||||
|
} else {
|
||||||
|
b.test().staticCallSite(I, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(I, C, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(J, C, "m", "()I").returns(2).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(2).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testOverrideDefault
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* interface J extends I {
|
||||||
|
* default static public int m() { return 2; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C implements J {}
|
||||||
|
*
|
||||||
|
* TEST: I o = new C(); o.m()I == 1
|
||||||
|
* TEST: J o = new C(); o.m()I == ICCE
|
||||||
|
* TEST: C o = new C(); o.m()I == 1
|
||||||
|
*/
|
||||||
|
public void testOverrideDefault() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.static_().public_().returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J).build();
|
||||||
|
|
||||||
|
if (!factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
b.test().callSite(I, C, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(J, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Reflection correctly finds the static method defined in J and
|
||||||
|
// calls it with invokestatic.
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(J, C, "m", "()I").returns(2).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testReabstract
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default static public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* interface J extends I {
|
||||||
|
* abstract public int m();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C implements J {}
|
||||||
|
*
|
||||||
|
* TEST: I o = new C(); o.m()I throws ICCE
|
||||||
|
* -mode reflect returns 1
|
||||||
|
* TEST: J o = new C(); o.m()I throws AME
|
||||||
|
* TEST: C o = new C(); o.m()I throws AME
|
||||||
|
*/
|
||||||
|
public void testReabstract() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.static_().public_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J).build();
|
||||||
|
|
||||||
|
if (!factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
b.test().callSite(I, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(J, C, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
.run();
|
||||||
|
} else {
|
||||||
|
b.test().callSite(I, C, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(J, C, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testOverrideAbstract
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* abstract public int m();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* interface J extends I {
|
||||||
|
* default static public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C implements J {}
|
||||||
|
*
|
||||||
|
* TEST: I o = new C(); o.m()I throws AME
|
||||||
|
* TEST: J o = new C(); o.m()I throws ICCE
|
||||||
|
* -mode reflect returns 1
|
||||||
|
* TEST: C o = new C(); o.m()I throws AME
|
||||||
|
*/
|
||||||
|
public void testOverrideAbstract() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.static_().public_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J).build();
|
||||||
|
|
||||||
|
if (!factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
b.test().callSite(I, C, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
.test().callSite(J, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
} else {
|
||||||
|
b.test().callSite(I, C, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
.test().callSite(J, C, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testInheritedDefault
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default static public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class B implements I {}
|
||||||
|
*
|
||||||
|
* class C extends B {}
|
||||||
|
*
|
||||||
|
* TEST: I o = new C(); o.m()I throws IncompatibleClassChangeError
|
||||||
|
* -mode reflect returns 1
|
||||||
|
* TEST: B o = new C(); o.m()I throws NoSuchMethodError
|
||||||
|
* TEST: C o = new C(); o.m()I throws NoSuchMethodError
|
||||||
|
*/
|
||||||
|
public void testInheritedDefault() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.static_().public_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass B = b.clazz("B").implement(I).build();
|
||||||
|
ConcreteClass C = b.clazz("C").extend(B).build();
|
||||||
|
|
||||||
|
if (!factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
b.test().callSite(I, C, "m","()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(B, C, "m","()I").throws_(NoSuchMethodError.class).done()
|
||||||
|
.test().callSite(C, C, "m","()I").throws_(NoSuchMethodError.class).done()
|
||||||
|
.run();
|
||||||
|
} else {
|
||||||
|
b.test().callSite(I, C, "m","()I").returns(1).done()
|
||||||
|
.test().callSite(B, C, "m","()I").throws_(NoSuchMethodError.class).done()
|
||||||
|
.test().callSite(C, C, "m","()I").throws_(NoSuchMethodError.class).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testDefaultVsConcreteInherited
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default static public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class B {
|
||||||
|
* public int m() { return 2; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C extends B implements I {}
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void testDefaultVsConcreteInherited() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.static_().public_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass B = b.clazz("B")
|
||||||
|
.concreteMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").extend(B).implement(I).build();
|
||||||
|
|
||||||
|
if (!factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
b.test().staticCallSite(I, "m","()I").returns(1).done()
|
||||||
|
.test().callSite(I, C, "m","()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(B, C, "m","()I").returns(2).done()
|
||||||
|
.test().callSite(C, C, "m","()I").returns(2).done()
|
||||||
|
.run();
|
||||||
|
} else {
|
||||||
|
b.test().staticCallSite(I, "m","()I").returns(1).done()
|
||||||
|
.test().callSite(I, C, "m","()I").returns(1).done()
|
||||||
|
.test().callSite(B, C, "m","()I").returns(2).done()
|
||||||
|
.test().callSite(C, C, "m","()I").returns(2).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testDefaultVsStaticConflict
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default static public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* interface J {
|
||||||
|
* default public int m() { return 2; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C implements I, J {}
|
||||||
|
*
|
||||||
|
* TEST: I o = new C(); o.m()I throws ICCE
|
||||||
|
* -mode reflect returns 1
|
||||||
|
* TEST: J o = new C(); o.m()I == 2
|
||||||
|
* TEST: C o = new C(); o.m()I == 2
|
||||||
|
*/
|
||||||
|
public void testDefaultVsStaticConflict() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.static_().public_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I,J).build();
|
||||||
|
|
||||||
|
if (!factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
b.test().callSite(I, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(J, C, "m", "()I").returns(2).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(2).done()
|
||||||
|
.run();
|
||||||
|
} else {
|
||||||
|
b.test().callSite(I, C, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(J, C, "m", "()I").returns(2).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(2).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* testStaticSuperClassVsDefaultSuperInterface
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class A {
|
||||||
|
* public static int m() { return 2; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C extends A implements I {}
|
||||||
|
*
|
||||||
|
* TEST: C o = new C(); o.m()I throws ICCE
|
||||||
|
* -mode reflect returns 2
|
||||||
|
* TEST: I o = new C(); o.m()I == 1
|
||||||
|
*/
|
||||||
|
public void testStaticSuperClassVsDefaultSuperInterface() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.public_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass A = b.clazz("A")
|
||||||
|
.concreteMethod("m", "()I")
|
||||||
|
.static_().public_().returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").extend(A).implement(I).build();
|
||||||
|
|
||||||
|
if (!factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
b.test().callSite(C, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(I, C, "m", "()I").returns(1).done()
|
||||||
|
.run();
|
||||||
|
} else {
|
||||||
|
b.test().callSite(C, C, "m", "()I").returns(2).done()
|
||||||
|
.test().callSite(I, C, "m", "()I").returns(1).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* testStaticLocalVsDefaultSuperInterface
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class A implements I {
|
||||||
|
* public static int m() { return 2; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C extends A implements I {}
|
||||||
|
*
|
||||||
|
* TEST: A o = new A(); o.m()I throws ICCE
|
||||||
|
* -mode reflect returns 2
|
||||||
|
* TEST: I o = new A(); o.m()I == 1
|
||||||
|
*/
|
||||||
|
public void testStaticLocalVsDefaultSuperInterface() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.public_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass A = b.clazz("A").implement(I)
|
||||||
|
.concreteMethod("m", "()I")
|
||||||
|
.static_().public_().returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").extend(A).implement(I).build();
|
||||||
|
|
||||||
|
if (!factory.getExecutionMode().equals("REFLECTION")) {
|
||||||
|
b.test().callSite(A, A, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(I, A, "m", "()I").returns(1).done()
|
||||||
|
.run();
|
||||||
|
} else {
|
||||||
|
b.test().callSite(A, A, "m", "()I").returns(2).done()
|
||||||
|
.test().callSite(I, A, "m", "()I").returns(1).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* testConflictingDefaultsandStaticMethod
|
||||||
|
* @bug 8033150
|
||||||
|
*
|
||||||
|
* interface I {
|
||||||
|
* default public int m() { return 1; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* interface J {
|
||||||
|
* default public int m() { return 2; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class A implements I, J {
|
||||||
|
* public static int m() { return 3; }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class C extends A {}
|
||||||
|
*
|
||||||
|
* TEST: C.m(); should call A.m, return value = 3
|
||||||
|
*/
|
||||||
|
public void testConflictingDefaultsandStaticMethod() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.public_().returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "()I")
|
||||||
|
.public_().returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass A = b.clazz("A").implement(I,J)
|
||||||
|
.concreteMethod("m", "()I")
|
||||||
|
.static_().public_().returns(3).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").extend(A).build();
|
||||||
|
|
||||||
|
b.test().staticCallSite(C, "m", "()I").returns(3).done()
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
}
|
315
test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/StressTest.java
Normal file
315
test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/StressTest.java
Normal file
@ -0,0 +1,315 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vm.runtime.defmeth;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
import nsk.share.TestFailure;
|
||||||
|
import nsk.share.test.StressOptions;
|
||||||
|
import nsk.share.test.Stresser;
|
||||||
|
import vm.runtime.defmeth.shared.Constants;
|
||||||
|
import vm.runtime.defmeth.shared.DefMethTest;
|
||||||
|
import vm.runtime.defmeth.shared.ExecutionMode;
|
||||||
|
import vm.runtime.defmeth.shared.builder.TestBuilder;
|
||||||
|
import vm.share.options.Option;
|
||||||
|
import vm.share.options.OptionSupport;
|
||||||
|
import vm.share.options.Options;
|
||||||
|
import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Stress test for default methods implementation.
|
||||||
|
*
|
||||||
|
* Stress scenario is the following:
|
||||||
|
* - in multiple threads ...
|
||||||
|
* - ... continuously run random tests ...
|
||||||
|
* - ... in random configuration ...
|
||||||
|
* - ... until predefined period of time is over...
|
||||||
|
* - ... or any failures occured.
|
||||||
|
*/
|
||||||
|
public class StressTest implements Runnable {
|
||||||
|
@Options
|
||||||
|
private StressOptions opts = new StressOptions();
|
||||||
|
|
||||||
|
@Option(name="seed", default_value="0", description="force deterministic behavior")
|
||||||
|
private int seed;
|
||||||
|
|
||||||
|
@Option(name="redefine", default_value="false", description="use scenarios w/ class redefinition")
|
||||||
|
private boolean doRedefine;
|
||||||
|
|
||||||
|
@Option(name="ver", default_value="49", description="minimum class file version to be used in the tests")
|
||||||
|
private int minMajorVer;
|
||||||
|
|
||||||
|
@Option(name="ignoreTestFailures", default_value="false", description="ignore failures of the executed tests")
|
||||||
|
private boolean ignoreTestFailures;
|
||||||
|
|
||||||
|
class Worker extends Thread {
|
||||||
|
private final Random rand;
|
||||||
|
|
||||||
|
private volatile DefMethTest failedTest;
|
||||||
|
private Throwable reason;
|
||||||
|
private volatile long executedTests = 0;
|
||||||
|
|
||||||
|
public Worker(String id, int seed) {
|
||||||
|
setName(id);
|
||||||
|
this.rand = new Random(seed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
while (!Thread.interrupted()) {
|
||||||
|
int idx = rand.nextInt(testlist.size());
|
||||||
|
DefMethTest test = testlist.get(idx);
|
||||||
|
try {
|
||||||
|
test.run();
|
||||||
|
executedTests++;
|
||||||
|
if (test.isFailed()) {
|
||||||
|
throw new TestFailure(test.toString());
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
if (!ignoreTestFailures) {
|
||||||
|
failedTest = test;
|
||||||
|
reason = e;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFailed() { return failedTest != null; }
|
||||||
|
public Throwable getReason() { return reason; }
|
||||||
|
public DefMethTest getFailedTest() { return failedTest; }
|
||||||
|
public long getExecutedTests() { return executedTests; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<DefMethTest> testlist;
|
||||||
|
|
||||||
|
private Worker[] workers;
|
||||||
|
|
||||||
|
Stresser stresser;
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
StressTest test = new StressTest();
|
||||||
|
OptionSupport.setupAndRun(test, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
configureTests();
|
||||||
|
startWorkers();
|
||||||
|
|
||||||
|
stresser = new Stresser(opts);
|
||||||
|
try {
|
||||||
|
stresser.start(0);
|
||||||
|
while (workersAlive() && stresser.continueExecution()) {
|
||||||
|
printStats();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
} catch (InterruptedException ex) {}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
interruptWorkers();
|
||||||
|
joinWorkers();
|
||||||
|
|
||||||
|
stresser.finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void configureTests() {
|
||||||
|
int[] majorVerValues = new int[52 - minMajorVer + 1];
|
||||||
|
for (int i = 0; i< majorVerValues.length; i++) {
|
||||||
|
majorVerValues[i] = minMajorVer + i;
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] flagsValues = new int[] {
|
||||||
|
0,
|
||||||
|
ACC_STRICT,
|
||||||
|
ACC_SYNCHRONIZED,
|
||||||
|
ACC_STRICT | ACC_SYNCHRONIZED
|
||||||
|
};
|
||||||
|
|
||||||
|
boolean[] doRedefineValues;
|
||||||
|
if (doRedefine) {
|
||||||
|
doRedefineValues = new boolean[] { true, false};
|
||||||
|
} else {
|
||||||
|
doRedefineValues = new boolean[] { false };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Upper limit for test count
|
||||||
|
int testCount = DefMethTest.getTests().size() * majorVerValues.length
|
||||||
|
* flagsValues.length * doRedefineValues.length;
|
||||||
|
|
||||||
|
testlist = new ArrayList<>(testCount);
|
||||||
|
|
||||||
|
// Enumerate all tests in all possible modes
|
||||||
|
for (Class<? extends DefMethTest> testClass : DefMethTest.getTests()) {
|
||||||
|
for (ExecutionMode mode : ExecutionMode.values()) {
|
||||||
|
// Skip REDEFINITION execmode, the top README file indicates that it isn't a
|
||||||
|
// valid execution mode and there's also no code supporting this in the test generator.
|
||||||
|
if ("REDEFINITION".equals(mode.toString())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int majorVer : majorVerValues) {
|
||||||
|
for (int flags : flagsValues ) {
|
||||||
|
for (boolean redefine : doRedefineValues) {
|
||||||
|
// RedefineTest isn't applicable to reflection-based execution scenario (REDEFINE & INVOKE_WITH_ARGS)
|
||||||
|
if (testClass == RedefineTest.class && mode.isReflectionBased()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only run the RedefineTest tests when redefining
|
||||||
|
if (!redefine && testClass == RedefineTest.class) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
DefMethTest test = testClass.newInstance();
|
||||||
|
|
||||||
|
OptionSupport.setup(test, new String[] {
|
||||||
|
"-execMode", mode.toString(),
|
||||||
|
"-ver", Integer.toString(majorVer),
|
||||||
|
"-flags", Integer.toString(flags),
|
||||||
|
"-redefine", Boolean.toString(redefine),
|
||||||
|
"-ignoreCrashes",
|
||||||
|
"-ignoreKnownFailures",
|
||||||
|
"-silent",
|
||||||
|
"-failfast"});
|
||||||
|
|
||||||
|
testlist.add(test);
|
||||||
|
} catch (InstantiationException | IllegalAccessException ex) {
|
||||||
|
throw new TestFailure(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.printf("Testlist size: %d\n", testlist.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startWorkers() {
|
||||||
|
Random rand;
|
||||||
|
if (seed == 0) {
|
||||||
|
seed = (new Random()).nextInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.printf("Seed: %d\n", seed);
|
||||||
|
rand = new Random(seed);
|
||||||
|
|
||||||
|
//Workaround for the deadlock caused by
|
||||||
|
// JDK-7122142: "(ann) Race condition between isAnnotationPresent and getAnnotations"
|
||||||
|
try {
|
||||||
|
// Do a warm-up cycle
|
||||||
|
for (Class<? extends DefMethTest> testClass : DefMethTest.getTests()) {
|
||||||
|
DefMethTest test = testClass.newInstance();
|
||||||
|
|
||||||
|
OptionSupport.setupAndRun(test,
|
||||||
|
new String[] { "-silent", "-ignoreKnownFailures"});
|
||||||
|
}
|
||||||
|
} catch(InstantiationException | IllegalAccessException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
int threadsCount = opts.getThreadsFactor();
|
||||||
|
if (threadsCount == 1) {
|
||||||
|
threadsCount = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
workers = new Worker[threadsCount];
|
||||||
|
|
||||||
|
System.out.printf("Spawning %d workers...\n", workers.length);
|
||||||
|
|
||||||
|
for (int i = 0; i < workers.length; i++) {
|
||||||
|
workers[i] = new Worker(
|
||||||
|
String.format("Worker #%d/%d", i+1, workers.length),
|
||||||
|
rand.nextInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Worker worker : workers) {
|
||||||
|
worker.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void interruptWorkers() {
|
||||||
|
for (Worker worker : workers) {
|
||||||
|
worker.interrupt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void joinWorkers() {
|
||||||
|
boolean isFailed = false;
|
||||||
|
|
||||||
|
for (Worker worker : workers) {
|
||||||
|
while (worker.isAlive()) {
|
||||||
|
try {
|
||||||
|
worker.join();
|
||||||
|
} catch (InterruptedException e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.printf("%s: %s (executed: %d)\n",
|
||||||
|
worker.getName(),
|
||||||
|
worker.isFailed() ? "FAILED: " + worker.getFailedTest() : "PASSED",
|
||||||
|
worker.getExecutedTests());
|
||||||
|
|
||||||
|
if (worker.isFailed()) {
|
||||||
|
if (Constants.PRINT_STACK_TRACE) {
|
||||||
|
worker.getReason().printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
isFailed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFailed) {
|
||||||
|
throw new TestFailure("Some of the worker threads failed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean workersAlive() {
|
||||||
|
for (Worker worker : workers) {
|
||||||
|
if (!worker.isAlive()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void printStats() {
|
||||||
|
long[] counts = new long[workers.length];
|
||||||
|
for (int i = 0; i < counts.length; i++) {
|
||||||
|
counts[i] = workers[i].executedTests;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder msg = new StringBuilder();
|
||||||
|
msg.append(stresser.getTimeLeft() / 1000).append("s left: ");
|
||||||
|
msg.append(Arrays.toString(counts));
|
||||||
|
|
||||||
|
System.out.println(msg);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,771 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vm.runtime.defmeth;
|
||||||
|
|
||||||
|
import nsk.share.test.TestBase;
|
||||||
|
import vm.runtime.defmeth.shared.DefMethTest;
|
||||||
|
import vm.runtime.defmeth.shared.annotation.KnownFailure;
|
||||||
|
import vm.runtime.defmeth.shared.annotation.NotApplicableFor;
|
||||||
|
import vm.runtime.defmeth.shared.data.*;
|
||||||
|
import vm.runtime.defmeth.shared.builder.TestBuilder;
|
||||||
|
import static vm.runtime.defmeth.shared.ExecutionMode.*;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Tests on invoke-super-default.
|
||||||
|
*
|
||||||
|
* Invoke-super-default is used by a subclass to defer to a default method
|
||||||
|
* implementation or to disambiguate between conflicting inherited default
|
||||||
|
* methods.
|
||||||
|
*
|
||||||
|
* Invoke-super-default appears in the source code as
|
||||||
|
* "<interface-name>.super.<method-name>(<args>)". It is compiled into an
|
||||||
|
* invokespecial instruction whose target is <interface-name>.<method-name>,
|
||||||
|
* where the interface is a direct supertype of the current class (the current class
|
||||||
|
* must directly implement <interface-name>).
|
||||||
|
*
|
||||||
|
* 0.6.3 JVMS draft for JDK8 updated.
|
||||||
|
* Invokespecial on any superinterface method will run interface method
|
||||||
|
* resolution, and then the selected method will be set to the resolved method.
|
||||||
|
* super defaults no longer check for lack of shadowing, other languages
|
||||||
|
* want this capability.
|
||||||
|
*/
|
||||||
|
public class SuperCallTest extends DefMethTest {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure() {
|
||||||
|
// Since invoke-super-default relies on new semantics of invokespecial,
|
||||||
|
// the tests are applicable only to class files of 52 version.
|
||||||
|
if (factory.getVer() != 52) {
|
||||||
|
getLog().warn("WARN: SuperCallTest is applicable only for class files w/ version 52.");
|
||||||
|
getLog().warn("WARN: Overriding \"-ver " + factory.getVer() + "\" w/ \"-ver 52\".");
|
||||||
|
|
||||||
|
factory.setVer(52);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
TestBase.runTest(new SuperCallTest(), args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Basic case
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J extends I { int m() default { return I.super.m(); } }
|
||||||
|
* class C implements J {}
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); c.m() == 88;
|
||||||
|
* TEST: I i = new C(); i.m() == 88;
|
||||||
|
*/
|
||||||
|
public void testSuperBasic1() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.defaultMethod("m", "()I").callSuper(I, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J).build();
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(J, C, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Super Conflict Resolution
|
||||||
|
*
|
||||||
|
* interface K { int m() default { return 1; } }
|
||||||
|
* interface L { int m() default { return 2; } }
|
||||||
|
* interface I extends K,L { int m() default { K.super.m(); } }
|
||||||
|
* class C implements I {}
|
||||||
|
* class D implements K,L {}
|
||||||
|
*
|
||||||
|
* TEST: K k = new C(); k.m() == 1
|
||||||
|
* TEST: L l = new C(); l.m() == 1
|
||||||
|
* TEST: I i = new C(); i.m() == 1
|
||||||
|
* TEST: C c = new C(); c.m() == 1
|
||||||
|
*
|
||||||
|
* TEST: K k = new D(); k.m() == 1
|
||||||
|
* TEST: L l = new D(); l.m() == 1
|
||||||
|
* TEST: D d = new D(); d.m() == 1
|
||||||
|
*/
|
||||||
|
public void testSuperConflictResolution() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface K = b.intf("K")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface L = b.intf("L")
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface I = b.intf("I").extend(K, L)
|
||||||
|
.defaultMethod("m", "()I").callSuper(K, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
ConcreteClass D = b.clazz("D").implement(K,L)
|
||||||
|
.concreteMethod("m", "()I").callSuper(K, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
|
||||||
|
b.test().callSite(K, C, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(L, C, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(I, C, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.test().callSite(K, D, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(L, D, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(D, D, "m", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Super call of conflicting default method from different method name
|
||||||
|
*
|
||||||
|
* interface K {
|
||||||
|
* default public int m(int) { return 1; }
|
||||||
|
* }
|
||||||
|
* interface L {
|
||||||
|
* default public int m(int) { return 2; }
|
||||||
|
* }
|
||||||
|
* interface I extends K, L {
|
||||||
|
* default public int k() { return K.super.m((int)0); }
|
||||||
|
* default public int l() { return L.super.m((int)0); }
|
||||||
|
* }
|
||||||
|
* class C implements I {}
|
||||||
|
* class D implements K, L {
|
||||||
|
* public int k() { return K.super.m((int)0); }
|
||||||
|
* public int l() { return L.super.m((int)0); }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* TEST: K o = new C(); o.m(I)I throws ICCE
|
||||||
|
* TEST: L o = new C(); o.m(I)I throws ICCE
|
||||||
|
* TEST: C o = new C(); o.m(I)I throws ICCE
|
||||||
|
* TEST: I o = new C(); o.k()I == 1
|
||||||
|
* TEST: C o = new C(); o.k()I == 1
|
||||||
|
* TEST: I o = new C(); o.l()I == 2
|
||||||
|
* TEST: C o = new C(); o.l()I == 2
|
||||||
|
* TEST: K o = new D(); o.m(I)I throws ICCE
|
||||||
|
* TEST: L o = new D(); o.m(I)I throws ICCE
|
||||||
|
* TEST: D o = new D(); o.m(I)I throws ICCE
|
||||||
|
* TEST: D o = new D(); o.k()I == 1
|
||||||
|
* TEST: D o = new D(); o.l()I == 2
|
||||||
|
*/
|
||||||
|
public void testSuperConflictDiffMethod() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface K = b.intf("K")
|
||||||
|
.defaultMethod("m", "(I)I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface L = b.intf("L")
|
||||||
|
.defaultMethod("m", "(I)I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface I = b.intf("I").extend(K, L)
|
||||||
|
.defaultMethod("k", "()I").callSuper(K, "m", "(I)I").build()
|
||||||
|
.defaultMethod("l", "()I").callSuper(L, "m", "(I)I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
ConcreteClass D = b.clazz("D").implement(K,L)
|
||||||
|
.concreteMethod("k", "()I").callSuper(K, "m", "(I)I").build()
|
||||||
|
.concreteMethod("l", "()I").callSuper(L, "m", "(I)I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(K, C, "m", "(I)I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(L, C, "m", "(I)I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "(I)I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
|
||||||
|
.test().callSite(I, C, "k", "()I").returns(1).done()
|
||||||
|
.test().callSite(C, C, "k", "()I").returns(1).done()
|
||||||
|
.test().callSite(I, C, "l", "()I").returns(2).done()
|
||||||
|
.test().callSite(C, C, "l", "()I").returns(2).done()
|
||||||
|
|
||||||
|
.test().callSite(K, D, "m", "(I)I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(L, D, "m", "(I)I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(D, D, "m", "(I)I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
|
||||||
|
.test().callSite(D, D, "k", "()I").returns(1).done()
|
||||||
|
.test().callSite(D, D, "l", "()I").returns(2).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SuperConflict
|
||||||
|
*
|
||||||
|
* interface K { int m() default { return 1; } }
|
||||||
|
* interface L { int m() default { return 2; } }
|
||||||
|
* interface J extends K, L {}
|
||||||
|
* interface I extends J, K { int m() default { J.super.m(); } }
|
||||||
|
* class C implements I {}
|
||||||
|
*
|
||||||
|
* TEST: K k = new C(); k.m() ==> ICCE
|
||||||
|
* TEST: L l = new C(); l.m() ==> ICCE
|
||||||
|
* TEST: J j = new C(); j.m() ==> ICCE
|
||||||
|
* TEST: I i = new C(); i.m() ==> ICCE
|
||||||
|
* TEST: C c = new C(); c.m() ==> ICCE
|
||||||
|
*/
|
||||||
|
public void testSuperConflict() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface K = b.intf("K")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface L = b.intf("L")
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(K, L).build();
|
||||||
|
|
||||||
|
Interface I = b.intf("I").extend(K, J)
|
||||||
|
.defaultMethod("m", "()I").callSuper(J, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I).build();
|
||||||
|
|
||||||
|
b.test().callSite(K, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(L, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(J, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(I, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SuperDisqual
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J { int m() default { return 2; } }
|
||||||
|
* class C implements I, J { public int m() { return I.super.m(); } }
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); c.m() ==> 1
|
||||||
|
* TEST: J j = new C(); j.m() ==> 1
|
||||||
|
*/
|
||||||
|
public void testSuperDisqual() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I, J)
|
||||||
|
.concreteMethod("m", "()I").callSuper(I, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(J, C, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SuperNull
|
||||||
|
*
|
||||||
|
* interface I { int m(); }
|
||||||
|
* interface J extends I { int m() default { return I.super.m(); } }
|
||||||
|
* interface K extends I { int m() default { return I.super.n(); } }
|
||||||
|
* class C implements J {}
|
||||||
|
* class D implements K {}
|
||||||
|
*
|
||||||
|
* TEST: I i = new C(); i.m() ==> AME
|
||||||
|
* TEST: J j = new C(); j.m() ==> AME
|
||||||
|
* TEST: C c = new C(); c.m() ==> AME
|
||||||
|
* TEST: K k = new D(); k.m() ==> NSME
|
||||||
|
*/
|
||||||
|
public void testSuperNull() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.defaultMethod("m", "()I").callSuper(I, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface K = b.intf("K").extend(I)
|
||||||
|
.defaultMethod("m", "()I").callSuper(I, "n", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J).build();
|
||||||
|
ConcreteClass D = b.clazz("D").implement(K).build();
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
.test().callSite(J, C, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
.test().callSite(K, D, "m", "()I").throws_(NoSuchMethodError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SuperGeneric
|
||||||
|
*
|
||||||
|
* interface J<T> { int m(T t) default { return 1; } }
|
||||||
|
* interface I extends J<String> { int m(String s) default { return J.super.m(); } }
|
||||||
|
* class C implements I {}
|
||||||
|
*
|
||||||
|
* TEST: I i = new C(); i.m(new Object()) == 1;
|
||||||
|
* TESTL J j = new C(); j.m(new Object()) == 1;
|
||||||
|
* TEST: J j = new C(); j.m("") == 1;
|
||||||
|
* TEST: C c = new C(); c.m(new Object()) == 1;
|
||||||
|
* TEST: C c = new C(); c.m("") == 1;
|
||||||
|
*/
|
||||||
|
@KnownFailure(modes = { INVOKE_EXACT, INVOKE_GENERIC, INVOKE_WITH_ARGS, INDY }) // Test2_J_C_m: AME => IAE => ICCE instead of successful call
|
||||||
|
public void testSuperGeneric() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
// interface I<T> {
|
||||||
|
// default int m(T t) { return 1; }
|
||||||
|
// }
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.sig("<T:Ljava/lang/Object;>Ljava/lang/Object;")
|
||||||
|
.defaultMethod("m", "(Ljava/lang/Object;)I").sig("(TT;)I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// interface J extends I<String> {
|
||||||
|
// default int m(String s) { return I.super.m(); }
|
||||||
|
// }
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.sig("Ljava/lang/Object;LI<Ljava/lang/String;>;")
|
||||||
|
.defaultMethod("m", "(Ljava/lang/String;)I").callSuper(I, "m", "(Ljava/lang/Object;)I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J).build();
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "(Ljava/lang/Object;)I").returns(1).done()
|
||||||
|
|
||||||
|
.test().callSite(J, C, "m", "(Ljava/lang/Object;)I").returns(1).done()
|
||||||
|
.test().callSite(J, C, "m", "(Ljava/lang/String;)I").returns(1).done()
|
||||||
|
|
||||||
|
.test().callSite(C, C, "m", "(Ljava/lang/Object;)I").returns(1).done()
|
||||||
|
.test().callSite(C, C, "m", "(Ljava/lang/String;)I").returns(1).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SuperGenericDisqual
|
||||||
|
*
|
||||||
|
* interface I<T> { int m(T t) default { return 1; } }
|
||||||
|
* interface J extends I<String> { int m(String s) default { return 2; } }
|
||||||
|
* class C implements I<String>, J { public int m(String s) { return I.super.m(s); } }
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); c.m("string") == 1
|
||||||
|
*/
|
||||||
|
@KnownFailure(modes = { INVOKE_EXACT, INVOKE_GENERIC, INVOKE_WITH_ARGS, INDY }) // Test2_J_C_m: AME => IAE => ICCE instead of successful call
|
||||||
|
public void testSuperGenericDisqual() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I").sig("<T:Ljava/lang/Object;>Ljava/lang/Object;")
|
||||||
|
.defaultMethod("m", "(Ljava/lang/Object;)I").sig("(TT;)I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.sig("Ljava/lang/Object;LJ<Ljava/lang/String;>;")
|
||||||
|
.defaultMethod("m", "(Ljava/lang/String;)I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I,J)
|
||||||
|
.sig("Ljava/lang/Object;LI;LJ<Ljava/lang/String;>;")
|
||||||
|
.concreteMethod("m", "(Ljava/lang/String;)I").callSuper(I, "m", "(Ljava/lang/Object;)I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(I, C, "m", "(Ljava/lang/Object;)I").returns(1).done()
|
||||||
|
|
||||||
|
.test().callSite(J, C, "m", "(Ljava/lang/Object;)I").returns(1).done()
|
||||||
|
.test().callSite(J, C, "m", "(Ljava/lang/String;)I").returns(1).done()
|
||||||
|
|
||||||
|
.test().callSite(C, C, "m", "(Ljava/lang/Object;)I").returns(1).done()
|
||||||
|
.test().callSite(C, C, "m", "(Ljava/lang/String;)I").returns(1).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Super-call of non-default method
|
||||||
|
*
|
||||||
|
* class C { int m() { return 1; } }
|
||||||
|
* class D extends C { int m() { return C.super.m(); } }
|
||||||
|
*
|
||||||
|
* TEST: C d = new D(); d.m() == 1
|
||||||
|
* TEST: D d = new D(); d.m() == 1
|
||||||
|
*/
|
||||||
|
public void testSuperNonDefault() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C")
|
||||||
|
.concreteMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass D = b.clazz("D").extend(C)
|
||||||
|
.concreteMethod("m", "()I").callSuper(C, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(C, D, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(D, D, "m", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Super-call of non-default method
|
||||||
|
*
|
||||||
|
* interface I { int m(); }
|
||||||
|
* class C { int m() { return 1; } }
|
||||||
|
* class D extends C implements I { int m() { return I.super.m(); } }
|
||||||
|
* class E extends C implements I { int m() { return C.super.m(); } }
|
||||||
|
*
|
||||||
|
* TEST: I d = new D(); d.m() ==> AME
|
||||||
|
* TEST: C d = new D(); d.m() ==> AME
|
||||||
|
* TEST: D d = new D(); d.m() ==> AME
|
||||||
|
* TEST: I e = new E(); e.m() == 1
|
||||||
|
* TEST: C e = new E(); e.m() == 1
|
||||||
|
* TEST: E e = new E(); e.m() == 1
|
||||||
|
*/
|
||||||
|
public void testSuperNonDefault1() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.abstractMethod("m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C")
|
||||||
|
.concreteMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass D = b.clazz("D").extend(C).implement(I)
|
||||||
|
.concreteMethod("m", "()I").callSuper(I, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass E = b.clazz("E").extend(C).implement(I)
|
||||||
|
.concreteMethod("m", "()I").callSuper(C, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(I, D, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
.test().callSite(C, D, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
.test().callSite(D, D, "m", "()I").throws_(AbstractMethodError.class).done()
|
||||||
|
|
||||||
|
.test().callSite(I, E, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(C, E, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(E, E, "m", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Super-call of non-default method
|
||||||
|
*
|
||||||
|
* interface I { int m() {return 1;} }
|
||||||
|
* class C { int m() { return 2; } }
|
||||||
|
* class D extends C implements I { int m() { return I.super.m(); } }
|
||||||
|
* class E extends C implements I { int m() { return C.super.m(); } }
|
||||||
|
*
|
||||||
|
* TEST: I d = new D(); d.m() == 1
|
||||||
|
* TEST: C d = new D(); d.m() == 1
|
||||||
|
* TEST: D d = new D(); d.m() == 1
|
||||||
|
*
|
||||||
|
* TEST: I e = new E(); e.m() == 2
|
||||||
|
* TEST: C e = new E(); e.m() == 2
|
||||||
|
* TEST: E e = new E(); e.m() == 2
|
||||||
|
*/
|
||||||
|
public void testSuperNonDefault2() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C")
|
||||||
|
.concreteMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass D = b.clazz("D").extend(C).implement(I)
|
||||||
|
.concreteMethod("m", "()I").callSuper(I, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass E = b.clazz("E").extend(C).implement(I)
|
||||||
|
.concreteMethod("m", "()I").callSuper(C, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(I, D, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(C, D, "m", "()I").returns(1).done()
|
||||||
|
.test().callSite(D, D, "m", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.test().callSite(I, E, "m", "()I").returns(2).done()
|
||||||
|
.test().callSite(C, E, "m", "()I").returns(2).done()
|
||||||
|
.test().callSite(E, E, "m", "()I").returns(2).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Disambig
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J { int m() default { return 2; } }
|
||||||
|
* class C implements I, J { int q() { return I.super.m(); }
|
||||||
|
* int r() { return J.super.m(); } }
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); c.m() == ICCE;
|
||||||
|
* TEST: C c = new C(); c.q() == 1;
|
||||||
|
* TEST: C c = new C(); c.r() == 2;
|
||||||
|
*/
|
||||||
|
public void testDisambig() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(I,J)
|
||||||
|
.concreteMethod("q", "()I").callSuper(I, "m", "()I").build()
|
||||||
|
.concreteMethod("r", "()I").callSuper(J, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(C, C, "q", "()I").returns(1).done()
|
||||||
|
.test().callSite(C, C, "r", "()I").returns(2).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Disambig2
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J { int m() default { return 2; } }
|
||||||
|
* interface K extends I
|
||||||
|
* interface L extends J
|
||||||
|
* class C implements K, L { int q() { return K.super.m(); }
|
||||||
|
* int r() { return L.super.m(); } }
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); c.m() == ICCE;
|
||||||
|
* TEST: C c = new C(); c.q() == 1;
|
||||||
|
* TEST: C c = new C(); c.r() == 2;
|
||||||
|
*/
|
||||||
|
public void testDisambig2() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J")
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface K = b.intf("K").extend(I).build();
|
||||||
|
|
||||||
|
Interface L = b.intf("L").extend(J).build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(K,L)
|
||||||
|
.concreteMethod("q", "()I").callSuper(K, "m", "()I").build()
|
||||||
|
.concreteMethod("r", "()I").callSuper(L, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(C, C, "q", "()I").returns(1).done()
|
||||||
|
.test().callSite(C, C, "r", "()I").returns(2).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testResolvedShadowed
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface K extends I { int m() default { return 2; } }
|
||||||
|
* interface J extends I { }
|
||||||
|
* class C implements J,K { int q { J.super.m(); } }
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); c.m() == 2
|
||||||
|
* TEST: C c = new C(); c.q() == 1
|
||||||
|
*/
|
||||||
|
public void testResolvedShadowed() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface K = b.intf("K").extend(I)
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J,K)
|
||||||
|
.concreteMethod("q", "()I").callSuper(J, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(C, C, "m", "()I").returns(2).done()
|
||||||
|
.test().callSite(C, C, "q", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testResolvedButSuperClass
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J { }
|
||||||
|
* class A { public int m() { return 2; } }
|
||||||
|
* class C implements J extends A { int q { J.super.m(); } }
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); c.q() == 1
|
||||||
|
* TEST: C c = new C(); c.m() == 2
|
||||||
|
*/
|
||||||
|
public void testResolvedButSuperClass() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass A = b.clazz("A")
|
||||||
|
.concreteMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J).extend(A)
|
||||||
|
.concreteMethod("q", "()I").callSuper(J, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(C, C, "q", "()I").returns(1).done()
|
||||||
|
.test().callSite(C, C, "m", "()I").returns(2).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* testResolved1Caller2NotShadowed
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J extends I { }
|
||||||
|
* interface L { int m() default { return 2; } }
|
||||||
|
* interface K extends I, L { }
|
||||||
|
* class C implements J,K { int q { J.super.m(); } }
|
||||||
|
*
|
||||||
|
* TEST: C c = new C(); c.m() == ICCE
|
||||||
|
* TEST: C c = new C(); c.q() == 1
|
||||||
|
*/
|
||||||
|
public void testResolved1Caller2NotShadowed() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I).build();
|
||||||
|
|
||||||
|
Interface L = b.intf("L")
|
||||||
|
.defaultMethod("m", "()I").returns(2).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface K = b.intf("K").extend(I,L)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(J,K)
|
||||||
|
.concreteMethod("q", "()I").callSuper(J, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
b.test().callSite(C, C, "m", "()I").throws_(IncompatibleClassChangeError.class).done()
|
||||||
|
.test().callSite(C, C, "q", "()I").returns(1).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test validity of invokespecial on indirect superinterface's method,
|
||||||
|
* this test should receive a verification error.
|
||||||
|
*
|
||||||
|
* (JVMS draft 0.7.0) JVMS 4.9.2 Structural Constraints
|
||||||
|
* Each invokespecial instruction must name an instance initialization
|
||||||
|
* method (2.9), or must reference a method in the current class or interface,
|
||||||
|
* a method in a superclass of the current class or interface, or a method
|
||||||
|
* in a direct superinterface of the current class or interface
|
||||||
|
*
|
||||||
|
* Note: Normally javac would reject this test case complaining that,
|
||||||
|
* InDirectSuper.java:5: error: not an enclosing class: I
|
||||||
|
* interface K extends J { default public void m() { I.super.m(); } }
|
||||||
|
* ^
|
||||||
|
* However, the below test case allows us to check for this structural
|
||||||
|
* constraint on invokespecial in the JVM.
|
||||||
|
*
|
||||||
|
* interface I { int m() default { return 1; } }
|
||||||
|
* interface J extends I { }
|
||||||
|
* interface K extends J { int m() default { return I.super.m(); } }
|
||||||
|
* class C implements K {}
|
||||||
|
*
|
||||||
|
* TEST: K k = new C(); k.m() == VerifyError
|
||||||
|
*/
|
||||||
|
@NotApplicableFor(modes = { REDEFINITION }) // Can't redefine a class that gets VerifyError
|
||||||
|
public void testSuperInvalidIndirectInterfaceMethodInvokeSpecial() {
|
||||||
|
TestBuilder b = factory.getBuilder();
|
||||||
|
|
||||||
|
Interface I = b.intf("I")
|
||||||
|
.defaultMethod("m", "()I").returns(1).build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Interface J = b.intf("J").extend(I).build();
|
||||||
|
|
||||||
|
Interface K = b.intf("K").extend(J)
|
||||||
|
.defaultMethod("m", "()I").callSuper(I, "m", "()I").build()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ConcreteClass C = b.clazz("C").implement(K).build();
|
||||||
|
|
||||||
|
b.test().callSite(K, C, "m", "()I").throws_(VerifyError.class).done()
|
||||||
|
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_none_direct_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 0
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_none_direct_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 0
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_none_invoke_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 0
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_none_invoke_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 0
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_none_reflect_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 0
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_none_reflect_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 0
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_strict_direct_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 2048
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_strict_direct_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 2048
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_strict_invoke_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 2048
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_strict_invoke_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 2048
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_strict_reflect_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 2048
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_strict_reflect_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 2048
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_sync_direct_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 32
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_sync_direct_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 32
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_sync_invoke_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 32
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_sync_invoke_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 32
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_sync_reflect_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 32
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_sync_reflect_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 32
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_syncstrict_direct_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 2080
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_syncstrict_direct_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 2080
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_syncstrict_invoke_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 2080
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_syncstrict_invoke_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 2080
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_syncstrict_reflect_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 2080
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/AccessibilityFlags_v52_syncstrict_reflect_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.AccessibilityFlagsTest
|
||||||
|
* -ver 52
|
||||||
|
* -flags 2080
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_none_direct_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 0
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_none_direct_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 0
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_none_invoke_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 0
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_none_invoke_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 0
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_none_reflect_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 0
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_none_reflect_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 0
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_strict_direct_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 2048
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_strict_direct_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 2048
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_strict_invoke_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 2048
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_strict_invoke_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 2048
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_strict_reflect_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 2048
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_strict_reflect_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 2048
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_sync_direct_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 32
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_sync_direct_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 32
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_sync_invoke_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 32
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_sync_invoke_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 32
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_sync_reflect_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 32
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_sync_reflect_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 32
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_syncstrict_direct_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 2080
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_syncstrict_direct_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 2080
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_syncstrict_invoke_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 2080
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_syncstrict_invoke_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 2080
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_syncstrict_reflect_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 2080
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v49_syncstrict_reflect_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 49
|
||||||
|
* -flags 2080
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_none_direct_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 0
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_none_direct_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 0
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_none_invoke_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 0
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_none_invoke_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 0
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_none_reflect_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 0
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_none_reflect_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 0
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_strict_direct_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 2048
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_strict_direct_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 2048
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_strict_invoke_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 2048
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_strict_invoke_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 2048
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_strict_reflect_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 2048
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_strict_reflect_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 2048
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_sync_direct_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 32
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_sync_direct_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 32
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_sync_invoke_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 32
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_sync_invoke_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 32
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_sync_reflect_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 32
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_sync_reflect_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 32
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_syncstrict_direct_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 2080
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_syncstrict_direct_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 2080
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_syncstrict_invoke_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 2080
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_syncstrict_invoke_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 2080
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_syncstrict_reflect_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 2080
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v50_syncstrict_reflect_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 50
|
||||||
|
* -flags 2080
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v51_none_direct_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 51
|
||||||
|
* -flags 0
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v51_none_direct_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 51
|
||||||
|
* -flags 0
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v51_none_invoke_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 51
|
||||||
|
* -flags 0
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v51_none_invoke_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 51
|
||||||
|
* -flags 0
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v51_none_reflect_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 51
|
||||||
|
* -flags 0
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v51_none_reflect_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 51
|
||||||
|
* -flags 0
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v51_strict_direct_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 51
|
||||||
|
* -flags 2048
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v51_strict_direct_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 51
|
||||||
|
* -flags 2048
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v51_strict_invoke_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 51
|
||||||
|
* -flags 2048
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v51_strict_invoke_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 51
|
||||||
|
* -flags 2048
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode invoke
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v51_strict_reflect_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 51
|
||||||
|
* -flags 2048
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v51_strict_reflect_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 51
|
||||||
|
* -flags 2048
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode reflect
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v51_sync_direct_noredefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm
|
||||||
|
* -XX:+IgnoreUnrecognizedVMOptions
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 51
|
||||||
|
* -flags 32
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2018, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @modules java.base/jdk.internal.org.objectweb.asm:+open java.base/jdk.internal.org.objectweb.asm.util:+open
|
||||||
|
*
|
||||||
|
* @summary converted from VM Testbase vm/runtime/defmeth/scenarios/Basic_v51_sync_direct_redefine.
|
||||||
|
* VM Testbase keywords: [defmeth, jdk8, jdk_instrument, quick]
|
||||||
|
*
|
||||||
|
* @library /vmTestbase /test/lib
|
||||||
|
*
|
||||||
|
* @comment build retransform.jar in current dir
|
||||||
|
* @run driver vm.runtime.defmeth.shared.BuildJar
|
||||||
|
*
|
||||||
|
* @run driver jdk.test.lib.FileInstaller . .
|
||||||
|
* @run main/othervm/native
|
||||||
|
* -agentlib:redefineClasses
|
||||||
|
* -javaagent:retransform.jar
|
||||||
|
* vm.runtime.defmeth.BasicTest
|
||||||
|
* -ver 51
|
||||||
|
* -flags 32
|
||||||
|
* -redefine
|
||||||
|
* -retransform
|
||||||
|
* -mode direct
|
||||||
|
*/
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user