public UnsupportedPointcutPrimitiveException(String pcExpression, PointcutPrimitive primitive) { super(WeaverMessages.format(WeaverMessages.UNSUPPORTED_POINTCUT_PRIMITIVE,pcExpression,primitive.getName())); this.pointcutExpression = pcExpression; this.unsupportedPrimitive = primitive; }
private IMessage.Kind getMessageKind(String v) { if (v.equals("ignore")) { return null; } else if (v.equals("warning")) { return IMessage.WARNING; } else if (v.equals("error")) { return IMessage.ERROR; } MessageUtil.error(world.getMessageHandler(), WeaverMessages.format(WeaverMessages.XLINT_VALUE_ERROR, v)); return null; }
/** * @param userPointcut */ private void raiseAmbiguityInDisjunctionError(Pointcut userPointcut, List<String> names) { StringBuffer formalNames = new StringBuffer(names.get(0).toString()); for (int i = 1; i < names.size(); i++) { formalNames.append(", "); formalNames.append(names.get(i)); } world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.AMBIGUOUS_BINDING_IN_OR, formalNames), userPointcut .getSourceContext().makeSourceLocation(userPointcut), null); }
/** * @param name * @param userPointcut */ private void raiseUnboundFormalError(String name, Pointcut userPointcut) { world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.UNBOUND_FORMAL, name), userPointcut.getSourceLocation(), null); }
public void setFromMap(Map<String,String> lintOptionsMap) { for (String key: lintOptionsMap.keySet()) { String value = lintOptionsMap.get(key); Kind kind = kinds.get(key); if (kind == null) { MessageUtil.error(world.getMessageHandler(), WeaverMessages.format(WeaverMessages.XLINT_KEY_ERROR, key)); } else { kind.setKind(getMessageKind(value)); } } }
/** * @param userPointcut */ private void raiseNegationBindingError(Pointcut userPointcut) { world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.NEGATION_DOESNT_ALLOW_BINDING), userPointcut .getSourceContext().makeSourceLocation(userPointcut), null); }
protected TypePattern notExactType(IScope s) { s.getMessageHandler().handleMessage( MessageUtil.error(WeaverMessages.format(WeaverMessages.EXACT_TYPE_PATTERN_REQD), getSourceLocation())); return NO; }
public void raiseWarningOnMissingInterfaceWhilstFindingMethods() { if (issuedMissingInterfaceWarning) { return; } String message = WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_INTERFACE_METHODS, getName(), signature); message += "\n" + CompilationAndWeavingContext.getCurrentContext(); world.getLint().cantFindTypeAffectingJoinPointMatch.signal(message, null); // MessageUtil.warn(world.getMessageHandler(),message); issuedMissingInterfaceWarning = true; }
private void raiseCantFindType(String key, String insert) { if (issuedCantFindTypeError) { return; } String message = WeaverMessages.format(key, getName(), insert); message += "\n" + CompilationAndWeavingContext.getCurrentContext(); world.getLint().cantFindType.signal(message, null); // MessageUtil.error(world.getMessageHandler(),message); issuedCantFindTypeError = true; }
@Override public TypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType) { // check that hasmember type patterns are allowed! if (!scope.getWorld().isHasMemberSupportEnabled()) { String msg = WeaverMessages.format(WeaverMessages.HAS_MEMBER_NOT_ENABLED, this.toString()); scope.message(IMessage.ERROR, this, msg); } signaturePattern.resolveBindings(scope, bindings); return this; }
protected void resolveBindings(IScope scope, Bindings bindings) { if (!scope.getWorld().isInJava5Mode()) { scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.ATWITHINCODE_ONLY_SUPPORTED_AT_JAVA5_LEVEL), getSourceLocation())); return; } annotationTypePattern = (ExactAnnotationTypePattern) annotationTypePattern.resolveBindings(scope, bindings, true); // must be either a Var, or an annotation type pattern }
private void signalError(String msgid, BcelClassWeaver weaver, UnresolvedType onType) { IMessage msg = MessageUtil.error(WeaverMessages.format(msgid, onType.getName()), getSourceLocation()); weaver.getWorld().getMessageHandler().handleMessage(msg); }
private void verifyRuntimeRetention(World world, ResolvedType resolvedAnnotationType) { if (!resolvedAnnotationType.isAnnotationWithRuntimeRetention()) { // default is class visibility // default is class visibility IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.BINDING_NON_RUNTIME_RETENTION_ANNOTATION, annotationType.getName()), getSourceLocation()); world.getMessageHandler().handleMessage(m); resolved = false; } }
private void verifyRuntimeRetention(ResolvedType rAnnotationType) { if (!(rAnnotationType.isAnnotationWithRuntimeRetention())) { IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.BINDING_NON_RUNTIME_RETENTION_ANNOTATION, rAnnotationType.getName()), getSourceLocation()); rAnnotationType.getWorld().getMessageHandler().handleMessage(m); } }
protected void verifyIsAnnotationType(ResolvedType type, IScope scope) { if (!type.isAnnotation()) { IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.REFERENCE_TO_NON_ANNOTATION_TYPE, type.getName()), getSourceLocation()); scope.getWorld().getMessageHandler().handleMessage(m); resolved = false; } }
public void check(World world) { if (getSignature().getDeclaringType().resolve(world).isAspect()) { world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.ITD_CONS_ON_ASPECT), getSignature() .getSourceLocation(), null); } }
public void resolveBindings(IScope scope, Bindings bindings) { typePattern = typePattern.resolveBindings(scope, bindings, false, false); // look for parameterized type patterns which are not supported... HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor visitor = new HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor(); typePattern.traverse(visitor, null); if (visitor.wellHasItThen/* ? */()) { scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.WITHIN_PCD_DOESNT_SUPPORT_PARAMETERS), getSourceLocation())); } }
@Override public void resolveBindings(IScope scope, Bindings bindings) { typePattern = typePattern.resolveBindings(scope, bindings, true, true); // look for parameterized type patterns which are not supported... HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor visitor = new HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor(); typePattern.traverse(visitor, null); if (visitor.wellHasItThen/* ? */()) { scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.THIS_AND_TARGET_DONT_SUPPORT_PARAMETERS), getSourceLocation())); } // ??? handle non-formal }
@Override public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) { if (isDeclare(bindings.getEnclosingAdvice())) { // Enforce rule about which designators are supported in declare inAspect.getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.IF_IN_DECLARE), bindings.getEnclosingAdvice().getSourceLocation(), null); return Pointcut.makeMatchesNothing(Pointcut.CONCRETE); } return makeIfFalsePointcut(state); }
protected Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) { if (isDeclare(bindings.getEnclosingAdvice())) { // Enforce rule about which designators are supported in declare inAspect.getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.ARGS_IN_DECLARE), bindings.getEnclosingAdvice().getSourceLocation(), null); return Pointcut.makeMatchesNothing(Pointcut.CONCRETE); } AnnotationPatternList list = arguments.resolveReferences(bindings); Pointcut ret = new ArgsAnnotationPointcut(list); ret.copyLocationFrom(this); return ret; }