Browse Source

Test and fix for PR103740: Compiler failure on @annotation

tags/preDefaultReweavable
aclement 18 years ago
parent
commit
2ae4f531c7

+ 16
- 0
tests/bugs150/pr103740/AroundAdvice.aj View File

@@ -0,0 +1,16 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)
public @interface AroundAdvice { }

aspect ErrorHandling {
before(): !@annotation(AroundAdvice) && execution(* C.*(..)) { }
}

class C {
public static void m1() {}
@AroundAdvice public static void m2() {}
public void m3() {}
@AroundAdvice public void m4() {}
}

+ 6
- 2
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java View File

@@ -405,11 +405,15 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
public void testSuperCallInITD() {
runTest("super call in ITD");
}
public void testSuperCallInITDPart2() {
runTest("super call in ITD - part 2");
}

public void testAtAnnotationBadTest_pr103740() {
runTest("Compiler failure on at_annotation");
}
public void testNoUnusedParameterWarningsForSyntheticAdviceArgs() {
runTest("no unused parameter warnings for synthetic advice args");
}

+ 7
- 0
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml View File

@@ -548,6 +548,13 @@
</compile>
</ajc-test>
<ajc-test dir="bugs150/pr103740" pr="103740" title="Compiler failure on at_annotation">
<compile files="AroundAdvice.aj" options="-1.5,-showWeaveInfo">
<message kind="weave" text="Join point 'method-execution(void C.m1())' in Type 'C' (AroundAdvice.aj:12) advised by before advice from 'ErrorHandling' (AroundAdvice.aj:8)"/>
<message kind="weave" text="Join point 'method-execution(void C.m3())' in Type 'C' (AroundAdvice.aj:14) advised by before advice from 'ErrorHandling' (AroundAdvice.aj:8)"/>
</compile>
</ajc-test>

<!-- ============================================================================ -->
<!-- ============================================================================ -->

+ 5
- 5
weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java View File

@@ -185,9 +185,6 @@ public class AnnotationPointcut extends NameBindingPointcut {
* @see org.aspectj.weaver.patterns.Pointcut#findResidue(org.aspectj.weaver.Shadow, org.aspectj.weaver.patterns.ExposedState)
*/
protected Test findResidueInternal(Shadow shadow, ExposedState state) {



if (annotationTypePattern instanceof BindingAnnotationTypePattern) {
BindingAnnotationTypePattern btp = (BindingAnnotationTypePattern)annotationTypePattern;
@@ -212,8 +209,11 @@ public class AnnotationPointcut extends NameBindingPointcut {
state.setErroneousVar(btp.getFormalIndex());
}
state.set(btp.getFormalIndex(),var);
}
return Literal.TRUE;
}
if (matchInternal(shadow).alwaysTrue())
return Literal.TRUE;
else
return Literal.FALSE;
}

/* (non-Javadoc)

Loading…
Cancel
Save