From 7b831ff7356725b9872a9635d1e0eeb035f2790b Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 3 Oct 2006 14:30:21 +0000 Subject: [PATCH] test and fixes for 152366: support AND in include/exclude/dump --- .../loadtime/definition/DocumentParser.java | 14 ++++-- tests/ltw/inclExcl/aop-aspectinclexcl.xml | 10 ++++ tests/ltw/inclExcl/aop-exclude.xml | 9 ++++ tests/ltw/inclExcl/aop-include.xml | 10 ++++ tests/ltw/inclExcl/pkg/Main.aj | 46 +++++++++++++++++++ tests/ltw/inclExcl/pkg/sub/Foo.aj | 5 ++ tests/ltw/inclExcl/tracing/Tracer.aj | 7 +++ .../ltw/inclExcl/tracing/staticinit/Tracer.aj | 7 +++ .../inclExcl/tracing/staticinit/sub/Tracer.aj | 7 +++ .../systemtest/ajc150/ltw/LTWTests.java | 14 +++++- .../systemtest/ajc150/ltw/ltw-tests.xml | 45 ++++++++++++++++++ 11 files changed, 167 insertions(+), 7 deletions(-) create mode 100644 tests/ltw/inclExcl/aop-aspectinclexcl.xml create mode 100644 tests/ltw/inclExcl/aop-exclude.xml create mode 100644 tests/ltw/inclExcl/aop-include.xml create mode 100644 tests/ltw/inclExcl/pkg/Main.aj create mode 100644 tests/ltw/inclExcl/pkg/sub/Foo.aj create mode 100644 tests/ltw/inclExcl/tracing/Tracer.aj create mode 100644 tests/ltw/inclExcl/tracing/staticinit/Tracer.aj create mode 100644 tests/ltw/inclExcl/tracing/staticinit/sub/Tracer.aj diff --git a/loadtime/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java b/loadtime/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java index 2800ebece..2e109527a 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java @@ -193,17 +193,17 @@ public class DocumentParser extends DefaultHandler { } else if (ASPECTS_ELEMENT.equals(qName)) { m_inAspects = true; } else if (INCLUDE_ELEMENT.equals(qName) && m_inWeaver) { - String typePattern = attributes.getValue(WITHIN_ATTRIBUTE); + String typePattern = getWithinAttribute(attributes); if (!isNull(typePattern)) { m_definition.getIncludePatterns().add(typePattern); } } else if (EXCLUDE_ELEMENT.equals(qName) && m_inWeaver) { - String typePattern = attributes.getValue(WITHIN_ATTRIBUTE); + String typePattern = getWithinAttribute(attributes); if (!isNull(typePattern)) { m_definition.getExcludePatterns().add(typePattern); } } else if (DUMP_ELEMENT.equals(qName) && m_inWeaver) { - String typePattern = attributes.getValue(WITHIN_ATTRIBUTE); + String typePattern = getWithinAttribute(attributes); if (!isNull(typePattern)) { m_definition.getDumpPatterns().add(typePattern); } @@ -212,12 +212,12 @@ public class DocumentParser extends DefaultHandler { m_definition.setDumpBefore(true); } } else if (EXCLUDE_ELEMENT.equals(qName) && m_inAspects) { - String typePattern = attributes.getValue(WITHIN_ATTRIBUTE); + String typePattern = getWithinAttribute(attributes); if (!isNull(typePattern)) { m_definition.getAspectExcludePatterns().add(typePattern); } } else if (INCLUDE_ELEMENT.equals(qName) && m_inAspects) { - String typePattern = attributes.getValue(WITHIN_ATTRIBUTE); + String typePattern = getWithinAttribute(attributes); if (!isNull(typePattern)) { m_definition.getAspectIncludePatterns().add(typePattern); } @@ -227,6 +227,10 @@ public class DocumentParser extends DefaultHandler { super.startElement(uri, localName, qName, attributes); } + private String getWithinAttribute(Attributes attributes) { + return replaceXmlAnd(attributes.getValue(WITHIN_ATTRIBUTE)); + } + public void endElement(String uri, String localName, String qName) throws SAXException { if (CONCRETE_ASPECT_ELEMENT.equals(qName)) { m_lastConcreteAspect = null; diff --git a/tests/ltw/inclExcl/aop-aspectinclexcl.xml b/tests/ltw/inclExcl/aop-aspectinclexcl.xml new file mode 100644 index 000000000..5f4c88d50 --- /dev/null +++ b/tests/ltw/inclExcl/aop-aspectinclexcl.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tests/ltw/inclExcl/aop-exclude.xml b/tests/ltw/inclExcl/aop-exclude.xml new file mode 100644 index 000000000..b13fcf099 --- /dev/null +++ b/tests/ltw/inclExcl/aop-exclude.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/ltw/inclExcl/aop-include.xml b/tests/ltw/inclExcl/aop-include.xml new file mode 100644 index 000000000..afdac0f49 --- /dev/null +++ b/tests/ltw/inclExcl/aop-include.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tests/ltw/inclExcl/pkg/Main.aj b/tests/ltw/inclExcl/pkg/Main.aj new file mode 100644 index 000000000..6cf8ae986 --- /dev/null +++ b/tests/ltw/inclExcl/pkg/Main.aj @@ -0,0 +1,46 @@ +package pkg; + +import java.io.File; + +public class Main { + public static void main(String argz[]) { + foo(); + } + + public static void foo() { + (new pkg.sub.Foo()).foo(); + + File dumpDir = new File("_ajdump"); + lsLR(dumpDir); + + // the LTW harness should clean up _ajdump files! + cleanup(dumpDir); + } + + public static void lsLR(File dir) { + String[] files = dir.list(); + if (files == null) return; + for (int i=0; i + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- 2.39.5