aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2005-09-28 13:20:19 +0000
committeraclement <aclement>2005-09-28 13:20:19 +0000
commitf8cf60b03ac66011a68da9407f49a69622f26dac (patch)
tree838d8db08f4883c41104168d02f73d86be566d12 /tests
parent0b8ed1d5c168d3f3c2eb4a1ca8bcf0f85249cd1b (diff)
downloadaspectj-f8cf60b03ac66011a68da9407f49a69622f26dac.tar.gz
aspectj-f8cf60b03ac66011a68da9407f49a69622f26dac.zip
pr110927: testcase and fix
Diffstat (limited to 'tests')
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java12
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java20
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml4
3 files changed, 29 insertions, 7 deletions
diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
index be876b1d7..9e59e59b4 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
@@ -19,6 +19,7 @@ import junit.framework.Test;
import org.aspectj.apache.bcel.classfile.JavaClass;
import org.aspectj.apache.bcel.classfile.Method;
+import org.aspectj.apache.bcel.classfile.Signature;
import org.aspectj.apache.bcel.util.ClassPath;
import org.aspectj.apache.bcel.util.SyntheticRepository;
import org.aspectj.asm.AsmManager;
@@ -39,6 +40,17 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
public void testBadDecp_pr110788_2() { runTest("bad generic decp - 2");}
public void testBadDecp_pr110788_3() { runTest("bad generic decp - 3");}
public void testBadDecp_pr110788_4() { runTest("bad generic decp - 4");}
+
+ public void testBadGenericSigAttribute_pr110927() {
+ runTest("cant create signature attribute");
+ Signature sig = GenericsTests.getClassSignature(ajc,"I");
+ if (sig==null) fail("Couldn't find signature attribute for type I");
+ String sigString = sig.getSignature();
+ if (!(sigString.equals("Ljava/lang/Object;LIE2;LIE1<Ljava/lang/String;>;") ||
+ sigString.equals("Ljava/lang/Object;LIE1<Ljava/lang/String;>;LIE2;"))) {
+ fail("Signature was "+sigString+" when should have been something like Ljava/lang/Object;LIE1<Ljava/lang/String;>;LIE2;");
+ }
+ }
public void test_typeProcessingOrderWhenDeclareParents() {
runTest("Order of types passed to compiler determines weaving behavior");
diff --git a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
index e57f9c4ed..f5066272a 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
@@ -10,6 +10,7 @@ import org.aspectj.apache.bcel.classfile.Signature;
import org.aspectj.apache.bcel.util.ClassPath;
import org.aspectj.apache.bcel.util.SyntheticRepository;
import org.aspectj.testing.XMLBasedAjcTestCase;
+import org.aspectj.tools.ajc.Ajc;
public class GenericsTests extends XMLBasedAjcTestCase {
@@ -429,7 +430,7 @@ public class GenericsTests extends XMLBasedAjcTestCase {
public void testPR96220_GenericDecp() {
runTest("generic decp - simple");
- verifyClassSignature("Basic","Ljava/lang/Object;LJ<Ljava/lang/Double;>;LI<Ljava/lang/Double;>;");
+ verifyClassSignature(ajc,"Basic","Ljava/lang/Object;LJ<Ljava/lang/Double;>;LI<Ljava/lang/Double;>;");
}
// Both the existing type decl and the one adding via decp are parameterized
@@ -473,7 +474,7 @@ public class GenericsTests extends XMLBasedAjcTestCase {
public void testGenericDecpParameterized() {
runTest("generic decp - with parameterized on the target");
- verifyClassSignature("Basic6","<J:Ljava/lang/Object;>Ljava/lang/Object;LI<TJ;>;LK<Ljava/lang/Integer;>;");
+ verifyClassSignature(ajc,"Basic6","<J:Ljava/lang/Object;>Ljava/lang/Object;LI<TJ;>;LK<Ljava/lang/Integer;>;");
}
public void testGenericDecpIncorrectNumberOfTypeParams() {
@@ -723,8 +724,7 @@ public class GenericsTests extends XMLBasedAjcTestCase {
// --- helpers
- // Check the signature attribute on a class is correct
- private void verifyClassSignature(String classname,String sig) {
+ public static Signature getClassSignature(Ajc ajc,String classname) {
try {
ClassPath cp =
new ClassPath(ajc.getSandboxDirectory() + File.pathSeparator + System.getProperty("java.class.path"));
@@ -736,12 +736,18 @@ public class GenericsTests extends XMLBasedAjcTestCase {
Attribute attribute = attrs[i];
if (attribute.getName().equals("Signature")) sigAttr = (Signature)attribute;
}
- assertTrue("Failed to find signature attribute for class "+classname,sigAttr!=null);
- assertTrue("Expected signature to be '"+sig+"' but was '"+sigAttr.getSignature()+"'",
- sigAttr.getSignature().equals(sig));
+ return sigAttr;
} catch (ClassNotFoundException e) {
fail("Couldn't find class "+classname+" in the sandbox directory.");
}
+ return null;
+ }
+ // Check the signature attribute on a class is correct
+ public static void verifyClassSignature(Ajc ajc,String classname,String sig) {
+ Signature sigAttr = getClassSignature(ajc,classname);
+ assertTrue("Failed to find signature attribute for class "+classname,sigAttr!=null);
+ assertTrue("Expected signature to be '"+sig+"' but was '"+sigAttr.getSignature()+"'",
+ sigAttr.getSignature().equals(sig));
}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
index 9697e7895..230e9dd00 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
@@ -4846,4 +4846,8 @@
<ajc-test dir="bugs150/pr110788" title="bad generic decp - 4">
<compile files="Case4.java" options="-1.5"/>
</ajc-test>
+
+ <ajc-test dir="bugs150/pr110927" title="cant create signature attribute">
+ <compile files="Case1.java" options="-1.5"/>
+ </ajc-test>
</suite> \ No newline at end of file