From ee5a8c8347a8d1638d7ca65783d96d17950bc016 Mon Sep 17 00:00:00 2001 From: jhugunin Date: Tue, 7 Jan 2003 23:20:37 +0000 Subject: [PATCH] the type declared soft must be a subtype of Throwable --- .../org/aspectj/weaver/patterns/DeclareSoft.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/weaver/src/org/aspectj/weaver/patterns/DeclareSoft.java b/weaver/src/org/aspectj/weaver/patterns/DeclareSoft.java index c249340e4..5306a16fe 100644 --- a/weaver/src/org/aspectj/weaver/patterns/DeclareSoft.java +++ b/weaver/src/org/aspectj/weaver/patterns/DeclareSoft.java @@ -15,7 +15,10 @@ package org.aspectj.weaver.patterns; import java.io.*; +import org.aspectj.bridge.IMessage; import org.aspectj.weaver.ISourceContext; +import org.aspectj.weaver.ResolvedTypeX; +import org.aspectj.weaver.TypeX; public class DeclareSoft extends Declare { private TypePattern exception; @@ -78,6 +81,17 @@ public class DeclareSoft extends Declare { public void resolve(IScope scope) { exception = exception.resolveBindings(scope, null, false, true); + TypeX excType = exception.getExactType(); + if (excType != ResolvedTypeX.MISSING) { + if (!scope.getWorld().resolve(TypeX.THROWABLE).isAssignableFrom(excType)) { + scope.getWorld().showMessage(IMessage.ERROR, + excType.getName() + " is not a subtype of Throwable", + exception.getSourceLocation(), null); + pointcut = Pointcut.makeMatchesNothing(Pointcut.RESOLVED); + return; + } + } + pointcut = pointcut.resolve(scope); } -- 2.39.5