8141557: TestResolvedJavaMethod.java times out after 1000 ms
authoriignatyev
Thu, 21 Jan 2016 22:23:22 +0300
changeset 35589 92c85abcc872
parent 35588 5d373c2c7c47
child 35590 39a11b5f4283
8141557: TestResolvedJavaMethod.java times out after 1000 ms Reviewed-by: twisti
hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java	Thu Jan 21 15:07:42 2016 +0100
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java	Thu Jan 21 22:23:22 2016 +0300
@@ -264,21 +264,37 @@
         }
     }
 
-    @Test(timeout = 1000L)
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.METHOD)
+    @interface TestAnnotation {
+        long value();
+    }
+
+    @Test
+    @TestAnnotation(value = 1000L)
     public void getAnnotationTest() throws NoSuchMethodException {
         ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("getAnnotationTest"));
-        Test annotation = method.getAnnotation(Test.class);
+        TestAnnotation annotation = method.getAnnotation(TestAnnotation.class);
         assertNotNull(annotation);
-        assertEquals(1000L, annotation.timeout());
+        assertEquals(1000L, annotation.value());
     }
 
-    @Test(timeout = 1000L)
+    @Test
+    @TestAnnotation(value = 1000L)
     public void getAnnotationsTest() throws NoSuchMethodException {
         ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("getAnnotationsTest"));
         Annotation[] annotations = method.getAnnotations();
         assertNotNull(annotations);
-        assertEquals(1, annotations.length);
-        assertEquals(1000L, ((Test) annotations[0]).timeout());
+        assertEquals(2, annotations.length);
+        TestAnnotation annotation = null;
+        for (Annotation a : annotations) {
+            if (a instanceof TestAnnotation) {
+                annotation = (TestAnnotation) a;
+                break;
+            }
+        }
+        assertNotNull(annotation);
+        assertEquals(1000L, annotation.value());
     }
 
     @Retention(RetentionPolicy.RUNTIME)