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); }
@SuppressWarnings("rawtypes") public void setFromProperties(Properties properties) { for (Iterator i = properties.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry) i.next(); Kind kind = kinds.get(entry.getKey()); if (kind == null) { MessageUtil.error(world.getMessageHandler(), WeaverMessages.format(WeaverMessages.XLINT_KEY_ERROR, entry.getKey())); } else { kind.setKind(getMessageKind((String) entry.getValue())); } } }
/** * @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); }
private void raiseAmbiguousBindingError(String name, Pointcut pointcut) { world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.AMBIGUOUS_BINDING, name), pointcut .getSourceContext().makeSourceLocation(pointcut), null); }
public List<ConcreteTypeMunger> getTypeMungers(ResolvedType onType) { World world = onType.getWorld(); List<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>(); for (Entry entry : typeMungers) { ResolvedType aspectType = world.resolve(entry.aspectType, true); if (aspectType.isMissing()) { world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.ASPECT_NEEDED, entry.aspectType, onType), onType.getSourceLocation(), null); continue; } ret.add(new TemporaryTypeMunger(entry.typeMunger, aspectType)); } return ret; }
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; }
public void raiseWarningOnJoinPointSignature(String signature) { if (issuedJoinPointWarning) { return; } String message = WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_JOINPOINT, getName(), signature); message += "\n" + CompilationAndWeavingContext.getCurrentContext(); world.getLint().cantFindTypeAffectingJoinPointMatch.signal(message, null); // MessageUtil.warn(world.getMessageHandler(),message); issuedJoinPointWarning = 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; }
/** * Special resolution for "core" types like OBJECT. These are resolved just like any other type, but if they are not found it is * more serious and we issue an error message immediately. */ // OPTIMIZE streamline path for core types? They are just simple types, // could look straight in the typemap? public ResolvedType getCoreType(UnresolvedType tx) { ResolvedType coreTy = resolve(tx, true); if (coreTy.isMissing()) { MessageUtil.error(messageHandler, WeaverMessages.format(WeaverMessages.CANT_FIND_CORE_TYPE, tx.getName())); } return coreTy; }
@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; } }
@Override public TypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType) { if (requireExactType) { scope.getWorld().getMessageHandler().handleMessage( MessageUtil.error(WeaverMessages.format(WeaverMessages.WILDCARD_NOT_ALLOWED), getSourceLocation())); return NO; } return super.resolveBindings(scope, bindings, allowBinding, requireExactType); }
@Override protected void resolveBindings(IScope scope, Bindings bindings) { if (!scope.getWorld().isInJava5Mode()) { scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.ATWITHIN_ONLY_SUPPORTED_AT_JAVA5_LEVEL), getSourceLocation())); return; } annotationTypePattern = annotationTypePattern.resolveBindings(scope, bindings, true); // must be either a Var, or an annotation type pattern }