diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2013-04-17 13:58:39 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2013-04-17 13:58:39 +0000 |
commit | 7a49552112a2e59dc9d5afc135dba918b8c36751 (patch) | |
tree | ee44a11c0de9895a2d63282ce7924e3df4a50eb2 /src/test | |
parent | 81e75232f4deaf5c9d45a4956d87a37f03722ca9 (diff) | |
download | javassist-7a49552112a2e59dc9d5afc135dba918b8c36751.tar.gz javassist-7a49552112a2e59dc9d5afc135dba918b8c36751.zip |
fixed JASSIST-181
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@706 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/javassist/JvstTest4.java | 23 | ||||
-rw-r--r-- | src/test/test4/JIRA181.java | 29 | ||||
-rw-r--r-- | src/test/test4/JIRA181b.java | 12 |
3 files changed, 64 insertions, 0 deletions
diff --git a/src/test/javassist/JvstTest4.java b/src/test/javassist/JvstTest4.java index 619b9e97..fe1ab7e8 100644 --- a/src/test/javassist/JvstTest4.java +++ b/src/test/javassist/JvstTest4.java @@ -839,6 +839,7 @@ public class JvstTest4 extends JvstTestRoot { assertEquals(12, invoke(obj, "test1")); } + // JASSIST-185 public void testLocalVariableTypeTable() throws Exception { CtClass cc = sloader.get("test4.Lvtt"); CtMethod m = cc.getDeclaredMethod("run"); @@ -846,4 +847,26 @@ public class JvstTest4 extends JvstTestRoot { cc.writeFile(); Object obj = make(cc.getName()); } + + // JASSISt-181 + public void testAnnotationWithGenerics() throws Exception { + CtClass cc0 = sloader.get("test4.JIRA181b"); + CtField field0 = cc0.getField("aField"); + String s0 = field0.getAnnotation(test4.JIRA181b.Condition.class).toString(); + assertEquals("@test4.JIRA181b$Condition(condition=java.lang.String.class)", s0); + CtField field01 = cc0.getField("aField2"); + String s01 = field01.getAnnotation(test4.JIRA181b.Condition.class).toString(); + assertEquals("@test4.JIRA181b$Condition(condition=void.class)", s01); + + CtClass cc = sloader.get("test4.JIRA181"); + CtField field = cc.getField("aField"); + String s = field.getAnnotation(test4.JIRA181.Condition.class).toString(); + assertEquals("@test4.JIRA181$Condition(condition=test4.JIRA181<T>.B.class)", s); + CtField field2 = cc.getField("aField2"); + String s2 = field2.getAnnotation(test4.JIRA181.Condition2.class).toString(); + assertEquals("@test4.JIRA181$Condition2(condition=test4.JIRA181<T>.B[].class)", s2); + } } + + + diff --git a/src/test/test4/JIRA181.java b/src/test/test4/JIRA181.java new file mode 100644 index 00000000..c3d2f45a --- /dev/null +++ b/src/test/test4/JIRA181.java @@ -0,0 +1,29 @@ +package test4; + +import java.util.ArrayList; + +public class JIRA181<T extends Number> extends ArrayList<T> { + public @interface Condition { + Class<? extends ICondition> condition(); + } + + public @interface Condition2 { + Class<?> condition(); + } + + @Condition(condition = B.class) + public Object aField; + + @Condition2(condition = B[].class) + public Object aField2; + + public interface ICondition { + boolean match(Object src); + } + + private class B implements ICondition { + public boolean match(Object src) { + return JIRA181.this.size() > 0; + } + } +} diff --git a/src/test/test4/JIRA181b.java b/src/test/test4/JIRA181b.java new file mode 100644 index 00000000..133931ae --- /dev/null +++ b/src/test/test4/JIRA181b.java @@ -0,0 +1,12 @@ +package test4; + +public class JIRA181b { + public @interface Condition { + Class<?> condition(); + } + + @Condition(condition = String.class) + public Object aField; + @Condition(condition = void.class) + public Object aField2; +} |