diff options
17 files changed, 103 insertions, 45 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index 4bda4705d..0dda15cb1 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -1074,7 +1074,6 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour public ICompilerRequestor getBatchRequestor() { return new ICompilerRequestor() { - @Override public void acceptResult(CompilationResult unitResult) { // end of compile, must now write the results to the output destination // this is either a jar file or a file in a directory diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjStateTest.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjStateTest.java index c230b9fae..1693178e3 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjStateTest.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjStateTest.java @@ -99,21 +99,17 @@ public class AjStateTest extends TestCase { super.setUp(); aRightState = new AjState(null); final BuildArgParser parser = new BuildArgParser(new IMessageHandler() { - @Override public boolean handleMessage(IMessage message) throws AbortException { return true; } - @Override public boolean isIgnoring(IMessage.Kind kind) { return false; } - @Override public void dontIgnore(IMessage.Kind kind) { } - @Override public void ignore(IMessage.Kind kind) { } }); diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/Ajc.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/Ajc.java index 3fa47859b..53b89e3d8 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/Ajc.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/Ajc.java @@ -55,8 +55,8 @@ public class Ajc { private static final String TESTER_PATH = ".." + File.separator + "testing-client" + File.separator + "bin" + File.pathSeparator + ".." + File.separator + "runtime" + File.separator + "bin" + File.pathSeparator + ".." + File.separator + "aspectj5rt" + File.separator + "bin" + File.pathSeparator + ".." + File.separator + "lib" - + File.separator + "junit" + File.separator + "junit.jar" + File.pathSeparator + "lib" + File.separator + "bcel" - + File.separator + "bcel.jar" + File.pathSeparator + "lib" + File.separator + "bcel" + File.separator + + File.separator + "junit" + File.separator + "junit.jar" + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "bcel" + + File.separator + "bcel.jar" + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "bcel" + File.separator + "bcel-verifier.jar" + File.pathSeparator + ".." + File.separator + "bridge" + File.separator + "bin" + File.pathSeparator + ".." @@ -289,7 +289,7 @@ public class Ajc { */ public void setBaseDir(File dir) { if ((dir != null) && !dir.isDirectory()) - throw new IllegalArgumentException(dir.getPath() + " is not a directory"); + throw new IllegalArgumentException(dir.getPath() + " is not a directory: "+dir.getAbsolutePath()); baseDir = dir; } diff --git a/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip b/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip Binary files differindex 9b4ee6592..f3beb1e03 100644 --- a/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip +++ b/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip diff --git a/org.eclipse.jdt.core/jdtcore-for-aspectj.jar b/org.eclipse.jdt.core/jdtcore-for-aspectj.jar Binary files differindex f446f6b7c..29699c325 100644 --- a/org.eclipse.jdt.core/jdtcore-for-aspectj.jar +++ b/org.eclipse.jdt.core/jdtcore-for-aspectj.jar diff --git a/testing/newsrc/org/aspectj/testing/AntSpec.java b/testing/newsrc/org/aspectj/testing/AntSpec.java index 8bd62c0ef..5eaa087d5 100644 --- a/testing/newsrc/org/aspectj/testing/AntSpec.java +++ b/testing/newsrc/org/aspectj/testing/AntSpec.java @@ -51,7 +51,7 @@ public class AntSpec implements ITestStep { + File.separator + "bridge/bin" + File.pathSeparator + ".." + File.separator + "loadtime/bin" + File.pathSeparator + ".." + File.separator + "loadtime5/bin" + File.pathSeparator + ".." + File.separator + "weaver/bin" + File.pathSeparator + ".." + File.separator + "org.aspectj.matcher/bin" + File.pathSeparator + ".." + File.separator - + "lib/bcel/bcel.jar" + File.pathSeparator + "lib/bcel/bcel-verifier.jar";; + + "lib/bcel/bcel.jar" + File.pathSeparator + ".." + File.separator + "lib/bcel/bcel-verifier.jar";; private boolean m_verbose = false; private AjcTest m_ajcTest; diff --git a/tests/generated/test/SomeCallbacks.java b/tests/generated/test/SomeCallbacks.java new file mode 100644 index 000000000..f40ea5fac --- /dev/null +++ b/tests/generated/test/SomeCallbacks.java @@ -0,0 +1,14 @@ +package test; + +/** + * Events' callbacks for test.Some. + * + * @author test.SimpleProcessor + */ +public final class SomeCallbacks { + public interface OnMethod1 { + void changed(Some emmiter); + } + +} + diff --git a/tests/generated/test/SomeEventsAspect.aj b/tests/generated/test/SomeEventsAspect.aj new file mode 100644 index 000000000..f661f237c --- /dev/null +++ b/tests/generated/test/SomeEventsAspect.aj @@ -0,0 +1,50 @@ +package test; +import java.util.ArrayList; +import java.util.Collection; + +/** + * Events for test.Some. + * + * @author test.SimpleProcessor + */ +@javax.annotation.Generated("test.SimpleProcessor") +final aspect SomeEventsAspect { + + public static final class SomeOnMethod1Event { + private Collection<SomeCallbacks.OnMethod1> callbacks = null; + + SomeOnMethod1Event() { + } + + public void add(SomeCallbacks.OnMethod1 callback) { + Collection<SomeCallbacks.OnMethod1> callbacksSafe = callbacks; + if (callbacksSafe == null) { + callbacksSafe = new ArrayList<>(1); + callbacks = callbacksSafe; + } + callbacksSafe.add(callback); + } + + public void clean() { + callbacks = null; + } + } + + private static void emit(SomeOnMethod1Event event, Some emmiter) { + final Collection<SomeCallbacks.OnMethod1> callbacksSafe = event.callbacks; + if (callbacksSafe == null) + return; + for (final SomeCallbacks.OnMethod1 callback : new ArrayList<>(callbacksSafe)) + callback.changed(emmiter); + } + + @SuppressWarnings("PublicField") + public final SomeOnMethod1Event test.Some.OnMethod1Event = new SomeOnMethod1Event(); + + before(): execution(void test.Some.method1()) { + final test.Some emmiter = (test.Some) thisJoinPoint.getThis(); + emit(emmiter.OnMethod1Event, emmiter); + } + +} + diff --git a/tests/src/org/aspectj/systemtest/ajc150/PerTypeWithinTests.java b/tests/src/org/aspectj/systemtest/ajc150/PerTypeWithinTests.java index 5ad789485..84b014392 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/PerTypeWithinTests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/PerTypeWithinTests.java @@ -67,10 +67,10 @@ public class PerTypeWithinTests extends XMLBasedAjcTestCase { * infrastructure is properly hidden in ajc$ or synthetic members) */ public void testPervasivenessOfWeaving() { - CompilationResult cR = ajc(new File("tests/java5/pertypewithin"),new String[]{"U.java","-showWeaveInfo"}); + CompilationResult cR = ajc(new File("../tests/java5/pertypewithin"),new String[]{"U.java","-showWeaveInfo"}); int weavingMessagesFromNormalDeploymentModel = cR.getWeaveMessages().size(); - cR = ajc(new File("tests/java5/pertypewithin"),new String[]{"V.java","-showWeaveInfo"}); + cR = ajc(new File("../tests/java5/pertypewithin"),new String[]{"V.java","-showWeaveInfo"}); int weavingMessagesFromPerTypeWithin = cR.getWeaveMessages().size(); assertEquals("Expected same number of messages regardless of perclause", diff --git a/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java b/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java index 2b35896b9..443018bb6 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java @@ -27,7 +27,7 @@ public class LTWTests extends org.aspectj.testing.XMLBasedAjcTestCase { } protected File getSpecFile() { - return getClassResource("ltw.xml"); + return new File("../tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml"); } public void testInclusionAndPattern() { diff --git a/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml b/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml index f6b37e124..e9617dba0 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml @@ -211,8 +211,8 @@ outjar="main.jar" > </compile> +<!-- was in next section classpath="main1.jar" --> <compile - classpath="main1.jar" files="AbstractSuperAspect.aj" outjar="aspect.jar" > diff --git a/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml b/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml index 24c9057c3..311872c09 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml @@ -1,5 +1,5 @@ <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ -<!ENTITY tests SYSTEM "tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml"> +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml"> ]> <!-- Load-time weaving tests --> diff --git a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml index 9ebbd0782..9b6ed3270 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml +++ b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml @@ -240,10 +240,10 @@ </ajc-test> <ajc-test dir="bugs153/pr152848" title="mixing generics"> - <compile files="PairGeneric.java" options="-1.5" outjar="pair.jar"/> - <compile files="BaseType.java" options="-1.5" outjar="basetype.jar" classpath="pair.jar"/> - <compile files="PairNormal.java" outjar="pair.jar"/> - <compile files="AnAspect.java" options="-1.5 -Xset:runMinimalMemory=true" inpath="basetype.jar;pair.jar"/> + <compile files="PairGeneric.java" options="-1.5" outjar="pair1.jar"/> + <compile files="BaseType.java" options="-1.5" outjar="basetype.jar" classpath="pair1.jar"/> + <compile files="PairNormal.java" outjar="pair2.jar"/> + <compile files="AnAspect.java" options="-1.5 -Xset:runMinimalMemory=true" inpath="basetype.jar;pair2.jar"/> </ajc-test> <ajc-test dir="bugs153/pr152871" title="parsing bytecode less"> diff --git a/tests/src/org/aspectj/systemtest/ajc169/ajc169.xml b/tests/src/org/aspectj/systemtest/ajc169/ajc169.xml index 8e4eab525..66de48191 100644 --- a/tests/src/org/aspectj/systemtest/ajc169/ajc169.xml +++ b/tests/src/org/aspectj/systemtest/ajc169/ajc169.xml @@ -65,7 +65,7 @@ <compile files="Anno.java" outjar="anno.jar" options="-1.5"/> <compile files="AspectA.java" classpath="anno.jar" outjar="aspect.jar" options="-Xlint:ignore -1.5"/> <compile files="AspectB.java" outjar="aspect2.jar" options="-Xlint:ignore -1.5"/> - <compile files="Code.java" classpath="code.jar;aspect.jar;aspect2.jar" options="-1.5"/> + <compile files="Code.java" classpath="aspect.jar;aspect2.jar" options="-1.5"/> <file deletefile="anno.jar"/> <run class="Code" ltw="META-INF/aop.xml" classpath=".;aspect.jar;aspect2.jar"> <stderr> @@ -88,7 +88,7 @@ <compile files="Anno.java" outjar="anno.jar" options="-1.5"/> <compile files="AspectA.java" classpath="anno.jar" outjar="aspect.jar" options="-Xlint:ignore -1.5"/> <compile files="AspectB.java" outjar="aspect2.jar" options="-Xlint:ignore -1.5"/> - <compile files="Code.java Code2.java" classpath="anno.jar;code.jar;aspect.jar;aspect2.jar" options="-1.5"/> + <compile files="Code.java Code2.java" classpath="anno.jar;aspect.jar;aspect2.jar" options="-1.5"/> <run class="Code2" ltw="META-INF/aop.xml" classpath=".;aspect.jar;aspect2.jar"> <stderr> <line text="AspectJ Weaver Version"/> diff --git a/tests/src/org/aspectj/systemtest/ajc172/ajc172.xml b/tests/src/org/aspectj/systemtest/ajc172/ajc172.xml index 0393ce54d..3eb4f2cb3 100644 --- a/tests/src/org/aspectj/systemtest/ajc172/ajc172.xml +++ b/tests/src/org/aspectj/systemtest/ajc172/ajc172.xml @@ -44,7 +44,7 @@ <compile files="Anno.java Anno2.java" outjar="anno.jar" options="-1.5"/> <compile files="AspectA.java" classpath="anno.jar" outjar="aspect.jar" options="-Xlint:ignore -1.5"/> <compile files="AspectB.java" outjar="aspect2.jar" options="-Xlint:ignore -1.5"/> - <compile files="Code.java Blah.java" classpath="code.jar;aspect.jar;aspect2.jar" options="-1.5"/> + <compile files="Code.java Blah.java" classpath="aspect.jar;aspect2.jar" options="-1.5"/> <compile files="AspectC.java" classpath="$sandbox" outjar="aspect3.jar" options="-Xlint:ignore -1.5"/> <compile files="AspectD.java" classpath="anno.jar" outjar="aspect4.jar" options="-Xlint:ignore -1.5"/> diff --git a/tests/src/org/aspectj/systemtest/apt/AptTests.java b/tests/src/org/aspectj/systemtest/apt/AptTests.java index 74df34ef4..7781ff013 100644 --- a/tests/src/org/aspectj/systemtest/apt/AptTests.java +++ b/tests/src/org/aspectj/systemtest/apt/AptTests.java @@ -15,7 +15,6 @@ import org.aspectj.apache.bcel.classfile.Method; import org.aspectj.testing.XMLBasedAjcTestCase; import java.io.File; -import java.nio.file.Files; /** * Annotation processing tool tests. diff --git a/util/src/org/aspectj/util/FileUtil.java b/util/src/org/aspectj/util/FileUtil.java index 56b55042f..f3db2bda7 100644 --- a/util/src/org/aspectj/util/FileUtil.java +++ b/util/src/org/aspectj/util/FileUtil.java @@ -488,7 +488,8 @@ public class FileUtil { * @param dir the File directory (if a file, the the file is deleted) * @return the total number of files deleted */ - public static int deleteContents(File dir, FileFilter filter, boolean deleteEmptyDirs) { + public static int deleteContents(File dir, FileFilter filter, + boolean deleteEmptyDirs) { if (null == dir) { throw new IllegalArgumentException("null dir"); } @@ -499,28 +500,27 @@ public class FileUtil { dir.delete(); return 1; } - String[] fromFiles = dir.list(); - if (fromFiles == null) { - return 0; - } - int result = 0; - for (int i = 0; i < fromFiles.length; i++) { - String string = fromFiles[i]; - File file = new File(dir, string); - if ((null == filter) || filter.accept(file)) { - if (file.isDirectory()) { - result += deleteContents(file, filter, deleteEmptyDirs); - String[] fileContent = file.list(); - if (deleteEmptyDirs && - fileContent != null && - 0 == fileContent.length) { - file.delete(); - } - } else { - /* boolean ret = */ - file.delete(); - result++; - } + String[] fromFiles = dir.list(); + if (fromFiles == null) { + return 0; + } + int result = 0; + for (int i = 0; i < fromFiles.length; i++) { + String string = fromFiles[i]; + File file = new File(dir, string); + if ((null == filter) || filter.accept(file)) { + if (file.isDirectory()) { + result += deleteContents(file, filter, deleteEmptyDirs); + String[] fileContent = file.list(); + if (deleteEmptyDirs && fileContent != null + && 0 == fileContent.length) { + file.delete(); + } + } else { + /* boolean ret = */ + file.delete(); + result++; + } } } return result; |