aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java2
-rw-r--r--testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java4
-rw-r--r--tests/apt/apt_service_description.jarbin0 -> 542 bytes
-rw-r--r--tests/apt/processor/Event.java20
-rw-r--r--tests/apt/processor/SimpleProcessor.java253
-rw-r--r--tests/apt/src/Some.java17
-rw-r--r--tests/src/org/aspectj/systemtest/ajc10x/Ajc10xTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc11/Ajc11Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc120/Ajc120Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc121/Ajc121Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/AccBridgeMethods.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/AnnotationPointcutsTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/AnnotationRuntimeTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/AnnotationsBinaryWeaving.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/Autoboxing.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/CovarianceTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/DeclareAnnotationTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/Enums.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/GenericITDsDesign.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/HasMember.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/MigrationTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/PerTypeWithinTests.java6
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/RuntimeAnnotations.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/StaticImports.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/SuppressedWarnings.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/VarargsTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjAnnotationGenTests.java4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjMisuseTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ltw/LTWServerTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc151/AtAroundTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc151/SerialVersionUIDTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc152/SynchronizationTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc153/JDTLikeHandleProviderTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc153/LTWServer153Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc153/PipeliningTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc154/Ajc154Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc160/AnnotationValueMatchingTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc160/NewFeatures.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc160/ParameterAnnotationMatchingTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc160/SanityTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc161/OptimizedAnnotationFieldBinding.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc1610/Ajc1610Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc1610/NewFeatures.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc1611/Ajc1611Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc1611/NewFeatures.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc1612/Ajc1612Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc164/DeclareMixinTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc164/JointpointIdTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc166/Ajc166Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc167/Ajc167Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc167/OverweavingTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc169/Ajc169Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc169/IntertypeTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc169/TransparentWeavingTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc171/Ajc171Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc173/Ajc173Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc175/Ajc175Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc180/Ajc180Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc181/Ajc181Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc181/AllTestsAspectJ181.java2
-rw-r--r--tests/src/org/aspectj/systemtest/apt/AllTestsApt.java25
-rw-r--r--tests/src/org/aspectj/systemtest/apt/AptTests.java51
-rw-r--r--tests/src/org/aspectj/systemtest/apt/apt-spec.xml88
-rw-r--r--tests/src/org/aspectj/systemtest/aspectpath/AspectPathTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/base/BaseTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/design/DesignTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/IncrementalTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/model/IncrementalModelTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/inpath/InPathTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/java14/Java14Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/model/Model5Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/model/ModelTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/options/OptionsTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/pre10x/AjcPre10xTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/serialVerUID/SUIDTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/tracing/TracingTests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/xlint/XLint5Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/xlint/XLintTests.java2
-rw-r--r--util/src/org/aspectj/util/FileUtil.java107
99 files changed, 609 insertions, 142 deletions
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java b/ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java
index e38538f20..6f9ad7790 100644
--- a/ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java
+++ b/ajdoc/src/org/aspectj/tools/ajdoc/StructureUtil.java
@@ -148,7 +148,7 @@ public class StructureUtil {
if (node.getParameterTypes() != null) {
sb.append('(');
for (int i = 0; i < node.getParameterTypes().size(); i++) {
- sb.append((String) node.getParameterTypes().get(i));
+ sb.append(String.valueOf(node.getParameterTypes().get(i)));
sb.append(' ');
sb.append((String) node.getParameterNames().get(i));
if (i < node.getParameterTypes().size() - 1) {
diff --git a/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java b/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java
index 30e6dd55f..652839a5b 100644
--- a/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java
+++ b/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java
@@ -429,5 +429,9 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase {
return null;
}
+ protected File getClassResource(String resourceName) {
+ return new File(getClass().getResource(resourceName).getFile());
+ }
+
}
diff --git a/tests/apt/apt_service_description.jar b/tests/apt/apt_service_description.jar
new file mode 100644
index 000000000..f823b1784
--- /dev/null
+++ b/tests/apt/apt_service_description.jar
Binary files differ
diff --git a/tests/apt/processor/Event.java b/tests/apt/processor/Event.java
new file mode 100644
index 000000000..9ac973f45
--- /dev/null
+++ b/tests/apt/processor/Event.java
@@ -0,0 +1,20 @@
+package test;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.METHOD)
+public @interface Event {
+
+ enum Order {
+ Before,
+ After
+ }
+
+ Order value() default Order.Before;
+
+ boolean treadSafe() default false;
+} \ No newline at end of file
diff --git a/tests/apt/processor/SimpleProcessor.java b/tests/apt/processor/SimpleProcessor.java
new file mode 100644
index 000000000..292dcd8d4
--- /dev/null
+++ b/tests/apt/processor/SimpleProcessor.java
@@ -0,0 +1,253 @@
+package test;
+
+import javax.annotation.Generated;
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.*;
+import javax.lang.model.type.TypeMirror;
+import javax.tools.Diagnostic;
+import javax.tools.FileObject;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardLocation;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.util.*;
+
+@SupportedSourceVersion(SourceVersion.RELEASE_7)
+public final class SimpleProcessor extends AbstractProcessor {
+
+ private final Map<TypeElement, List<Item>> collectedElements = new HashMap<>();
+ private static String callbacksClassName(TypeElement ce) {
+ return ce.getSimpleName() + "Callbacks";
+ }
+
+ private static String capitalize(String str) {
+ char[] chars = str.toCharArray();
+ return String.valueOf(chars[0]).toUpperCase() + String.valueOf(Arrays.copyOfRange(chars, 1, chars.length));
+ }
+
+ private static String callbacksSubClassName(Item item) {
+ return "On" + capitalize(item.element.getSimpleName().toString());
+ }
+
+ private static String callbackName(TypeElement ce, Item item) {
+ return callbacksClassName(ce) + '.' + callbacksSubClassName(item);
+ }
+
+ private static String eventName(TypeElement ce, Item item) {
+ return ce.getSimpleName() + fieldName(item);
+ }
+
+ private static String fieldName(Item item) {
+ return "On" + capitalize(item.element.getSimpleName().toString()) + "Event";
+ }
+
+ private static String toString(VariableElement var, boolean printNames) {
+ final StringBuilder builder = new StringBuilder();
+ if (printNames) {
+ for (final AnnotationMirror annotation : var.getAnnotationMirrors())
+ builder.append(annotation).append(' ');
+ }
+ builder.append(var.asType());
+ if (printNames)
+ builder.append(' ').append(var);
+
+ return builder.toString();
+ }
+
+ private static void generateEmit(BufferedWriter bw, TypeElement ce, Item item) throws IOException {
+ bw.append(" private static void emit(").append(eventName(ce, item)).append(" event, ").append(ce.getSimpleName()).append(" emmiter");
+ for (final VariableElement variableElement : item.element.getParameters())
+ bw.append(", ").append(toString(variableElement, true));
+ bw.append(") {\n");
+ bw.append(" final Collection<").append(callbackName(ce, item)).append("> callbacksSafe = event.callbacks;\n");
+ bw.append(" if (callbacksSafe == null)\n");
+ bw.append(" return;\n");
+ bw.append(" for (final ").append(callbackName(ce, item)).append(" callback : new ArrayList<>(callbacksSafe))\n");
+ bw.append(" callback.changed(emmiter");
+ for (final VariableElement variableElement : item.element.getParameters())
+ bw.append(", ").append(variableElement.getSimpleName());
+ bw.append(");\n");
+ bw.append(" }\n");
+ bw.newLine();
+ }
+
+ private static void generateEvent(BufferedWriter bw, TypeElement ce, Item item) throws IOException {
+ bw.append(" public static final class ").append(eventName(ce, item)).append(" {\n");
+ bw.append(" private Collection<").append(callbackName(ce, item)).append("> callbacks = null;\n");
+ bw.append("\n");
+ bw.append(" ").append(eventName(ce, item)).append("() {\n");
+ bw.append(" }\n");
+ bw.append("\n");
+ bw.append(" public void add(").append(callbackName(ce, item)).append(" callback) {\n");
+ bw.append(" Collection<").append(callbackName(ce, item)).append("> callbacksSafe = callbacks;\n");
+ bw.append(" if (callbacksSafe == null) {\n");
+ bw.append(" callbacksSafe = new ArrayList<>(1);\n");
+ bw.append(" callbacks = callbacksSafe;\n");
+ bw.append(" }\n");
+ bw.append(" callbacksSafe.add(callback);\n");
+ bw.append(" }\n");
+ bw.append("\n");
+ bw.append(" public void clean() {\n");
+ bw.append(" callbacks = null;\n");
+ bw.append(" }\n");
+ bw.append(" }");
+ bw.newLine();
+ bw.newLine();
+ }
+
+ private static void generateField(BufferedWriter bw, TypeElement ce, Item item) throws IOException {
+ bw.append(" @SuppressWarnings(\"PublicField\")\n");
+ bw.append(" public final ").append(eventName(ce, item)).append(' ').append(ce.getQualifiedName()).append('.').append(fieldName(item))
+ .append(" = new ").append(eventName(ce, item)).append("();\n");
+ bw.newLine();
+ }
+
+ private static void generatePointcut(BufferedWriter bw, TypeElement ce, Item item) throws IOException {
+ bw.append(" ").append(item.description.value().name().toLowerCase()).append("(): execution(").append(item.element.getReturnType().toString()).append(' ').append(ce.getQualifiedName()).append('.')
+ .append(item.element.getSimpleName()).append('(');
+ for (final Iterator<? extends TypeParameterElement> i = item.element.getTypeParameters().iterator(); i.hasNext(); ) {
+ bw.append(i.next().getSimpleName());
+ if (i.hasNext())
+ bw.append(", ");
+ }
+ bw.append(")) {\n");
+ bw.append(" final ").append(ce.getQualifiedName()).append(" emmiter = (").append(ce.getQualifiedName()).append(") thisJoinPoint.getThis();\n");
+ bw.append(" emit(emmiter.").append(fieldName(item)).append(", emmiter");
+ final List<? extends VariableElement> parameters = item.element.getParameters();
+ for (int i = 0, s = parameters.size(); i < s; i++) {
+ final VariableElement element = parameters.get(i);
+ final TypeMirror type = element.asType();
+ bw.append(", ").append('(').append(type.toString()).append(") thisJoinPoint.getArgs()[").append(Integer.toString(i)).append(']');
+ }
+ bw.append(");\n");
+ bw.append(" }");
+ bw.newLine();
+ bw.newLine();
+ }
+
+ @Override
+ public Set<String> getSupportedAnnotationTypes() {
+ return Collections.singleton(Event.class.getName());
+ }
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ if (roundEnv.processingOver()) {
+ generateAll();
+ return true;
+ }
+
+ for (final Element elem : roundEnv.getElementsAnnotatedWith(Event.class)) {
+ final Event description = elem.getAnnotation(Event.class);
+ if (description == null)
+ continue;
+
+ if (elem.getKind() == ElementKind.FIELD) {
+ // TODO(yushkovskiy): implement this
+ continue;
+ }
+
+ if (elem.getKind() != ElementKind.METHOD)
+ continue;
+
+ final ExecutableElement exeElement = (ExecutableElement) elem;
+ final Element enclosingElement = exeElement.getEnclosingElement();
+ final TypeElement classElement = (TypeElement) enclosingElement;
+
+ List<Item> items = collectedElements.get(classElement);
+ if (items == null) {
+ items = new ArrayList<>();
+ collectedElements.put(classElement, items);
+ }
+ items.add(new Item(exeElement, description));
+ }
+
+ return true; // no further processing of this annotation type
+ }
+
+ private void generateCallbacks(TypeElement ce, List<Item> items) throws IOException {
+ final PackageElement packageElement = (PackageElement) ce.getEnclosingElement();
+ final JavaFileObject jfo = processingEnv.getFiler().createSourceFile(packageElement.getQualifiedName().toString() + '.' + callbacksClassName(ce));
+ try (final BufferedWriter bw = new BufferedWriter(jfo.openWriter())) {
+ bw.append("package ").append(packageElement.getQualifiedName()).append(";");
+ bw.newLine();
+ bw.newLine();
+ bw.append("/**\n").append(" * Events' callbacks for ").append(ce.getQualifiedName()).append(".\n").append(" *\n").append(" * @author ").append(SimpleProcessor.class.getCanonicalName()).append("\n").append(" */");
+ bw.newLine();
+
+ bw.append("public final class ").append(callbacksClassName(ce)).append(" {");
+ bw.newLine();
+
+ for (final Item item : items) {
+ bw.append(" public interface ").append(callbacksSubClassName(item)).append(" {\n");
+ bw.append(" void changed(").append(ce.getSimpleName()).append(" emmiter");
+ for (final VariableElement var : item.element.getParameters())
+ bw.append(", ").append(toString(var, true));
+ bw.append(");\n");
+ bw.append(" }");
+ bw.newLine();
+ bw.newLine();
+ }
+
+ bw.append("}");
+ bw.newLine();
+ bw.newLine();
+ }
+ }
+
+ private void generateAll() {
+ for (final Map.Entry<TypeElement, List<Item>> entry : collectedElements.entrySet()) {
+ final TypeElement classElement = entry.getKey();
+ final PackageElement packageElement = (PackageElement) classElement.getEnclosingElement();
+ try {
+ final FileObject jfo = processingEnv.getFiler().createResource(
+ StandardLocation.SOURCE_OUTPUT,
+ packageElement.getQualifiedName(),
+ classElement.getSimpleName() + "EventsAspect.aj");
+
+ try (final BufferedWriter bw = new BufferedWriter(jfo.openWriter())) {
+ bw.append("package ").append(packageElement.getQualifiedName()).append(";");
+ bw.newLine();
+ bw.append("import java.util.ArrayList;\n");
+ bw.append("import java.util.Collection;");
+ bw.newLine();
+ bw.newLine();
+ bw.append("/**\n").append(" * Events for ").append(classElement.getQualifiedName()).append(".\n").append(" *\n").append(" * @author ").append(SimpleProcessor.class.getCanonicalName()).append("\n").append(" */");
+ bw.newLine();
+ bw.append("@").append(Generated.class.getCanonicalName()).append("(\"").append(SimpleProcessor.class.getCanonicalName()).append("\")");
+ bw.newLine();
+ bw.append("final aspect ").append(classElement.getSimpleName()).append("EventsAspect").append(" {");
+ bw.newLine();
+ bw.newLine();
+
+ generateCallbacks(classElement, entry.getValue());
+ for (final Item item : entry.getValue()) {
+ generateEvent(bw, classElement, item);
+ generateEmit(bw, classElement, item);
+ generateField(bw, classElement, item);
+ generatePointcut(bw, classElement, item);
+ }
+
+ bw.append("}");
+ bw.newLine();
+ bw.newLine();
+ }
+ } catch (final Throwable e) {
+ processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, e.getMessage());
+ }
+ }
+ }
+
+ private static final class Item {
+ private final ExecutableElement element;
+ private final Event description;
+
+ private Item(ExecutableElement element, Event description) {
+ this.element = element;
+ this.description = description;
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/apt/src/Some.java b/tests/apt/src/Some.java
new file mode 100644
index 000000000..b47aa787e
--- /dev/null
+++ b/tests/apt/src/Some.java
@@ -0,0 +1,17 @@
+package test;
+
+public class Some {
+
+ public static void main(String[] args) {
+ Some some = new Some();
+ some.OnMethod1Event.add((emmiter) -> {
+ System.out.println("callback registered from before aspect");
+ });
+ some.method1();
+ }
+
+ @Event(Event.Order.Before)
+ public void method1() {
+ System.out.println("method1 is invoked");
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc10x/Ajc10xTests.java b/tests/src/org/aspectj/systemtest/ajc10x/Ajc10xTests.java
index 8128fcdaa..1fb6b7045 100644
--- a/tests/src/org/aspectj/systemtest/ajc10x/Ajc10xTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc10x/Ajc10xTests.java
@@ -23,7 +23,7 @@ public class Ajc10xTests extends org.aspectj.testing.XMLBasedAjcTestCase {
@Override
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc10x/ajc10x.xml");
+ return getClassResource("ajc10x.xml");
}
public void test001() {
diff --git a/tests/src/org/aspectj/systemtest/ajc11/Ajc11Tests.java b/tests/src/org/aspectj/systemtest/ajc11/Ajc11Tests.java
index 06fa8b6a4..01ea96560 100644
--- a/tests/src/org/aspectj/systemtest/ajc11/Ajc11Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc11/Ajc11Tests.java
@@ -22,7 +22,7 @@ public class Ajc11Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc11/ajc11.xml");
+ return getClassResource("ajc11.xml");
}
public void test001() {
diff --git a/tests/src/org/aspectj/systemtest/ajc120/Ajc120Tests.java b/tests/src/org/aspectj/systemtest/ajc120/Ajc120Tests.java
index da8a40cc6..8e1ef8789 100644
--- a/tests/src/org/aspectj/systemtest/ajc120/Ajc120Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc120/Ajc120Tests.java
@@ -20,7 +20,7 @@ public class Ajc120Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc120/ajc120.xml");
+ return getClassResource("ajc120.xml");
}
diff --git a/tests/src/org/aspectj/systemtest/ajc121/Ajc121Tests.java b/tests/src/org/aspectj/systemtest/ajc121/Ajc121Tests.java
index bc5abcc62..e1ae534bf 100644
--- a/tests/src/org/aspectj/systemtest/ajc121/Ajc121Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc121/Ajc121Tests.java
@@ -25,7 +25,7 @@ public class Ajc121Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc121/ajc121.xml");
+ return getClassResource("ajc121.xml");
}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/AccBridgeMethods.java b/tests/src/org/aspectj/systemtest/ajc150/AccBridgeMethods.java
index 8a8505d8a..e9348f49c 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/AccBridgeMethods.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/AccBridgeMethods.java
@@ -49,7 +49,7 @@ public class AccBridgeMethods extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
index 592747c62..0c21e3fcc 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
@@ -31,7 +31,7 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
public void testMixingCodeStyles_pr121385() {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java b/tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java
index 7d5bd2a6b..63cebdb06 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java
@@ -28,7 +28,7 @@ public class AnnotationBinding extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
// /////////////////////////////////// @ANNOTATION and CALL
diff --git a/tests/src/org/aspectj/systemtest/ajc150/AnnotationPointcutsTests.java b/tests/src/org/aspectj/systemtest/ajc150/AnnotationPointcutsTests.java
index 44a4b5cdd..4301a44c0 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/AnnotationPointcutsTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/AnnotationPointcutsTests.java
@@ -27,7 +27,7 @@ public class AnnotationPointcutsTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
// before(): call(@SimpleAnnotation * *(..)) { }
diff --git a/tests/src/org/aspectj/systemtest/ajc150/AnnotationRuntimeTests.java b/tests/src/org/aspectj/systemtest/ajc150/AnnotationRuntimeTests.java
index 13d3d7f66..e1d83a6cc 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/AnnotationRuntimeTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/AnnotationRuntimeTests.java
@@ -26,7 +26,7 @@ public class AnnotationRuntimeTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
// No longer a limitation ASC 31Jan05
diff --git a/tests/src/org/aspectj/systemtest/ajc150/AnnotationsBinaryWeaving.java b/tests/src/org/aspectj/systemtest/ajc150/AnnotationsBinaryWeaving.java
index ad7036f0c..cec4665a7 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/AnnotationsBinaryWeaving.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/AnnotationsBinaryWeaving.java
@@ -35,7 +35,7 @@ public class AnnotationsBinaryWeaving extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
// Cannot make ITD (c/m/f) on an annotation
diff --git a/tests/src/org/aspectj/systemtest/ajc150/Autoboxing.java b/tests/src/org/aspectj/systemtest/ajc150/Autoboxing.java
index 47b2c1bb3..46a261e24 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/Autoboxing.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/Autoboxing.java
@@ -27,7 +27,7 @@ public class Autoboxing extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
public void testSimpleBoxing() {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/CovarianceTests.java b/tests/src/org/aspectj/systemtest/ajc150/CovarianceTests.java
index 6d92eaaca..662394969 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/CovarianceTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/CovarianceTests.java
@@ -63,7 +63,7 @@ public class CovarianceTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
private boolean verbose = false;
diff --git a/tests/src/org/aspectj/systemtest/ajc150/DeclareAnnotationTests.java b/tests/src/org/aspectj/systemtest/ajc150/DeclareAnnotationTests.java
index 6ccca0e15..28d48c6ca 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/DeclareAnnotationTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/DeclareAnnotationTests.java
@@ -28,7 +28,7 @@ public class DeclareAnnotationTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
// parsing the various forms of declare @
diff --git a/tests/src/org/aspectj/systemtest/ajc150/Enums.java b/tests/src/org/aspectj/systemtest/ajc150/Enums.java
index 1696b3dd5..7f7f8bac4 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/Enums.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/Enums.java
@@ -37,7 +37,7 @@ public class Enums extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
// Cannot make ITDC on an enum
diff --git a/tests/src/org/aspectj/systemtest/ajc150/GenericITDsDesign.java b/tests/src/org/aspectj/systemtest/ajc150/GenericITDsDesign.java
index 542c47554..dfedf65a0 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/GenericITDsDesign.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/GenericITDsDesign.java
@@ -36,7 +36,7 @@ public class GenericITDsDesign extends XMLBasedAjcTestCase {
@Override
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
private void verifyDebugString(ResolvedMember theMember, String string) {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
index b7e20f2cb..21efa3328 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
@@ -185,7 +185,7 @@ public class GenericsTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
public void testITDReturningParameterizedType() {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/HasMember.java b/tests/src/org/aspectj/systemtest/ajc150/HasMember.java
index 553913327..57e053b9b 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/HasMember.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/HasMember.java
@@ -23,7 +23,7 @@ public class HasMember extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
public void testSimpleDecPHasMethod() {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/MigrationTests.java b/tests/src/org/aspectj/systemtest/ajc150/MigrationTests.java
index 1d3f43afa..a9322b086 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/MigrationTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/MigrationTests.java
@@ -27,7 +27,7 @@ public class MigrationTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
/**
* Compile a simple java class with an aspect library built with aspectj 1.2.1 - this
diff --git a/tests/src/org/aspectj/systemtest/ajc150/PerTypeWithinTests.java b/tests/src/org/aspectj/systemtest/ajc150/PerTypeWithinTests.java
index 0de905919..5ad789485 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/PerTypeWithinTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/PerTypeWithinTests.java
@@ -26,7 +26,7 @@ public class PerTypeWithinTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
/**
@@ -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/RuntimeAnnotations.java b/tests/src/org/aspectj/systemtest/ajc150/RuntimeAnnotations.java
index 0ece3bd0b..676c2b014 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/RuntimeAnnotations.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/RuntimeAnnotations.java
@@ -16,7 +16,7 @@ public class RuntimeAnnotations extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
public void test01() {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/StaticImports.java b/tests/src/org/aspectj/systemtest/ajc150/StaticImports.java
index ff57458f0..71b82f4e4 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/StaticImports.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/StaticImports.java
@@ -23,7 +23,7 @@ public class StaticImports extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
public void testImportStaticSystemDotOut() {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/SuppressedWarnings.java b/tests/src/org/aspectj/systemtest/ajc150/SuppressedWarnings.java
index 2e8c3f05f..0a830018e 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/SuppressedWarnings.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/SuppressedWarnings.java
@@ -23,7 +23,7 @@ public class SuppressedWarnings extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
// Check basic suppression
diff --git a/tests/src/org/aspectj/systemtest/ajc150/VarargsTests.java b/tests/src/org/aspectj/systemtest/ajc150/VarargsTests.java
index fea81bd36..7592f7c6d 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/VarargsTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/VarargsTests.java
@@ -30,7 +30,7 @@ public class VarargsTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
+ return getClassResource("ajc150.xml");
}
// check when signature is from a call PCD
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjAnnotationGenTests.java b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjAnnotationGenTests.java
index 78c70596d..bfbc289f6 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjAnnotationGenTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjAnnotationGenTests.java
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * initial development Jonas Bonér, Alexandre Vasseur
+ * initial development Jonas Bon�r, Alexandre Vasseur
*******************************************************************************/
package org.aspectj.systemtest.ajc150.ataspectj;
@@ -28,7 +28,7 @@ public class AtAjAnnotationGenTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ataspectj/annotationgen.xml");
+ return getClassResource("annotationgen.xml");
}
public void testSimpleAspect() {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java
index e28d1af4e..966642da2 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java
@@ -28,7 +28,7 @@ public class AtAjLTWTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml");
+ return getClassResource("ltw.xml");
}
public void testRunThemAllWithJavacCompiledAndLTW() {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjMisuseTests.java b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjMisuseTests.java
index 037615be3..0f13e8f8b 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjMisuseTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjMisuseTests.java
@@ -22,7 +22,7 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
public class AtAjMisuseTests extends XMLBasedAjcTestCase {
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ataspectj/misuse.xml");
+ return getClassResource("misuse.xml");
}
public static Test suite() {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java
index 10c3fd9ae..794fce907 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java
@@ -29,7 +29,7 @@ public class AtAjSyntaxTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ataspectj/syntax.xml");
+ return getClassResource("syntax.xml");
}
public void testSimpleBefore() {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWServerTests.java b/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWServerTests.java
index b187c609b..d73e594b9 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWServerTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWServerTests.java
@@ -13,7 +13,7 @@ public class LTWServerTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml");
+ return getClassResource("ltw.xml");
}
public void testServerWithHelloWorld () {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java b/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java
index 443018bb6..2b35896b9 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 new File("../tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml");
+ return getClassResource("ltw.xml");
}
public void testInclusionAndPattern() {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml b/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml
index 311872c09..24c9057c3 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/ajc151/Ajc151Tests.java b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
index c24b5bddc..5b3c795d4 100644
--- a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
@@ -279,7 +279,7 @@ public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc151/ajc151.xml");
+ return getClassResource("ajc151.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc151/AtAroundTests.java b/tests/src/org/aspectj/systemtest/ajc151/AtAroundTests.java
index e64b8945b..9512e8db4 100644
--- a/tests/src/org/aspectj/systemtest/ajc151/AtAroundTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc151/AtAroundTests.java
@@ -83,7 +83,7 @@ public class AtAroundTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc151/ataround.xml");
+ return getClassResource("ataround.xml");
}
}
diff --git a/tests/src/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java b/tests/src/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java
index d16271960..4b21319d0 100644
--- a/tests/src/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java
@@ -119,7 +119,7 @@ public class NewarrayJoinpointTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc151/newarray_joinpoint.xml");
+ return getClassResource("newarray_joinpoint.xml");
}
}
diff --git a/tests/src/org/aspectj/systemtest/ajc151/SerialVersionUIDTests.java b/tests/src/org/aspectj/systemtest/ajc151/SerialVersionUIDTests.java
index 876792242..c1bf29475 100644
--- a/tests/src/org/aspectj/systemtest/ajc151/SerialVersionUIDTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc151/SerialVersionUIDTests.java
@@ -31,7 +31,7 @@ public class SerialVersionUIDTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc151/serialversionuid.xml");
+ return getClassResource("serialversionuid.xml");
}
}
diff --git a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
index 228824e6d..d0ced6179 100644
--- a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
@@ -378,7 +378,7 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc152/ajc152.xml");
+ return getClassResource("ajc152.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc152/SynchronizationTests.java b/tests/src/org/aspectj/systemtest/ajc152/SynchronizationTests.java
index 6e9e3dd42..47baa2940 100644
--- a/tests/src/org/aspectj/systemtest/ajc152/SynchronizationTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc152/SynchronizationTests.java
@@ -255,7 +255,7 @@ public class SynchronizationTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc152/synchronization.xml");
+ return getClassResource("synchronization.xml");
}
}
diff --git a/tests/src/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java b/tests/src/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java
index 5b5b8b290..64fa5a174 100644
--- a/tests/src/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java
@@ -301,7 +301,7 @@ public class SynchronizationTransformTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc152/synchronization.xml");
+ return getClassResource("synchronization.xml");
}
public void tearDown() {
diff --git a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java
index a25c6f91d..304e34898 100644
--- a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java
@@ -502,7 +502,7 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc153/ajc153.xml");
+ return getClassResource("ajc153.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc153/JDTLikeHandleProviderTests.java b/tests/src/org/aspectj/systemtest/ajc153/JDTLikeHandleProviderTests.java
index c2f586b4a..e26c8c90b 100644
--- a/tests/src/org/aspectj/systemtest/ajc153/JDTLikeHandleProviderTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc153/JDTLikeHandleProviderTests.java
@@ -547,7 +547,7 @@ public class JDTLikeHandleProviderTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc153/jdtlikehandleprovider.xml");
+ return getClassResource("jdtlikehandleprovider.xml");
}
}
diff --git a/tests/src/org/aspectj/systemtest/ajc153/LTWServer153Tests.java b/tests/src/org/aspectj/systemtest/ajc153/LTWServer153Tests.java
index 151af029d..b307cb30a 100644
--- a/tests/src/org/aspectj/systemtest/ajc153/LTWServer153Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc153/LTWServer153Tests.java
@@ -13,7 +13,7 @@ public class LTWServer153Tests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc153/ajc153.xml");
+ return getClassResource("ajc153.xml");
}
public void testHandleDuplicateConfiguration_pr157474 () {
diff --git a/tests/src/org/aspectj/systemtest/ajc153/PipeliningTests.java b/tests/src/org/aspectj/systemtest/ajc153/PipeliningTests.java
index 1e93e7740..9edd04515 100644
--- a/tests/src/org/aspectj/systemtest/ajc153/PipeliningTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc153/PipeliningTests.java
@@ -84,6 +84,6 @@ public class PipeliningTests extends org.aspectj.testing.XMLBasedAjcTestCase {
return XMLBasedAjcTestCase.loadSuite(PipeliningTests.class);
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc153/pipelining.xml");
+ return getClassResource("pipelining.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc154/Ajc154Tests.java b/tests/src/org/aspectj/systemtest/ajc154/Ajc154Tests.java
index 6c9be21ff..7a025d796 100644
--- a/tests/src/org/aspectj/systemtest/ajc154/Ajc154Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc154/Ajc154Tests.java
@@ -354,7 +354,7 @@ public class Ajc154Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc154/ajc154.xml");
+ return getClassResource("ajc154.xml");
}
// ---
diff --git a/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java b/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java
index 6a93f3a53..5f5162b0d 100644
--- a/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java
@@ -148,7 +148,7 @@ public class Ajc160Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc160/ajc160.xml");
+ return getClassResource("ajc160.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc160/AnnotationValueMatchingTests.java b/tests/src/org/aspectj/systemtest/ajc160/AnnotationValueMatchingTests.java
index 85df30124..d26cb9856 100644
--- a/tests/src/org/aspectj/systemtest/ajc160/AnnotationValueMatchingTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc160/AnnotationValueMatchingTests.java
@@ -50,6 +50,6 @@ public class AnnotationValueMatchingTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc160/annotationValueMatching.xml");
+ return getClassResource("annotationValueMatching.xml");
}
}
diff --git a/tests/src/org/aspectj/systemtest/ajc160/NewFeatures.java b/tests/src/org/aspectj/systemtest/ajc160/NewFeatures.java
index 0fbb0e661..03c8d4f50 100644
--- a/tests/src/org/aspectj/systemtest/ajc160/NewFeatures.java
+++ b/tests/src/org/aspectj/systemtest/ajc160/NewFeatures.java
@@ -28,7 +28,7 @@ public class NewFeatures extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc160/newfeatures-tests.xml");
+ return getClassResource("newfeatures-tests.xml");
}
diff --git a/tests/src/org/aspectj/systemtest/ajc160/ParameterAnnotationMatchingTests.java b/tests/src/org/aspectj/systemtest/ajc160/ParameterAnnotationMatchingTests.java
index 166ad09eb..95a3f218f 100644
--- a/tests/src/org/aspectj/systemtest/ajc160/ParameterAnnotationMatchingTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc160/ParameterAnnotationMatchingTests.java
@@ -93,6 +93,6 @@ public class ParameterAnnotationMatchingTests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc160/parameterAnnotations.xml");
+ return getClassResource("parameterAnnotations.xml");
}
}
diff --git a/tests/src/org/aspectj/systemtest/ajc160/SanityTests.java b/tests/src/org/aspectj/systemtest/ajc160/SanityTests.java
index 07cdbc83b..5d0462c99 100644
--- a/tests/src/org/aspectj/systemtest/ajc160/SanityTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc160/SanityTests.java
@@ -156,7 +156,7 @@ public class SanityTests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc160/sanity-tests.xml");
+ return getClassResource("sanity-tests.xml");
}
}
diff --git a/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java b/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java
index 72f29fe17..cbe5e788b 100644
--- a/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java
@@ -198,7 +198,7 @@ public class Ajc161Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc161/ajc161.xml");
+ return getClassResource("ajc161.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc161/OptimizedAnnotationFieldBinding.java b/tests/src/org/aspectj/systemtest/ajc161/OptimizedAnnotationFieldBinding.java
index 6f8ec319f..6755a3ef6 100644
--- a/tests/src/org/aspectj/systemtest/ajc161/OptimizedAnnotationFieldBinding.java
+++ b/tests/src/org/aspectj/systemtest/ajc161/OptimizedAnnotationFieldBinding.java
@@ -67,6 +67,6 @@ public class OptimizedAnnotationFieldBinding extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc161/annotationFieldBinding.xml");
+ return getClassResource("annotationFieldBinding.xml");
}
}
diff --git a/tests/src/org/aspectj/systemtest/ajc1610/Ajc1610Tests.java b/tests/src/org/aspectj/systemtest/ajc1610/Ajc1610Tests.java
index f71420923..80d85d9e8 100644
--- a/tests/src/org/aspectj/systemtest/ajc1610/Ajc1610Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc1610/Ajc1610Tests.java
@@ -61,7 +61,7 @@ public class Ajc1610Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
@Override
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc1610/ajc1610.xml");
+ return getClassResource("ajc1610.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc1610/NewFeatures.java b/tests/src/org/aspectj/systemtest/ajc1610/NewFeatures.java
index 68f1384ad..b9de3dff7 100644
--- a/tests/src/org/aspectj/systemtest/ajc1610/NewFeatures.java
+++ b/tests/src/org/aspectj/systemtest/ajc1610/NewFeatures.java
@@ -145,7 +145,7 @@ public class NewFeatures extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc1610/newfeatures-tests.xml");
+ return getClassResource("newfeatures-tests.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc1611/Ajc1611Tests.java b/tests/src/org/aspectj/systemtest/ajc1611/Ajc1611Tests.java
index c55eb47ef..1c857eb82 100644
--- a/tests/src/org/aspectj/systemtest/ajc1611/Ajc1611Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc1611/Ajc1611Tests.java
@@ -123,7 +123,7 @@ public class Ajc1611Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
@Override
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc1611/ajc1611.xml");
+ return getClassResource("ajc1611.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc1611/NewFeatures.java b/tests/src/org/aspectj/systemtest/ajc1611/NewFeatures.java
index 3df8d1a00..58a8f0ae2 100644
--- a/tests/src/org/aspectj/systemtest/ajc1611/NewFeatures.java
+++ b/tests/src/org/aspectj/systemtest/ajc1611/NewFeatures.java
@@ -71,7 +71,7 @@ public class NewFeatures extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc1611/newfeatures-tests.xml");
+ return getClassResource("newfeatures-tests.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc1612/Ajc1612Tests.java b/tests/src/org/aspectj/systemtest/ajc1612/Ajc1612Tests.java
index eb5c5b36b..347b63e17 100644
--- a/tests/src/org/aspectj/systemtest/ajc1612/Ajc1612Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc1612/Ajc1612Tests.java
@@ -414,7 +414,7 @@ public class Ajc1612Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
@Override
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc1612/ajc1612.xml");
+ return getClassResource("ajc1612.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java b/tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java
index 957c50aa9..fb42a6351 100644
--- a/tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java
@@ -217,7 +217,7 @@ public class Ajc162Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc162/ajc162.xml");
+ return getClassResource("ajc162.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java b/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
index 2b2f5c70a..224f695ef 100644
--- a/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
@@ -306,7 +306,7 @@ public class Ajc163Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc163/ajc163.xml");
+ return getClassResource("ajc163.xml");
}
// ---
diff --git a/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java b/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java
index 155792ca0..58de6b447 100644
--- a/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java
@@ -417,7 +417,7 @@ public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc164/ajc164.xml");
+ return getClassResource("ajc164.xml");
}
private IProgramElement findElementAtLine(IProgramElement whereToLook, int line) {
diff --git a/tests/src/org/aspectj/systemtest/ajc164/DeclareMixinTests.java b/tests/src/org/aspectj/systemtest/ajc164/DeclareMixinTests.java
index ec5030f14..a8e9b6875 100644
--- a/tests/src/org/aspectj/systemtest/ajc164/DeclareMixinTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc164/DeclareMixinTests.java
@@ -151,7 +151,7 @@ public class DeclareMixinTests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc164/declareMixin.xml");
+ return getClassResource("declareMixin.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc164/JointpointIdTests.java b/tests/src/org/aspectj/systemtest/ajc164/JointpointIdTests.java
index 32716e66c..68f769af6 100644
--- a/tests/src/org/aspectj/systemtest/ajc164/JointpointIdTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc164/JointpointIdTests.java
@@ -33,7 +33,7 @@ public class JointpointIdTests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc164/joinpointid.xml");
+ return getClassResource("joinpointid.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java b/tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java
index 1f13e3603..441e0b4e6 100644
--- a/tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java
@@ -116,7 +116,7 @@ public class Ajc165Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc165/ajc165.xml");
+ return getClassResource("ajc165.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc166/Ajc166Tests.java b/tests/src/org/aspectj/systemtest/ajc166/Ajc166Tests.java
index 59265110e..4622ae492 100644
--- a/tests/src/org/aspectj/systemtest/ajc166/Ajc166Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc166/Ajc166Tests.java
@@ -99,7 +99,7 @@ public class Ajc166Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc166/ajc166.xml");
+ return getClassResource("ajc166.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc167/Ajc167Tests.java b/tests/src/org/aspectj/systemtest/ajc167/Ajc167Tests.java
index 28e1bd918..7360222ba 100644
--- a/tests/src/org/aspectj/systemtest/ajc167/Ajc167Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc167/Ajc167Tests.java
@@ -83,7 +83,7 @@ public class Ajc167Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
@Override
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc167/ajc167.xml");
+ return getClassResource("ajc167.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc167/OverweavingTests.java b/tests/src/org/aspectj/systemtest/ajc167/OverweavingTests.java
index daff18842..ebd66a0b5 100644
--- a/tests/src/org/aspectj/systemtest/ajc167/OverweavingTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc167/OverweavingTests.java
@@ -78,7 +78,7 @@ public class OverweavingTests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc167/overweaving.xml");
+ return getClassResource("overweaving.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc169/Ajc169Tests.java b/tests/src/org/aspectj/systemtest/ajc169/Ajc169Tests.java
index cfbcefcd4..3aff31ca8 100644
--- a/tests/src/org/aspectj/systemtest/ajc169/Ajc169Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc169/Ajc169Tests.java
@@ -247,7 +247,7 @@ public class Ajc169Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
@Override
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc169/ajc169.xml");
+ return getClassResource("ajc169.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc169/IntertypeTests.java b/tests/src/org/aspectj/systemtest/ajc169/IntertypeTests.java
index 8a8df7cb4..5099a929b 100644
--- a/tests/src/org/aspectj/systemtest/ajc169/IntertypeTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc169/IntertypeTests.java
@@ -208,7 +208,7 @@ public class IntertypeTests extends org.aspectj.testing.XMLBasedAjcTestCase {
@Override
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc169/intertype.xml");
+ return getClassResource("intertype.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc169/TransparentWeavingTests.java b/tests/src/org/aspectj/systemtest/ajc169/TransparentWeavingTests.java
index a64c390da..a32f4f15e 100644
--- a/tests/src/org/aspectj/systemtest/ajc169/TransparentWeavingTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc169/TransparentWeavingTests.java
@@ -238,7 +238,7 @@ public class TransparentWeavingTests extends org.aspectj.testing.XMLBasedAjcTest
@Override
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc169/transparentweaving.xml");
+ return getClassResource("transparentweaving.xml");
}
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc171/Ajc171Tests.java b/tests/src/org/aspectj/systemtest/ajc171/Ajc171Tests.java
index c21fc77b2..922ac483a 100644
--- a/tests/src/org/aspectj/systemtest/ajc171/Ajc171Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc171/Ajc171Tests.java
@@ -69,7 +69,7 @@ public class Ajc171Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
@Override
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc171/ajc171.xml");
+ return getClassResource("ajc171.xml");
}
}
diff --git a/tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java b/tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java
index 083c56caf..c4c10d1fa 100644
--- a/tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java
@@ -204,7 +204,7 @@ public class Ajc172Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
@Override
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc172/ajc172.xml");
+ return getClassResource("ajc172.xml");
}
}
diff --git a/tests/src/org/aspectj/systemtest/ajc173/Ajc173Tests.java b/tests/src/org/aspectj/systemtest/ajc173/Ajc173Tests.java
index 774cb84e6..5e007441f 100644
--- a/tests/src/org/aspectj/systemtest/ajc173/Ajc173Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc173/Ajc173Tests.java
@@ -78,7 +78,7 @@ public class Ajc173Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
@Override
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc173/ajc173.xml");
+ return getClassResource("ajc173.xml");
}
}
diff --git a/tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java b/tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java
index e647532fd..274fc892c 100644
--- a/tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java
@@ -90,7 +90,7 @@ public class Ajc174Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
@Override
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc174/ajc174.xml");
+ return getClassResource("ajc174.xml");
}
}
diff --git a/tests/src/org/aspectj/systemtest/ajc175/Ajc175Tests.java b/tests/src/org/aspectj/systemtest/ajc175/Ajc175Tests.java
index 7a31126c5..2296c8e59 100644
--- a/tests/src/org/aspectj/systemtest/ajc175/Ajc175Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc175/Ajc175Tests.java
@@ -36,7 +36,7 @@ public class Ajc175Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc175/ajc175.xml");
+ return getClassResource("ajc175.xml");
}
public static void main(String[] args) {
diff --git a/tests/src/org/aspectj/systemtest/ajc180/Ajc180Tests.java b/tests/src/org/aspectj/systemtest/ajc180/Ajc180Tests.java
index 24a05d4c5..558179f0a 100644
--- a/tests/src/org/aspectj/systemtest/ajc180/Ajc180Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc180/Ajc180Tests.java
@@ -53,7 +53,7 @@ public class Ajc180Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
@Override
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc180/ajc180.xml");
+ return getClassResource("ajc180.xml");
}
}
diff --git a/tests/src/org/aspectj/systemtest/ajc181/Ajc181Tests.java b/tests/src/org/aspectj/systemtest/ajc181/Ajc181Tests.java
index 24c07b03f..a15231dcf 100644
--- a/tests/src/org/aspectj/systemtest/ajc181/Ajc181Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc181/Ajc181Tests.java
@@ -60,7 +60,7 @@ public class Ajc181Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
@Override
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc181/ajc181.xml");
+ return getClassResource("ajc181.xml");
}
}
diff --git a/tests/src/org/aspectj/systemtest/ajc181/AllTestsAspectJ181.java b/tests/src/org/aspectj/systemtest/ajc181/AllTestsAspectJ181.java
index f06fccc32..a6c89f895 100644
--- a/tests/src/org/aspectj/systemtest/ajc181/AllTestsAspectJ181.java
+++ b/tests/src/org/aspectj/systemtest/ajc181/AllTestsAspectJ181.java
@@ -12,6 +12,7 @@ package org.aspectj.systemtest.ajc181;
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.aspectj.systemtest.apt.AptTests;
public class AllTestsAspectJ181 {
@@ -19,6 +20,7 @@ public class AllTestsAspectJ181 {
TestSuite suite = new TestSuite("AspectJ 1.8.1 tests");
// $JUnit-BEGIN$
suite.addTest(Ajc181Tests.suite());
+ suite.addTest(AptTests.suite());
// $JUnit-END$
return suite;
}
diff --git a/tests/src/org/aspectj/systemtest/apt/AllTestsApt.java b/tests/src/org/aspectj/systemtest/apt/AllTestsApt.java
new file mode 100644
index 000000000..fbba0be31
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/apt/AllTestsApt.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.apt;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTestsApt {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Annotation processing tests");
+ // $JUnit-BEGIN$
+ suite.addTest(AptTests.suite());
+ // $JUnit-END$
+ return suite;
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/apt/AptTests.java b/tests/src/org/aspectj/systemtest/apt/AptTests.java
new file mode 100644
index 000000000..74df34ef4
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/apt/AptTests.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.apt;
+
+import junit.framework.Test;
+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.
+ *
+ * @author Sergey Stupin.
+ */
+public class AptTests extends XMLBasedAjcTestCase {
+
+ public void testAptWithSpecifiedProcessor() {
+ runTest("annotation processing with specified processor");
+ }
+
+ /**
+ * SPI - http://docs.oracle.com/javase/tutorial/sound/SPI-intro.html
+ */
+ public void testAptUsingSPI() {
+ runTest("annotation processing in action using SPI");
+ }
+
+ public void testDisabledApt() {
+ runTest("disabled annotation processing");
+ }
+
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(AptTests.class);
+ }
+
+ @Override
+ protected File getSpecFile() {
+ return getClassResource("apt-spec.xml");
+ }
+
+}
diff --git a/tests/src/org/aspectj/systemtest/apt/apt-spec.xml b/tests/src/org/aspectj/systemtest/apt/apt-spec.xml
new file mode 100644
index 000000000..c1d34bd23
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/apt/apt-spec.xml
@@ -0,0 +1,88 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<suite>
+
+ <ajc-test dir="apt" title="annotation processing with specified processor">
+ <compile options="-1.8" files="processor/Event.java processor/SimpleProcessor.java"
+ outjar="annotation_processor.jar"/>
+ <!--
+ SimpleProcessor should generate 2 files for each java class that utilizes @Event annotation:
+ - {className}EventsAspect.aj - this file describes aspect with advices to weaving method annotated with @Event.
+ - {className}Callbacks.java - this file contains callback interfaces for methods annotated with @Event. Example:
+ public final class SomeCallbacks {
+ public interface OnMethod1 {
+ void changed(Some emmiter);
+ }
+ }
+ -->
+ <compile options="-1.8 -processor test.SimpleProcessor -s generated -showWeaveInfo" files="src/Some.java"
+ classpath="annotation_processor.jar" outjar="code.jar">
+ <message kind="weave"
+ text="Type 'test.Some' (Some.java) has intertyped field from 'test.SomeEventsAspect' (SomeEventsAspect.aj:'test.SomeEventsAspect$SomeOnMethod1Event test.Some.OnMethod1Event')"/>
+ <message kind="weave"
+ text="Join point 'method-execution(void test.Some.method1())' in Type 'test.Some' (Some.java:14) advised by before advice from 'test.SomeEventsAspect' (SomeEventsAspect.aj:44)"/>
+ </compile>
+ <run class="test.Some">
+ <stdout>
+ <line text="callback registered from before aspect"/>
+ <line text="method1 is invoked"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="apt" title="annotation processing in action using SPI">
+ <!--
+ what is SPI is described here - http://docs.oracle.com/javase/tutorial/sound/SPI-intro.html
+ -->
+ <!--<compile options="-1.8" files="processor/Event.java processor/SimpleProcessor.java" outjar="annotation_processors_with_spi.jar"/>-->
+ <compile options="-1.8 -sourceroots processor" inpath="processor/" outjar="annotation_processor.jar"/>
+ <!--
+ SimpleProcessor should generate 2 files for each java class that utilizes @Event annotation:
+ - {className}EventsAspect.aj - this file describes aspect with advices to weaving method annotated with @Event.
+ - {className}Callbacks.java - this file contains callback interfaces for methods annotated with @Event. Example:
+ public final class SomeCallbacks {
+ public interface OnMethod1 {
+ void changed(Some emmiter);
+ }
+ }
+ -->
+
+ <!--apt_service_description.jar contains only SPI descrition file - META-INF/services/javax.annotation.processing.Processor-->
+ <compile options="-1.8 -s generated -showWeaveInfo" files="src/Some.java"
+ classpath="annotation_processor.jar;apt_service_description.jar" outjar="code.jar">
+ <message kind="weave"
+ text="Type 'test.Some' (Some.java) has intertyped field from 'test.SomeEventsAspect' (SomeEventsAspect.aj:'test.SomeEventsAspect$SomeOnMethod1Event test.Some.OnMethod1Event')"/>
+ <message kind="weave"
+ text="Join point 'method-execution(void test.Some.method1())' in Type 'test.Some' (Some.java:14) advised by before advice from 'test.SomeEventsAspect' (SomeEventsAspect.aj:44)"/>
+ </compile>
+
+ <run class="test.Some">
+ <stdout>
+ <line text="callback registered from before aspect"/>
+ <line text="method1 is invoked"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="apt" title="disabled annotation processing">
+ <compile options="-1.8" files="processor/Event.java processor/SimpleProcessor.java"
+ outjar="annotation_processor.jar"/>
+ <!--
+ SimpleProcessor should generate 2 files for each java class that utilizes @Event annotation:
+ - {className}EventsAspect.aj - this file describes aspect with advices to weaving method annotated with @Event.
+ - {className}Callbacks.java - this file contains callback interfaces for methods annotated with @Event. Example:
+ public final class SomeCallbacks {
+ public interface OnMethod1 {
+ void changed(Some emmiter);
+ }
+ }
+ -->
+
+ <compile options="-1.8 -s generated -showWeaveInfo -proc:none" files="src/Some.java"
+ classpath="annotation_processor.jar" outjar="code.jar">
+ <!--field was not injected, so error should occur-->
+ <message kind="error" text="OnMethod1Event cannot be resolved or is not a field"/>
+ </compile>
+ </ajc-test>
+
+</suite>
diff --git a/tests/src/org/aspectj/systemtest/aspectpath/AspectPathTests.java b/tests/src/org/aspectj/systemtest/aspectpath/AspectPathTests.java
index f7388ee7f..3a77d2778 100644
--- a/tests/src/org/aspectj/systemtest/aspectpath/AspectPathTests.java
+++ b/tests/src/org/aspectj/systemtest/aspectpath/AspectPathTests.java
@@ -20,7 +20,7 @@ public class AspectPathTests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/aspectpath/aspectpath.xml");
+ return getClassResource("aspectpath.xml");
}
diff --git a/tests/src/org/aspectj/systemtest/base/BaseTests.java b/tests/src/org/aspectj/systemtest/base/BaseTests.java
index 23f450897..e85d327c7 100644
--- a/tests/src/org/aspectj/systemtest/base/BaseTests.java
+++ b/tests/src/org/aspectj/systemtest/base/BaseTests.java
@@ -20,7 +20,7 @@ public class BaseTests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/base/baseTests.xml");
+ return getClassResource("baseTests.xml");
}
diff --git a/tests/src/org/aspectj/systemtest/design/DesignTests.java b/tests/src/org/aspectj/systemtest/design/DesignTests.java
index 52d2f07c3..3a19663a6 100644
--- a/tests/src/org/aspectj/systemtest/design/DesignTests.java
+++ b/tests/src/org/aspectj/systemtest/design/DesignTests.java
@@ -20,7 +20,7 @@ public class DesignTests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/design/design.xml");
+ return getClassResource("design.xml");
}
diff --git a/tests/src/org/aspectj/systemtest/incremental/IncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/IncrementalTests.java
index c977cd813..a499e1421 100644
--- a/tests/src/org/aspectj/systemtest/incremental/IncrementalTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/IncrementalTests.java
@@ -25,7 +25,7 @@ public class IncrementalTests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/incremental/incremental.xml");
+ return getClassResource("incremental.xml");
}
diff --git a/tests/src/org/aspectj/systemtest/incremental/model/IncrementalModelTests.java b/tests/src/org/aspectj/systemtest/incremental/model/IncrementalModelTests.java
index a9f119973..a2ce02c0c 100644
--- a/tests/src/org/aspectj/systemtest/incremental/model/IncrementalModelTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/model/IncrementalModelTests.java
@@ -24,7 +24,7 @@ public class IncrementalModelTests extends org.aspectj.testing.XMLBasedAjcTestCa
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/incremental/model/incremental-model.xml");
+ return getClassResource("incremental-model.xml");
}
// This first test doesnt do a lot currently, but is ready too...
diff --git a/tests/src/org/aspectj/systemtest/inpath/InPathTests.java b/tests/src/org/aspectj/systemtest/inpath/InPathTests.java
index 3d177260b..ec2fd8d7b 100644
--- a/tests/src/org/aspectj/systemtest/inpath/InPathTests.java
+++ b/tests/src/org/aspectj/systemtest/inpath/InPathTests.java
@@ -20,7 +20,7 @@ public class InPathTests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/inpath/inpath.xml");
+ return getClassResource("inpath.xml");
}
diff --git a/tests/src/org/aspectj/systemtest/java14/Java14Tests.java b/tests/src/org/aspectj/systemtest/java14/Java14Tests.java
index 3b56286d3..d71b2ba4f 100644
--- a/tests/src/org/aspectj/systemtest/java14/Java14Tests.java
+++ b/tests/src/org/aspectj/systemtest/java14/Java14Tests.java
@@ -23,7 +23,7 @@ public class Java14Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/java14/java14.xml");
+ return getClassResource("java14.xml");
}
diff --git a/tests/src/org/aspectj/systemtest/model/Model5Tests.java b/tests/src/org/aspectj/systemtest/model/Model5Tests.java
index edfb853e9..3176803e4 100644
--- a/tests/src/org/aspectj/systemtest/model/Model5Tests.java
+++ b/tests/src/org/aspectj/systemtest/model/Model5Tests.java
@@ -87,7 +87,7 @@ public class Model5Tests extends ModelTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/model/model.xml");
+ return getClassResource("model.xml");
}
}
diff --git a/tests/src/org/aspectj/systemtest/model/ModelTests.java b/tests/src/org/aspectj/systemtest/model/ModelTests.java
index 3031b2731..26b3887f7 100644
--- a/tests/src/org/aspectj/systemtest/model/ModelTests.java
+++ b/tests/src/org/aspectj/systemtest/model/ModelTests.java
@@ -108,7 +108,7 @@ public class ModelTests extends ModelTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/model/model.xml");
+ return getClassResource("model.xml");
}
}
diff --git a/tests/src/org/aspectj/systemtest/options/OptionsTests.java b/tests/src/org/aspectj/systemtest/options/OptionsTests.java
index 08b5a5af2..80710a6ed 100644
--- a/tests/src/org/aspectj/systemtest/options/OptionsTests.java
+++ b/tests/src/org/aspectj/systemtest/options/OptionsTests.java
@@ -20,7 +20,7 @@ public class OptionsTests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/options/options.xml");
+ return getClassResource("options.xml");
}
diff --git a/tests/src/org/aspectj/systemtest/pre10x/AjcPre10xTests.java b/tests/src/org/aspectj/systemtest/pre10x/AjcPre10xTests.java
index 15f8fd824..be240a9be 100644
--- a/tests/src/org/aspectj/systemtest/pre10x/AjcPre10xTests.java
+++ b/tests/src/org/aspectj/systemtest/pre10x/AjcPre10xTests.java
@@ -20,7 +20,7 @@ public class AjcPre10xTests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/pre10x/pre10x.xml");
+ return getClassResource("pre10x.xml");
}
diff --git a/tests/src/org/aspectj/systemtest/serialVerUID/SUIDTests.java b/tests/src/org/aspectj/systemtest/serialVerUID/SUIDTests.java
index add1e5909..50c5dc216 100644
--- a/tests/src/org/aspectj/systemtest/serialVerUID/SUIDTests.java
+++ b/tests/src/org/aspectj/systemtest/serialVerUID/SUIDTests.java
@@ -20,7 +20,7 @@ public class SUIDTests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/serialVerUID/serialVerUID.xml");
+ return getClassResource("serialVerUID.xml");
}
diff --git a/tests/src/org/aspectj/systemtest/tracing/TracingTests.java b/tests/src/org/aspectj/systemtest/tracing/TracingTests.java
index c144e48e8..3e8b6d8db 100644
--- a/tests/src/org/aspectj/systemtest/tracing/TracingTests.java
+++ b/tests/src/org/aspectj/systemtest/tracing/TracingTests.java
@@ -23,7 +23,7 @@ public class TracingTests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/tracing/tracing.xml");
+ return getClassResource("tracing.xml");
}
public void testTracing () {
diff --git a/tests/src/org/aspectj/systemtest/xlint/XLint5Tests.java b/tests/src/org/aspectj/systemtest/xlint/XLint5Tests.java
index e146b0280..35e5b05ca 100644
--- a/tests/src/org/aspectj/systemtest/xlint/XLint5Tests.java
+++ b/tests/src/org/aspectj/systemtest/xlint/XLint5Tests.java
@@ -23,7 +23,7 @@ public class XLint5Tests extends XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/xlint/xlint.xml");
+ return getClassResource("xlint.xml");
}
public void testBug99136(){
diff --git a/tests/src/org/aspectj/systemtest/xlint/XLintTests.java b/tests/src/org/aspectj/systemtest/xlint/XLintTests.java
index 61942fef4..c5a2b7fdf 100644
--- a/tests/src/org/aspectj/systemtest/xlint/XLintTests.java
+++ b/tests/src/org/aspectj/systemtest/xlint/XLintTests.java
@@ -23,7 +23,7 @@ public class XLintTests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/xlint/xlint.xml");
+ return getClassResource("xlint.xml");
}
diff --git a/util/src/org/aspectj/util/FileUtil.java b/util/src/org/aspectj/util/FileUtil.java
index 5269b50a6..56b55042f 100644
--- a/util/src/org/aspectj/util/FileUtil.java
+++ b/util/src/org/aspectj/util/FileUtil.java
@@ -245,7 +245,7 @@ public class FileUtil {
/**
* Extract the name of a class from the path to its file. If the basedir is null, then the class is assumed to be in the default
* package unless the classFile has one of the top-level suffixes { com, org, java, javax } as a parent directory.
- *
+ *
* @param basedir the File of the base directory (prefix of classFile)
* @param classFile the File of the class to extract the name for
* @throws IllegalArgumentException if classFile is null or does not end with ".class" or a non-null basedir is not a prefix of
@@ -288,7 +288,7 @@ public class FileUtil {
/**
* Normalize path for comparisons by rendering absolute, clipping basedir prefix, trimming and changing '\\' to '/'
- *
+ *
* @param file the File with the path to normalize
* @param basedir the File for the prefix of the file to normalize - ignored if null
* @return "" if null or normalized path otherwise
@@ -310,7 +310,7 @@ public class FileUtil {
/**
* Render a set of files to String as a path by getting absolute paths of each and delimiting with infix.
- *
+ *
* @param files the File[] to flatten - may be null or empty
* @param infix the String delimiter internally between entries (if null, then use File.pathSeparator). (alias to
* <code>flatten(getAbsolutePaths(files), infix)</code>
@@ -325,7 +325,7 @@ public class FileUtil {
/**
* Flatten File[] to String.
- *
+ *
* @param files the File[] of paths to flatten - null ignored
* @param infix the String infix to use - null treated as File.pathSeparator
*/
@@ -352,7 +352,7 @@ public class FileUtil {
/**
* Normalize path for comparisons by rendering absolute trimming and changing '\\' to '/'
- *
+ *
* @return "" if null or normalized path otherwise
*/
public static String normalizedPath(File file) {
@@ -372,7 +372,7 @@ public class FileUtil {
/**
* Get best File for the first-readable path in input paths, treating entries prefixed "sp:" as system property keys. Safe to
* call in static initializers.
- *
+ *
* @param paths the String[] of paths to check.
* @return null if not found, or valid File otherwise
*/
@@ -410,7 +410,7 @@ public class FileUtil {
/**
* Render as best file, canonical or absolute.
- *
+ *
* @param file the File to get the best File for (not null)
* @return File of the best-available path
* @throws IllegalArgumentException if file is null
@@ -430,7 +430,7 @@ public class FileUtil {
/**
* Render as best path, canonical or absolute.
- *
+ *
* @param file the File to get the path for (not null)
* @return String of the best-available path
* @throws IllegalArgumentException if file is null
@@ -464,7 +464,7 @@ public class FileUtil {
/**
* Recursively delete the contents of dir, but not the dir itself
- *
+ *
* @return the total number of files deleted
*/
public static int deleteContents(File dir) {
@@ -474,7 +474,7 @@ public class FileUtil {
/**
* Recursively delete some contents of dir, but not the dir itself. This deletes any subdirectory which is empty after its files
* are deleted.
- *
+ *
* @return the total number of files deleted
*/
public static int deleteContents(File dir, FileFilter filter) {
@@ -484,7 +484,7 @@ public class FileUtil {
/**
* Recursively delete some contents of dir, but not the dir itself. If deleteEmptyDirs is true, this deletes any subdirectory
* which is empty after its files are deleted.
- *
+ *
* @param dir the File directory (if a file, the the file is deleted)
* @return the total number of files deleted
*/
@@ -499,21 +499,28 @@ public class FileUtil {
dir.delete();
return 1;
}
- String[] fromFiles = dir.list();
- 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);
- if (deleteEmptyDirs && (0 == file.list().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;
@@ -521,7 +528,7 @@ public class FileUtil {
/**
* Copy contents of fromDir into toDir
- *
+ *
* @param fromDir must exist and be readable
* @param toDir must exist or be creatable and be writable
* @return the total number of files copied
@@ -534,7 +541,7 @@ public class FileUtil {
* Recursively copy files in fromDir (with any fromSuffix) to toDir, replacing fromSuffix with toSuffix if any. This silently
* ignores dirs and files that are not readable but throw IOException for directories that are not writable. This does not clean
* out the original contents of toDir. (subdirectories are not renamed per directory rules)
- *
+ *
* @param fromSuffix select files with this suffix - select all if null or empty
* @param toSuffix replace fromSuffix with toSuffix in the destination file name - ignored if null or empty, appended to name if
* fromSuffix is null or empty
@@ -584,7 +591,7 @@ public class FileUtil {
* ignores dirs and files that are not readable but throw IOException for directories that are not writable. This does not clean
* out the original contents of toDir. (subdirectories are not renamed per directory rules) This calls any delegate
* FilenameFilter to collect any selected file.
- *
+ *
* @param fromSuffix select files with this suffix - select all if null or empty
* @param toSuffix replace fromSuffix with toSuffix in the destination file name - ignored if null or empty, appended to name if
* fromSuffix is null or empty
@@ -641,7 +648,7 @@ public class FileUtil {
/**
* Recursively list files in srcDir.
- *
+ *
* @return ArrayList with String paths of File under srcDir (relative to srcDir)
*/
public static String[] listFiles(File srcDir) {
@@ -661,7 +668,7 @@ public class FileUtil {
/**
* Recursively list files in srcDir.
- *
+ *
* @return ArrayList with String paths of File under srcDir (relative to srcDir)
*/
public static File[] listFiles(File srcDir, FileFilter fileFilter) {
@@ -674,7 +681,7 @@ public class FileUtil {
/**
* Recursively list .class files in specified directory
- *
+ *
* @return List of File objects
*/
public static List<File> listClassFiles(File dir) {
@@ -687,7 +694,7 @@ public class FileUtil {
/**
* Convert String[] paths to File[] as offset of base directory
- *
+ *
* @param basedir the non-null File base directory for File to create with paths
* @param paths the String[] of paths to create
* @return File[] with same length as paths
@@ -698,7 +705,7 @@ public class FileUtil {
/**
* Convert String[] paths to File[] as offset of base directory
- *
+ *
* @param basedir the non-null File base directory for File to create with paths
* @param paths the String[] of paths to create
* @param suffixes the String[] of suffixes to limit sources to - ignored if null
@@ -731,7 +738,7 @@ public class FileUtil {
/**
* Create a new File, resolving paths ".." and "." specially.
- *
+ *
* @param dir the File for the parent directory of the file
* @param path the path in the parent directory (filename only?)
* @return File for the new file.
@@ -755,7 +762,7 @@ public class FileUtil {
* Copy files from source dir into destination directory, creating any needed directories. This differs from copyDir in not
* being recursive; each input with the source dir creates a full path. However, if the source is a directory, it is copied as
* such.
- *
+ *
* @param srcDir an existing, readable directory containing relativePaths files
* @param relativePaths a set of paths relative to srcDir to readable File to copy
* @param destDir an existing, writable directory to copy files to
@@ -785,7 +792,7 @@ public class FileUtil {
/**
* Copy fromFile to toFile, handling file-file, dir-dir, and file-dir copies.
- *
+ *
* @param fromFile the File path of the file or directory to copy - must be readable
* @param toFile the File path of the target file or directory - must be writable (will be created if it does not exist)
*/
@@ -825,7 +832,7 @@ public class FileUtil {
/**
* Ensure that the parent directory to path can be written. If the path has a null parent, DEFAULT_PARENT is tested. If the path
* parent does not exist, this tries to create it.
- *
+ *
* @param path the File path whose parent should be writable
* @return the File path of the writable parent directory
* @throws IllegalArgumentException if parent cannot be written or path is null.
@@ -845,7 +852,7 @@ public class FileUtil {
/**
* Copy file to file.
- *
+ *
* @param fromFile the File to copy (readable, non-null file)
* @param toFile the File to copy to (non-null, parent dir exists)
* @throws IOException
@@ -896,7 +903,7 @@ public class FileUtil {
/**
* Make a new child directory of parent
- *
+ *
* @param parent a File for the parent (writable)
* @param child a prefix for the child directory
* @return a File dir that exists with parentDir as the parent file or null
@@ -924,7 +931,7 @@ public class FileUtil {
/**
* Make a new temporary directory in the same directory that the system uses for temporary files, or if that files, in the
* current directory.
- *
+ *
* @param name the preferred (simple) name of the directory - may be null.
* @return File of an existing new temp dir, or null if unable to create
*/
@@ -963,7 +970,7 @@ public class FileUtil {
/**
* Get URL for a File. This appends "/" for directories. prints errors to System.err
- *
+ *
* @param file the File to convert to URL (not null)
*/
@SuppressWarnings("deprecation")
@@ -988,7 +995,7 @@ public class FileUtil {
/**
* Write contents to file, returning null on success or error message otherwise. This tries to make any necessary parent
* directories first.
- *
+ *
* @param file the File to write (not null)
* @param contents the String to write (use "" if null)
* @return String null on no error, error otherwise
@@ -1221,7 +1228,7 @@ public class FileUtil {
/**
* Do line-based search for literal text in source files, returning file:line where found.
- *
+ *
* @param sought the String text to seek in the file
* @param sources the List of String paths to the source files
* @param listAll if false, only list first match in file
@@ -1248,7 +1255,7 @@ public class FileUtil {
* Do line-based search for literal text in source file, returning line where found as a String in the form
* {sourcePath}:line:column submitted to the collecting parameter sink. Any error is rendered to String and returned as the
* result.
- *
+ *
* @param sought the String text to seek in the file
* @param sources the List of String paths to the source files
* @param listAll if false, only list first match in file
@@ -1305,7 +1312,7 @@ public class FileUtil {
/**
* Sleep until after the last last-modified stamp from the files.
- *
+ *
* @param files the File[] of files to inspect for last modified times (this ignores null or empty files array and null or
* non-existing components of files array)
* @return true if succeeded without 100 interrupts
@@ -1402,7 +1409,7 @@ public class FileUtil {
return url.toURI().getPath();
} catch (URISyntaxException e) {
System.err.println("Warning!! Malformed URL may cause problems: "+url); // TODO: Better way to report this?
- // In this case it was likely not using properly escaped
+ // In this case it was likely not using properly escaped
// characters so we just use the 'bad' method that doesn't decode
// special chars
return url.getPath();
@@ -1411,7 +1418,7 @@ public class FileUtil {
/**
* A pipe when run reads from an input stream to an output stream, optionally sleeping between reads.
- *
+ *
* @see #copyStream(InputStream, OutputStream)
*/
public static class Pipe implements Runnable {
@@ -1437,7 +1444,7 @@ public class FileUtil {
/**
* alias for <code>Pipe(in, out, 100l, false, false)</code>
- *
+ *
* @param in the InputStream source to read
* @param out the OutputStream sink to write
*/
@@ -1523,7 +1530,7 @@ public class FileUtil {
/**
* Tell the pipe to halt the next time it gains control.
- *
+ *
* @param wait if true, this waits synchronously until pipe is done
* @param finishStream if true, then continue until a read from the input stream returns no bytes, then halt.
* @return true if <code>run()</code> will return the next time it gains control