- 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
rm -rf classes
Using ajc:
- ajc -classpath ../../../lib/test/aspectjrt.jar \
+ ajc -classpath ../../../../lib/test/aspectjrt.jar \
-outjar ../injars/app-ajc-1.1.jar app/Main.java
Using ajc in eclipse, from a module directory:
static String staticString = "hello";
- String s = "me";
+ String s = "me"; // bug 8 initializer picked out as execution
public static void main(String[] args) {
}
}
- Main() { // 23
+ Main() { s += "pick me, not initializer"; // 23
}
void go(String s) { String t = "..".substring(0); // 26
String temp = this.s; // 29
this.s = temp + ", " + s; // 31
-
+ D.go(); // 32
} catch (RuntimeException e) { String u = "..".substring(0); // 33
stop(); // 35
void stop() { // 40
- new Main(); // 42
+ D.go(); // 42
}
}
}
+class D {
+
+ static void go() {
+
+ }
+
+}
--- /dev/null
+
+package aspects;
+
+import app.Main;
+
+// WARNING: do not change message text without changing test specification
+public privileged aspect ConstructorExecutionWarning {
+
+ declare warning : execution(Main.new()) // 23 (bug: 8)
+ : "execution(Main.new())";
+
+}
\ No newline at end of file
public privileged aspect MainWarnings {
declare warning : staticinitialization(Main)
- : "staticinitializtion(Main)";
+ : "staticinitialization(Main)";
- declare warning : initialization(Main.new())
+ declare warning : initialization(Main.new()) // 23
: "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(void Main.go(String))
: "call(void Main.go(String))";
- declare warning : call(Main.new())
+ declare warning : call(void app.D.go()) // 42 (bug missing)
&& withincode(void Main.stop())
- : "call(Main.new()) && withincode(void Main.stop())";
+ : "withincode(void Main.stop())";
+
+ declare warning : call(void app.D.go()) // 32
+ && withincode(void Main.go(String))
+ : "D.go withincode(void Main.go(String))";
- declare warning : call(void Main.stop())
+ declare warning : call(void Main.stop()) // 35
&& withincode(void Main.go(String))
- : "call(void Main.stop()) && withincode(void Main.go(String))";
+ : "Main.stop withincode(void Main.go(String))";
declare warning : get(String Main.s)
: "get(String Main.s)";