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;
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));
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);
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) {
public static URL fileToURL(File file) {
try {
- return file.toURI().toURL();
+ return file.toURL();
} catch (MalformedURLException e) {
return null;
}
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);
}
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;
} 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;
*******************************************************************************/
package org.aspectj.systemtest.ajc150.ataspectj;
-import org.aspectj.testing.AutowiredXMLBasedAjcTestCase;
+import org.aspectj.testing.XMLBasedAjcTestCase;
import junit.framework.Test;
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");
+ }
}
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");
+ }
}
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
<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">
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;
}
* 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) {
* 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) {
// 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);
// 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()) {