Browse Source

tests and fix for pr108816, args with binding with .. at join point with synthetic arguments

tags/preDefaultReweavable
acolyer 18 years ago
parent
commit
71771abbb2

+ 20
- 0
tests/bugs150/pr108816.aj View File

@@ -0,0 +1,20 @@
aspect BadAdvice {
after(Object controller) returning (Object foo):
cflow(adviceexecution() && args(controller, ..) && this(BadAdvice)) &&
call(Bar+.new(..))
{
}
Object around(Object controller) : call(* whoKnows()) && target(controller)
{
return new Bar();
}
public static void main(String args[]) {
(new Bar()).whoKnows();
}
}

class Bar {
void whoKnows() {}
}

+ 4
- 0
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java View File

@@ -393,6 +393,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
public void testPrivatePointcutOverriding() {
runTest("can't override private pointcut in abstract aspect");
}

public void testAdviceOnCflow() {
runTest("advising cflow advice execution");
}
// helper methods.....

+ 5
- 1
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml View File

@@ -500,7 +500,11 @@
<message kind="warning" line="21" text="matched join point from sub advice"/>
</compile>
</ajc-test>
<ajc-test dir="bugs150" pr="108816" title="advising cflow advice execution">
<compile files="pr108816.aj" >
</compile>
</ajc-test>
<!-- ============================================================================ -->
<!-- ============================================================================ -->

+ 3
- 2
weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java View File

@@ -350,7 +350,8 @@ public class ArgsPointcut extends NameBindingPointcut {
}
protected Test findResidueInternal(Shadow shadow, ExposedState state) {
if (arguments.matches(getArgumentsToMatchAgainst(shadow), TypePattern.DYNAMIC).alwaysFalse()) {
ResolvedType[] argsToMatch = getArgumentsToMatchAgainst(shadow);
if (arguments.matches(argsToMatch, TypePattern.DYNAMIC).alwaysFalse()) {
return Literal.FALSE;
}
int ellipsisCount = arguments.ellipsisCount;
@@ -358,7 +359,7 @@ public class ArgsPointcut extends NameBindingPointcut {
return findResidueNoEllipsis(shadow, state, arguments.getTypePatterns());
} else if (ellipsisCount == 1) {
TypePattern[] patternsWithEllipsis = arguments.getTypePatterns();
TypePattern[] patternsWithoutEllipsis = new TypePattern[shadow.getArgCount()];
TypePattern[] patternsWithoutEllipsis = new TypePattern[argsToMatch.length];
int lenWithEllipsis = patternsWithEllipsis.length;
int lenWithoutEllipsis = patternsWithoutEllipsis.length;
// l1+1 >= l0

Loading…
Cancel
Save