test/java/lang/reflect/Method/GenericStringTest.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2013, 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.

@@ -21,11 +21,11 @@
  * questions.
  */
 
 /*
  * @test
- * @bug 5033583 6316717 6470106
+ * @bug 5033583 6316717 6470106 8004979
  * @summary Check toGenericString() and toString() methods
  * @author Joseph D. Darcy
  */
 
 import java.lang.reflect.*;

@@ -37,10 +37,11 @@
         int failures = 0;
         List<Class<?>> classList = new LinkedList<Class<?>>();
         classList.add(TestClass1.class);
         classList.add(TestClass2.class);
         classList.add(Roebling.class);
+        classList.add(TestInterface1.class);
 
 
         for(Class<?> clazz: classList)
             for(Method method: clazz.getDeclaredMethods()) {
                 ExpectedGenericString egs = method.getAnnotation(ExpectedGenericString.class);

@@ -127,10 +128,31 @@
     @ExpectedString(
    "void Roebling.varArg(java.lang.Object[])")
     void varArg(Object ... arg) {}
 }
 
+interface TestInterface1 {
+    @ExpectedGenericString(
+   "public default void TestInterface1.foo()")
+    @ExpectedString(
+   "public default void TestInterface1.foo()")
+    public default void foo(){;}
+
+    @ExpectedString(
+   "public default java.lang.Object TestInterface1.bar()")
+    @ExpectedGenericString(
+   "public default <A> A TestInterface1.bar()")
+    default <A> A bar(){return null;}
+
+    @ExpectedString(
+   "public default strictfp double TestInterface1.quux()")
+    @ExpectedGenericString(
+    "public default strictfp double TestInterface1.quux()")
+    strictfp default double quux(){return 1.0;}
+
+}
+
 @Retention(RetentionPolicy.RUNTIME)
 @interface ExpectedGenericString {
     String value();
 }