90 result.add(new TestCase(true, MultipleImplementer1.class, "testMethod"));
91 // default interface method not redefined in implementer
92 // result.add(new TestCase(true, SingleImplementer.class,
93 // SingleImplementerInterface.class, "defaultMethod"));
94 // static method
95 result.add(new TestCase(false, SingleSubclass.class, "staticMethod"));
96 // interface method
97 result.add(new TestCase(false, MultipleSuperImplementers.class,
98 DuplicateSimpleSingleImplementerInterface.class, "interfaceMethod"));
99 result.add(new TestCase(false, MultipleSuperImplementers.class,
100 SimpleSingleImplementerInterface.class, "interfaceMethod"));
101 return result;
102 }
103
104 private void runTest(TestCase tcase) throws NoSuchMethodException {
105 System.out.println(tcase);
106 Method method = tcase.holder.getDeclaredMethod(tcase.methodName);
107 HotSpotResolvedJavaMethod testMethod = CTVMUtilities.getResolvedMethod(method);
108
109 HotSpotResolvedObjectType resolvedType = CompilerToVMHelper
110 .lookupType(Utils.toJVMTypeSignature(tcase.receiver), getClass(),
111 /* resolve = */ true);
112 HotSpotResolvedJavaMethod concreteMethod = CompilerToVMHelper
113 .findUniqueConcreteMethod(resolvedType, testMethod);
114 Asserts.assertEQ(concreteMethod, tcase.isPositive ? testMethod : null,
115 "Unexpected concrete method for " + tcase.methodName);
116 }
117
118 private static class TestCase {
119 public final Class<?> receiver;
120 public final Class<?> holder;
121 public final String methodName;
122 public final boolean isPositive;
123
124 public TestCase(boolean isPositive, Class<?> clazz, Class<?> holder,
125 String methodName) {
126 this.receiver = clazz;
127 this.methodName = methodName;
128 this.isPositive = isPositive;
129 this.holder = holder;
130 }
|
90 result.add(new TestCase(true, MultipleImplementer1.class, "testMethod"));
91 // default interface method not redefined in implementer
92 // result.add(new TestCase(true, SingleImplementer.class,
93 // SingleImplementerInterface.class, "defaultMethod"));
94 // static method
95 result.add(new TestCase(false, SingleSubclass.class, "staticMethod"));
96 // interface method
97 result.add(new TestCase(false, MultipleSuperImplementers.class,
98 DuplicateSimpleSingleImplementerInterface.class, "interfaceMethod"));
99 result.add(new TestCase(false, MultipleSuperImplementers.class,
100 SimpleSingleImplementerInterface.class, "interfaceMethod"));
101 return result;
102 }
103
104 private void runTest(TestCase tcase) throws NoSuchMethodException {
105 System.out.println(tcase);
106 Method method = tcase.holder.getDeclaredMethod(tcase.methodName);
107 HotSpotResolvedJavaMethod testMethod = CTVMUtilities.getResolvedMethod(method);
108
109 HotSpotResolvedObjectType resolvedType = CompilerToVMHelper
110 .lookupTypeHelper(Utils.toJVMTypeSignature(tcase.receiver), getClass(),
111 /* resolve = */ true);
112 HotSpotResolvedJavaMethod concreteMethod = CompilerToVMHelper
113 .findUniqueConcreteMethod(resolvedType, testMethod);
114 Asserts.assertEQ(concreteMethod, tcase.isPositive ? testMethod : null,
115 "Unexpected concrete method for " + tcase.methodName);
116 }
117
118 private static class TestCase {
119 public final Class<?> receiver;
120 public final Class<?> holder;
121 public final String methodName;
122 public final boolean isPositive;
123
124 public TestCase(boolean isPositive, Class<?> clazz, Class<?> holder,
125 String methodName) {
126 this.receiver = clazz;
127 this.methodName = methodName;
128 this.isPositive = isPositive;
129 this.holder = holder;
130 }
|