From 21e06a69892469bab688d2315e7e034047431082 Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 28 Jun 2006 09:16:01 +0000 Subject: [PATCH] test and fix for 148727 - reverse synthetic changes for aspectOf() and hasAspect() --- tests/bugs152/pr148727/Asp.aj | 2 ++ tests/bugs152/pr148727/Client.java | 7 +++++ tests/features152/synthetic/TheWholeShow.aj | 1 + .../systemtest/ajc152/Ajc152Tests.java | 3 ++ .../org/aspectj/systemtest/ajc152/ajc152.xml | 31 +++++++++++++++++++ .../src/org/aspectj/weaver/NameMangler.java | 11 ++++--- 6 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 tests/bugs152/pr148727/Asp.aj create mode 100644 tests/bugs152/pr148727/Client.java diff --git a/tests/bugs152/pr148727/Asp.aj b/tests/bugs152/pr148727/Asp.aj new file mode 100644 index 000000000..446fb5849 --- /dev/null +++ b/tests/bugs152/pr148727/Asp.aj @@ -0,0 +1,2 @@ +public aspect Asp { +} diff --git a/tests/bugs152/pr148727/Client.java b/tests/bugs152/pr148727/Client.java new file mode 100644 index 000000000..2ced473f4 --- /dev/null +++ b/tests/bugs152/pr148727/Client.java @@ -0,0 +1,7 @@ +public class Client { + public static void main(String argz[]) { + if (!Asp.hasAspect()) + throw new RuntimeException("ou est le aspect?"); + System.out.println("Can call aspectOf? "+Asp.aspectOf()); + } +} diff --git a/tests/features152/synthetic/TheWholeShow.aj b/tests/features152/synthetic/TheWholeShow.aj index d1e032e8b..7045c8192 100644 --- a/tests/features152/synthetic/TheWholeShow.aj +++ b/tests/features152/synthetic/TheWholeShow.aj @@ -58,6 +58,7 @@ public class TheWholeShow { for (Method m : ms) { if (!m.isSynthetic()) { String name = m.getName(); + if (name.equals("aspectOf") || name.equals("hasAspect")) continue; if ( ! (name.startsWith("ajc$before") || name.startsWith("ajc$after") || name.startsWith("ajc$around") || name.startsWith("ajc$interMethod$"))) { System.err.println("Found non-synthetic method: " + m.getName() + " in " + c.getName()); diff --git a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java index e53fc4f4a..c60ba90b4 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java @@ -35,6 +35,8 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase { // public void testItdCallingGenericMethod_pr145391_2() { runTest("itd calling generic method - 2");} // public void testAdviceNotWovenAspectPath_pr147841() { runTest("advice not woven on aspectpath");} // public void testClassCastForInvalidAnnotationValue_pr148537() { runTest("classcast annotation value");} + public void testSeparateCallAspectOf_pr148727() { runTest("separate compilation calling aspectOf and hasAspect"); } + public void testIntegratedCallAspectOf_pr148727() { runTest("integrated compilation calling aspectOf and hasAspect"); } public void testFreakyNewArrayJoinpoint_pr148786() { runTest("freaky new array joinpoint"); } public void testPrivilegeGeneric_pr148545() { runTest("nosuchmethoderror for privileged aspect");} public void testPrivilegeGeneric_pr148545_2() { runTest("nosuchmethoderror for privileged aspect - 2");} @@ -97,6 +99,7 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testAspectLibrariesAndASM_pr135001() { runTest("aspect libraries and asm");} public void testStackOverflow_pr136258() { runTest("stack overflow");} public void testIncorrectOverridesEvaluation13() { runTest("incorrect overrides evaluation - 1.3"); } +// public void testIncorrectOverridesEvaluation14() { runTest("incorrect overrides evaluation - 1.4"); } public void testIncorrectOverridesEvaluation15() { runTest("incorrect overrides evaluation - 1.5"); } public void testAtWithinCodeBug_pr138798() { runTest("atWithinCodeBug"); } public void testReferencePCutInDeclareWarning_pr138215() { runTest("Reference pointcut fails inside @DeclareWarning");} diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml index cbff0e3d1..6fed5f9db 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml +++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml @@ -381,6 +381,16 @@ + + + + + + + + + + @@ -792,4 +802,25 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/weaver/src/org/aspectj/weaver/NameMangler.java b/weaver/src/org/aspectj/weaver/NameMangler.java index 73d349fa6..faf06df83 100644 --- a/weaver/src/org/aspectj/weaver/NameMangler.java +++ b/weaver/src/org/aspectj/weaver/NameMangler.java @@ -71,11 +71,12 @@ public class NameMangler { else if (methodName.indexOf("_aroundBody") != -1) { return true; } - else if (declaredInAspect) { - if (methodName.equals("aspectOf") || methodName.equals("hasAspect")) { - return true; - } - } +// these aren't the droids you're looking for...move along...... pr148727 +// else if (declaredInAspect) { +// if (methodName.equals("aspectOf") || methodName.equals("hasAspect")) { +// return true; +// } +// } return false; } -- 2.39.5