]> source.dussan.org Git - aspectj.git/commitdiff
updated tests for [method|execution] binary join point detection.
authorwisberg <wisberg>
Thu, 1 May 2003 11:13:25 +0000 (11:13 +0000)
committerwisberg <wisberg>
Thu, 1 May 2003 11:13:25 +0000 (11:13 +0000)
added narrower knownLimitation test

tests/ajcTests.xml
tests/ajcTestsFailing.xml
tests/new/binaryWarnings/injars/app-ajc-1.1.jar
tests/new/binaryWarnings/injars/app-javac-1.4.jar
tests/new/binaryWarnings/injars/appStartLines-ajc-1.1.jar [new file with mode: 0644]
tests/new/binaryWarnings/injars/appStartLines-javac-1.4.jar [new file with mode: 0644]
tests/new/binaryWarnings/readme.txt
tests/new/binaryWarnings/src/app/Main.java
tests/new/binaryWarnings/src/app/MainExecStartLines.java [new file with mode: 0644]
tests/new/binaryWarnings/src/aspects/MainExecStartLinesErrors.java [new file with mode: 0644]

index 8553355a5f65f5b7a28c6eb43578d6a7d576b408..8c4c2163951d62bf579c5e2b2fccda8907a0d03a 100644 (file)
         <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>
index 711108e0a758c9d52f9cdbdd3610e7714c9afc90..2b914897ef990450711593bb2a1f721400256d04 100644 (file)
         <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>
index c05b4224703bd87906bc275112d32ddceb7fc2ed..020b5d00e37952d9abe8eaf50af8f9e8b0c5d5ad 100644 (file)
Binary files a/tests/new/binaryWarnings/injars/app-ajc-1.1.jar and b/tests/new/binaryWarnings/injars/app-ajc-1.1.jar differ
index c163258972380a3cd1ac74aa04c6a9dbae8cfea0..fd98323505386cdf301df39aa04eeabae1c50957 100644 (file)
Binary files a/tests/new/binaryWarnings/injars/app-javac-1.4.jar and b/tests/new/binaryWarnings/injars/app-javac-1.4.jar 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 (file)
index 0000000..a795186
Binary files /dev/null and b/tests/new/binaryWarnings/injars/appStartLines-ajc-1.1.jar 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 (file)
index 0000000..2824d4a
Binary files /dev/null and b/tests/new/binaryWarnings/injars/appStartLines-javac-1.4.jar differ
index 6b6eb486ec2b8663fe7b6c631d5fec6d7a837a9a..a6f0a69a40e083e179d107b835b1c9142eefcf0f 100644 (file)
@@ -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:
index a2daee1d9fde881cac15b1d540892c8d149ceca2..a118555d40a67a22988778da4eaa7662f0c10c94 100644 (file)
@@ -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 (file)
index 0000000..826fd29
--- /dev/null
@@ -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 (file)
index 0000000..704afa9
--- /dev/null
@@ -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