summaryrefslogtreecommitdiffstats
path: root/tests/java5/annotations/within_code/TestingAnnotations.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/java5/annotations/within_code/TestingAnnotations.java')
-rw-r--r--tests/java5/annotations/within_code/TestingAnnotations.java54
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/java5/annotations/within_code/TestingAnnotations.java b/tests/java5/annotations/within_code/TestingAnnotations.java
new file mode 100644
index 000000000..35eb49e12
--- /dev/null
+++ b/tests/java5/annotations/within_code/TestingAnnotations.java
@@ -0,0 +1,54 @@
+public class TestingAnnotations {
+
+ public static void main(String[] args) {
+
+ A a = new A();
+ B b = new B();
+ C c = new C();
+ D d = new D();
+ A reallyB = new B();
+ C reallyD = new D();
+
+ a.doSomething();
+ b.doSomething();
+ c.doSomething();
+ d.doSomething();
+ reallyB.doSomething();
+ reallyD.doSomething();
+ }
+
+}
+
+@MyClassRetentionAnnotation
+class A {
+ public void doSomething() {}
+}
+
+
+@MyAnnotation
+class B extends A {
+
+ @MyClassRetentionAnnotation public void doSomething(C c) {
+ c.doSomething();
+ }
+}
+
+@MyInheritableAnnotation
+@MyAnnotation
+class C {
+ public void doSomething() {}
+}
+
+class D extends C {
+ public void doSomething() {}
+}
+
+
+@interface MyClassRetentionAnnotation {}
+
+@java.lang.annotation.Retention(value=java.lang.annotation.RetentionPolicy.RUNTIME)
+@interface MyAnnotation {}
+
+@java.lang.annotation.Retention(value=java.lang.annotation.RetentionPolicy.RUNTIME)
+@java.lang.annotation.Inherited
+@interface MyInheritableAnnotation {} \ No newline at end of file