diff options
Diffstat (limited to 'test/048-reflect-v8/src/Main.java')
| -rw-r--r-- | test/048-reflect-v8/src/Main.java | 43 |
1 files changed, 7 insertions, 36 deletions
diff --git a/test/048-reflect-v8/src/Main.java b/test/048-reflect-v8/src/Main.java index 7fa2a923d7..f2b8287d18 100644 --- a/test/048-reflect-v8/src/Main.java +++ b/test/048-reflect-v8/src/Main.java @@ -14,43 +14,14 @@ * limitations under the License. */ -import java.lang.reflect.Method; - public class Main { - interface DefaultInterface { - default void sayHi() { - System.out.println("hi default"); - } - } - - interface RegularInterface { - void sayHi(); - } - - class ImplementsWithDefault implements DefaultInterface {} - class ImplementsWithRegular implements RegularInterface { - public void sayHi() { - System.out.println("hello specific"); - } - } - - private static void printIsDefault(Class<?> klass) { - Method m; - try { - m = klass.getMethod("sayHi"); - } catch (Throwable t) { - System.out.println(t); - return; - } - - boolean isDefault = m.isDefault(); - System.out.println(klass.getName() + " is default = " + (isDefault ? "yes" : "no")); - } - public static void main(String[] args) { - printIsDefault(DefaultInterface.class); - printIsDefault(RegularInterface.class); - printIsDefault(ImplementsWithDefault.class); - printIsDefault(ImplementsWithRegular.class); + IsDefaultTest.test(); + AnnotationTest.testAnnotationsByType(); + AnnotationTest.testDeclaredAnnotation(); + AnnotationTest.testDeclaredAnnotationsByType(); + AnnotationTest.testMethodAnnotationsByType(); + AnnotationTest.testMethodDeclaredAnnotations(); + AnnotationTest.testMethodDeclaredAnnotationsByType(); } } |