aboutsummaryrefslogtreecommitdiffstats
path: root/testing/src
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2021-03-12 10:16:36 +0700
committerAlexander Kriegisch <Alexander@Kriegisch.name>2021-03-12 12:54:16 +0700
commita78abecee0a116336cc9ae604c2a7fbe9d11d621 (patch)
treecb417e1163926772d20cae78284db06a653b8921 /testing/src
parent42b1e6f09e00194ba2ec32e0972b91e19b9161f9 (diff)
downloadaspectj-a78abecee0a116336cc9ae604c2a7fbe9d11d621.tar.gz
aspectj-a78abecee0a116336cc9ae604c2a7fbe9d11d621.zip
Fix: WeaveSpec no longer ignores the '-Xlintfile' parameter
Some tests in ajc150.xml and ajc190_from150.xml contain '<weave ...>' build steps with 'xlintfile="..."' parameters. Those parameters were passed through to Java and aspect code building steps, but not to the final weaving step, sometimes leading to spurious "type not exposed to weaver" warnings which occurred for some local and CI builds, but not always. Very strange indeed. Anyway, by making method WeaveSpec.buildWeaveArgs() pass on this parameter, the tests seem to run reliably now. TODO: Why does Ajc report that warning if the application JAR is on the inpath and the aspect JAR is on the aspectpath? Is it because a marker annotation is defined within the aspect JAR? But actually, that should not matter, especially not work once and fail at other times. I guess there is a class loading order problem or similar involved. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'testing/src')
-rw-r--r--testing/src/test/java/org/aspectj/testing/WeaveSpec.java41
1 files changed, 23 insertions, 18 deletions
diff --git a/testing/src/test/java/org/aspectj/testing/WeaveSpec.java b/testing/src/test/java/org/aspectj/testing/WeaveSpec.java
index 9d95e79b5..41b561311 100644
--- a/testing/src/test/java/org/aspectj/testing/WeaveSpec.java
+++ b/testing/src/test/java/org/aspectj/testing/WeaveSpec.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2005 IBM Corporation
- * 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:
- * Adrian Colyer,
+ * 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:
+ * Adrian Colyer,
* ******************************************************************/
package org.aspectj.testing;
@@ -52,21 +52,21 @@ public class WeaveSpec extends CompileSpec {
inTestCase.assertNoMessages(result,failMessage);
File sandbox = inTestCase.getSandboxDirectory();
createJar(sandbox,"classes.jar",true);
-
- inTestCase.setShouldEmptySandbox(false);
+
+ inTestCase.setShouldEmptySandbox(false);
setFiles(aspectsFiles);
String options = getOptions();
if (options == null) {
- setOptions("");
+ setOptions("");
}
setClasspath("classes.jar");
args = buildArgs();
result = inTestCase.ajc(base,args);
inTestCase.assertNoMessages(result,failMessage);
createJar(sandbox,"aspects.jar",false);
-
+
args = buildWeaveArgs();
- inTestCase.setShouldEmptySandbox(false);
+ inTestCase.setShouldEmptySandbox(false);
result = inTestCase.ajc(base,args);
AjcTestCase.MessageSpec messageSpec = buildMessageSpec();
inTestCase.assertMessages(result,failMessage,messageSpec);
@@ -79,7 +79,7 @@ public class WeaveSpec extends CompileSpec {
public void setClassesFiles(String files) {
this.classesFiles = files;
}
-
+
public void setAspectsFiles(String files) {
this.aspectsFiles = files;
}
@@ -112,7 +112,7 @@ public class WeaveSpec extends CompileSpec {
jarOut.flush();
jarOut.close();
}
-
+
private void collectClassFiles(File inDir, List<File> inList, List<File> toExclude) {
File[] contents = inDir.listFiles();
for (File content : contents) {
@@ -125,7 +125,7 @@ public class WeaveSpec extends CompileSpec {
}
}
}
-
+
private void copyFile(File f, OutputStream dest) throws IOException {
FileInputStream fis = new FileInputStream(f);
byte[] buf = new byte[4096];
@@ -135,7 +135,7 @@ public class WeaveSpec extends CompileSpec {
}
fis.close();
}
-
+
private String[] buildWeaveArgs() {
StringBuffer args = new StringBuffer();
if (getOptions() != null) {
@@ -152,6 +152,11 @@ public class WeaveSpec extends CompileSpec {
args.append(" ");
args.append("-aspectpath ");
args.append("aspects.jar");
+ if (getXlintfile() != null) {
+ args.append(" -Xlintfile ");
+ args.append(getXlintfile());
+ args.append(" ");
+ }
String argumentString = args.toString();
StringTokenizer strTok = new StringTokenizer(argumentString," ");
String[] ret = new String[strTok.countTokens()];
@@ -160,5 +165,5 @@ public class WeaveSpec extends CompileSpec {
}
return ret;
}
-
+
}