summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2005-08-23 14:02:30 +0000
committeraclement <aclement>2005-08-23 14:02:30 +0000
commit284c4eed6b80ac368ca60c2f9eb7aff1234bf2a8 (patch)
tree0953fe63aa97f0b16f8358ed0f3eee18bfb5db13 /tests
parent4aacf20ad0fd3f3782fe1ff936aa13f666431beb (diff)
downloadaspectj-284c4eed6b80ac368ca60c2f9eb7aff1234bf2a8.tar.gz
aspectj-284c4eed6b80ac368ca60c2f9eb7aff1234bf2a8.zip
@override support for ITDs. Plus some binary weaving generic ITD tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/java5/generics/itds/C.java2
-rw-r--r--tests/java5/generics/itds/D.java2
-rw-r--r--tests/java5/generics/itds/FieldITDOnGenericType.aj (renamed from tests/java5/generics/itds/FieldITDOnGeneric.aj)2
-rw-r--r--tests/java5/generics/itds/binaryweaving/TestA_generictype.java3
-rw-r--r--tests/java5/generics/itds/binaryweaving/TestB_aspect1.aj5
-rw-r--r--tests/java5/generics/itds/binaryweaving/TestB_aspect2.aj5
-rw-r--r--tests/java5/generics/itds/binaryweaving/TestB_class.java15
-rw-r--r--tests/java5/generics/itds/binaryweaving/TestB_generictype.java3
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java44
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml44
10 files changed, 96 insertions, 29 deletions
diff --git a/tests/java5/generics/itds/C.java b/tests/java5/generics/itds/C.java
index b1a630cfc..dc64b17d6 100644
--- a/tests/java5/generics/itds/C.java
+++ b/tests/java5/generics/itds/C.java
@@ -7,5 +7,7 @@ public abstract aspect C<T> {
}
}
+public aspect C<String> { }
+
class Foo {
}
diff --git a/tests/java5/generics/itds/D.java b/tests/java5/generics/itds/D.java
index 2ab496cc0..6843765b1 100644
--- a/tests/java5/generics/itds/D.java
+++ b/tests/java5/generics/itds/D.java
@@ -8,4 +8,6 @@ public abstract aspect D<T> {
}
+aspect E extends D<String> {}
+
class Goo<P> {}
diff --git a/tests/java5/generics/itds/FieldITDOnGeneric.aj b/tests/java5/generics/itds/FieldITDOnGenericType.aj
index 9fb784b62..2a670219e 100644
--- a/tests/java5/generics/itds/FieldITDOnGeneric.aj
+++ b/tests/java5/generics/itds/FieldITDOnGenericType.aj
@@ -12,7 +12,7 @@ public class FieldITDOnGenericType {
public static void main(String[] argv) {
MathUtils<Integer> mu = new MathUtils<Integer>();
mu.n=42;
- System.err.prinltn(">"+mu.n);
+ System.err.println(">"+mu.n);
}
}
diff --git a/tests/java5/generics/itds/binaryweaving/TestA_generictype.java b/tests/java5/generics/itds/binaryweaving/TestA_generictype.java
index 005d936a0..f89e3363a 100644
--- a/tests/java5/generics/itds/binaryweaving/TestA_generictype.java
+++ b/tests/java5/generics/itds/binaryweaving/TestA_generictype.java
@@ -1,4 +1,3 @@
import java.util.*;
-class TestA_generictype<N> {// extends Number> {
-}
+class TestA_generictype<N extends Number> { }
diff --git a/tests/java5/generics/itds/binaryweaving/TestB_aspect1.aj b/tests/java5/generics/itds/binaryweaving/TestB_aspect1.aj
new file mode 100644
index 000000000..145b67eb5
--- /dev/null
+++ b/tests/java5/generics/itds/binaryweaving/TestB_aspect1.aj
@@ -0,0 +1,5 @@
+import java.util.*;
+
+aspect TestB_aspect1 {
+ public <L extends Number> void TestB_generictype<X,Y>.mxy(List<L> ll1, List<X> lx,List<Y> ly,List<L> ll2) {}
+}
diff --git a/tests/java5/generics/itds/binaryweaving/TestB_aspect2.aj b/tests/java5/generics/itds/binaryweaving/TestB_aspect2.aj
new file mode 100644
index 000000000..c8eac2a35
--- /dev/null
+++ b/tests/java5/generics/itds/binaryweaving/TestB_aspect2.aj
@@ -0,0 +1,5 @@
+import java.util.*;
+
+aspect TestB_aspect2 {
+ public <L extends Number> void TestB_generictype<X,Y>.myx(List<L> ll1, List<Y> ly,List<X> lx,List<L> ll2) {}
+}
diff --git a/tests/java5/generics/itds/binaryweaving/TestB_class.java b/tests/java5/generics/itds/binaryweaving/TestB_class.java
new file mode 100644
index 000000000..098aabdbe
--- /dev/null
+++ b/tests/java5/generics/itds/binaryweaving/TestB_class.java
@@ -0,0 +1,15 @@
+import java.util.*;
+
+public class TestB_class {
+ public static void main(String []argv) {
+ TestB_generictype<Float,String> sc1=new TestB_generictype<Float,String>();
+ TestB_generictype<Integer,Float> sc2=new TestB_generictype<Integer,Float>();
+
+ List<Integer> li = new ArrayList<Integer>();
+ List<String> ls = new ArrayList<String>();
+ List<Float> lf = new ArrayList<Float>();
+
+ sc1.mxy(li,lf,ls,li);
+ sc2.myx(li,lf,li,li);
+ }
+}
diff --git a/tests/java5/generics/itds/binaryweaving/TestB_generictype.java b/tests/java5/generics/itds/binaryweaving/TestB_generictype.java
new file mode 100644
index 000000000..f693ea61d
--- /dev/null
+++ b/tests/java5/generics/itds/binaryweaving/TestB_generictype.java
@@ -0,0 +1,3 @@
+import java.util.*;
+
+class TestB_generictype<N extends Number,P> { }
diff --git a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
index 0a12d2df8..bf2233041 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
@@ -161,12 +161,13 @@ public class GenericsTests extends XMLBasedAjcTestCase {
* PASS recursive type variable definitions
* PASS generic aspects
* PASS parameterizing ITDs with type variables
- * TODO using type variables from the target type in your *STATIC* ITD (field/method/ctor) (error scenario)
+ * PASS using type variables from the target type in your *STATIC* ITD (field/method/ctor) (error scenario)
+ * PASS basic binary weaving of generic itds
+ * TODO generic aspect binary weaving (or at least multi source file weaving)
* TODO binary weaving with changing types (moving between generic and simple)
* TODO bridge method creation (also relates to covariance overrides..)
* TODO exotic class/interface bounds ('? extends List<String>','? super anything')
* TODO signature attributes for generic ITDs (public only?)
- * TODO generic aspect binary weaving (or at least multi source file weaving)
*
*
* strangeness:
@@ -218,8 +219,9 @@ public class GenericsTests extends XMLBasedAjcTestCase {
public void testPR96220_GenericAspects1() {runTest("generic aspects - 1");}
public void testPR96220_GenericAspects2() {runTest("generic aspects - 2");}
public void testPR96220_GenericAspects3() {runTest("generic aspects - 3");}
-// public void testGenericAspects4() {runTest("generic aspects - 4");}
-// public void testGenericAspects5() {runTest("generic aspects - 5 (ajdk)");}
+ public void testGenericAspects4() {runTest("generic aspects - 4");}
+ // TODO FREAKYGENERICASPECTPROBLEM why does everything have to be in one source file?
+ // public void testGenericAspects5() {runTest("generic aspects - 5 (ajdk)");}
public void testTypeVariablesInDeclareWarning() { runTest("generic aspect with declare warning using type vars");}
public void testTypeVariablesInExecutionAdvice() { runTest("generic aspect with execution advice using type vars");}
public void testTypeVariablesInAnonymousPointcut() { runTest("generic aspect with anonymous pointcut");}
@@ -367,13 +369,18 @@ public class GenericsTests extends XMLBasedAjcTestCase {
public void testSophisticatedAspectsT() {runTest("uberaspects - T");}
public void testSophisticatedAspectsU() {runTest("uberaspects - U");} // includes nasty casts
- public void testBinaryWeavingITDsA() {runTest("binary weaving ITDs - A");}
+ // FIXME asc these two tests have peculiar error messages - generic aspect related
+// public void testItdUsingTypeParameter() {runTest("itd using type parameter");}
+// public void testItdIncorrectlyUsingTypeParameter() {runTest("itd incorrectly using type parameter");}
+
+ public void testBinaryWeavingITDsA() {runTest("binary weaving ITDs - A");}
+ public void testBinaryWeavingITDsB() {runTest("binary weaving ITDs - B");}
+ public void testBinaryWeavingITDs1() {runTest("binary weaving ITDs - 1");}
// ?? Looks like reweavable files dont process their type mungers correctly.
// See AjLookupEnvironment.weaveInterTypeDeclarations(SourceTypeBinding,typeMungers,declareparents,...)
// it seems to process any it discovers from the weaver state info then not apply new ones (the ones
// passed in!)
-// public void testBinaryWeavingITDs1() {runTest("binary weaving ITDs - 1");}
// public void testBinaryWeavingITDs2() {runTest("binary weaving ITDs - 2");}
// public void testBinaryWeavingITDs3() {runTest("binary weaving ITDs - 3");}
@@ -386,22 +393,15 @@ public class GenericsTests extends XMLBasedAjcTestCase {
public void testStaticGenericMethodITD() {runTest("static generic method itd");}
-
-// public void testGenericITFSharingTypeVariable() {
-// runTest("generic intertype field declaration, sharing type variable");
-// }
-
-// public void testItdOnGenericType() {
-// runTest("ITDs on generic type");
-// }
-//
-// public void testItdUsingTypeParameter() {
-// runTest("itd using type parameter");
-// }
-//
-// public void testItdIncorrectlyUsingTypeParameter() {
-// runTest("itd incorrectly using type parameter");
-// }
+ public void testAtOverride0() {runTest("atOverride used with ITDs");}
+ public void testAtOverride1() {runTest("atOverride used with ITDs - 1");}
+ public void testAtOverride2() {runTest("atOverride used with ITDs - 2");}
+ public void testAtOverride3() {runTest("atOverride used with ITDs - 3");}
+ public void testAtOverride4() {runTest("atOverride used with ITDs - 4");}
+ public void testAtOverride5() {runTest("atOverride used with ITDs - 5");}
+ public void testAtOverride6() {runTest("atOverride used with ITDs - 6");}
+
+ public void testGenericITFSharingTypeVariable() {runTest("generic intertype field declaration, sharing type variable");}
// ----------------------------------------------------------------------------------------
// generic declare parents tests
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
index 690925d61..e1c1c8ede 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
@@ -311,7 +311,37 @@
<message kind="error" line="5" text="Syntax error on tokens, valid member declaration expected instead"/>
</compile>
</ajc-test>
+
+ <!-- atOverride tests with ITDs -->
+
+ <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs">
+ <compile files="AtOverride.aj" options="-1.5"/>
+ </ajc-test>
+ <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 1">
+ <compile files="AtOverride1.aj" options="-1.5">
+ <message kind="error" line="9" text="The method method() of type Child must override a superclass method"/>
+ </compile>
+ </ajc-test>
+ <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 2">
+ <compile files="AtOverride2.aj" options="-1.5"/>
+ </ajc-test>
+ <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 3">
+ <compile files="AtOverride3.aj" options="-1.5"/>
+ </ajc-test>
+ <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 4">
+ <compile files="AtOverride4.aj" options="-1.5"/>
+ </ajc-test>
+ <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 5">
+ <compile files="AtOverride5.aj" options="-1.5">
+ <message kind="error" line="11" text="The method method() of type Child must override a superclass method"/>
+ </compile>
+ </ajc-test>
+ <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 6">
+ <compile files="AtOverride6.aj" options="-1.5"/>
+ </ajc-test>
+ <!-- end of atOverride tests with ITDs -->
+
<ajc-test dir="../docs/dist/doc/examples/introduction" title="introduction sample" vm="1.5">
<compile files="CloneablePoint.java,ComparablePoint.java,HashablePoint.java,Point.java" options="-1.5"/>
</ajc-test>
@@ -3189,10 +3219,10 @@
</ajc-test>
<ajc-test dir="java5/generics/itds" title="generic intertype field declaration, sharing type variable">
- <compile files="FieldITDOnGeneric.aj" options="-1.5"/>
- <run class="FieldITDOnGeneric">
+ <compile files="FieldITDOnGenericType.aj" options="-1.5"/>
+ <run class="FieldITDOnGenericType">
<stderr>
- <line text="foo"/>
+ <line text=">42"/>
</stderr>
</run>
</ajc-test>
@@ -3310,7 +3340,13 @@
<compile files="TestA_generictype.java" outjar="code.jar" options="-1.5,-Xreweavable"/>
<compile files="TestA_aspect.aj,TestA_class.java" inpath="code.jar" options="-1.5,-Xreweavable"/>
<run class="TestA_class"/>
- </ajc-test>
+ </ajc-test>
+
+ <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - B">
+ <compile files="TestB_generictype.java" outjar="code.jar" options="-1.5,-Xreweavable"/>
+ <compile files="TestB_aspect1.aj,TestB_aspect2.aj,TestB_class.java" inpath="code.jar" options="-1.5,-Xreweavable"/>
+ <run class="TestB_class"/>
+ </ajc-test>
<ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - 1">
<compile files="BaseClass.java" outjar="code.jar" options="-1.5,-Xreweavable"/>