diff options
-rw-r--r-- | tests/bugs152/pr148727/Asp.aj | 2 | ||||
-rw-r--r-- | tests/bugs152/pr148727/Client.java | 7 | ||||
-rw-r--r-- | tests/features152/synthetic/TheWholeShow.aj | 1 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java | 3 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc152/ajc152.xml | 31 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/NameMangler.java | 11 |
6 files changed, 50 insertions, 5 deletions
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 @@ </compile> </ajc-test> + <ajc-test dir="bugs152/binaryDecp" title="incorrect overrides evaluation - 1.4"> + <compile files="IsItSynthetic.java" options="-1.5"/> + <compile files="Top.java" options="-source 1.5 -target 1.5" outjar="a.jar"/> + <compile files="Bottom.java" classpath="$sandbox/a.jar" options="-source 1.4 -target 1.4" outjar="b.jar"/> + <compile files="Middle.java" classpath="$sandbox/a.jar" options="-source 1.4 -target 1.4" outjar="c.jar"/> + <compile files="X2.aj" classpath="$sandbox/a.jar;$sandbox/b.jar;$sandbox/c.jar" options="-Xlint:ignore" outjar="x.jar"/> + <run class="Bottom" classpath="a.jar;b.jar;c.jar;x.jar" ltw="aop.xml"/> + <!--message kind="weave" text="Setting superclass of type 'Bottom' (Bottom.java) to 'Middle' (X2.aj)"/--> + </ajc-test> + <ajc-test dir="bugs152/binaryDecp" title="incorrect overrides evaluation - 1.5"> <compile files="SubClassLoader.java,SubSubClassLoader.java" options="-1.5" outjar="lib.jar"/> <compile files="X.aj" inpath="lib.jar" options="-showWeaveInfo"> @@ -792,4 +802,25 @@ </stderr> </run> </ajc-test> + + <ajc-test dir="bugs152/pr148727" pr="148727" + title="integrated compilation calling aspectOf and hasAspect" > + <compile files="Asp.aj, Client.java" options="-source 1.4"/> + <run class="Client"> + <stdout> + <line text="Can call aspectOf? Asp@"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr148727" pr="148727" + title="separate compilation calling aspectOf and hasAspect" > + <compile files="Asp.aj" outjar="asp.jar"/> + <compile files="Client.java" classpath="asp.jar" options="-source 1.4"/> + <run class="Client"> + <stdout> + <line text="Can call aspectOf? Asp@"/> + </stdout> + </run> + </ajc-test> </suite>
\ 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; } |