diff options
author | Andy Clement <aclement@gopivotal.com> | 2014-08-27 13:25:21 -0700 |
---|---|---|
committer | Andy Clement <aclement@gopivotal.com> | 2014-08-27 13:25:21 -0700 |
commit | d929114a6659d64d71c47f7bf8f70e9973e5c857 (patch) | |
tree | 9960a5e53a5b3cf697196191ded1fee9e55fa738 /tests/bugs183 | |
parent | 62b5e69a857ef64c71c39176d3fadc51c308ea02 (diff) | |
download | aspectj-d929114a6659d64d71c47f7bf8f70e9973e5c857.tar.gz aspectj-d929114a6659d64d71c47f7bf8f70e9973e5c857.zip |
442425: fix error on attempted annotation style decp
Diffstat (limited to 'tests/bugs183')
-rw-r--r-- | tests/bugs183/442425/EntityController.java | 10 | ||||
-rw-r--r-- | tests/bugs183/442425/EntityControllerAspect.java | 16 | ||||
-rw-r--r-- | tests/bugs183/442425/EntityMongoController.java | 8 | ||||
-rw-r--r-- | tests/bugs183/442425/IEntityController.java | 6 | ||||
-rw-r--r-- | tests/bugs183/442425/MyAnnotatedController.java | 37 | ||||
-rw-r--r-- | tests/bugs183/442425/de/scrum_master/app/EntityController.class | bin | 0 -> 403 bytes | |||
-rw-r--r-- | tests/bugs183/442425/de/scrum_master/app/EntityControllerAspect.class | bin | 0 -> 1667 bytes | |||
-rw-r--r-- | tests/bugs183/442425/de/scrum_master/app/EntityMongoController.class | bin | 0 -> 996 bytes | |||
-rw-r--r-- | tests/bugs183/442425/de/scrum_master/app/IEntityController.class | bin | 0 -> 639 bytes | |||
-rw-r--r-- | tests/bugs183/442425/de/scrum_master/app/MyAnnotatedController.class | bin | 0 -> 3588 bytes |
10 files changed, 77 insertions, 0 deletions
diff --git a/tests/bugs183/442425/EntityController.java b/tests/bugs183/442425/EntityController.java new file mode 100644 index 000000000..2423b642d --- /dev/null +++ b/tests/bugs183/442425/EntityController.java @@ -0,0 +1,10 @@ +package de.scrum_master.app; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface EntityController {} diff --git a/tests/bugs183/442425/EntityControllerAspect.java b/tests/bugs183/442425/EntityControllerAspect.java new file mode 100644 index 000000000..7540db933 --- /dev/null +++ b/tests/bugs183/442425/EntityControllerAspect.java @@ -0,0 +1,16 @@ +package de.scrum_master.app; + +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.*; + +@Aspect +public class EntityControllerAspect { + @DeclareParents(value = "@EntityController *", defaultImpl = EntityMongoController.class) + private IEntityController iEntityController; +/* + @DeclareMixin("@EntityController *") + private IEntityController createEntityControllerInstance() { + return new EntityMongoController(); + } +*/ +} diff --git a/tests/bugs183/442425/EntityMongoController.java b/tests/bugs183/442425/EntityMongoController.java new file mode 100644 index 000000000..345f32043 --- /dev/null +++ b/tests/bugs183/442425/EntityMongoController.java @@ -0,0 +1,8 @@ +package de.scrum_master.app; + +public class EntityMongoController<T> implements IEntityController<T> { + private T entity; + + public void setEntity(T entity) { this.entity = entity; } + public T getEntity() { return entity; } +} diff --git a/tests/bugs183/442425/IEntityController.java b/tests/bugs183/442425/IEntityController.java new file mode 100644 index 000000000..440edcd31 --- /dev/null +++ b/tests/bugs183/442425/IEntityController.java @@ -0,0 +1,6 @@ +package de.scrum_master.app; + +public interface IEntityController<T> { + void setEntity(T entity); + T getEntity(); +} 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()); + } +} + diff --git a/tests/bugs183/442425/de/scrum_master/app/EntityController.class b/tests/bugs183/442425/de/scrum_master/app/EntityController.class Binary files differnew file mode 100644 index 000000000..e224f8fea --- /dev/null +++ b/tests/bugs183/442425/de/scrum_master/app/EntityController.class diff --git a/tests/bugs183/442425/de/scrum_master/app/EntityControllerAspect.class b/tests/bugs183/442425/de/scrum_master/app/EntityControllerAspect.class Binary files differnew file mode 100644 index 000000000..2e64a3da0 --- /dev/null +++ b/tests/bugs183/442425/de/scrum_master/app/EntityControllerAspect.class diff --git a/tests/bugs183/442425/de/scrum_master/app/EntityMongoController.class b/tests/bugs183/442425/de/scrum_master/app/EntityMongoController.class Binary files differnew file mode 100644 index 000000000..028780fb1 --- /dev/null +++ b/tests/bugs183/442425/de/scrum_master/app/EntityMongoController.class diff --git a/tests/bugs183/442425/de/scrum_master/app/IEntityController.class b/tests/bugs183/442425/de/scrum_master/app/IEntityController.class Binary files differnew file mode 100644 index 000000000..b3cd36beb --- /dev/null +++ b/tests/bugs183/442425/de/scrum_master/app/IEntityController.class diff --git a/tests/bugs183/442425/de/scrum_master/app/MyAnnotatedController.class b/tests/bugs183/442425/de/scrum_master/app/MyAnnotatedController.class Binary files differnew file mode 100644 index 000000000..dae29b206 --- /dev/null +++ b/tests/bugs183/442425/de/scrum_master/app/MyAnnotatedController.class |