]> source.dussan.org Git - aspectj.git/commitdiff
better error message for trying declare parents on Object
authorjhugunin <jhugunin>
Mon, 19 May 2003 20:51:44 +0000 (20:51 +0000)
committerjhugunin <jhugunin>
Mon, 19 May 2003 20:51:44 +0000 (20:51 +0000)
weaver/src/org/aspectj/weaver/patterns/DeclareParents.java

index efc8bf69b36db8d267543a26e8385836d99bcb08..7a66631b00906d36f1abb079bd7d1519851bb03f 100644 (file)
@@ -113,12 +113,18 @@ public class DeclareParents extends Declare {
                if (typePattern == TypePattern.NO) return null;  // already had an error here
                TypeX iType = typePattern.getExactType();
                ResolvedTypeX parentType = iType.resolve(world);
+               
+               if (targetType.equals(world.resolve(TypeX.OBJECT))) {
+                       world.showMessage(IMessage.ERROR, "can't change the parents of java.lang.Object",
+                                         this.getSourceLocation(), null);
+                       return null;
+               }
                        
                if (parentType.isAssignableFrom(targetType)) return null;  // already a parent
                                        
                if (targetType.isAssignableFrom(parentType)) {
                        world.showMessage(IMessage.ERROR,
-                               "type can not extend itself", this.getSourceLocation(), null
+                               "type \'" + targetType.getName() + "\'can not extend itself", this.getSourceLocation(), null
                        );
                        return null;
                }