aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs183/442425/MyAnnotatedController.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bugs183/442425/MyAnnotatedController.java')
-rw-r--r--tests/bugs183/442425/MyAnnotatedController.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/bugs183/442425/MyAnnotatedController.java b/tests/bugs183/442425/MyAnnotatedController.java
new file mode 100644
index 000000000..fab43b835
--- /dev/null
+++ b/tests/bugs183/442425/MyAnnotatedController.java
@@ -0,0 +1,37 @@
+package de.scrum_master.app;
+
+import java.lang.reflect.Method;
+
+@EntityController
+public class MyAnnotatedController<T> {
+ public void doSomething() {
+ System.out.println("Doing something");
+ }
+
+ public static void main(String[] args) {
+ // Use class type directly so as to call its method
+ MyAnnotatedController<String> annotatedTextController = new MyAnnotatedController<>();
+ annotatedTextController.doSomething();
+
+ // Print all declared methods (should also show interface methods introduced via ITD)
+ for (Method method : annotatedTextController.getClass().getDeclaredMethods()) {
+ if (!method.getName().startsWith("ajc$"))
+ System.out.println(method);
+ }
+
+ // Prove that class type is compatible with interface type
+ //IEntityController<String> entityTextController = annotatedTextController;
+ //entityTextController.setEntity("foo");
+ // Would not work here because generic interface type is type-safe:
+ // entityNumberController.setEntity(123);
+ //System.out.println("Entity value = " + entityTextController.getEntity());
+
+ // Create another object and directly assign it to interface type
+ //IEntityController<Integer> entityNumberController = new MyAnnotatedController<>();
+ //entityNumberController.setEntity(123);
+ // Would not work here because generic interface type is type-safe:
+ // entityNumberController.setEntity("foo");
+ //System.out.println("Entity value = " + entityNumberController.getEntity());
+ }
+}
+