From 54a8e9ae3854be8bc202eb55fd1c4e0f735bd424 Mon Sep 17 00:00:00 2001 From: jhugunin Date: Wed, 23 Jul 2003 00:22:50 +0000 Subject: [PATCH] added test for expanded version of Bugzilla Bug 39711 Class Literals as non final fields --- tests/ajcTestsFailing.xml | 8 ++++++-- tests/bugs/ClassLiteralField.java | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 tests/bugs/ClassLiteralField.java 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 @@ - - + + + + + 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 -- 2.39.5