String thrownFormal = getStringLiteralFor("throwing",ajAnnotations.adviceAnnotation,throwingLocation);
if (thrownFormal != null) {
Argument[] arguments = methodDeclaration.arguments;
- if (methodDeclaration.arguments != null
- && !toArgumentNames(methodDeclaration.arguments).contains(thrownFormal)) {
+ if (!toArgumentNames(methodDeclaration.arguments).contains(thrownFormal)) {
methodDeclaration.scope.problemReporter()
.signalError(methodDeclaration.sourceStart,methodDeclaration.sourceEnd,"throwing formal '" + thrownFormal + "' must be declared as a parameter in the advice signature");
- } else {
- methodDeclaration.scope.problemReporter()
- .signalError(methodDeclaration.sourceStart,methodDeclaration.sourceEnd,"throwing formal '" + thrownFormal + "' must be declared as a parameter in the advice signature");
}
}
}
int[] throwingLocation = new int[2];
String returningFormal = getStringLiteralFor("returning",ajAnnotations.adviceAnnotation,throwingLocation);
if (returningFormal != null) {
- if (methodDeclaration.arguments.length > 0
- && !toArgumentNames(methodDeclaration.arguments).contains(returningFormal)) {
+ if (!toArgumentNames(methodDeclaration.arguments).contains(returningFormal)) {
methodDeclaration.scope.problemReporter()
.signalError(methodDeclaration.sourceStart,methodDeclaration.sourceEnd,"returning formal '" + returningFormal + "' must be declared as a parameter in the advice signature");
- } else {
- methodDeclaration.scope.problemReporter()
- .signalError(methodDeclaration.sourceStart,methodDeclaration.sourceEnd,"returning formal '" + returningFormal + "' must be declared as a parameter in the advice signature");
}
}
}
log("perTarget");
}
- public void xtestPerTarget() {
+ public void testPerTarget() {
s_log = new StringBuffer();
perTarget();
assertEquals("AOP.perTarget perTarget ", s_log.toString());
log("perCflow");
}
- public void xtestPerCflow() throws Throwable {
+ public void testPerCflow() throws Throwable {
s_log = new StringBuffer();
// no aspect bound yet
assertEquals(2, PerClauseTestAspects.TestAspectPerCflow.s_count);
}
- public void xtestPerTypeWithin() {
+ public void testPerTypeWithin() {
assertTrue(Aspects.hasAspect(PerClauseTestAspects.TestAspectPTW.class, PTW1.class));
assertTrue(Aspects.hasAspect(PerClauseTestAspects.TestAspectPTW.class, PTW2.class));
assertFalse(Aspects.hasAspect(PerClauseTestAspects.TestAspectPTW.class, PTWNoMatch.class));
runTest("BindingTest no inline");
}
- //FIXME AV 2005-09 - commented as perthis(this(Type)) fails for now as of #108488
public void testPerClause() {
- //runTest("PerClause");
+ runTest("PerClause");
}
public void testAroundInlineMunger_XnoInline() {
//pertarget(target(Foo)) => Foo+ for type pattern matching
//perthis(this(Foo)) => Foo+ for type pattern matching
// TODO AV - we do like a deep copy by parsing it again.. quite dirty, would need a clean deep copy
- TypePattern copy = new PatternParser(node.getType().toString()).parseTypePattern();
+ TypePattern copy = new PatternParser(node.getType().toString().replace('$', '.')).parseTypePattern();
+ // TODO AV - see dirty replace from $ to . here as inner classes are with $ instead (#108488)
copy.includeSubtypes = true;
return copy;
} else {
UnresolvedType typeToMatch = isThis ? shadow.getThisType() : shadow.getTargetType();
//if (typeToMatch == ResolvedType.MISSING) return FuzzyBoolean.NO;
- return type.matches(typeToMatch.resolve(shadow.getIWorld()), TypePattern.DYNAMIC);
+ return type.matches(typeToMatch.resolve(shadow.getIWorld()), TypePattern.DYNAMIC);//AVPT was DYNAMIC
}
public void write(DataOutputStream s) throws IOException {
*/
public FuzzyBoolean matchesInstanceof(ResolvedType type) {
//XXX hack to let unmatched types just silently remain so
- if (maybeGetSimpleName() != null) return FuzzyBoolean.NO;
+ if (maybeGetSimpleName() != null) return
+ FuzzyBoolean.NO;
type.getWorld().getMessageHandler().handleMessage(
new Message("can't do instanceof matching on patterns with wildcards",