diff options
Diffstat (limited to 'tests/bugs170/xmldefs/Hello.java')
-rw-r--r-- | tests/bugs170/xmldefs/Hello.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/bugs170/xmldefs/Hello.java b/tests/bugs170/xmldefs/Hello.java new file mode 100644 index 000000000..fdf29eab3 --- /dev/null +++ b/tests/bugs170/xmldefs/Hello.java @@ -0,0 +1,36 @@ +import java.lang.annotation.Annotation; +import java.lang.reflect.Method; + +public class Hello { + + public static void main(String[] args) { + sayHello(); + printAnnos("sayHello"); + } + + public static void sayHello() { + System.out.println("Hello"); + sayWorld(); + } + + public static int sayWorld() { + System.out.println("World"); + return 0; + } + + public static void printAnnos(String methodname) { + try { + Method m = Hello.class.getDeclaredMethod(methodname); + Annotation[] annos = m.getAnnotations(); + System.out.println("Annotations on "+methodname+"? "+(annos!=null && annos.length!=0)); + if (annos!=null && annos.length>0) { + System.out.println("Annotation count is "+annos.length); + for (Annotation anno: annos) { + System.out.println(anno); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } +} |