From 9a532972a6044080b4fed1d1d4a76f803f46fcc6 Mon Sep 17 00:00:00 2001 From: jhugunin Date: Tue, 14 Jan 2003 19:28:13 +0000 Subject: added test for introduced final fields and rearranged some --- tests/new/finalfield/Introducer.java | 5 +++++ tests/new/finalfield/Receiver.java | 2 ++ tests/new/finalfield/User1.java | 8 ++++++++ tests/new/finalfield/User2.java | 11 +++++++++++ tests/new/finalfield/UserCf.java | 8 ++++++++ 5 files changed, 34 insertions(+) create mode 100644 tests/new/finalfield/Introducer.java create mode 100644 tests/new/finalfield/Receiver.java create mode 100644 tests/new/finalfield/User1.java create mode 100644 tests/new/finalfield/User2.java create mode 100644 tests/new/finalfield/UserCf.java (limited to 'tests/new') diff --git a/tests/new/finalfield/Introducer.java b/tests/new/finalfield/Introducer.java new file mode 100644 index 000000000..fbd736ead --- /dev/null +++ b/tests/new/finalfield/Introducer.java @@ -0,0 +1,5 @@ +aspect Introducer { + final boolean Receiver.someField = true; + + public static final int Receiver.constant = 2; +} diff --git a/tests/new/finalfield/Receiver.java b/tests/new/finalfield/Receiver.java new file mode 100644 index 000000000..f8c8e2ea0 --- /dev/null +++ b/tests/new/finalfield/Receiver.java @@ -0,0 +1,2 @@ +class Receiver { +} diff --git a/tests/new/finalfield/User1.java b/tests/new/finalfield/User1.java new file mode 100644 index 000000000..ab27a1213 --- /dev/null +++ b/tests/new/finalfield/User1.java @@ -0,0 +1,8 @@ +import org.aspectj.testing.Tester; + +public class User1 { + public static void main(String[] args) { + Receiver r = new Receiver(); + Tester.check(r.someField, "introduced field"); + } +} \ No newline at end of file diff --git a/tests/new/finalfield/User2.java b/tests/new/finalfield/User2.java new file mode 100644 index 000000000..6210f2a6b --- /dev/null +++ b/tests/new/finalfield/User2.java @@ -0,0 +1,11 @@ +import org.aspectj.testing.Tester; + +public class User2 { + public static void main(String[] args) { + switch(Receiver.constant) { + case 2: + return; + } + Tester.checkFailed("shouldn't get here"); + } +} \ No newline at end of file diff --git a/tests/new/finalfield/UserCf.java b/tests/new/finalfield/UserCf.java new file mode 100644 index 000000000..20bb77b7a --- /dev/null +++ b/tests/new/finalfield/UserCf.java @@ -0,0 +1,8 @@ +import org.aspectj.testing.Tester; + +public class UserCf { + public static void main(String[] args) { + Receiver r = new Receiver(); + r.someField = false; + } +} \ No newline at end of file -- cgit v1.2.3