]> source.dussan.org Git - aspectj.git/commitdiff
added test for expanded version of Bugzilla Bug 39711
authorjhugunin <jhugunin>
Wed, 23 Jul 2003 00:22:50 +0000 (00:22 +0000)
committerjhugunin <jhugunin>
Wed, 23 Jul 2003 00:22:50 +0000 (00:22 +0000)
   Class Literals as non final fields

tests/ajcTestsFailing.xml
tests/bugs/ClassLiteralField.java [new file with mode: 0644]

index cb741c1e06e224218dbbdf2f4da77f36dff43413..cd8e52f6e1cf03fa8c87e16ddbc371cb14398124 100644 (file)
@@ -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 (file)
index 0000000..1353947
--- /dev/null
@@ -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