Mercurial > hg > graal-jvmci-8
comparison jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java @ 23789:0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 04 Nov 2016 14:22:47 +0100 |
parents | d6bd0b9cd0b6 |
children | 224f43824e2b |
comparison
equal
deleted
inserted
replaced
23788:e804aec381cd | 23789:0cb263db490f |
---|---|
27 * @run junit jdk.vm.ci.runtime.test.TestResolvedJavaMethod | 27 * @run junit jdk.vm.ci.runtime.test.TestResolvedJavaMethod |
28 */ | 28 */ |
29 | 29 |
30 package jdk.vm.ci.runtime.test; | 30 package jdk.vm.ci.runtime.test; |
31 | 31 |
32 import static org.junit.Assert.assertArrayEquals; | |
32 import static org.junit.Assert.assertEquals; | 33 import static org.junit.Assert.assertEquals; |
33 import static org.junit.Assert.assertFalse; | 34 import static org.junit.Assert.assertFalse; |
34 import static org.junit.Assert.assertNotNull; | 35 import static org.junit.Assert.assertNotNull; |
35 import static org.junit.Assert.assertTrue; | 36 import static org.junit.Assert.assertTrue; |
36 | 37 |
54 import org.junit.Test; | 55 import org.junit.Test; |
55 | 56 |
56 import jdk.vm.ci.meta.ConstantPool; | 57 import jdk.vm.ci.meta.ConstantPool; |
57 import jdk.vm.ci.meta.ExceptionHandler; | 58 import jdk.vm.ci.meta.ExceptionHandler; |
58 import jdk.vm.ci.meta.ResolvedJavaMethod; | 59 import jdk.vm.ci.meta.ResolvedJavaMethod; |
60 import jdk.vm.ci.meta.ResolvedJavaMethod.Parameter; | |
59 import jdk.vm.ci.meta.ResolvedJavaType; | 61 import jdk.vm.ci.meta.ResolvedJavaType; |
60 | 62 |
61 /** | 63 /** |
62 * Tests for {@link ResolvedJavaMethod}. | 64 * Tests for {@link ResolvedJavaMethod}. |
63 */ | 65 */ |
257 public void getConstantPoolTest() { | 259 public void getConstantPoolTest() { |
258 for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) { | 260 for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) { |
259 ResolvedJavaMethod m = e.getValue(); | 261 ResolvedJavaMethod m = e.getValue(); |
260 ConstantPool cp = m.getConstantPool(); | 262 ConstantPool cp = m.getConstantPool(); |
261 assertTrue(cp.length() > 0); | 263 assertTrue(cp.length() > 0); |
264 } | |
265 } | |
266 | |
267 @Test | |
268 public void getParametersTest() { | |
269 for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) { | |
270 java.lang.reflect.Parameter[] expected = e.getKey().getParameters(); | |
271 Parameter[] actual = e.getValue().getParameters(); | |
272 assertEquals(actual.length, expected.length); | |
273 for (int i = 0; i < actual.length; i++) { | |
274 java.lang.reflect.Parameter exp = expected[i]; | |
275 Parameter act = actual[i]; | |
276 System.out.println(exp + " " + act); | |
277 assertEquals(exp.getName(), act.getName()); | |
278 assertEquals(exp.getModifiers(), act.getModifiers()); | |
279 assertEquals(exp.getModifiers(), act.getModifiers()); | |
280 assertArrayEquals(exp.getAnnotations(), act.getAnnotations()); | |
281 assertEquals(exp.getType().getName(), act.getType().toClassName()); | |
282 assertEquals(exp.getParameterizedType(), act.getParameterizedType()); | |
283 assertEquals(metaAccess.lookupJavaMethod(exp.getDeclaringExecutable()), act.getDeclaringMethod()); | |
284 } | |
262 } | 285 } |
263 } | 286 } |
264 | 287 |
265 @Test(timeout = 1000L) | 288 @Test(timeout = 1000L) |
266 public void getAnnotationTest() throws NoSuchMethodException { | 289 public void getAnnotationTest() throws NoSuchMethodException { |