summaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorAndy Clement <aclement@gopivotal.com>2014-10-06 17:35:51 -0700
committerAndy Clement <aclement@gopivotal.com>2014-10-06 17:35:51 -0700
commitc8e951296c5f95e82d4c7c3f8eb9b0a647014e20 (patch)
tree2eaed5b80ad735e4c91e424098e35e221f4fea44 /tests/src
parent102173fc11fc6648ed8f2283d3c5ad535e412c73 (diff)
downloadaspectj-c8e951296c5f95e82d4c7c3f8eb9b0a647014e20.tar.gz
aspectj-c8e951296c5f95e82d4c7c3f8eb9b0a647014e20.zip
Fix 436653: conditional aspect activation plus various polish
Modified test expectation system so it is possible to say the test cares about one particular message and the rest do not matter (prefix message string with '*') - crude but quick. Polished many places to exploit generics Upgraded all the tests to work on Java8 - some serious changes regarding ajdoc on Java8. Hopefully it has stayed backwards compatible with earlier JDK versions (e.g. if using AspectJ 1.8.3+ with a JDK less than 8) but no explicit testing done for this.
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java6
-rw-r--r--tests/src/org/aspectj/systemtest/ajc170/ajc170.xml14
-rw-r--r--tests/src/org/aspectj/systemtest/ajc173/ajc173.xml2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc183/Ajc183Tests.java32
-rw-r--r--tests/src/org/aspectj/systemtest/ajc183/ajc183.xml87
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java2
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java20
7 files changed, 141 insertions, 22 deletions
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);