]> source.dussan.org Git - aspectj.git/commitdiff
239539: test and fix: better message when cannot override pointcut due to it not...
authoraclement <aclement>
Wed, 20 Aug 2008 18:56:50 +0000 (18:56 +0000)
committeraclement <aclement>
Wed, 20 Aug 2008 18:56:50 +0000 (18:56 +0000)
weaver/src/org/aspectj/weaver/ResolvedType.java
weaver/src/org/aspectj/weaver/WeaverMessages.java
weaver/src/org/aspectj/weaver/weaver-messages.properties

index a1ce07fa72fcc9468caa36c48631eee7cb4bcfa8..8bf8b117d25547ec9522c174a16c74e9667e7d2c 100644 (file)
@@ -1882,6 +1882,15 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
                                if (!isVisible(existing.getModifiers(),
                                        existing.getDeclaringType().resolve(getWorld()),
                                        this)) {
+                                       // if they intended to override it but it is not visible, give them a nicer message
+                                       if (existing.isAbstract() && conflictingSignature(existing,toAdd)) {
+                                               getWorld().showMessage(
+                                                               IMessage.ERROR,
+                                                               WeaverMessages.format(WeaverMessages.POINTCUT_NOT_VISIBLE,
+                                                                               existing.getDeclaringType().getName() + "." + existing.getName()+"()", this.getName()),
+                                                               toAdd.getSourceLocation(),null);
+                                               j.remove();
+                                       }
                                        continue;
                                }
                                if (conflictingSignature(existing, toAdd)) {
index 00b2e1f019b7c7dc59ffe9e843b741c3ef7086c3..5e86794a4457850710b7fac3d9bcb629478e3e16 100644 (file)
@@ -24,6 +24,7 @@ public class WeaverMessages {
        public static final String THIS_OR_TARGET_IN_DECLARE = "thisOrTargetInDeclare";
        public static final String ABSTRACT_POINTCUT = "abstractPointcut";
        public static final String POINCUT_NOT_CONCRETE = "abstractPointcutNotMadeConcrete";
+       public static final String POINTCUT_NOT_VISIBLE = "pointcutNotVisible";
        public static final String CONFLICTING_INHERITED_POINTCUTS = "conflictingInheritedPointcuts";
        public static final String CIRCULAR_POINTCUT = "circularPointcutDeclaration";
        public static final String CANT_FIND_POINTCUT = "cantFindPointcut";
index 77c9b003190e01f0235e0d05f56fc9e645ea7e6d..eced71a424b73617452b1cbbf04da36732b82c02 100644 (file)
@@ -23,6 +23,7 @@ conflictingInheritedPointcuts=conflicting inherited pointcuts in {0}
 circularPointcutDeclaration=circular pointcut declaration involving: {0}
 cantFindPointcut=can''t find pointcut ''{0}'' on {1}
 exactTypePatternRequired=exact type pattern required
+pointcutNotVisible=pointcut ''{0}'' is not visible from type ''{1}'' - cannot override
 cantBindType=can''t bind type name ''{0}''
 wildcardTypePatternNotAllowed=wildcard type pattern not allowed, must use type name
 fieldCantBeVoid=fields cannot have a void type