aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2016-11-18 09:00:28 -0800
committerAndy Clement <aclement@pivotal.io>2016-11-18 09:00:28 -0800
commitb6f2b6337fbaf95b78c20862cd90f0e027509531 (patch)
treeda38bdf8ab392b0e6f49da7a676a75f885fe9b85 /tests
parente8be95bbfd291f93319d1a1e9920e44cd7eb7569 (diff)
downloadaspectj-b6f2b6337fbaf95b78c20862cd90f0e027509531.tar.gz
aspectj-b6f2b6337fbaf95b78c20862cd90f0e027509531.zip
Fix 500035: handling target only binding in @AJ pointcut
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs1810/500035/Code.java30
-rw-r--r--tests/bugs1810/500035/Code2.java30
-rw-r--r--tests/bugs1810/500035/Code3.java76
-rw-r--r--tests/bugs1810/500035/Code4.java35
-rw-r--r--tests/bugs1810/501656/ApplicationException.java9
-rw-r--r--tests/bugs1810/501656/ApplicationExceptionHandler.java17
-rw-r--r--tests/bugs1810/501656/Code.java4
-rw-r--r--tests/bugs1810/501656/out/com/myapp/ApplicationException.classbin0 -> 499 bytes
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java5
-rw-r--r--tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java7
-rw-r--r--tests/src/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java7
-rw-r--r--tests/src/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java13
-rw-r--r--tests/src/org/aspectj/systemtest/ajc180/AllTestsAspectJ180.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java30
-rw-r--r--tests/src/org/aspectj/systemtest/ajc1810/ajc1810.xml68
-rw-r--r--tests/src/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java1
-rw-r--r--tests/src/org/aspectj/systemtest/ajc185/Ajc185Tests.java9
-rw-r--r--tests/src/org/aspectj/systemtest/ajc187/Ajc187Tests.java7
-rw-r--r--tests/src/org/aspectj/systemtest/ajc187/AllTestsAspectJ187.java1
-rw-r--r--tests/src/org/aspectj/systemtest/ajc188/AllTestsAspectJ188.java1
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java14
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/IncrementalOutputLocationManagerTests.java10
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java55
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestOutputLocationManager.java6
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java13
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/OutputLocationManagerTests.java12
26 files changed, 360 insertions, 102 deletions
diff --git a/tests/bugs1810/500035/Code.java b/tests/bugs1810/500035/Code.java
new file mode 100644
index 000000000..58e738da4
--- /dev/null
+++ b/tests/bugs1810/500035/Code.java
@@ -0,0 +1,30 @@
+import org.aspectj.lang.annotation.*;
+import org.aspectj.lang.*;
+
+@Aspect
+public class Code {
+
+ @Around(value = "args(regex, replacement) && target(targetObject) " +
+ "&& call(public String String.replaceFirst(String, String)) "
+//, argNames = "proceedingJoinPoint,targetObject,regex,replacement,thisJoinPoint"
+)
+ public String replaceFirstAspect(ProceedingJoinPoint proceedingJoinPoint, String targetObject, String regex, String replacement) throws Throwable {
+System.out.println("targetObject = "+targetObject);
+System.out.println("regex = "+regex);
+System.out.println("replacement = "+replacement);
+ String returnObject = (String) proceedingJoinPoint.proceed(new Object[]{ targetObject, regex, replacement});
+ return returnObject;
+ }
+
+
+ public static void main(String []argv) {
+ new Code().run();
+ }
+
+ public void run() {
+ String s = "hello";
+ s = s.replaceFirst("l","7");
+ System.out.println(s);
+ }
+
+}
diff --git a/tests/bugs1810/500035/Code2.java b/tests/bugs1810/500035/Code2.java
new file mode 100644
index 000000000..23eddce7e
--- /dev/null
+++ b/tests/bugs1810/500035/Code2.java
@@ -0,0 +1,30 @@
+import org.aspectj.lang.annotation.*;
+import org.aspectj.lang.*;
+
+@Aspect
+public class Code2 {
+
+ @Around(value = "args(regex, replacement) && target(targetObject) " +
+ "&& call(public String String.replaceFirst(String, String)) && this(c)"
+//, argNames = "proceedingJoinPoint,targetObject,regex,replacement,thisJoinPoint"
+)
+ public String replaceFirstAspect(ProceedingJoinPoint proceedingJoinPoint, Code2 c, String targetObject, String regex, String replacement) throws Throwable {
+System.out.println("targetObject = "+targetObject);
+System.out.println("regex = "+regex);
+System.out.println("replacement = "+replacement);
+ String returnObject = (String) proceedingJoinPoint.proceed(new Object[]{ c, targetObject, regex, replacement});
+ return returnObject;
+ }
+
+
+ public static void main(String []argv) {
+ new Code2().run();
+ }
+
+ public void run() {
+ String s = "hello";
+ s = s.replaceFirst("l","8");
+ System.out.println(s);
+ }
+
+}
diff --git a/tests/bugs1810/500035/Code3.java b/tests/bugs1810/500035/Code3.java
new file mode 100644
index 000000000..48f672991
--- /dev/null
+++ b/tests/bugs1810/500035/Code3.java
@@ -0,0 +1,76 @@
+import org.aspectj.lang.annotation.*;
+import org.aspectj.lang.*;
+
+@Aspect
+public class Code3 {
+
+ @Around(value = "args(s) && target(targeto) && call(* Foo.run1(String))")
+ public void first(ProceedingJoinPoint proceedingJoinPoint, Foo targeto, String s) throws Throwable {
+ System.out.println("first: binding target, just passing everything through: target=Foo(1)");
+ proceedingJoinPoint.proceed(new Object[]{ targeto, s});
+ }
+
+ @Around(value = "args(s) && this(thiso) && target(targeto) && call(* run2(String))")
+ public void second(ProceedingJoinPoint proceedingJoinPoint, Foo thiso, Foo targeto, String s) throws Throwable {
+ System.out.println("second: binding this and target, just passing everything through: this=Foo(0) target=Foo(1)");
+ proceedingJoinPoint.proceed(new Object[]{ thiso, targeto, s});
+ }
+
+ @Around(value = "args(s) && this(thiso) && call(* run3(String))")
+ public void third(ProceedingJoinPoint proceedingJoinPoint, Foo thiso, String s) throws Throwable {
+ System.out.println("third: binding this, just passing everything through: this=Foo(0)");
+ proceedingJoinPoint.proceed(new Object[]{ thiso, s});
+ }
+
+ @Around(value = "args(s) && this(thiso) && call(* run4(String))")
+ public void fourth(ProceedingJoinPoint proceedingJoinPoint, Foo thiso, String s) throws Throwable {
+ System.out.println("fourth: binding this, switching from Foo(0) to Foo(3)");
+ proceedingJoinPoint.proceed(new Object[]{ new Foo(3), s});
+ }
+
+ @Around(value = "args(s) && target(targeto) && call(* run5(String))")
+ public void fifth(ProceedingJoinPoint proceedingJoinPoint, Foo targeto, String s) throws Throwable {
+ System.out.println("fifth: binding target, switching from Foo(1) to Foo(4)");
+ proceedingJoinPoint.proceed(new Object[]{ new Foo(4), s});
+ }
+
+ @Around(value = "args(s) && this(thiso) && target(targeto) && call(* run6(String))")
+ public void sixth(ProceedingJoinPoint proceedingJoinPoint, Foo thiso, Foo targeto, String s) throws Throwable {
+ System.out.println("sixth: binding this and target, switching them around (before this=Foo(0) target=Foo(1))");
+ proceedingJoinPoint.proceed(new Object[]{ targeto, thiso, s});
+ }
+
+ public static void main(String []argv) {
+ new Foo(0).execute1();
+ new Foo(0).execute2();
+ new Foo(0).execute3();
+ new Foo(0).execute4();
+ new Foo(0).execute5();
+ new Foo(0).execute6();
+ }
+}
+
+class Foo {
+ int i;
+ public Foo(int i) {
+ this.i = i;
+ }
+
+ public void execute1() { new Foo(1).run1("abc"); }
+ public void execute2() { new Foo(1).run2("abc"); }
+ public void execute3() { new Foo(1).run3("abc"); }
+ public void execute4() { new Foo(1).run4("abc"); }
+ public void execute5() { new Foo(1).run5("abc"); }
+ public void execute6() { new Foo(1).run6("abc"); }
+
+ public void run1(String s) { System.out.println("Executing run("+s+") on "+this.toString()); }
+ public void run2(String s) { System.out.println("Executing run("+s+") on "+this.toString()); }
+ public void run3(String s) { System.out.println("Executing run("+s+") on "+this.toString()); }
+ public void run4(String s) { System.out.println("Executing run("+s+") on "+this.toString()); }
+ public void run5(String s) { System.out.println("Executing run("+s+") on "+this.toString()); }
+ public void run6(String s) { System.out.println("Executing run("+s+") on "+this.toString()); }
+
+ public String toString() {
+ return ("Foo(i="+i+")");
+ }
+}
diff --git a/tests/bugs1810/500035/Code4.java b/tests/bugs1810/500035/Code4.java
new file mode 100644
index 000000000..176ce2011
--- /dev/null
+++ b/tests/bugs1810/500035/Code4.java
@@ -0,0 +1,35 @@
+import org.aspectj.lang.annotation.*;
+import org.aspectj.lang.*;
+
+public aspect Code4 {
+
+ void around(Foo targeto, String s): call(* Foo.run(String)) && args(s) && target(targeto) {
+ System.out.println("first: binding target, just passing everything through");
+ proceed(targeto, s);
+ }
+
+ public static void main(String []argv) {
+ new Foo(0).execute();
+ }
+}
+
+class Foo {
+ int i;
+ public Foo(int i) {
+ this.i = i;
+ }
+
+ public void execute() {
+ Foo f1 = new Foo(1);
+ Foo f2 = new Foo(2);
+ f1.run("abc");
+ }
+
+ public void run(String s) {
+ System.out.println("Executing run("+s+") on "+this.toString());
+ }
+
+ public String toString() {
+ return ("Foo(i="+i+")");
+ }
+}
diff --git a/tests/bugs1810/501656/ApplicationException.java b/tests/bugs1810/501656/ApplicationException.java
new file mode 100644
index 000000000..5392eeaef
--- /dev/null
+++ b/tests/bugs1810/501656/ApplicationException.java
@@ -0,0 +1,9 @@
+package com.myapp;
+
+public class ApplicationException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public ApplicationException(String message) {
+ super(message);
+ }
+}
diff --git a/tests/bugs1810/501656/ApplicationExceptionHandler.java b/tests/bugs1810/501656/ApplicationExceptionHandler.java
new file mode 100644
index 000000000..bd96e1c27
--- /dev/null
+++ b/tests/bugs1810/501656/ApplicationExceptionHandler.java
@@ -0,0 +1,17 @@
+package com.myapp.aspect;
+
+import org.aspectj.lang.annotation.AfterThrowing;
+import org.aspectj.lang.annotation.Aspect;
+
+import com.myapp.ApplicationException;
+
+@Aspect
+public abstract class ApplicationExceptionHandler<EX extends ApplicationException> {
+ @AfterThrowing(
+ pointcut = "execution(* com.myapp.*.facade.*.*(..))",
+ throwing = "exception"
+, argNames="exception"
+ )
+ public abstract void handleFacadeException(EX exception);
+
+}
diff --git a/tests/bugs1810/501656/Code.java b/tests/bugs1810/501656/Code.java
new file mode 100644
index 000000000..c8e603a9e
--- /dev/null
+++ b/tests/bugs1810/501656/Code.java
@@ -0,0 +1,4 @@
+public abstract class Code {
+ public void m(String str1) {}
+ public abstract void m2(String str2);
+}
diff --git a/tests/bugs1810/501656/out/com/myapp/ApplicationException.class b/tests/bugs1810/501656/out/com/myapp/ApplicationException.class
new file mode 100644
index 000000000..fbbbdda19
--- /dev/null
+++ b/tests/bugs1810/501656/out/com/myapp/ApplicationException.class
Binary files differ
diff --git a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
index 1ec2b21c1..ff08047d1 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
@@ -5,11 +5,8 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
-import junit.framework.Test;
-
import org.aspectj.apache.bcel.classfile.Attribute;
import org.aspectj.apache.bcel.classfile.JavaClass;
import org.aspectj.apache.bcel.classfile.Signature;
@@ -19,6 +16,8 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
import org.aspectj.tools.ajc.Ajc;
import org.aspectj.util.LangUtil;
+import junit.framework.Test;
+
public class GenericsTests extends XMLBasedAjcTestCase {
/*==========================================
diff --git a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
index 5b3c795d4..8928678c8 100644
--- a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
@@ -12,17 +12,14 @@ package org.aspectj.systemtest.ajc151;
import java.io.File;
import java.io.IOException;
-import java.io.PrintWriter;
-import junit.framework.Test;
-
-import org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder;
import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IHierarchy;
import org.aspectj.asm.IProgramElement;
import org.aspectj.systemtest.ajc150.GenericsTests;
import org.aspectj.testing.XMLBasedAjcTestCase;
-import org.aspectj.weaver.UnresolvedType.TypeKind;
+
+import junit.framework.Test;
public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
diff --git a/tests/src/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java b/tests/src/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java
index 4b21319d0..9c92f8488 100644
--- a/tests/src/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java
@@ -17,6 +17,7 @@ import junit.framework.Test;
import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IProgramElement;
+import org.aspectj.asm.IRelationship;
import org.aspectj.testing.XMLBasedAjcTestCase;
/*
@@ -102,14 +103,14 @@ public class NewarrayJoinpointTests extends XMLBasedAjcTestCase {
runTest("structure model");
IProgramElement ipe = AsmManager.lastActiveStructureModel.getHierarchy().findElementForType("", "Five");
assertTrue("Couldnt find 'Five' type in the model", ipe != null);
- List kids = ipe.getChildren();
+ List<IProgramElement> kids = ipe.getChildren();
assertTrue("Couldn't find 'main' method in the 'Five' type", kids != null && kids.size() == 1);
- List codenodes = ((IProgramElement) kids.get(0)).getChildren();
+ List<IProgramElement> codenodes = ((IProgramElement) kids.get(0)).getChildren();
assertTrue("Couldn't find nodes below 'main' method", codenodes != null && codenodes.size() == 1);
IProgramElement arrayCtorCallNode = (IProgramElement) codenodes.get(0);
String exp = "constructor-call(void java.lang.Integer[].<init>(int))";
assertTrue("Expected '" + exp + "' but found " + arrayCtorCallNode.toString(), arrayCtorCallNode.toString().equals(exp));
- List rels = AsmManager.lastActiveStructureModel.getRelationshipMap().get(arrayCtorCallNode);
+ List<IRelationship> rels = AsmManager.lastActiveStructureModel.getRelationshipMap().get(arrayCtorCallNode);
assertTrue("Should have a relationship from the ctorcall node, but didn't find one?", rels != null && rels.size() == 1);
}
diff --git a/tests/src/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java b/tests/src/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java
index 64fa5a174..922f4c5b4 100644
--- a/tests/src/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java
@@ -181,9 +181,8 @@ public class SynchronizationTransformTests extends XMLBasedAjcTestCase {
private LazyMethodGen getMethod(String typename, String methodname) {
BcelObjectType type = getBcelObjectFor(typename);
LazyClassGen lcg = type.getLazyClassGen();
- List /* LazyMethodGen */methods = lcg.getMethodGens();
- for (Iterator iter = methods.iterator(); iter.hasNext();) {
- LazyMethodGen element = (LazyMethodGen) iter.next();
+ List<LazyMethodGen> methods = lcg.getMethodGens();
+ for (LazyMethodGen element: methods) {
if (element.getName().equals(methodname)) {
return element;
}
@@ -234,7 +233,7 @@ public class SynchronizationTransformTests extends XMLBasedAjcTestCase {
// Load the file in
fr = new BufferedReader(new FileReader(f));
String line = null;
- List originalFileContents = new ArrayList();
+ List<String> originalFileContents = new ArrayList<>();
while ((line = fr.readLine()) != null)
originalFileContents.add(line);
String[] fileContents = (String[]) originalFileContents.toArray(new String[] {});
@@ -256,10 +255,10 @@ public class SynchronizationTransformTests extends XMLBasedAjcTestCase {
}
}
- private String stringify(List l) {
+ private String stringify(List<String> l) {
StringBuffer result = new StringBuffer();
- for (Iterator iter = l.iterator(); iter.hasNext();) {
- String str = (String) iter.next();
+ for (Iterator<String> iter = l.iterator(); iter.hasNext();) {
+ String str = iter.next();
result.append(str);
result.append("\n");
}
diff --git a/tests/src/org/aspectj/systemtest/ajc180/AllTestsAspectJ180.java b/tests/src/org/aspectj/systemtest/ajc180/AllTestsAspectJ180.java
index 6feff4445..453c057eb 100644
--- a/tests/src/org/aspectj/systemtest/ajc180/AllTestsAspectJ180.java
+++ b/tests/src/org/aspectj/systemtest/ajc180/AllTestsAspectJ180.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.aspectj.systemtest.ajc180;
-import org.aspectj.systemtest.ajc181.Ajc181Tests;
-
import junit.framework.Test;
import junit.framework.TestSuite;
diff --git a/tests/src/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java b/tests/src/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java
index 6122b1638..3cae1378c 100644
--- a/tests/src/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java
@@ -12,24 +12,38 @@ package org.aspectj.systemtest.ajc1810;
import java.io.File;
-import junit.framework.Test;
-
import org.aspectj.apache.bcel.Constants;
import org.aspectj.apache.bcel.classfile.Attribute;
-import org.aspectj.apache.bcel.classfile.Constant;
-import org.aspectj.apache.bcel.classfile.ConstantClass;
-import org.aspectj.apache.bcel.classfile.ConstantPool;
-import org.aspectj.apache.bcel.classfile.ConstantUtf8;
-import org.aspectj.apache.bcel.classfile.InnerClass;
-import org.aspectj.apache.bcel.classfile.InnerClasses;
import org.aspectj.apache.bcel.classfile.JavaClass;
import org.aspectj.testing.XMLBasedAjcTestCase;
+import junit.framework.Test;
+
/**
* @author Andy Clement
*/
public class Ajc1810Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+ public void testBinding_500035() {
+ runTest("ataspectj binding");
+ }
+
+ public void testBinding_500035_2() {
+ runTest("ataspectj binding 2");
+ }
+
+ public void testBinding_500035_3() {
+ runTest("ataspectj binding 3 -XnoInline");
+ }
+
+ public void testBinding_500035_4() {
+ runTest("ataspectj binding 4");
+ }
+
+ public void testGenericsException_501656() {
+ runTest("generics exception");
+ }
+
public void testAIOOBE_502807() {
runTest("unexpected aioobe");
}
diff --git a/tests/src/org/aspectj/systemtest/ajc1810/ajc1810.xml b/tests/src/org/aspectj/systemtest/ajc1810/ajc1810.xml
index 065420da3..7485c1c20 100644
--- a/tests/src/org/aspectj/systemtest/ajc1810/ajc1810.xml
+++ b/tests/src/org/aspectj/systemtest/ajc1810/ajc1810.xml
@@ -2,6 +2,74 @@
<suite>
+ <ajc-test dir="bugs1810/500035" title="ataspectj binding">
+ <compile options="-1.8" files="Code.java"/>
+ <run class="Code">
+ <stdout>
+ <line text="targetObject = hello"/>
+ <line text="regex = l"/>
+ <line text="replacement = 7"/>
+ <line text="he7lo"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs1810/500035" title="ataspectj binding 2">
+ <compile options="-1.8" files="Code2.java"/>
+ <run class="Code2">
+ <stdout>
+ <line text="targetObject = hello"/>
+ <line text="regex = l"/>
+ <line text="replacement = 8"/>
+ <line text="he8lo"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs1810/500035" title="ataspectj binding 3 -XnoInline">
+ <compile options="-1.8 -XnoInline" files="Code3.java"/>
+ <run class="Code3">
+ <stdout>
+ <line text="first: binding target, just passing everything through: target=Foo(1)"/>
+ <line text="Executing run(abc) on Foo(i=1)"/>
+ <line text="second: binding this and target, just passing everything through: this=Foo(0) target=Foo(1)"/>
+ <line text="Executing run(abc) on Foo(i=1)"/>
+ <line text="third: binding this, just passing everything through: this=Foo(0)"/>
+ <line text="Executing run(abc) on Foo(i=1)"/>
+ <line text="fourth: binding this, switching from Foo(0) to Foo(3)"/>
+ <line text="Executing run(abc) on Foo(i=1)"/>
+ <line text="fifth: binding target, switching from Foo(1) to Foo(4)"/>
+ <line text="Executing run(abc) on Foo(i=4)"/>
+ <line text="sixth: binding this and target, switching them around (before this=Foo(0) target=Foo(1))"/>
+ <line text="Executing run(abc) on Foo(i=0)"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs1810/500035" title="ataspectj binding 4">
+ <compile options="-1.8" files="Code3.java"/>
+ <run class="Code3">
+ <stdout>
+ <line text="first: binding target, just passing everything through: target=Foo(1)"/>
+ <line text="Executing run(abc) on Foo(i=1)"/>
+ <line text="second: binding this and target, just passing everything through: this=Foo(0) target=Foo(1)"/>
+ <line text="Executing run(abc) on Foo(i=1)"/>
+ <line text="third: binding this, just passing everything through: this=Foo(0)"/>
+ <line text="Executing run(abc) on Foo(i=1)"/>
+ <line text="fourth: binding this, switching from Foo(0) to Foo(3)"/>
+ <line text="Executing run(abc) on Foo(i=1)"/>
+ <line text="fifth: binding target, switching from Foo(1) to Foo(4)"/>
+ <line text="Executing run(abc) on Foo(i=4)"/>
+ <line text="sixth: binding this and target, switching them around (before this=Foo(0) target=Foo(1))"/>
+ <line text="Executing run(abc) on Foo(i=0)"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs1810/501656" title="generics exception">
+ <compile options="-1.8 -parameters" files="ApplicationException.java ApplicationExceptionHandler.java"/>
+ </ajc-test>
+
<ajc-test dir="bugs1810/490315" title="indy">
<compile options="-1.8" files="FailingAspect.java SomeAnno.java SomeContext.java SomeCriteria.java SomeDTO.java SomeEnum.java SomePiece.java SomePropertyDTO.java SomeService.java SomeServiceImpl.java"/>
</ajc-test>
diff --git a/tests/src/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java b/tests/src/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java
index 10551687d..c0323f0ef 100644
--- a/tests/src/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java
+++ b/tests/src/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java
@@ -12,7 +12,6 @@ package org.aspectj.systemtest.ajc182;
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.aspectj.systemtest.apt.AptTests;
public class AllTestsAspectJ182 {
diff --git a/tests/src/org/aspectj/systemtest/ajc185/Ajc185Tests.java b/tests/src/org/aspectj/systemtest/ajc185/Ajc185Tests.java
index cc9800043..77b453188 100644
--- a/tests/src/org/aspectj/systemtest/ajc185/Ajc185Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc185/Ajc185Tests.java
@@ -10,17 +10,12 @@
*******************************************************************************/
package org.aspectj.systemtest.ajc185;
-import java.io.BufferedInputStream;
import java.io.File;
-import java.io.FileInputStream;
-import junit.framework.Test;
-
-import org.aspectj.apache.bcel.classfile.JavaClass;
-import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen;
-import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
import org.aspectj.testing.XMLBasedAjcTestCase;
+import junit.framework.Test;
+
/**
* @author Andy Clement
*/
diff --git a/tests/src/org/aspectj/systemtest/ajc187/Ajc187Tests.java b/tests/src/org/aspectj/systemtest/ajc187/Ajc187Tests.java
index 754864fd7..4ff34b28e 100644
--- a/tests/src/org/aspectj/systemtest/ajc187/Ajc187Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc187/Ajc187Tests.java
@@ -11,14 +11,11 @@
package org.aspectj.systemtest.ajc187;
import java.io.File;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.URLClassLoader;
-
-import junit.framework.Test;
import org.aspectj.testing.XMLBasedAjcTestCase;
+import junit.framework.Test;
+
/**
* @author Andy Clement
*/
diff --git a/tests/src/org/aspectj/systemtest/ajc187/AllTestsAspectJ187.java b/tests/src/org/aspectj/systemtest/ajc187/AllTestsAspectJ187.java
index 79634df8c..ef8ff0a1c 100644
--- a/tests/src/org/aspectj/systemtest/ajc187/AllTestsAspectJ187.java
+++ b/tests/src/org/aspectj/systemtest/ajc187/AllTestsAspectJ187.java
@@ -12,7 +12,6 @@ package org.aspectj.systemtest.ajc187;
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.aspectj.systemtest.apt.AptTests;
public class AllTestsAspectJ187 {
diff --git a/tests/src/org/aspectj/systemtest/ajc188/AllTestsAspectJ188.java b/tests/src/org/aspectj/systemtest/ajc188/AllTestsAspectJ188.java
index 8867d9174..32d3c12bf 100644
--- a/tests/src/org/aspectj/systemtest/ajc188/AllTestsAspectJ188.java
+++ b/tests/src/org/aspectj/systemtest/ajc188/AllTestsAspectJ188.java
@@ -12,7 +12,6 @@ package org.aspectj.systemtest.ajc188;
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.aspectj.systemtest.apt.AptTests;
public class AllTestsAspectJ188 {
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java
index cfe4495a4..01426d923 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java
@@ -99,7 +99,7 @@ public class AjdeInteractionTestbed extends TestCase {
((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setNonStandardOptions(options);
}
- public void configureAspectPath(String projectName, Set aspectpath) {
+ public void configureAspectPath(String projectName, Set<File> aspectpath) {
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName);
((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setAspectPath(aspectpath);
}
@@ -121,12 +121,12 @@ public class AjdeInteractionTestbed extends TestCase {
((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setAspectPath(s);
}
- public void configureResourceMap(String projectName, Map resourcesMap) {
+ public void configureResourceMap(String projectName, Map<String,File> resourcesMap) {
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName);
((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setSourcePathResources(resourcesMap);
}
- public void configureJavaOptionsMap(String projectName, Map options) {
+ public void configureJavaOptionsMap(String projectName, Map<String,String> options) {
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName);
((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setJavaOptions(options);
}
@@ -240,7 +240,7 @@ public class AjdeInteractionTestbed extends TestCase {
private void addSourceFilesToBuild(String pname, AjCompiler compiler) {
File projectBase = new File(sandboxDir, pname);
ICompilerConfiguration icc = compiler.getCompilerConfiguration();
- List currentFiles = icc.getProjectSourceFiles();
+ List<String> currentFiles = icc.getProjectSourceFiles();
List<String> filesForCompilation = new ArrayList<String>();
collectUpFiles(projectBase, projectBase, filesForCompilation);
boolean changed = false;
@@ -392,12 +392,10 @@ public class AjdeInteractionTestbed extends TestCase {
if (getCompiledFiles(projectName).size() == 0 && getWovenClasses(projectName).size() == 0) {
sb.append("No files were compiled or woven\n");
}
- for (Iterator iter = getCompiledFiles(projectName).iterator(); iter.hasNext();) {
- Object element = iter.next();
+ for (String element: getCompiledFiles(projectName)) {
sb.append("compiled: " + element + "\n");
}
- for (Iterator iter = getWovenClasses(projectName).iterator(); iter.hasNext();) {
- Object element = iter.next();
+ for (String element: getWovenClasses(projectName)) {
sb.append("woven: " + element + "\n");
}
return sb.toString();
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalOutputLocationManagerTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalOutputLocationManagerTests.java
index 0c13b154b..3f2afc409 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalOutputLocationManagerTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalOutputLocationManagerTests.java
@@ -40,7 +40,7 @@ public class IncrementalOutputLocationManagerTests extends AbstractMultiProjectI
private String projectDir;
private int numberOfSrcDirs;
- private List allOutputDirs;
+ private List<File> allOutputDirs;
public MyOutputLocationManager(String projectName, int numberOfSrcDirs) {
projectDir = getWorkingDir() + File.separator + projectName;
@@ -53,8 +53,8 @@ public class IncrementalOutputLocationManagerTests extends AbstractMultiProjectI
public void reportFileRemove(String outputfile, int filetype) {
}
- public Map getInpathMap() {
- return Collections.EMPTY_MAP;
+ public Map<File,String> getInpathMap() {
+ return Collections.emptyMap();
}
public File getOutputLocationForClass(File compilationUnit) {
@@ -72,9 +72,9 @@ public class IncrementalOutputLocationManagerTests extends AbstractMultiProjectI
return getOutputLocationForClass(resource);
}
- public List getAllOutputLocations() {
+ public List<File> getAllOutputLocations() {
if (allOutputDirs == null) {
- allOutputDirs = new ArrayList();
+ allOutputDirs = new ArrayList<>();
for (int i = 0; i < numberOfSrcDirs + 1; i++) {
File f = null;
if (i == 0) {
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java
index 3299ee833..308ed42d5 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java
@@ -64,12 +64,12 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
build("inpathTesting");
AjState state = getState();
- Map classNameToFileMap = state.getClassNameToFileMap();
+ Map<String,File> classNameToFileMap = state.getClassNameToFileMap();
assertFalse("expected there to be classes ", classNameToFileMap.isEmpty());
- Set entrySet = classNameToFileMap.entrySet();
- for (Iterator iterator = entrySet.iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- String className = (String) entry.getKey();
+ Set<Map.Entry<String,File>> entrySet = classNameToFileMap.entrySet();
+ for (Iterator<Map.Entry<String,File>> iterator = entrySet.iterator(); iterator.hasNext();) {
+ Map.Entry<String,File> entry = iterator.next();
+ String className = entry.getKey();
String fullClassName = expectedOutputDir + File.separator + className.replace('.', File.separatorChar) + ".class";
File file = (File) entry.getValue();
assertEquals("expected file to have path \n" + fullClassName + ", but" + " found path \n" + file.getAbsolutePath(),
@@ -105,15 +105,14 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
// the classes onthe inpath are recorded against the AjBuildManager
// (they are deleted from the ajstate whilst cleaning up after a build)
- Map binarySources = state.getAjBuildManager().getBinarySourcesForThisWeave();
+ Map<String,List<UnwovenClassFile>> binarySources = state.getAjBuildManager().getBinarySourcesForThisWeave();
assertFalse("expected there to be binary sources from the inpath setting but didn't find any", binarySources.isEmpty());
- List unwovenClassFiles = (List) binarySources.get(inpathDir + File.separator + "InpathClass.class");
- List fileNames = new ArrayList();
+ List<UnwovenClassFile> unwovenClassFiles = binarySources.get(inpathDir + File.separator + "InpathClass.class");
+ List<String> fileNames = new ArrayList<>();
// the unwovenClassFiles should have filenames that point to the output dir
// (which in this case is the sandbox dir) and not where they came from.
- for (Iterator iterator = unwovenClassFiles.iterator(); iterator.hasNext();) {
- UnwovenClassFile ucf = (UnwovenClassFile) iterator.next();
+ for (UnwovenClassFile ucf: unwovenClassFiles) {
if (ucf.getFilename().indexOf(expectedOutputDir) == -1) {
fileNames.add(ucf.getFilename());
}
@@ -145,15 +144,14 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
AjBuildConfig buildConfig = state.getBuildConfig();
state.prepareForNextBuild(buildConfig);
- Map binarySources = state.getBinaryFilesToCompile(true);
+ Map<String, List<UnwovenClassFile>> binarySources = state.getBinaryFilesToCompile(true);
assertFalse("expected there to be binary sources from the inpath setting but didn't find any", binarySources.isEmpty());
- List unwovenClassFiles = (List) binarySources.get(inpathDir + File.separator + "InpathClass.class");
- List fileNames = new ArrayList();
+ List<UnwovenClassFile> unwovenClassFiles = binarySources.get(inpathDir + File.separator + "InpathClass.class");
+ List<String> fileNames = new ArrayList<>();
// the unwovenClassFiles should have filenames that point to the output dir
// (which in this case is the sandbox dir) and not where they came from.
- for (Iterator iterator = unwovenClassFiles.iterator(); iterator.hasNext();) {
- UnwovenClassFile ucf = (UnwovenClassFile) iterator.next();
+ for (UnwovenClassFile ucf: unwovenClassFiles) {
if (ucf.getFilename().indexOf(expectedOutputDir) == -1) {
fileNames.add(ucf.getFilename());
}
@@ -177,14 +175,13 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
AjState state = getState();
// tests AjState.createUnwovenClassFile(BinarySourceFile)
- Map binarySources = state.getAjBuildManager().getBinarySourcesForThisWeave();
+ Map<String,List<UnwovenClassFile>> binarySources = state.getAjBuildManager().getBinarySourcesForThisWeave();
assertFalse("expected there to be binary sources from the inpath setting but didn't find any", binarySources.isEmpty());
- List unwovenClassFiles = (List) binarySources.get(inpathDir);
- List fileNames = new ArrayList();
+ List<UnwovenClassFile> unwovenClassFiles = binarySources.get(inpathDir);
+ List<String> fileNames = new ArrayList<>();
- for (Iterator iterator = unwovenClassFiles.iterator(); iterator.hasNext();) {
- UnwovenClassFile ucf = (UnwovenClassFile) iterator.next();
+ for (UnwovenClassFile ucf: unwovenClassFiles) {
if (ucf.getFilename().indexOf(expectedOutputDir) == -1) {
fileNames.add(ucf.getFilename());
}
@@ -312,7 +309,7 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
return;
}
File f = new File(entry);
- Set s = new HashSet();
+ Set<File> s = new HashSet<>();
s.add(f);
configureInPath("inpathTesting", s);
}
@@ -325,14 +322,14 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
private File classOutputLoc;
private File resourceOutputLoc;
private String testProjectOutputPath;
- private List allOutputLocations;
+ private List<File> allOutputLocations;
private File outputLoc;
public SingleDirOutputLocMgr(String testProjectPath) {
this.testProjectOutputPath = testProjectPath + File.separator + "bin";
outputLoc = new File(testProjectOutputPath);
- allOutputLocations = new ArrayList();
+ allOutputLocations = new ArrayList<>();
allOutputLocations.add(outputLoc);
}
@@ -340,8 +337,8 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
return outputLoc;
}
- public Map getInpathMap() {
- return Collections.EMPTY_MAP;
+ public Map<File,String> getInpathMap() {
+ return Collections.emptyMap();
}
@@ -349,7 +346,7 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
return outputLoc;
}
- public List /* File */getAllOutputLocations() {
+ public List<File> getAllOutputLocations() {
return allOutputLocations;
}
@@ -364,13 +361,11 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
}
public String getSourceFolderForFile(File sourceFile) {
- // TODO Auto-generated method stub
- return null;
+ return null; // no impl
}
public int discoverChangesSince(File dir, long buildtime) {
- // TODO Auto-generated method stub
- return 0;
+ return 0; // no impl
}
}
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestOutputLocationManager.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestOutputLocationManager.java
index a5e93a824..bb04e515b 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestOutputLocationManager.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestOutputLocationManager.java
@@ -31,7 +31,7 @@ public class MultiProjTestOutputLocationManager implements IOutputLocationManage
private File classOutputLoc;
private File resourceOutputLoc;
private final Map sourceFolders = new HashMap();
- private List allOutputLocations;
+ private List<File> allOutputLocations;
public MultiProjTestOutputLocationManager(String testProjectPath) {
this.testProjectOutputPath = testProjectPath + File.separator + "bin";
@@ -52,9 +52,9 @@ public class MultiProjTestOutputLocationManager implements IOutputLocationManage
return resourceOutputLoc;
}
- public List getAllOutputLocations() {
+ public List<File> getAllOutputLocations() {
if (allOutputLocations == null) {
- allOutputLocations = new ArrayList();
+ allOutputLocations = new ArrayList<>();
initLocations();
allOutputLocations.add(classOutputLoc);
if (!classOutputLoc.equals(resourceOutputLoc)) {
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
index 36001fe6a..779143bd1 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
@@ -1233,7 +1233,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
alter(p, "inc2"); // whitespace change on affected file
build(p);
checkWasntFullBuild();
- List l = getCompilerErrorMessages(p);
+ List<String> l = getCompilerErrorMessages(p);
assertEquals("Unexpected compiler error", 0, l.size());
}
@@ -2646,7 +2646,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
configureShowWeaveInfoMessages("PR157054", true);
build("PR157054");
checkWasFullBuild();
- List weaveMessages = getWeavingMessages("PR157054");
+ List<IMessage> weaveMessages = getWeavingMessages("PR157054");
assertTrue("Should be two weaving messages but there are " + weaveMessages.size(), weaveMessages.size() == 2);
alter("PR157054", "inc1");
build("PR157054");
@@ -2827,7 +2827,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
initialiseProject("PR152257");
configureNonStandardCompileOptions("PR152257", "-XnoInline");
build("PR152257");
- List errors = getErrorMessages("PR152257");
+ List<IMessage> errors = getErrorMessages("PR152257");
assertTrue("Should be no warnings, but there are #" + errors.size(), errors.size() == 0);
checkWasFullBuild();
alter("PR152257", "inc1");
@@ -2965,10 +2965,9 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
}
private void checkCompiled(String projectName, String typeNameSubstring) {
- List files = getCompiledFiles(projectName);
+ List<String> files = getCompiledFiles(projectName);
boolean found = false;
- for (Iterator iterator = files.iterator(); iterator.hasNext();) {
- String object = (String) iterator.next();
+ for (String object: files) {
if (object.indexOf(typeNameSubstring) != -1) {
found = true;
}
@@ -3302,7 +3301,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
// Step2. Quick check that the advice points to something...
IProgramElement nodeForTypeA = checkForNode(model, "pkg", "A", true);
IProgramElement nodeForAdvice = findAdvice(nodeForTypeA);
- List relatedElements = getRelatedElements(model, nodeForAdvice, 1);
+ List<String> relatedElements = getRelatedElements(model, nodeForAdvice, 1);
// Step3. Check the advice applying at the first 'code' join point
// in pkg.C is from aspect pkg.A, line 7
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/OutputLocationManagerTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/OutputLocationManagerTests.java
index 2de3976db..333495399 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/OutputLocationManagerTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/OutputLocationManagerTests.java
@@ -50,7 +50,7 @@ public class OutputLocationManagerTests extends AbstractMultiProjectIncrementalA
}
public void testResourceCopying() {
- Map resourceMap = new HashMap();
+ Map<String,File> resourceMap = new HashMap<>();
resourceMap.put("resourceOne.txt", new File(getFile(PROJECT_NAME, "srcRootOne/resourceOne.txt")));
resourceMap.put("resourceTwo.txt", new File(getFile(PROJECT_NAME, "srcRootTwo/resourceTwo.txt")));
configureResourceMap(PROJECT_NAME, resourceMap);
@@ -93,7 +93,7 @@ public class OutputLocationManagerTests extends AbstractMultiProjectIncrementalA
private static class MyOutputLocationManager implements IOutputLocationManager {
private File projectHome;
- private List allOutputDirs;
+ private List<File> allOutputDirs;
public MyOutputLocationManager(File projectHome) {
this.projectHome = projectHome;
@@ -106,8 +106,8 @@ public class OutputLocationManagerTests extends AbstractMultiProjectIncrementalA
public void reportFileRemove(String outputfile, int filetype) {
}
- public Map getInpathMap() {
- return Collections.EMPTY_MAP;
+ public Map<File,String> getInpathMap() {
+ return Collections.emptyMap();
}
@@ -132,9 +132,9 @@ public class OutputLocationManagerTests extends AbstractMultiProjectIncrementalA
return getOutputLocationForClass(resource);
}
- public List getAllOutputLocations() {
+ public List<File> getAllOutputLocations() {
if (allOutputDirs == null) {
- allOutputDirs = new ArrayList();
+ allOutputDirs = new ArrayList<>();
allOutputDirs.add(new File(projectHome, "target/main/classes"));
allOutputDirs.add(new File(projectHome, "target/test/classes"));
allOutputDirs.add(new File(projectHome, "target/anotherTest/classes"));