From 77d9906679b671488272fe62c8409bcc32bbb99c Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 24 Apr 2006 10:18:27 +0000 Subject: [PATCH] fix for 138158 --- tests/bugs152/pr138158/Foo.java | 27 +++++++++++++++++++ .../systemtest/ajc152/Ajc152Tests.java | 5 ++-- .../org/aspectj/systemtest/ajc152/ajc152.xml | 10 ++++++- .../WithinCodeAnnotationPointcut.java | 7 ++--- 4 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 tests/bugs152/pr138158/Foo.java diff --git a/tests/bugs152/pr138158/Foo.java b/tests/bugs152/pr138158/Foo.java new file mode 100644 index 000000000..fdda0b42b --- /dev/null +++ b/tests/bugs152/pr138158/Foo.java @@ -0,0 +1,27 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +@interface Goo {} + + +public class Foo { + public static void main(String []argv) { + new Foo().m(); + } + + @Goo + public void m() { + System.err.println(""); + } + + public void m2() { + System.err.println(""); + } +} + +aspect X { + before(): call(* println(..)) && !@withincode(Goo) { } + + + before(): call(* println(..)) && @withincode(Goo) { } +} \ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java index 09d83eb2b..120cd10d2 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java @@ -17,8 +17,9 @@ import org.aspectj.testing.XMLBasedAjcTestCase; public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase { - //public void testNotAtWithincode_pr138158() { runTest("not at withincode");} - //public void testComplexGenericDecl_pr137568() { runTest("complicated generics declaration");} + public void testNotAtWithincode_pr138158_1() { runTest("not at withincode - 1");} + public void testNotAtWithincode_pr138158_2() { runTest("not at withincode - 2");} +// public void testComplexGenericDecl_pr137568() { runTest("complicated generics declaration");} public void testNpeOnDup_pr138143() { runTest("npe on duplicate method with ataj");} public void testPointcutsAndGenerics_pr137496_1() { runTest("pointcuts and generics - B");} public void testPointcutsAndGenerics_pr137496_2() { runTest("pointcuts and generics - D");} diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml index 024fe802d..4147db02e 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml +++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml @@ -20,13 +20,21 @@ - + + + + + + + + + diff --git a/weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java index bb0b3bb65..f4bf40132 100644 --- a/weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java @@ -154,11 +154,8 @@ public class WithinCodeAnnotationPointcut extends NameBindingPointcut { state.set(btp.getFormalIndex(),var); } - return Literal.TRUE; -// if (matchInternal(shadow).alwaysTrue()) -// return Literal.TRUE; -// else -// return Literal.FALSE; + if (matchInternal(shadow).alwaysTrue()) return Literal.TRUE; + else return Literal.FALSE; } -- 2.39.5