@Override protected Test findResidueInternal(Shadow shadow, ExposedState state) { if (annotationTypePattern instanceof BindingAnnotationFieldTypePattern) { if (shadow.getKind() != Shadow.MethodExecution) { shadow.getIWorld() .getMessageHandler()
public String toString() { return getKind() + "(" + getSignature() + ")"; // + getSourceLines(); }
@Override protected FuzzyBoolean matchInternal(Shadow shadow) { if (shadow.getKind() != kind) { return FuzzyBoolean.NO; } if (shadow.getKind() == Shadow.SynchronizationLock && kind == Shadow.SynchronizationLock) { return FuzzyBoolean.YES; } if (shadow.getKind() == Shadow.SynchronizationUnlock && kind == Shadow.SynchronizationUnlock) { return FuzzyBoolean.YES; } if (!signature.matches(shadow.getMatchingSignature(), shadow.getIWorld(), this.kind == Shadow.MethodCall)) { if (kind == Shadow.MethodCall) { warnOnConfusingSig(shadow); // warnOnBridgeMethod(shadow); } return FuzzyBoolean.NO; } return FuzzyBoolean.YES; }
public int getArgCount() { if (getKind() == FieldSet) { return 1; } return getSignature().getParameterTypes().length; }
public String toResolvedString(World world) { StringBuffer sb = new StringBuffer(); sb.append(getKind()); sb.append("("); Member m = getSignature(); if (m == null) { sb.append("<<missing signature>>"); } else { ResolvedMember rm = world.resolve(m); if (rm == null) { sb.append("<<unresolvableMember:").append(m).append(">>"); } else { String genString = rm.toGenericString(); if (genString == null) { sb.append("<<unableToGetGenericStringFor:").append(rm).append(">>"); } else { sb.append(genString); } } } sb.append(")"); return sb.toString(); // was: return getKind() + "(" + world.resolve(getSignature()).toGenericString() + ")"; }
public boolean isShadowForArrayConstructionJoinpoint() { return (getKind() == ConstructorCall && signature.getDeclaringType().isArray()); }
/** * could this(*) pcd ever match */ public final boolean hasThis() { if (getKind().neverHasThis()) { return false; } else if (getKind().isEnclosingKind()) { return !Modifier.isStatic(getSignature().getModifiers()); } else if (enclosingShadow == null) { return false; } else { return enclosingShadow.hasThis(); } }
/** * Do I really match this shadow? XXX implementors need to handle state */ public final FuzzyBoolean match(Shadow shadow) { if (shadow.shadowId == lastMatchedShadowId) { return lastMatchedShadowResult; } FuzzyBoolean ret; // this next test will prevent a lot of un-needed matching going on.... if (shadow.getKind().isSet(couldMatchKinds())) { ret = matchInternal(shadow); } else { ret = FuzzyBoolean.NO; } lastMatchedShadowId = shadow.shadowId; lastMatchedShadowResult = ret; return ret; }
/** * the type of the this object here * * @throws IllegalStateException if there is no this here */ public final UnresolvedType getThisType() { if (!hasThis()) { throw new IllegalStateException("no this"); } if (getKind().isEnclosingKind()) { return getSignature().getDeclaringType(); } else { return enclosingShadow.getThisType(); } }
public UnresolvedType[] getArgTypes() { if (getKind() == FieldSet) { return new UnresolvedType[] { getSignature().getReturnType() }; } return getSignature().getParameterTypes(); }
public UnresolvedType getArgType(int arg) { if (getKind() == FieldSet) { return getSignature().getReturnType(); } return getSignature().getParameterTypes()[arg]; }
if (shadow.getKind() == Shadow.AdviceExecution) { int numExtraArgs = 0; for (int i = 0; i < argumentsToMatchAgainst.length; i++) { argumentsToMatchAgainst = argsSubset; } else if (shadow.getKind() == Shadow.ConstructorExecution) { if (shadow.getMatchingSignature().getParameterTypes().length < argumentsToMatchAgainst.length) {
protected FuzzyBoolean matchInternal(Shadow shadow) { if (shadow.getKind() != Shadow.ExceptionHandler) { return FuzzyBoolean.NO; } exceptionType.resolve(shadow.getIWorld()); // we know we have exactly one parameter since we're checking an exception handler return exceptionType.matches(shadow.getSignature().getParameterTypes()[0].resolve(shadow.getIWorld()), TypePattern.STATIC); }
public UnresolvedType[] getGenericArgTypes() { if (isShadowForArrayConstructionJoinpoint()) { return getArgumentTypesForArrayConstructionShadow(); } if (isShadowForMonitor()) { return UnresolvedType.ARRAY_WITH_JUST_OBJECT; } if (getKind() == FieldSet) { return new UnresolvedType[] { getResolvedSignature().getGenericReturnType() }; } return getResolvedSignature().getGenericParameterTypes(); }
protected boolean checkCanThrow(ShadowMunger munger, ResolvedType resolvedTypeX) { if (getKind() == ExceptionHandler) { // XXX much too lenient rules here, need to walk up exception handlers return true; } if (!isDeclaredException(resolvedTypeX, getSignature())) { getIWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.CANT_THROW_CHECKED, resolvedTypeX, this), // from // advice // in // \ // '" // + // munger // . // + // "\'" // , getSourceLocation(), munger.getSourceLocation()); } return true; }
if (shadow.getKind() == Shadow.SynchronizationUnlock) { if (advice.lastReportedMonitorExitJoinpointLocation == null) {
Shadow.Kind kind = shadow.getKind(); if (kind == Shadow.StaticInitialization) { toMatchAgainst = rMember.getDeclaringType().resolve(shadow.getIWorld());