aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorwisberg <wisberg>2003-05-01 11:13:25 +0000
committerwisberg <wisberg>2003-05-01 11:13:25 +0000
commit2a0ce5da6e2839e21345f9cff3327038e40408db (patch)
treea324a2a2e89f5ef4b4a1d10e9e857044dd151cbf /tests
parent6d42cb250bdd315ca5f3ac7f8f3eab29c0d185c9 (diff)
downloadaspectj-2a0ce5da6e2839e21345f9cff3327038e40408db.tar.gz
aspectj-2a0ce5da6e2839e21345f9cff3327038e40408db.zip
updated tests for [method|execution] binary join point detection.
added narrower knownLimitation test
Diffstat (limited to 'tests')
-rw-r--r--tests/ajcTests.xml131
-rw-r--r--tests/ajcTestsFailing.xml21
-rw-r--r--tests/new/binaryWarnings/injars/app-ajc-1.1.jarbin1143 -> 1180 bytes
-rw-r--r--tests/new/binaryWarnings/injars/app-javac-1.4.jarbin1208 -> 1275 bytes
-rw-r--r--tests/new/binaryWarnings/injars/appStartLines-ajc-1.1.jarbin0 -> 554 bytes
-rw-r--r--tests/new/binaryWarnings/injars/appStartLines-javac-1.4.jarbin0 -> 692 bytes
-rw-r--r--tests/new/binaryWarnings/readme.txt4
-rw-r--r--tests/new/binaryWarnings/src/app/Main.java4
-rw-r--r--tests/new/binaryWarnings/src/app/MainExecStartLines.java28
-rw-r--r--tests/new/binaryWarnings/src/aspects/MainExecStartLinesErrors.java16
10 files changed, 202 insertions, 2 deletions
diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml
index 8553355a5..8c4c21639 100644
--- a/tests/ajcTests.xml
+++ b/tests/ajcTests.xml
@@ -5913,4 +5913,135 @@
<compile files="ClassForName.java"/>
<run class="ClassForName"/>
</ajc-test>
+
+ <ajc-test dir="new/binaryWarnings/src" pr="37020"
+ title="declare warnings on main">
+ <compile files="aspects/MainWarnings.java,app/Main.java">
+ <message kind="warning" file="app/Main.java"
+ line="6" text="set(String Main.staticString)"/>
+ <message kind="warning" file="app/Main.java"
+ line="8" text="set(String Main.s)"/>
+ <message kind="warning" file="app/Main.java"
+ line="12" text="get(String Main.staticString)"/>
+ <message kind="warning" file="app/Main.java"
+ line="14" text="set(String Main.staticString)"/>
+ <message kind="warning" file="app/Main.java"
+ line="16" text="call(Main.new())"/>
+ <message kind="warning" file="app/Main.java"
+ line="19" text="call(void Main.go(String))"/>
+ <message kind="warning" file="app/Main.java"
+ line="23" text="execution(Main.new())"/>
+ <message kind="warning" file="app/Main.java"
+ line="26" text="execution(void Main.go(String))"/>
+ <message kind="warning" file="app/Main.java"
+ line="29" text="get(String Main.s)"/>
+ <message kind="warning" file="app/Main.java"
+ line="31" text="set(String Main.s)"/>
+ <message kind="warning" file="app/Main.java"
+ line="33" text="handler(RuntimeException)"/>
+ <message kind="warning" file="app/Main.java"
+ line="35" text="withincode(void Main.go(String))"/>
+ <message kind="warning" file="app/Main.java"
+ line="42" text="withincode(void Main.stop())"/>
+ <message kind="warning" file="app/Main.java"
+ line="50" text="preinitialization(app.C.new())"/>
+ </compile>
+
+ <run class="app.Main"/>
+ </ajc-test>
+
+ <ajc-test dir="new/binaryWarnings/src" pr="37020"
+ title="declare warnings on binary javac 1.4 classes">
+ <compile files="aspects/MainWarnings.java,../injars/app-javac-1.4.jar">
+ <message kind="warning" file="app/Main.java"
+ line="6" text="set(String Main.staticString)"/>
+ <message kind="warning" file="app/Main.java"
+ line="8" text="set(String Main.s)"/>
+ <message kind="warning" file="app/Main.java"
+ line="12" text="get(String Main.staticString)"/>
+ <message kind="warning" file="app/Main.java"
+ line="14" text="set(String Main.staticString)"/>
+ <message kind="warning" file="app/Main.java"
+ line="16" text="call(Main.new())"/>
+ <message kind="warning" file="app/Main.java"
+ line="19" text="call(void Main.go(String))"/>
+ <message kind="warning" file="app/Main.java"
+ line="23" text="execution(Main.new())"/>
+ <message kind="warning" file="app/Main.java"
+ line="26" text="execution(void Main.go(String))"/>
+ <message kind="warning" file="app/Main.java"
+ line="29" text="get(String Main.s)"/>
+ <message kind="warning" file="app/Main.java"
+ line="31" text="set(String Main.s)"/>
+ <message kind="warning" file="app/Main.java"
+ line="33" text="handler(RuntimeException)"/>
+ <message kind="warning" file="app/Main.java"
+ line="35" text="withincode(void Main.go(String))"/>
+ <message kind="warning" file="app/Main.java"
+ line="42" text="withincode(void Main.stop())"/>
+ <message kind="warning" file="app/Main.java"
+ line="50" text="preinitialization(app.C.new())"/>
+ </compile>
+ <run class="app.Main"/>
+ </ajc-test>
+ <ajc-test dir="new/binaryWarnings/src" pr="37023"
+ title="declare warnings on binary ajc 1.1 classes">
+ <compile files="aspects/MainWarnings.java,../injars/app-ajc-1.1.jar">
+ <message kind="warning" file="app/Main.java"
+ line="6" text="set(String Main.staticString)"/>
+ <message kind="warning" file="app/Main.java"
+ line="8" text="set(String Main.s)"/>
+ <message kind="warning" file="app/Main.java"
+ line="12" text="get(String Main.staticString)"/>
+ <message kind="warning" file="app/Main.java"
+ line="14" text="set(String Main.staticString)"/>
+ <message kind="warning" file="app/Main.java"
+ line="16" text="call(Main.new())"/>
+ <message kind="warning" file="app/Main.java"
+ line="19" text="call(void Main.go(String))"/>
+ <message kind="warning" file="app/Main.java"
+ line="23" text="execution(Main.new())"/>
+ <message kind="warning" file="app/Main.java"
+ line="26" text="execution(void Main.go(String))"/>
+ <message kind="warning" file="app/Main.java"
+ line="29" text="get(String Main.s)"/>
+ <message kind="warning" file="app/Main.java"
+ line="31" text="set(String Main.s)"/>
+ <message kind="warning" file="app/Main.java"
+ line="33" text="handler(RuntimeException)"/>
+ <message kind="warning" file="app/Main.java"
+ line="35" text="withincode(void Main.go(String))"/>
+ <message kind="warning" file="app/Main.java"
+ line="42" text="withincode(void Main.stop())"/>
+ <message kind="warning" file="app/Main.java"
+ line="50" text="preinitialization(app.C.new())"/>
+
+ </compile>
+ <run class="app.Main"/>
+ </ajc-test>
+
+ <ajc-test dir="new/binaryWarnings/src" pr="37020"
+ keywords="knownLimitation"
+ comment="source loc of binary jp depends on first code, not block start"
+ title="declare error on handler/method execution with no code on binary ajc 1.1 classes">
+ <compile files="aspects/MainExecStartLinesErrors.java,../injars/appStartLines-ajc-1.1.jar">
+ <message kind="error" file="app/MainExecStartLines.java"
+ line="6" text="execution(void MainExecStartLines.main(String[]))"/>
+ <message kind="error" file="app/MainExecStartLines.java"
+ line="17" text="handler(RuntimeException)"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="new/binaryWarnings/src" pr="37020"
+ keywords="knownLimitation"
+ comment="source loc of binary jp depends on first code, not block start; XXX need javac inlining example"
+ title="declare error on handler/method execution with no code on binary javac 1.4 classes">
+ <compile files="aspects/MainExecStartLinesErrors.java,../injars/appStartLines-javac-1.4.jar">
+ <message kind="error" file="app/MainExecStartLines.java"
+ line="6" text="execution(void MainExecStartLines.main(String[]))"/>
+ <message kind="error" file="app/MainExecStartLines.java"
+ line="17" text="handler(RuntimeException)"/>
+ </compile>
+ </ajc-test>
+
</suite>
diff --git a/tests/ajcTestsFailing.xml b/tests/ajcTestsFailing.xml
index 711108e0a..2b914897e 100644
--- a/tests/ajcTestsFailing.xml
+++ b/tests/ajcTestsFailing.xml
@@ -118,5 +118,26 @@
<run class="app.Main"/>
</ajc-test>
+ <ajc-test dir="new/binaryWarnings/src" pr="37020"
+ keywords="knownLimitation"
+ title="declare error on handler/method execution with no code on binary ajc 1.1 classes">
+ <compile files="aspects/MainExecStartLinesErrors.java,../injars/appStartLines-ajc-1.1.jar">
+ <message kind="error" file="app/MainExecStartLines.java"
+ line="6" text="execution(void MainExecStartLines.main(String[]))"/>
+ <message kind="error" file="app/MainExecStartLines.java"
+ line="17" text="handler(RuntimeException)"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="new/binaryWarnings/src" pr="37020"
+ keywords="knownLimitation"
+ title="declare error on handler/method execution with no code on binary javac 1.4 classes">
+ <compile files="aspects/MainExecStartLinesErrors.java,../injars/appStartLines-javac-1.4.jar">
+ <message kind="error" file="app/MainExecStartLines.java"
+ line="6" text="execution(void MainExecStartLines.main(String[]))"/>
+ <message kind="error" file="app/MainExecStartLines.java"
+ line="17" text="handler(RuntimeException)"/>
+ </compile>
+ </ajc-test>
</suite>
diff --git a/tests/new/binaryWarnings/injars/app-ajc-1.1.jar b/tests/new/binaryWarnings/injars/app-ajc-1.1.jar
index c05b42247..020b5d00e 100644
--- a/tests/new/binaryWarnings/injars/app-ajc-1.1.jar
+++ b/tests/new/binaryWarnings/injars/app-ajc-1.1.jar
Binary files differ
diff --git a/tests/new/binaryWarnings/injars/app-javac-1.4.jar b/tests/new/binaryWarnings/injars/app-javac-1.4.jar
index c16325897..fd9832350 100644
--- a/tests/new/binaryWarnings/injars/app-javac-1.4.jar
+++ b/tests/new/binaryWarnings/injars/app-javac-1.4.jar
Binary files differ
diff --git a/tests/new/binaryWarnings/injars/appStartLines-ajc-1.1.jar b/tests/new/binaryWarnings/injars/appStartLines-ajc-1.1.jar
new file mode 100644
index 000000000..a79518649
--- /dev/null
+++ b/tests/new/binaryWarnings/injars/appStartLines-ajc-1.1.jar
Binary files differ
diff --git a/tests/new/binaryWarnings/injars/appStartLines-javac-1.4.jar b/tests/new/binaryWarnings/injars/appStartLines-javac-1.4.jar
new file mode 100644
index 000000000..2824d4a0c
--- /dev/null
+++ b/tests/new/binaryWarnings/injars/appStartLines-javac-1.4.jar
Binary files differ
diff --git a/tests/new/binaryWarnings/readme.txt b/tests/new/binaryWarnings/readme.txt
index 6b6eb486e..a6f0a69a4 100644
--- a/tests/new/binaryWarnings/readme.txt
+++ b/tests/new/binaryWarnings/readme.txt
@@ -23,6 +23,10 @@ Bugs: 37020, 37021, 37023
- all test specifications should have exactly the same warnings
as each other as as specified in MainWarnings.java
+- the ExecStartLine variants show that for binary join points,
+ we detect the first line of code in the associated block,
+ not the first line of the block. This is a known limitation.
+
To build the injar sources from the src directory:
Using javac:
diff --git a/tests/new/binaryWarnings/src/app/Main.java b/tests/new/binaryWarnings/src/app/Main.java
index a2daee1d9..a118555d4 100644
--- a/tests/new/binaryWarnings/src/app/Main.java
+++ b/tests/new/binaryWarnings/src/app/Main.java
@@ -23,14 +23,14 @@ public class Main {
Main() { // 23
}
- void go(String s) { // 26
+ void go(String s) { String t = "..".substring(0); // 26
try {
String temp = this.s; // 29
this.s = temp + ", " + s; // 31
- } catch (RuntimeException e) { // 33
+ } catch (RuntimeException e) { String u = "..".substring(0); // 33
stop(); // 35
diff --git a/tests/new/binaryWarnings/src/app/MainExecStartLines.java b/tests/new/binaryWarnings/src/app/MainExecStartLines.java
new file mode 100644
index 000000000..826fd29b2
--- /dev/null
+++ b/tests/new/binaryWarnings/src/app/MainExecStartLines.java
@@ -0,0 +1,28 @@
+
+package app;
+
+public class MainExecStartLines {
+
+ public static void main(String[] args) // 6
+ { // 7
+
+
+
+
+ String t = "....".substring(0); // 12
+ }
+ void go(String s) {
+ try {
+ String t = "....".substring(0);
+ } catch (RuntimeException e) { // 17
+
+
+ String t = "....".substring(0); // 20
+ }
+ }
+}
+/*
+ * known limitation:
+ * For static shadow of [method|handler] execution join points
+ * in binary form, only can detect first line of code.
+ */
diff --git a/tests/new/binaryWarnings/src/aspects/MainExecStartLinesErrors.java b/tests/new/binaryWarnings/src/aspects/MainExecStartLinesErrors.java
new file mode 100644
index 000000000..704afa98d
--- /dev/null
+++ b/tests/new/binaryWarnings/src/aspects/MainExecStartLinesErrors.java
@@ -0,0 +1,16 @@
+
+package aspects;
+
+import app.MainExecStartLines;
+
+// WARNING: do not change message text without changing test specification
+public privileged aspect MainExecStartLinesErrors {
+
+ declare error : execution(void MainExecStartLines.main(String[]))
+ : "execution(void MainExecStartLines.main(String[]))";
+
+ declare error : handler(RuntimeException)
+ && within(MainExecStartLines)
+ : "handler(RuntimeException) && within(MainExecStartLines)";
+
+} \ No newline at end of file