aboutsummaryrefslogtreecommitdiffstats
path: root/tests/base/test112/Driver.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/base/test112/Driver.java')
-rw-r--r--tests/base/test112/Driver.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/base/test112/Driver.java b/tests/base/test112/Driver.java
new file mode 100644
index 000000000..6e8a757c9
--- /dev/null
+++ b/tests/base/test112/Driver.java
@@ -0,0 +1,28 @@
+import org.aspectj.testing.Tester;
+
+public class Driver {
+ public static int constructorCount = 0;
+
+ public static void main(String[] args) { test(); }
+
+ public static void test() {
+ SubClass sub1 = new SubClass();
+ // only one constructor has been called
+ Tester.checkEqual(constructorCount, 1, "constructor called");
+ }
+}
+
+
+class SuperClass {
+ public SuperClass() {}
+}
+
+class SubClass extends SuperClass {
+ public SubClass() {}
+}
+
+aspect SuperAspect {
+ after () returning(): call(SuperClass+.new(..)) {
+ Driver.constructorCount += 1;
+ }
+}