diff options
author | jhugunin <jhugunin> | 2003-01-08 02:15:21 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2003-01-08 02:15:21 +0000 |
commit | 91d9045736aa5705ad0289c0209474bac205aab7 (patch) | |
tree | 23f0cc30fe2bb61f9ecaa6f67a697debc6f370f6 /weaver | |
parent | 14783484fbcb2151328592cee51531449fc03cb0 (diff) | |
download | aspectj-91d9045736aa5705ad0289c0209474bac205aab7.tar.gz aspectj-91d9045736aa5705ad0289c0209474bac205aab7.zip |
proper error checks for around advice return type compatibility with join points
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/Advice.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/weaver/src/org/aspectj/weaver/Advice.java b/weaver/src/org/aspectj/weaver/Advice.java index cb6a4d5bc..b0b1023bd 100644 --- a/weaver/src/org/aspectj/weaver/Advice.java +++ b/weaver/src/org/aspectj/weaver/Advice.java @@ -112,13 +112,21 @@ public abstract class Advice extends ShadowMunger { getSourceLocation(), shadow.getSourceLocation()); return false; } 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); - - 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; } } |