< prev index next >
test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java
Print this page
*** 72,120 ****
}
private static Set<TestCase> createTestCases() {
Set<TestCase> result = new HashSet<>();
// a public method
! result.add(new TestCase(true, SingleSubclass.class,
! SingleSubclass.class, "usualMethod"));
// overriden method
! result.add(new TestCase(true, SingleSubclass.class,
! SingleSubclass.class, "overridenMethod"));
// private method
! result.add(new TestCase(true, SingleSubclass.class,
! SingleSubclass.class, "privateMethod"));
// protected method
! result.add(new TestCase(true, SingleSubclass.class,
! SingleSubclass.class, "protectedMethod"));
// default(package-private) method
! result.add(new TestCase(true, SingleSubclass.class,
! SingleSubclass.class, "defaultAccessMethod"));
// default interface method redefined in implementer
! result.add(new TestCase(true, MultipleImplementer1.class,
! MultipleImplementer1.class, "defaultMethod"));
// interface method
! result.add(new TestCase(true, MultipleImplementer1.class,
! MultipleImplementer1.class, "testMethod"));
// default interface method not redefined in implementer
! result.add(new TestCase(true, SingleImplementer.class,
! SingleImplementerInterface.class, "defaultMethod"));
// static method
! result.add(new TestCase(false, SingleSubclass.class,
! SingleSubclass.class, "staticMethod"));
// interface method
result.add(new TestCase(false, MultipleSuperImplementers.class,
! DuplicateSimpleSingleImplementerInterface.class, "interfaceMethod", false));
result.add(new TestCase(false, MultipleSuperImplementers.class,
! SimpleSingleImplementerInterface.class, "interfaceMethod", false));
return result;
}
private void runTest(TestCase tcase) throws NoSuchMethodException {
System.out.println(tcase);
Method method = tcase.holder.getDeclaredMethod(tcase.methodName);
! HotSpotResolvedJavaMethod testMethod = CTVMUtilities
! .getResolvedMethod(tcase.methodFromReceiver ? tcase.receiver : tcase.holder, method);
HotSpotResolvedObjectType resolvedType = CompilerToVMHelper
.lookupType(Utils.toJVMTypeSignature(tcase.receiver), getClass(),
/* resolve = */ true);
HotSpotResolvedJavaMethod concreteMethod = CompilerToVMHelper
.findUniqueConcreteMethod(resolvedType, testMethod);
--- 72,112 ----
}
private static Set<TestCase> createTestCases() {
Set<TestCase> result = new HashSet<>();
// a public method
! result.add(new TestCase(true, SingleSubclass.class, "usualMethod"));
// overriden method
! result.add(new TestCase(true, SingleSubclass.class, "overridenMethod"));
// private method
! result.add(new TestCase(true, SingleSubclass.class, "privateMethod"));
// protected method
! result.add(new TestCase(true, SingleSubclass.class, "protectedMethod"));
// default(package-private) method
! result.add(new TestCase(true, SingleSubclass.class, "defaultAccessMethod"));
// default interface method redefined in implementer
! result.add(new TestCase(true, MultipleImplementer1.class, "defaultMethod"));
// interface method
! result.add(new TestCase(true, MultipleImplementer1.class, "testMethod"));
// default interface method not redefined in implementer
! // result.add(new TestCase(true, SingleImplementer.class,
! // SingleImplementerInterface.class, "defaultMethod"));
// static method
! result.add(new TestCase(false, SingleSubclass.class, "staticMethod"));
// interface method
result.add(new TestCase(false, MultipleSuperImplementers.class,
! DuplicateSimpleSingleImplementerInterface.class, "interfaceMethod"));
result.add(new TestCase(false, MultipleSuperImplementers.class,
! SimpleSingleImplementerInterface.class, "interfaceMethod"));
return result;
}
private void runTest(TestCase tcase) throws NoSuchMethodException {
System.out.println(tcase);
Method method = tcase.holder.getDeclaredMethod(tcase.methodName);
! HotSpotResolvedJavaMethod testMethod = CTVMUtilities.getResolvedMethod(method);
!
HotSpotResolvedObjectType resolvedType = CompilerToVMHelper
.lookupType(Utils.toJVMTypeSignature(tcase.receiver), getClass(),
/* resolve = */ true);
HotSpotResolvedJavaMethod concreteMethod = CompilerToVMHelper
.findUniqueConcreteMethod(resolvedType, testMethod);
*** 125,151 ****
private static class TestCase {
public final Class<?> receiver;
public final Class<?> holder;
public final String methodName;
public final boolean isPositive;
- public final boolean methodFromReceiver;
public TestCase(boolean isPositive, Class<?> clazz, Class<?> holder,
! String methodName, boolean methodFromReceiver) {
this.receiver = clazz;
this.methodName = methodName;
this.isPositive = isPositive;
this.holder = holder;
- this.methodFromReceiver = methodFromReceiver;
}
! public TestCase(boolean isPositive, Class<?> clazz, Class<?> holder, String methodName) {
! this(isPositive, clazz, holder, methodName, true);
}
@Override
public String toString() {
! return String.format("CASE: receiver=%s, holder=%s, method=%s, isPositive=%s, methodFromReceiver=%s",
! receiver.getName(), holder.getName(), methodName, isPositive, methodFromReceiver);
}
}
}
--- 117,141 ----
private static class TestCase {
public final Class<?> receiver;
public final Class<?> holder;
public final String methodName;
public final boolean isPositive;
public TestCase(boolean isPositive, Class<?> clazz, Class<?> holder,
! String methodName) {
this.receiver = clazz;
this.methodName = methodName;
this.isPositive = isPositive;
this.holder = holder;
}
! public TestCase(boolean isPositive, Class<?> clazz, String methodName) {
! this(isPositive, clazz, clazz, methodName);
}
@Override
public String toString() {
! return String.format("CASE: receiver=%s, holder=%s, method=%s, isPositive=%s",
! receiver.getName(), holder.getName(), methodName, isPositive);
}
}
}
< prev index next >