From: aclement Date: Wed, 20 Aug 2008 18:56:50 +0000 (+0000) Subject: 239539: test and fix: better message when cannot override pointcut due to it not... X-Git-Tag: V162DEV_M1~114 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9e8236201e7e67f5add224e61c915bab82eb4273;p=aspectj.git 239539: test and fix: better message when cannot override pointcut due to it not being visible --- diff --git a/weaver/src/org/aspectj/weaver/ResolvedType.java b/weaver/src/org/aspectj/weaver/ResolvedType.java index a1ce07fa7..8bf8b117d 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedType.java +++ b/weaver/src/org/aspectj/weaver/ResolvedType.java @@ -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)) { diff --git a/weaver/src/org/aspectj/weaver/WeaverMessages.java b/weaver/src/org/aspectj/weaver/WeaverMessages.java index 00b2e1f01..5e86794a4 100644 --- a/weaver/src/org/aspectj/weaver/WeaverMessages.java +++ b/weaver/src/org/aspectj/weaver/WeaverMessages.java @@ -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"; diff --git a/weaver/src/org/aspectj/weaver/weaver-messages.properties b/weaver/src/org/aspectj/weaver/weaver-messages.properties index 77c9b0031..eced71a42 100644 --- a/weaver/src/org/aspectj/weaver/weaver-messages.properties +++ b/weaver/src/org/aspectj/weaver/weaver-messages.properties @@ -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