Browse Source

proper error checks for around advice return type compatibility with join points

tags/V_1_1_b5
jhugunin 21 years ago
parent
commit
91d9045736
1 changed files with 14 additions and 6 deletions
  1. 14
    6
      weaver/src/org/aspectj/weaver/Advice.java

+ 14
- 6
weaver/src/org/aspectj/weaver/Advice.java View File

getSourceLocation(), shadow.getSourceLocation()); getSourceLocation(), shadow.getSourceLocation());
return false; return false;
} else { } else {
if (!getSignature().getReturnType().isConvertableFrom(shadow.getReturnType(), world)) {
//System.err.println(getSignature().getReturnType() + " from " + shadow.getReturnType());
if (getSignature().getReturnType() == ResolvedTypeX.VOID) {
if (shadow.getReturnType() != ResolvedTypeX.VOID) {
world.showMessage(IMessage.ERROR,
"applying to join point that doesn't return void: " + shadow,
getSourceLocation(), shadow.getSourceLocation());
return false;
}
} else if (getSignature().getReturnType().equals(TypeX.OBJECT)) {
return true;
} else if(!shadow.getReturnType().isAssignableFrom(getSignature().getReturnType(), world)) {
//System.err.println(this + ", " + sourceContext + ", " + start); //System.err.println(this + ", " + sourceContext + ", " + start);
world.getMessageHandler().handleMessage(
MessageUtil.error("incompatible return type applying to " + shadow,
getSourceLocation()));
//XXX need a crosscutting error message here
world.showMessage(IMessage.ERROR,
"incompatible return type applying to " + shadow,
getSourceLocation(), shadow.getSourceLocation());
return false; return false;
} }
} }

Loading…
Cancel
Save