]> source.dussan.org Git - aspectj.git/commitdiff
the type declared soft must be a subtype of Throwable
authorjhugunin <jhugunin>
Tue, 7 Jan 2003 23:20:37 +0000 (23:20 +0000)
committerjhugunin <jhugunin>
Tue, 7 Jan 2003 23:20:37 +0000 (23:20 +0000)
weaver/src/org/aspectj/weaver/patterns/DeclareSoft.java

index c249340e402ac855d863c7b0134d1c24874b04d3..5306a16fe3a4f37037cb7e1dfa07322f8773357c 100644 (file)
@@ -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);     
     }