<!-- contains valid tests that the compiler has never passed -->
<suite>
+ <!-- expected messages the same for these tests. note:
+ - that pointcut-and not supported in message text TODO
+ - no test on adviceexecution()
+ - only verifying by line number now
+ (not flagging error in filename. Binary filenames are
+ listed as, e.g., app.Main.class.
+ Should get from filename attribute)
+ -->
+ <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>
</suite>
--- /dev/null
+
+Warning: brittle test! Change carefully and rebuild binaries!
+
+Bugs: 37020, 37021, 37023
+
+- there are 3+ associated test specifications:
+ - source-only
+ - binary (javac) application, source aspect
+ - binary (ajc) application, source aspect
+ - binary (javac) application, binary aspect (todo)
+ - binary (ajc) application, binary aspect (todo)
+
+- the lines in Main.java correspond with
+ warning line values in the test specifications
+
+- the message text in MainWarnings.java correspond with
+ warning text values in the test specifications
+
+- all the warnings in MainWarnings.java
+ should resolve to unique lines
+ (until we verify based on more than line)
+
+- all test specifications should have exactly the same warnings
+ as each other as as specified in MainWarnings.java
+
+To build the injar sources from the src directory:
+
+Using javac:
+ mkdir classes
+ javac -d classes app/Main.java
+ jar cfM ../injars/app-javac-1.4.jar -C classes .
+ rm -rf classes
+
+Using ajc:
+ ajc -classpath ../../../lib/test/aspectjrt.jar \
+ -outjar ../injars/app-ajc-1.1.jar app/Main.java
+
+Using ajc in eclipse, from a module directory:
+
+ {ajc} -classpath ../lib/test/aspectjrt.jar
+ -outjar ../tests/new/binaryWarnings/injars/app-ajc-1.1.jar
+ ../test/new/binnaryWarnings/src/app/Main.java
+
--- /dev/null
+
+package aspects;
+
+import app.Main;
+
+// WARNING: do not change message text without changing test specification
+public privileged aspect MainWarnings {
+
+ declare warning : staticinitialization(Main)
+ : "staticinitializtion(Main)";
+
+ declare warning : initialization(Main.new())
+ : "initialization(Main.new())";
+
+ declare warning : execution(Main.new())
+ : "execution(Main.new())";
+
+ declare warning : execution(void Main.go(String))
+ : "execution(void Main.go(String))";
+
+ declare warning : call(Main.new())
+ : "call(Main.new())";
+
+ declare warning : call(void Main.go(String))
+ : "call(void Main.go(String))";
+
+ declare warning : call(Main.new())
+ && withincode(void Main.stop())
+ : "call(Main.new()) && withincode(void Main.stop())";
+
+ declare warning : call(void Main.stop())
+ && withincode(void Main.go(String))
+ : "call(void Main.stop()) && withincode(void Main.go(String))";
+
+ declare warning : get(String Main.s)
+ : "get(String Main.s)";
+
+ declare warning : set(String Main.s)
+ : "set(String Main.s)";
+
+ declare warning : get(String Main.staticString)
+ : "get(String Main.staticString)";
+
+ declare warning : set(String Main.staticString)
+ : "set(String Main.staticString)";
+
+ declare warning : handler(RuntimeException)
+ && within(Main)
+ : "handler(RuntimeException) && within(Main)";
+
+ declare warning : preinitialization(app.C.new())
+ : "preinitialization(app.C.new())";
+
+// declare warning : adviceexecution() && within(app.AdvisingAspect)
+// : "adviceexecution() && within(app.AdvisingAspect)";
+}
\ No newline at end of file