protected TypePattern notExactType(IScope s) { s.getMessageHandler().handleMessage( MessageUtil.error(WeaverMessages.format(WeaverMessages.EXACT_TYPE_PATTERN_REQD), getSourceLocation())); return NO; }
private int matchingIndex(ResolvedType a) { ensureResolved(); int knownMatch = -1; int starMatch = -1; for (int i = 0, len = patterns.size(); i < len; i++) { TypePattern p = patterns.get(i); if (p.isStar()) { starMatch = i; } else if (p.matchesStatically(a)) { if (knownMatch != -1) { a.getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.MULTIPLE_MATCHES_IN_PRECEDENCE, a, patterns.get(knownMatch), p), patterns.get(knownMatch).getSourceLocation(), p.getSourceLocation()); return -1; } else { knownMatch = i; } } } if (knownMatch == -1) { return starMatch; } else { return knownMatch; } }
if (seenStar) { scope.getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.TWO_STARS_IN_PRECEDENCE), pi.getSourceLocation(), null); && !exactType.isTypeVariableReference()) { scope.getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.CLASSES_IN_PRECEDENCE, exactType.getName()), pi.getSourceLocation(), null); scope.getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.TWO_PATTERN_MATCHES_IN_PRECEDENCE, exactType.getName()), pi.getSourceLocation(), pj.getSourceLocation());
@Override public void resolve(IScope scope) { exception = exception.resolveBindings(scope, null, false, true); ResolvedType excType = exception.getExactType().resolve(scope.getWorld()); if (!excType.isMissing()) { if (excType.isTypeVariableReference()) { TypeVariableReferenceType typeVariableRT = (TypeVariableReferenceType) excType; // a declare soft in a generic abstract aspect, we need to check the upper bound // WIBBLE excType = typeVariableRT.getTypeVariable().getFirstBound().resolve(scope.getWorld()); } if (!scope.getWorld().getCoreType(UnresolvedType.THROWABLE).isAssignableFrom(excType)) { scope.getWorld() .showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.NOT_THROWABLE, excType.getName()), exception.getSourceLocation(), null); pointcut = Pointcut.makeMatchesNothing(Pointcut.RESOLVED); return; } // ENH 42743 suggests that we don't soften runtime exceptions. if (scope.getWorld().getCoreType(UnresolvedType.RUNTIME_EXCEPTION).isAssignableFrom(excType)) { scope.getWorld().getLint().runtimeExceptionNotSoftened.signal(new String[] { excType.getName() }, exception .getSourceLocation(), null); pointcut = Pointcut.makeMatchesNothing(Pointcut.RESOLVED); return; } } pointcut = pointcut.resolve(scope); }