diff options
author | Andy Clement <andrew.clement@gmail.com> | 2013-02-04 13:33:26 -0800 |
---|---|---|
committer | Andy Clement <andrew.clement@gmail.com> | 2013-02-04 13:33:26 -0800 |
commit | 4af4b1e634c9dbb8af1741aad22a2c3441aa1751 (patch) | |
tree | df6ff6764f8c204ee7857cbb78e17536ba8d0faf | |
parent | d524403d64f7d5d8f84ddb3e91afa4e3b91fd958 (diff) | |
download | aspectj-4af4b1e634c9dbb8af1741aad22a2c3441aa1751.tar.gz aspectj-4af4b1e634c9dbb8af1741aad22a2c3441aa1751.zip |
399590
-rw-r--r-- | org.aspectj.matcher/src/org/aspectj/weaver/BoundedReferenceType.java | 22 | ||||
-rw-r--r-- | tests/bugs172/pr399590/Cage.java | 9 | ||||
-rw-r--r-- | tests/bugs172/pr399590/Cage2.java | 13 | ||||
-rw-r--r-- | tests/bugs172/pr399590/five/Cage.java | 9 | ||||
-rw-r--r-- | tests/bugs172/pr399590/five/Cage2.java | 9 | ||||
-rw-r--r-- | tests/bugs172/pr399590/four/Cage.java | 11 | ||||
-rw-r--r-- | tests/bugs172/pr399590/four/Cage2.java | 13 | ||||
-rw-r--r-- | tests/bugs172/pr399590/three/Cage.java | 10 | ||||
-rw-r--r-- | tests/bugs172/pr399590/three/Cage2.java | 11 | ||||
-rw-r--r-- | tests/bugs172/pr399590/two/Cage.java | 9 | ||||
-rw-r--r-- | tests/bugs172/pr399590/two/Cage2.java | 13 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java | 60 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc172/ajc172.xml | 26 |
13 files changed, 215 insertions, 0 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/BoundedReferenceType.java b/org.aspectj.matcher/src/org/aspectj/weaver/BoundedReferenceType.java index 30a2e4e4c..dc28ad3c1 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/BoundedReferenceType.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/BoundedReferenceType.java @@ -115,6 +115,28 @@ public class BoundedReferenceType extends ReferenceType { } } + @Override + public String getSignatureForAttribute() { + StringBuilder ret = new StringBuilder(); + if (kind==SUPER){ + ret.append("-"); + ret.append(lowerBound.getSignatureForAttribute()); + for (int i=0;i<additionalInterfaceBounds.length;i++) { + ret.append(additionalInterfaceBounds[i].getSignatureForAttribute()); + } + } else if (kind==EXTENDS) { + ret.append("+"); + ret.append(upperBound.getSignatureForAttribute()); + for (int i=0;i<additionalInterfaceBounds.length;i++) { + ret.append(additionalInterfaceBounds[i].getSignatureForAttribute()); + } + } else if (kind==UNBOUND) { + ret.append("*"); + } + return ret.toString(); + } + + public boolean hasLowerBound() { return lowerBound != null; } diff --git a/tests/bugs172/pr399590/Cage.java b/tests/bugs172/pr399590/Cage.java new file mode 100644 index 000000000..cf3bfd546 --- /dev/null +++ b/tests/bugs172/pr399590/Cage.java @@ -0,0 +1,9 @@ +class LionCage extends Cage<Lion> {} +class Lion extends Animal<LionCage> {} + +class Animal<T> { } + +class Bar {} + +public class Cage<T extends Animal<? extends Cage<T>>> extends Bar { } + diff --git a/tests/bugs172/pr399590/Cage2.java b/tests/bugs172/pr399590/Cage2.java new file mode 100644 index 000000000..4da3e4711 --- /dev/null +++ b/tests/bugs172/pr399590/Cage2.java @@ -0,0 +1,13 @@ +class LionCage2 extends Cage2<Lion2> {} +class Lion2 extends Animal2<LionCage2> {} + +class Animal2<T> { } + +class Bar2 {} + +public class Cage2<T extends Animal2<? extends Cage2<T>>> extends Bar2 { } + +aspect X { + declare parents: Cage2 implements java.io.Serializable; +} + diff --git a/tests/bugs172/pr399590/five/Cage.java b/tests/bugs172/pr399590/five/Cage.java new file mode 100644 index 000000000..f817ef10c --- /dev/null +++ b/tests/bugs172/pr399590/five/Cage.java @@ -0,0 +1,9 @@ +//class LionCage extends Cage<Lion> {} +//class Lion extends Animal<LionCage> {} + +class Animal<T> { } + +class Bar {} + + +public class Cage<T extends Animal<?>> extends Bar { } diff --git a/tests/bugs172/pr399590/five/Cage2.java b/tests/bugs172/pr399590/five/Cage2.java new file mode 100644 index 000000000..94a3e4331 --- /dev/null +++ b/tests/bugs172/pr399590/five/Cage2.java @@ -0,0 +1,9 @@ +class Animal2<T> { } + +class Bar2 {} + +public class Cage2<T extends Animal2<?>> extends Bar2 { } + +aspect X { + declare parents: Cage2 implements java.io.Serializable; +} diff --git a/tests/bugs172/pr399590/four/Cage.java b/tests/bugs172/pr399590/four/Cage.java new file mode 100644 index 000000000..68414b59e --- /dev/null +++ b/tests/bugs172/pr399590/four/Cage.java @@ -0,0 +1,11 @@ +//class LionCage extends Cage<Lion> {} +//class Lion extends Animal<LionCage> {} + +class Animal<T,R> { } + +class Bar {} + +interface XXX<T> {} +interface YYY<T> {} + +public class Cage<T extends Animal<? super XXX<T>,YYY>> extends Bar { } diff --git a/tests/bugs172/pr399590/four/Cage2.java b/tests/bugs172/pr399590/four/Cage2.java new file mode 100644 index 000000000..9b9ba0f1a --- /dev/null +++ b/tests/bugs172/pr399590/four/Cage2.java @@ -0,0 +1,13 @@ +class Animal2<T,Q> { } + +class Bar2 {} + +interface XXX2<T> {} + +interface YYY2<T> {} + +public class Cage2<T extends Animal2<? super XXX2<T>,YYY2>> extends Bar2 { } + +aspect X { + declare parents: Cage2 implements java.io.Serializable; +} diff --git a/tests/bugs172/pr399590/three/Cage.java b/tests/bugs172/pr399590/three/Cage.java new file mode 100644 index 000000000..8882c45a4 --- /dev/null +++ b/tests/bugs172/pr399590/three/Cage.java @@ -0,0 +1,10 @@ +//class LionCage extends Cage<Lion> {} +//class Lion extends Animal<LionCage> {} + +class Animal<T> { } + +class Bar {} + +interface XXX<T> {} + +public class Cage<T extends Animal<? super XXX<T>>> extends Bar { } diff --git a/tests/bugs172/pr399590/three/Cage2.java b/tests/bugs172/pr399590/three/Cage2.java new file mode 100644 index 000000000..d03ebd038 --- /dev/null +++ b/tests/bugs172/pr399590/three/Cage2.java @@ -0,0 +1,11 @@ +class Animal2<T> { } + +class Bar2 {} + +interface XXX2<T> {} + +public class Cage2<T extends Animal2<? super XXX2<T>>> extends Bar2 { } + +aspect X { + declare parents: Cage2 implements java.io.Serializable; +} diff --git a/tests/bugs172/pr399590/two/Cage.java b/tests/bugs172/pr399590/two/Cage.java new file mode 100644 index 000000000..7cdc1af64 --- /dev/null +++ b/tests/bugs172/pr399590/two/Cage.java @@ -0,0 +1,9 @@ + +class Animal<T,Q> { } + +class Bar {} + +class Intf {} + +public class Cage<T extends Animal<? extends Cage<T,Intf>,Intf>,Q> extends Bar { } + diff --git a/tests/bugs172/pr399590/two/Cage2.java b/tests/bugs172/pr399590/two/Cage2.java new file mode 100644 index 000000000..6758be4ce --- /dev/null +++ b/tests/bugs172/pr399590/two/Cage2.java @@ -0,0 +1,13 @@ + +class Animal2<T,Q> { } + +class Bar2 {} + +class Intf2 {} + +public class Cage2<T extends Animal2<? extends Cage2<T,Intf2>,Intf2>,Q> extends Bar2 { } + + +aspect X { + declare parents: Cage2 implements java.io.Serializable; +} diff --git a/tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java b/tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java index fd9454164..e6f5c292c 100644 --- a/tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java @@ -23,6 +23,66 @@ import org.aspectj.testing.XMLBasedAjcTestCase; */ public class Ajc172Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + // extends + public void testPSignatures_pr399590() throws Exception { + runTest("p signatures 1"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Cage"); + String sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal<+LCage<TT;>;>;>LBar;", sss); + jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2"); + sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal2<+LCage2<TT;>;>;>LBar2;Ljava/io/Serializable;", sss); + jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2"); + } + + // extends two classes + public void testPSignatures_pr399590_2() throws Exception { + runTest("p signatures 2"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Cage"); + String sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal<+LCage<TT;LIntf;>;LIntf;>;Q:Ljava/lang/Object;>LBar;", sss); + jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2"); + sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal2<+LCage2<TT;LIntf2;>;LIntf2;>;Q:Ljava/lang/Object;>LBar2;Ljava/io/Serializable;", sss); + jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2"); + } + + // super + public void testPSignatures_pr399590_3() throws Exception { + runTest("p signatures 3"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Cage"); + String sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal<-LXXX<TT;>;>;>LBar;", sss); + jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2"); + sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal2<-LXXX2<TT;>;>;>LBar2;Ljava/io/Serializable;", sss); + jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2"); + } + + // super + public void testPSignatures_pr399590_4() throws Exception { + runTest("p signatures 4"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Cage"); + String sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal<-LXXX<TT;>;LYYY;>;>LBar;", sss); + jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2"); + sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal2<-LXXX2<TT;>;LYYY2;>;>LBar2;Ljava/io/Serializable;", sss); + jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2"); + } + + // unbound + public void testPSignatures_pr399590_5() throws Exception { + runTest("p signatures 5"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Cage"); + String sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal<*>;>LBar;", sss); + jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2"); + sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal2<*>;>LBar2;Ljava/io/Serializable;", sss); + jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2"); + } + public void testIfPointcutNames_pr398246() throws Exception { runTest("if pointcut names"); JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X"); diff --git a/tests/src/org/aspectj/systemtest/ajc172/ajc172.xml b/tests/src/org/aspectj/systemtest/ajc172/ajc172.xml index 606ae311e..6d6ffa6f8 100644 --- a/tests/src/org/aspectj/systemtest/ajc172/ajc172.xml +++ b/tests/src/org/aspectj/systemtest/ajc172/ajc172.xml @@ -1,6 +1,32 @@ <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> <suite> + + <ajc-test dir="bugs172/pr399590" title="p signatures 1"> + <compile files="Cage.java" options="-1.5"/> + <compile files="Cage2.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs172/pr399590/two" title="p signatures 2"> + <compile files="Cage.java" options="-1.5"/> + <compile files="Cage2.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs172/pr399590/three" title="p signatures 3"> + <compile files="Cage.java" options="-1.5"/> + <compile files="Cage2.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs172/pr399590/four" title="p signatures 4"> + <compile files="Cage.java" options="-1.5"/> + <compile files="Cage2.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs172/pr399590/five" title="p signatures 5"> + <compile files="Cage.java" options="-1.5"/> + <compile files="Cage2.java" options="-1.5"/> + </ajc-test> + <ajc-test dir="bugs172/pr398588" title="optional aspects"> <compile files="Anno.java Anno2.java" outjar="anno.jar" options="-1.5"/> <compile files="AspectA.java" classpath="anno.jar" outjar="aspect.jar" options="-Xlint:ignore -1.5"/> |