aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravasseur <avasseur>2005-05-13 09:37:31 +0000
committeravasseur <avasseur>2005-05-13 09:37:31 +0000
commit0852d51f34460040aa3d3c60e47b7e0fe7b7633d (patch)
tree4b897ec6d3b3bba87b7c53643203ede5dda73fc7
parente8345b8759aebb52e5d56e216cb6634b6591fa54 (diff)
downloadaspectj-0852d51f34460040aa3d3c60e47b7e0fe7b7633d.tar.gz
aspectj-0852d51f34460040aa3d3c60e47b7e0fe7b7633d.zip
added test entries instead of autowiredtest for Andy sake, fix 1.4 dependancies in loadtime module and util module
-rw-r--r--loadtime/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java19
-rw-r--r--testing-util/src/org/aspectj/testing/util/TestUtil.java4
-rw-r--r--tests/java5/ataspectj/ataspectj/TestHelper.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java18
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjMisuseTests.java38
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java54
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml2
-rw-r--r--util/src/org/aspectj/util/FileUtil.java2
-rw-r--r--util/src/org/aspectj/util/LangUtil.java6
-rw-r--r--weaver/src/org/aspectj/weaver/PerObjectInterfaceTypeMunger.java2
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/PerObject.java2
11 files changed, 128 insertions, 21 deletions
diff --git a/loadtime/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java b/loadtime/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java
index 4e1967870..92f2c4b89 100644
--- a/loadtime/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java
+++ b/loadtime/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java
@@ -19,6 +19,7 @@ import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.helpers.XMLReaderFactory;
+import org.aspectj.util.LangUtil;
import java.io.InputStream;
import java.net.URL;
@@ -83,12 +84,21 @@ public class DocumentParser extends DefaultHandler {
try {
xmlReader.setFeature("http://xml.org/sax/features/validation", false);
+ } catch (SAXException e) {
+ ;//fine, the parser don't do validation
+ }
+ try {
xmlReader.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ } catch (SAXException e) {
+ ;//fine, the parser don't do validation
+ }
+ try {
xmlReader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
- } catch (SAXNotRecognizedException e) {
+ } catch (SAXException e) {
;//fine, the parser don't do validation
}
+
xmlReader.setEntityResolver(parser);
in = url.openStream();
xmlReader.parse(new InputSource(in));
@@ -106,6 +116,10 @@ public class DocumentParser extends DefaultHandler {
if (publicId.equals(DTD_PUBLIC_ID) || publicId.equals(DTD_PUBLIC_ID_ALIAS)) {
InputStream in = DTD_STREAM;
if (in == null) {
+ System.err.println(
+ "AspectJ - WARN - could not read DTD "
+ + publicId
+ );
return null;
} else {
return new InputSource(in);
@@ -203,8 +217,7 @@ public class DocumentParser extends DefaultHandler {
private static String replaceXmlAnd(String expression) {
//TODO AV do we need to handle "..)AND" or "AND(.." ?
- //FIXME AV Java 1.4 code - if KO, use some Strings util
- return expression.replaceAll(" AND ", " && ");
+ return LangUtil.replace(expression, " AND ", " && ");
}
private boolean isNull(String s) {
diff --git a/testing-util/src/org/aspectj/testing/util/TestUtil.java b/testing-util/src/org/aspectj/testing/util/TestUtil.java
index 6bf3350cf..4b62f9a90 100644
--- a/testing-util/src/org/aspectj/testing/util/TestUtil.java
+++ b/testing-util/src/org/aspectj/testing/util/TestUtil.java
@@ -135,7 +135,7 @@ public final class TestUtil {
public static URL fileToURL(File file) {
try {
- return file.toURI().toURL();
+ return file.toURL();
} catch (MalformedURLException e) {
return null;
}
@@ -223,7 +223,7 @@ public final class TestUtil {
public static URL libURL(String rpath) {
File file = libFile(rpath);
try {
- return file.toURI().toURL();
+ return file.toURL();
} catch (MalformedURLException e) {
throw new IllegalArgumentException("bad URL from: " + file);
}
diff --git a/tests/java5/ataspectj/ataspectj/TestHelper.java b/tests/java5/ataspectj/ataspectj/TestHelper.java
index c1e75532d..10855a5db 100644
--- a/tests/java5/ataspectj/ataspectj/TestHelper.java
+++ b/tests/java5/ataspectj/ataspectj/TestHelper.java
@@ -18,7 +18,6 @@ import junit.framework.TestFailure;
import java.util.Enumeration;
-import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.AbortException;
import org.aspectj.weaver.loadtime.DefaultMessageHandler;
@@ -61,6 +60,7 @@ public class TestHelper extends DefaultMessageHandler {
} else {
// we do exit here since Assert.fail will only trigger a runtime exception that might
// be catched by the weaver anyway
+ System.err.println("*** Exiting - got a warning/fail/error/abort IMessage");
System.exit(-1);
}
return ret;
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java
index 0f820873e..a4ba644a3 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java
@@ -11,7 +11,7 @@
*******************************************************************************/
package org.aspectj.systemtest.ajc150.ataspectj;
-import org.aspectj.testing.AutowiredXMLBasedAjcTestCase;
+import org.aspectj.testing.XMLBasedAjcTestCase;
import junit.framework.Test;
import java.io.File;
@@ -19,13 +19,25 @@ import java.io.File;
/**
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
*/
-public class AtAjLTWTests extends AutowiredXMLBasedAjcTestCase {
+public class AtAjLTWTests extends XMLBasedAjcTestCase {
public static Test suite() {
- return AutowiredXMLBasedAjcTestCase.loadSuite(org.aspectj.systemtest.ajc150.ataspectj.AtAjLTWTests.class);
+ return XMLBasedAjcTestCase.loadSuite(org.aspectj.systemtest.ajc150.ataspectj.AtAjLTWTests.class);
}
protected File getSpecFile() {
return new File("../tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml");
}
+
+ public void testRunThemAllWithJavacCompiledAndLTW() {
+ runTest("RunThemAllWithJavacCompiledAndLTW");
+ }
+
+ public void testAjcLTWPerClauseTest_XnoWeave() {
+ runTest("AjcLTW PerClauseTest -XnoWeave");
+ }
+
+ public void testAjcLTWPerClauseTest_Xreweavable() {
+ runTest("AjcLTW PerClauseTest -Xreweavable");
+ }
}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjMisuseTests.java b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjMisuseTests.java
index 82bee5e63..318d60295 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjMisuseTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjMisuseTests.java
@@ -14,18 +14,50 @@ import java.io.File;
import junit.framework.Test;
-import org.aspectj.testing.AutowiredXMLBasedAjcTestCase;
+import org.aspectj.testing.XMLBasedAjcTestCase;
/**
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
*/
-public class AtAjMisuseTests extends AutowiredXMLBasedAjcTestCase {
+public class AtAjMisuseTests extends XMLBasedAjcTestCase {
protected File getSpecFile() {
return new File("../tests/src/org/aspectj/systemtest/ajc150/ataspectj/misuse.xml");
}
public static Test suite() {
- return AutowiredXMLBasedAjcTestCase.loadSuite(AtAjMisuseTests.class);
+ return XMLBasedAjcTestCase.loadSuite(AtAjMisuseTests.class);
}
+
+ public void testQAspectClassExtendingQAspectClass() {
+ runTest("@Aspect class extending @Aspect class");
+ }
+
+ public void testClassWithQBeforeExtendingQAspectClass() {
+ runTest("class with @Before extending @Aspect class");
+ }
+
+ public void testQPointcutNotReturningVoid() {
+ runTest("@Pointcut not returning void");
+ }
+
+ public void testQPointcutWithGarbageString() {
+ runTest("@Pointcut with garbage string");
+ }
+
+ public void testQPointcutWithThrowsClause() {
+ runTest("@Pointcut with throws clause");
+ }
+
+ public void testQAfterReturningWithWrongNumberOfArgs() {
+ runTest("@AfterReturning with wrong number of args");
+ }
+
+ public void testQBeforeOnNon_publicMethod() {
+ runTest("@Before on non-public method");
+ }
+
+ public void testQBeforeOnMethodNotReturningVoid() {
+ runTest("@Before on method not returning void");
+ }
}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java
index 7927a2675..a23806e06 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java
@@ -16,21 +16,69 @@ import java.io.File;
import junit.framework.Test;
import org.aspectj.testing.XMLBasedAjcTestCase;
-import org.aspectj.testing.AutowiredXMLBasedAjcTestCase;
/**
* A suite for @AspectJ aspects located in java5/ataspectj
*
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
*/
-public class AtAjSyntaxTests extends AutowiredXMLBasedAjcTestCase {
+public class AtAjSyntaxTests extends XMLBasedAjcTestCase {
public static Test suite() {
- return AutowiredXMLBasedAjcTestCase.loadSuite(AtAjSyntaxTests.class);
+ return XMLBasedAjcTestCase.loadSuite(AtAjSyntaxTests.class);
}
protected File getSpecFile() {
return new File("../tests/src/org/aspectj/systemtest/ajc150/ataspectj/syntax.xml");
}
+
+ public void testSimpleBefore() {
+ runTest("SimpleBefore");
+ }
+
+ public void testSimpleAfter() {
+ runTest("SimpleAfter");
+ }
+
+ public void testSingletonAspectBindings() {
+ runTest("singletonAspectBindings");
+ }
+
+ public void testCflowTest() {
+ runTest("CflowTest");
+ }
+
+ public void testPointcutReferenceTest() {
+ runTest("PointcutReferenceTest");
+ }
+
+ public void testXXJoinPointTest() {
+ runTest("XXJoinPointTest");
+ }
+
+ public void testPrecedenceTest() {
+ runTest("PrecedenceTest");
+ }
+
+ public void testAfterXTest() {
+ runTest("AfterXTest");
+ }
+
+ public void testBindingTest() {
+ runTest("BindingTest");
+ }
+
+ public void testBindingTestNoInline() {
+ runTest("BindingTest no inline");
+ }
+
+ public void testPerClause() {
+ runTest("PerClause");
+ }
+
+ public void testAroundInlineMunger() {
+ runTest("AroundInlineMunger");
+ }
+
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml
index ae296871c..e44aef3f9 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml
@@ -2,7 +2,7 @@
<suite>
<ajc-test dir="java5/ataspectj" title="RunThemAllWithJavacCompiledAndLTW">
- <ant file="ajc-ant.xml" target="javac.ltw"/>
+ <ant file="ajc-ant.xml" target="javac.ltw" verbose="true"/>
</ajc-test>
<ajc-test dir="java5/ataspectj" title="AjcLTW PerClauseTest -XnoWeave">
diff --git a/util/src/org/aspectj/util/FileUtil.java b/util/src/org/aspectj/util/FileUtil.java
index 2d2a90e0e..ddaeedb43 100644
--- a/util/src/org/aspectj/util/FileUtil.java
+++ b/util/src/org/aspectj/util/FileUtil.java
@@ -879,7 +879,7 @@ public class FileUtil {
LangUtil.throwIaxIfNull(file, "file");
URL result = null;
try {
- result = file.toURI().toURL();
+ result = file.toURL();//TODO AV - was toURI.toURL that does not works on Java 1.3
if (null != result) {
return result;
}
diff --git a/util/src/org/aspectj/util/LangUtil.java b/util/src/org/aspectj/util/LangUtil.java
index 7e88949ae..d33e54d99 100644
--- a/util/src/org/aspectj/util/LangUtil.java
+++ b/util/src/org/aspectj/util/LangUtil.java
@@ -210,7 +210,7 @@ public class LangUtil {
* Splits <code>input</code> at commas,
* trimming any white space.
*
- * @param text <code>String</code> to split.
+ * @param input <code>String</code> to split.
* @return List of String of elements.
*/
public static List commaSplit(String input) {
@@ -265,8 +265,8 @@ public class LangUtil {
* no delimiters, the input itself is returned
* after trimming white space.
*
- * @param text <code>String</code> to split.
- * @param delimiter <code>String</code> separators for input.
+ * @param input <code>String</code> to split.
+ * @param delim <code>String</code> separators for input.
* @return List of String of elements.
*/
public static List anySplit(String input, String delim) {
diff --git a/weaver/src/org/aspectj/weaver/PerObjectInterfaceTypeMunger.java b/weaver/src/org/aspectj/weaver/PerObjectInterfaceTypeMunger.java
index a9f885d0c..512f9ca4f 100644
--- a/weaver/src/org/aspectj/weaver/PerObjectInterfaceTypeMunger.java
+++ b/weaver/src/org/aspectj/weaver/PerObjectInterfaceTypeMunger.java
@@ -97,6 +97,8 @@ public class PerObjectInterfaceTypeMunger extends ResolvedTypeMunger {
// FIXME AV - #75442 see thread
// back off on old style : it can happen for perTarget that target type is presented first to the weaver
// while caller side is not thus we have advisedTypeToAspects still empty..
+
+ // note: needed only for perTarget if lateMunger is used (see PerObject)
return !matchType.isInterface() && !matchType.isAnnotationStyleAspect();
} else {
return aspects.contains(aspectType);
diff --git a/weaver/src/org/aspectj/weaver/patterns/PerObject.java b/weaver/src/org/aspectj/weaver/patterns/PerObject.java
index 45602d386..aec9f7f4d 100644
--- a/weaver/src/org/aspectj/weaver/patterns/PerObject.java
+++ b/weaver/src/org/aspectj/weaver/patterns/PerObject.java
@@ -109,7 +109,7 @@ public class PerObject extends PerClause {
// see #75442 thread. Issue with weaving order.
ResolvedTypeMunger munger =
new PerObjectInterfaceTypeMunger(inAspect, concreteEntry);
- inAspect.crosscuttingMembers.addTypeMunger(world.concreteTypeMunger(munger, inAspect));
+ inAspect.crosscuttingMembers.addLateTypeMunger(world.concreteTypeMunger(munger, inAspect));
//ATAJ: add a munger to add the aspectOf(..) to the @AJ aspects
if (inAspect.isAnnotationStyleAspect()) {