aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjhugunin <jhugunin>2003-07-23 00:22:50 +0000
committerjhugunin <jhugunin>2003-07-23 00:22:50 +0000
commit54a8e9ae3854be8bc202eb55fd1c4e0f735bd424 (patch)
treea577c46df120003c20d6285a4d0b366371361160 /tests
parent9894a3d4826ef3480a53aa7cd8d86804af3f1fdd (diff)
downloadaspectj-54a8e9ae3854be8bc202eb55fd1c4e0f735bd424.tar.gz
aspectj-54a8e9ae3854be8bc202eb55fd1c4e0f735bd424.zip
added test for expanded version of Bugzilla Bug 39711
Class Literals as non final fields
Diffstat (limited to 'tests')
-rw-r--r--tests/ajcTestsFailing.xml8
-rw-r--r--tests/bugs/ClassLiteralField.java26
2 files changed, 32 insertions, 2 deletions
diff --git a/tests/ajcTestsFailing.xml b/tests/ajcTestsFailing.xml
index cb741c1e0..cd8e52f6e 100644
--- a/tests/ajcTestsFailing.xml
+++ b/tests/ajcTestsFailing.xml
@@ -2,7 +2,11 @@
<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd">
<!-- contains valid tests that the compiler has never passed -->
-<suite>
-
+<suite>
+ <ajc-test dir="bugs" pr="39711"
+ title="Class Literals as non final fields (also assert, and this$0)">
+ <compile files="ClassLiteralField.java" options="-source14"/>
+ <run class="ClassLiteralField"/>
+ </ajc-test>
</suite>
diff --git a/tests/bugs/ClassLiteralField.java b/tests/bugs/ClassLiteralField.java
new file mode 100644
index 000000000..13539479f
--- /dev/null
+++ b/tests/bugs/ClassLiteralField.java
@@ -0,0 +1,26 @@
+import org.aspectj.testing.Tester;
+
+public class ClassLiteralField { // synthetic class$n set
+ public static void main(String[] args) {
+ Class c = ClassLiteralField.class; // synthetic class$n get
+ assert c != null; //synthetic $assert
+ new ClassLiteralField().doInner();
+ }
+ int x=10;
+ void doInner() {
+ new Runnable() { // synthetic this$n
+ public void run() {
+ x+=1; // synthetic this$n
+ }
+ }.run();
+ }
+}
+
+aspect A {
+// before(): within(ClassLiteralField) && get(* *) && !get(* x) {
+// System.out.println("get: " + thisJoinPoint +", " + thisJoinPoint.getSourceLocation());
+// }
+
+ declare error: within(ClassLiteralField) && get(* *) && !get(* x): "unexpected get";
+ declare error: within(ClassLiteralField) && set(* *) && !set(* x): "unexpected set";
+} \ No newline at end of file