diff options
Diffstat (limited to 'tests')
27 files changed, 247 insertions, 29 deletions
diff --git a/tests/bugs183/436653/A.java b/tests/bugs183/436653/A.java new file mode 100644 index 000000000..9f4b93d84 --- /dev/null +++ b/tests/bugs183/436653/A.java @@ -0,0 +1 @@ +public class A {} diff --git a/tests/bugs183/436653/AnnoX.java b/tests/bugs183/436653/AnnoX.java new file mode 100644 index 000000000..19c10457f --- /dev/null +++ b/tests/bugs183/436653/AnnoX.java @@ -0,0 +1,10 @@ +import org.aspectj.lang.annotation.*; + +@RequiredTypes("A") +@Aspect +class X { + @Before("execution(* Code.*(..))") + public void m() { + System.out.println("x"); + } +} diff --git a/tests/bugs183/436653/B.java b/tests/bugs183/436653/B.java new file mode 100644 index 000000000..b90c4517f --- /dev/null +++ b/tests/bugs183/436653/B.java @@ -0,0 +1 @@ +public class B {} diff --git a/tests/bugs183/436653/Code.java b/tests/bugs183/436653/Code.java new file mode 100644 index 000000000..866a01f1d --- /dev/null +++ b/tests/bugs183/436653/Code.java @@ -0,0 +1,3 @@ +public class Code { + public void m() {} +} diff --git a/tests/bugs183/436653/Runner.java b/tests/bugs183/436653/Runner.java new file mode 100644 index 000000000..7705eccd5 --- /dev/null +++ b/tests/bugs183/436653/Runner.java @@ -0,0 +1,11 @@ +public class Runner { + public static void main(String []argv) { + new Code().m(); + } +} + +class Code { + public void m() { + System.out.println("Code.m() running"); + } +} diff --git a/tests/bugs183/436653/X.java b/tests/bugs183/436653/X.java new file mode 100644 index 000000000..0f19a6190 --- /dev/null +++ b/tests/bugs183/436653/X.java @@ -0,0 +1,6 @@ +import org.aspectj.lang.annotation.*; + +@RequiredTypes("A") +aspect X { + before(): execution(* Code.*(..)) {System.out.println("x");} +} diff --git a/tests/bugs183/436653/XA.java b/tests/bugs183/436653/XA.java new file mode 100644 index 000000000..fc4029829 --- /dev/null +++ b/tests/bugs183/436653/XA.java @@ -0,0 +1,7 @@ +import org.aspectj.lang.annotation.*; + +aspect XA { + @SuppressAjWarnings("adviceDidNotMatch") + before(): execution(* A.*(..)) {} +} + diff --git a/tests/bugs183/436653/XA2.java b/tests/bugs183/436653/XA2.java new file mode 100644 index 000000000..94748bd28 --- /dev/null +++ b/tests/bugs183/436653/XA2.java @@ -0,0 +1,9 @@ +import org.aspectj.lang.annotation.*; + +// Aspect deactivated if A is missing +@RequiredTypes("A") +aspect XA2 { + @SuppressAjWarnings("adviceDidNotMatch") + before(): execution(* A.*(..)) {} +} + diff --git a/tests/bugs183/436653/XA3.java b/tests/bugs183/436653/XA3.java new file mode 100644 index 000000000..483d310ae --- /dev/null +++ b/tests/bugs183/436653/XA3.java @@ -0,0 +1,9 @@ +import org.aspectj.lang.annotation.*; + +// Aspect deactivated if A or B is missing (although aspect only really needs A) +@RequiredTypes({"A","B"}) +aspect XA2 { + @SuppressAjWarnings("adviceDidNotMatch") + before(): execution(* A.*(..)) {} +} + diff --git a/tests/bugs183/436653/XB.java b/tests/bugs183/436653/XB.java new file mode 100644 index 000000000..4bcf903ca --- /dev/null +++ b/tests/bugs183/436653/XB.java @@ -0,0 +1,6 @@ +import org.aspectj.lang.annotation.*; + +aspect XB { + before(): execution(* B.*(..)) {} +} + diff --git a/tests/bugs183/436653/XCode.java b/tests/bugs183/436653/XCode.java new file mode 100644 index 000000000..d3985fc20 --- /dev/null +++ b/tests/bugs183/436653/XCode.java @@ -0,0 +1,7 @@ +import org.aspectj.lang.annotation.*; + +aspect XCode { + @SuppressAjWarnings("adviceDidNotMatch") + before(): execution(* Cod*.*(..)) {} +} + diff --git a/tests/bugs183/436653/aop.xml b/tests/bugs183/436653/aop.xml new file mode 100644 index 000000000..aa7d74b40 --- /dev/null +++ b/tests/bugs183/436653/aop.xml @@ -0,0 +1,7 @@ +<aspectj> +<aspects> +<aspect name="X"/> +</aspects> +<weaver options="-verbose"/> +</aspectj> + diff --git a/tests/bugs183/436653/aop2.xml b/tests/bugs183/436653/aop2.xml new file mode 100644 index 000000000..aa7d74b40 --- /dev/null +++ b/tests/bugs183/436653/aop2.xml @@ -0,0 +1,7 @@ +<aspectj> +<aspects> +<aspect name="X"/> +</aspects> +<weaver options="-verbose"/> +</aspectj> + diff --git a/tests/bugs183/436653/bin/Code.class b/tests/bugs183/436653/bin/Code.class Binary files differnew file mode 100644 index 000000000..3cb964043 --- /dev/null +++ b/tests/bugs183/436653/bin/Code.class diff --git a/tests/java5/annotations/itds/AtItd3.aj b/tests/java5/annotations/itds/AtItd3.aj index bc6c671f9..c3412cf56 100644 --- a/tests/java5/annotations/itds/AtItd3.aj +++ b/tests/java5/annotations/itds/AtItd3.aj @@ -22,7 +22,8 @@ public class AtItd3 { Annotation aa = m.getAnnotation(Ann.class); System.err.println("Ann.class retrieved is: "+aa); - if (!aa.toString().equals("@Ann(id=goodbye, anInt=4)")) + if (!aa.toString().equals("@Ann(id=goodbye, anInt=4)")) // < Java8 order + if (!aa.toString().equals("@Ann(anInt=4, id=goodbye)")) // Java8 order throw new RuntimeException("Incorrect output, expected:"+ "@Ann(id=goodbye, anInt=4) but got "+aa.toString()); diff --git a/tests/java5/ataspectj/ajc-ant.xml b/tests/java5/ataspectj/ajc-ant.xml index 4f2e9f36c..0730d7b85 100644 --- a/tests/java5/ataspectj/ajc-ant.xml +++ b/tests/java5/ataspectj/ajc-ant.xml @@ -10,7 +10,7 @@ <target name="compile:javac"> <!-- compile only javac compilable stuff, exclude the one that needs other dependencies --> - <javac target="1.5" destdir="${aj.sandbox}" classpathref="aj.path" + <javac source="1.5" target="1.5" destdir="${aj.sandbox}" classpathref="aj.path" srcdir="${basedir}" includes="ataspectj/*" excludes="ataspectj/UnweavableTest.java" @@ -75,7 +75,7 @@ <target name="ltw.Aspect2MainTest"> <!-- javac Aspect2 --> - <javac target="1.5" destdir="${aj.sandbox}" classpathref="aj.path" + <javac source="1.5" target="1.5" destdir="${aj.sandbox}" classpathref="aj.path" srcdir="${basedir}" includes="ataspectj/ltwreweavable/Aspect2.java" debug="true"> @@ -125,7 +125,7 @@ </target> <target name="ltw.Unweavable"> - <javac target="1.5" destdir="${aj.sandbox}" + <javac source="1.5" target="1.5" destdir="${aj.sandbox}" srcdir="${basedir}" includes="ataspectj/UnweavableTest.java, ataspectj/TestHelper.java" debug="true"> @@ -171,7 +171,7 @@ <target name="ltw.Decp2"> <!-- javac compile the 2nd aspect --> - <javac target="1.5" destdir="${aj.sandbox}" + <javac source="1.5" target="1.5" destdir="${aj.sandbox}" srcdir="${basedir}" includes="ataspectj/DeclareParentsImplementsReweavableTestAspect.java" debug="true"> diff --git a/tests/java5/ataspectj/annotationGen/SA.aj b/tests/java5/ataspectj/annotationGen/SA.aj new file mode 100644 index 000000000..5ca3d661a --- /dev/null +++ b/tests/java5/ataspectj/annotationGen/SA.aj @@ -0,0 +1,14 @@ +import org.aspectj.lang.annotation.Aspect; +import java.lang.annotation.*; + +public aspect SA { + + public static void main(String[] args) { + Annotation[] annotations = SA.class.getAnnotations(); + if (annotations.length != 1) throw new RuntimeException("Should have one annotation but has "+annotations.length); + Aspect aspectAnnotation = (Aspect) annotations[0]; +System.out.println(aspectAnnotation); + if (!aspectAnnotation.value().equals("")) throw new RuntimeException("value should be empty"); + } + +} diff --git a/tests/java5/ataspectj/annotationGen/SA.class b/tests/java5/ataspectj/annotationGen/SA.class Binary files differnew file mode 100644 index 000000000..1ce9f8f94 --- /dev/null +++ b/tests/java5/ataspectj/annotationGen/SA.class diff --git a/tests/java5/ataspectj/annotationGen/SimpleAspect.aj b/tests/java5/ataspectj/annotationGen/SimpleAspect.aj index 34f6954dc..731ef5ca9 100644 --- a/tests/java5/ataspectj/annotationGen/SimpleAspect.aj +++ b/tests/java5/ataspectj/annotationGen/SimpleAspect.aj @@ -5,9 +5,9 @@ public aspect SimpleAspect { public static void main(String[] args) { Annotation[] annotations = SimpleAspect.class.getAnnotations(); - if (annotations.length != 1) throw new RuntimeException("Should have one annotation"); + if (annotations.length != 1) throw new RuntimeException("Should have one annotation but has "+annotations.length); Aspect aspectAnnotation = (Aspect) annotations[0]; if (!aspectAnnotation.value().equals("")) throw new RuntimeException("value should be empty"); } -}
\ No newline at end of file +} diff --git a/tests/java5/ataspectj/annotationGen/SimpleAspect.class b/tests/java5/ataspectj/annotationGen/SimpleAspect.class Binary files differnew file mode 100644 index 000000000..a5d815f04 --- /dev/null +++ b/tests/java5/ataspectj/annotationGen/SimpleAspect.class diff --git a/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java b/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java index 443018bb6..ff9e59339 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java @@ -119,9 +119,9 @@ public class LTWTests extends org.aspectj.testing.XMLBasedAjcTestCase { runTest("JDK14 LTW with XML"); } - public void testJ14LTWWithASPECTPATH() { - runTest("JDK14 LTW with ASPECTPATH"); - } +// public void testJ14LTWWithASPECTPATH() { +// runTest("JDK14 LTW with ASPECTPATH"); +// } //public void testDiscardingWovenTypes() { diff --git a/tests/src/org/aspectj/systemtest/ajc170/ajc170.xml b/tests/src/org/aspectj/systemtest/ajc170/ajc170.xml index 6e95476ed..37963fc15 100644 --- a/tests/src/org/aspectj/systemtest/ajc170/ajc170.xml +++ b/tests/src/org/aspectj/systemtest/ajc170/ajc170.xml @@ -181,10 +181,10 @@ <stdout> <line text="Annotations on field1? true"/> <line text="Annotation count is 4"/> - <line text="@AnnoBoolean(zzz=false, value=true)"/> + <line text="@AnnoBoolean(value=true, zzz=false)"/> <line text="@AnnoClass(value=class java.lang.Integer, ccc=class java.lang.String)"/> - <line text="@AnnoLong(jjj=111, value=999)"/> - <line text="@AnnoString(sss=xyz, value=set from xml)"/> + <line text="@AnnoLong(value=999, jjj=111)"/> + <line text="@AnnoString(value=set from xml, sss=xyz)"/> <line text="Annotations on field2? true"/> <line text="Annotation count is 1"/> <line text="@AnnoClass(value=class java.lang.String, ccc=class java.lang.String)"/> @@ -199,13 +199,13 @@ <line text="Annotations on field1? true"/> <line text="Annotation count is 4"/> <line text="@AnnoChar(value=z, ccc=a)"/> - <line text="@AnnoDouble(ddd=3.0, value=99.0)"/> - <line text="@AnnoFloat(fff=4.0, value=6.0)"/> - <line text="@AnnoShort(sss=3, value=8)"/> + <line text="@AnnoDouble(value=99.0, ddd=3.0)"/> + <line text="@AnnoFloat(value=6.0, fff=4.0)"/> + <line text="@AnnoShort(value=8, sss=3)"/> <line text="Annotations on field2? true"/> <line text="Annotation count is 2"/> <line text="@AnnoByte(value=88, bbb=66)"/> - <line text="@AnnoInt(value=99, iii=111)"/> + <line text="@AnnoInt(iii=111, value=99)"/> </stdout> </run> </ajc-test> diff --git a/tests/src/org/aspectj/systemtest/ajc173/ajc173.xml b/tests/src/org/aspectj/systemtest/ajc173/ajc173.xml index f882d71c7..7c2b88a54 100644 --- a/tests/src/org/aspectj/systemtest/ajc173/ajc173.xml +++ b/tests/src/org/aspectj/systemtest/ajc173/ajc173.xml @@ -9,7 +9,7 @@ </compile> <run class="Hello"> <stdout> - <line text="@MyAnnotation(dummy2=korte, dummy1=)"/> + <line text="@MyAnnotation(dummy1=, dummy2=korte)"/> </stdout> </run> </ajc-test> diff --git a/tests/src/org/aspectj/systemtest/ajc183/Ajc183Tests.java b/tests/src/org/aspectj/systemtest/ajc183/Ajc183Tests.java index ed7c74aee..412fc00eb 100644 --- a/tests/src/org/aspectj/systemtest/ajc183/Ajc183Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc183/Ajc183Tests.java @@ -21,6 +21,38 @@ import org.aspectj.testing.XMLBasedAjcTestCase; */ public class Ajc183Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testSuppressTypeNotFound_436653() { + runTest("suppress type not found"); + } + + public void testSuppressTypeNotFound_436653_2() { + runTest("suppress type not found 2"); + } + + public void testSuppressTypeNotFound_436653_3() { + runTest("suppress type not found 3"); + } + + public void testSuppressTypeNotFound_436653_4() { + runTest("suppress type not found 4"); + } + + public void testSuppressTypeNotFound_436653_5() { + runTest("suppress type not found 5"); + } + + public void testSuppressTypeNotFound_436653_6() { + runTest("suppress type not found 6"); + } + + public void testSuppressTypeNotFound_436653_7() { + runTest("suppress type not found 7"); + } + + public void testSuppressTypeNotFound_436653_8() { + runTest("suppress type not found 8"); + } + public void testConstantPool_445395_0() { runTest("constant pool 0"); } diff --git a/tests/src/org/aspectj/systemtest/ajc183/ajc183.xml b/tests/src/org/aspectj/systemtest/ajc183/ajc183.xml index b08be60a9..163ce443e 100644 --- a/tests/src/org/aspectj/systemtest/ajc183/ajc183.xml +++ b/tests/src/org/aspectj/systemtest/ajc183/ajc183.xml @@ -2,6 +2,93 @@ <suite> + <ajc-test dir="bugs183/436653" title="suppress type not found 4"> + <compile options="-1.8 -Xlint:ignore" files="X.java" outjar="aspects.jar"/> + <compile options="-1.8" files="Runner.java"/> + <run class="Runner" ltw="aop.xml"> + <stdout> + <line text="Code.m() running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs183/436653" title="suppress type not found 5"> + <compile options="-1.8 -Xlint:ignore" files="X.java" outjar="aspects.jar"/> + <compile class="-1.8" files="A.java"/> + <compile options="-1.8" files="Runner.java"/> + <run class="Runner" ltw="aop.xml"> + <stdout> + <line text="x"/> + <line text="Code.m() running"/> + </stdout> + </run> + </ajc-test> + + <!-- annotation style aspect, missing type so deactivated --> + <ajc-test dir="bugs183/436653" title="suppress type not found 6"> + <compile options="-1.8 -Xlint:ignore" files="AnnoX.java" outjar="aspects.jar"/> + <compile options="-1.8" files="Runner.java"/> + <run class="Runner" ltw="aop2.xml"> + <stdout> + <line text="Code.m() running"/> + </stdout> + </run> + </ajc-test> + + <!-- annotation style aspect, type not missing so not deactivated --> + <ajc-test dir="bugs183/436653" title="suppress type not found 7"> + <compile options="-1.8 -Xlint:ignore" files="AnnoX.java A.java" outjar="aspects.jar"/> + <compile options="-1.8" files="Runner.java"/> + <run class="Runner" ltw="aop2.xml"> + <stdout> + <line text="x"/> + <line text="Code.m() running"/> + </stdout> + </run> + </ajc-test> + + <!-- annotation style aspect, type not missing so not deactivated --> + <ajc-test dir="bugs183/436653" title="suppress type not found 8"> + <compile options="-1.8 -Xlint:ignore" files="AnnoX.java A.java" outjar="aspects.jar"/> + <compile options="-1.8 -showWeaveInfo" files="Runner.java" aspectpath="aspects.jar"> + <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Runner.java:8) advised by before advice from 'X' (aspects.jar!AnnoX.class(from AnnoX.java))"/> + </compile> + <run class="Runner"> + <stdout> + <line text="x"/> + <line text="Code.m() running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs183/436653" title="suppress type not found 3"> + <compile options="-1.8" files="A.java" outjar="typeA.jar"/> + <compile options="-1.8" files="B.java" outjar="typeB.jar"/> + <!-- adviceDidNotMatch messages are suppressed here --> + <compile options="-1.8" files="XA3.java XCode.java" outjar="aspects.jar" classpath="typeA.jar"/> + <compile options="-1.8 -verbose" files="Code.java" classpath="typeA.jar" aspectpath="aspects.jar"> + <!-- '*' is a hint that we care about only this message, not other messages. avoids needing to list them all --> + <message kind="info" text="*deactivating aspect 'XA2' as it requires type 'B' which cannot be found on the classpath"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs183/436653" title="suppress type not found 2"> + <compile options="-1.8" files="A.java" outjar="typeA.jar"/> + <!-- adviceDidNotMatch messages are suppressed here --> + <compile options="-1.8" files="XA2.java XCode.java" outjar="aspects.jar" classpath="typeA.jar"/> + <compile options="-1.8" files="Code.java" aspectpath="aspects.jar"> + </compile> + </ajc-test> + + <ajc-test dir="bugs183/436653" title="suppress type not found"> + <compile options="-1.8" files="A.java" outjar="typeA.jar"/> + <!-- adviceDidNotMatch messages are suppressed here --> + <compile options="-1.8" files="XA.java XCode.java" outjar="aspects.jar" classpath="typeA.jar"/> + <compile options="-1.8" files="Code.java" aspectpath="aspects.jar"> + <message kind="error" text="can't determine modifiers of missing type A"/> + </compile> + </ajc-test> + <ajc-test dir="bugs183/445395" title="constant pool 0"> <compile options="-1.8" files="Code.java"> </compile> diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java index 14e880a0a..9b6c11e90 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java @@ -241,7 +241,7 @@ public class AjdeInteractionTestbed extends TestCase { File projectBase = new File(sandboxDir, pname); ICompilerConfiguration icc = compiler.getCompilerConfiguration(); List currentFiles = icc.getProjectSourceFiles(); - List filesForCompilation = new ArrayList(); + List<String> filesForCompilation = new ArrayList<String>(); collectUpFiles(projectBase, projectBase, filesForCompilation); boolean changed = false; for (int i = 0; i < filesForCompilation.size(); i++) { diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java index f355e1557..562291c69 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java @@ -33,7 +33,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio private Set aspectPath = null; private Map sourcePathResources = null; private IOutputLocationManager outputLocationManager = null; - private List dependants; + private List<String> dependants; private Map javaOptionsMap; private Set<File> inpath; private String encoding = null; @@ -41,9 +41,9 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio private String processor; private String processorPath; private String nonstandardoptions; - private List modifiedFiles; - private List modifiedDirs; - private List projectSourceFiles = new ArrayList(); + private List<File> modifiedFiles; + private List<String> modifiedDirs; + private List<String> projectSourceFiles = new ArrayList(); private List xmlConfigFiles = new ArrayList(); private String projectPath; @@ -129,7 +129,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio return xmlConfigFiles; } - public List getProjectSourceFilesChanged() { + public List<File> getProjectSourceFilesChanged() { log("ICompilerConfiguration.getProjectSourceFilesChanged()"); return modifiedFiles; } @@ -146,7 +146,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio public void addDependancy(String projectItDependsOn) { if (dependants == null) { - dependants = new ArrayList(); + dependants = new ArrayList<String>(); } dependants.add(projectItDependsOn); } @@ -187,19 +187,19 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio this.changed |= ICompilerConfiguration.NONSTANDARDOPTIONS_CHANGED; } - public void setProjectSourceFiles(List projectSourceFiles) { + public void setProjectSourceFiles(List<String> projectSourceFiles) { this.projectSourceFiles = projectSourceFiles; this.changed |= ICompilerConfiguration.PROJECTSOURCEFILES_CHANGED; } - public void setProjectXmlConfigFiles(List xmlConfigFiles) { + public void setProjectXmlConfigFiles(List<String> xmlConfigFiles) { this.xmlConfigFiles = xmlConfigFiles; this.changed |= ICompilerConfiguration.XMLCONFIG_CHANGED; } public void addProjectSourceFileChanged(File f) { if (this.modifiedFiles == null) { - this.modifiedFiles = new ArrayList(); + this.modifiedFiles = new ArrayList<File>(); } if (f != null) { modifiedFiles.add(f); @@ -208,7 +208,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio public void addClasspathEntryChanged(String f) { if (this.modifiedDirs == null) { - this.modifiedDirs = new ArrayList(); + this.modifiedDirs = new ArrayList<String>(); } if (f != null) { modifiedDirs.add(f); |