private static String getStaticInitializationSignatureString(Member m, World world) { StringBuffer buf = new StringBuffer(); buf.append(makeString(m.getModifiers(world))); buf.append('-'); // buf.append(getName()); buf.append('-'); buf.append(makeString(m.getDeclaringType())); buf.append('-'); return buf.toString(); }
/** * the type of the target object here * * @throws IllegalStateException if there is no target here */ public final UnresolvedType getTargetType() { if (!hasTarget()) { throw new IllegalStateException("no target"); } return getSignature().getDeclaringType(); }
protected static String getConstructorSignatureString(Member m, World world) { StringBuffer buf = new StringBuffer(); buf.append(makeString(m.getModifiers(world))); buf.append('-'); buf.append('-'); buf.append(makeString(m.getDeclaringType())); buf.append('-'); buf.append(makeString(m.getParameterTypes())); buf.append('-'); buf.append(makeString(m.getParameterNames(world))); buf.append('-'); buf.append(makeString(m.getExceptions(world))); buf.append('-'); return buf.toString(); }
public static Shadow makeInitializationShadow(World inWorld, Constructor forConstructor, MatchingContext withContext) { Kind kind = Shadow.Initialization; Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(forConstructor, inWorld); ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld); return new ReflectionShadow(inWorld, kind, signature, null, enclosingType, null, withContext); }
public static Shadow makePreInitializationShadow(World inWorld, Constructor forConstructor, MatchingContext withContext) { Kind kind = Shadow.PreInitialization; Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(forConstructor, inWorld); ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld); return new ReflectionShadow(inWorld, kind, signature, null, enclosingType, null, withContext); }
public static Shadow makeExecutionShadow(World inWorld, java.lang.reflect.Member forMethod, MatchingContext withContext) { Kind kind = (forMethod instanceof Method) ? Shadow.MethodExecution : Shadow.ConstructorExecution; Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(forMethod, inWorld); ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld); return new StandardShadow(inWorld, kind, signature, null, enclosingType, null, withContext); }
public static Shadow makeAdviceExecutionShadow(World inWorld, java.lang.reflect.Method forMethod, MatchingContext withContext) { Kind kind = Shadow.AdviceExecution; Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedAdviceMember(forMethod, inWorld); ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld); return new StandardShadow(inWorld, kind, signature, null, enclosingType, null, withContext); }
public static Shadow makeStaticInitializationShadow(World inWorld, Class forType, MatchingContext withContext) { Member signature = ReflectionBasedReferenceTypeDelegateFactory.createStaticInitMember(forType, inWorld); ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld); Kind kind = Shadow.StaticInitialization; return new StandardShadow(inWorld, kind, signature, null, enclosingType, null, withContext); }
public static Shadow makeExecutionShadow(World inWorld, java.lang.reflect.Member forMethod, MatchingContext withContext) { Kind kind = (forMethod instanceof Method) ? Shadow.MethodExecution : Shadow.ConstructorExecution; Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(forMethod, inWorld); ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld); return new ReflectionShadow(inWorld, kind, signature, null, enclosingType, null, withContext); }
public static Shadow makeStaticInitializationShadow(World inWorld, Class forType, MatchingContext withContext) { Member signature = ReflectionBasedReferenceTypeDelegateFactory.createStaticInitMember(forType, inWorld); ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld); Kind kind = Shadow.StaticInitialization; return new ReflectionShadow(inWorld, kind, signature, null, enclosingType, null, withContext); }
public static Shadow makePreInitializationShadow(World inWorld, Constructor forConstructor, MatchingContext withContext) { Kind kind = Shadow.PreInitialization; Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(forConstructor, inWorld); ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld); return new StandardShadow(inWorld, kind, signature, null, enclosingType, null, withContext); }
public static Shadow makeAdviceExecutionShadow(World inWorld, java.lang.reflect.Method forMethod, MatchingContext withContext) { Kind kind = Shadow.AdviceExecution; Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedAdviceMember(forMethod, inWorld); ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld); return new ReflectionShadow(inWorld, kind, signature, null, enclosingType, null, withContext); }
public static ResolvedMember inlineAccessMethodForFieldSet(UnresolvedType aspectType, Member field) { String sig; if (Modifier.isStatic(field.getModifiers())) { sig = "(" + field.getReturnType().getSignature() + ")V"; } else { sig = "(" + field.getDeclaringType().getSignature() + field.getReturnType().getSignature() + ")V"; } return new ResolvedMemberImpl(Member.METHOD, aspectType, PUBLIC_STATIC, // Modifier.PUBLIC | (field.isStatic() ? // Modifier.STATIC : 0), NameMangler.inlineAccessMethodForFieldSet(field.getName(), field.getDeclaringType(), aspectType), sig); }
public static ResolvedMember inlineAccessMethodForFieldGet(UnresolvedType aspectType, Member field) { String sig; if (Modifier.isStatic(field.getModifiers())) { sig = "()" + field.getReturnType().getSignature(); } else { sig = "(" + field.getDeclaringType().getSignature() + ")" + field.getReturnType().getSignature(); } return new ResolvedMemberImpl(Member.METHOD, aspectType, PUBLIC_STATIC, // Modifier.PUBLIC | (field.isStatic() ? // Modifier.STATIC : 0), NameMangler.inlineAccessMethodForFieldGet(field.getName(), field.getDeclaringType(), aspectType), sig); }
public static Instruction createGet(InstructionFactory fact, Member signature) { short kind; if (Modifier.isStatic(signature.getModifiers())) { kind = Constants.GETSTATIC; } else { kind = Constants.GETFIELD; } return fact.createFieldAccess(signature.getDeclaringType().getName(), signature.getName(), BcelWorld.makeBcelType(signature.getReturnType()), kind); }
/** * Checks for suppression specified on the member or on the declaring type of that member */ public static boolean isSuppressing(Member member, String lintkey) { boolean isSuppressing = Utils.isSuppressing(member.getAnnotations(), lintkey); if (isSuppressing) { return true; } UnresolvedType type = member.getDeclaringType(); if (type instanceof ResolvedType) { return Utils.isSuppressing(((ResolvedType) type).getAnnotations(), lintkey); } return false; }
public static Instruction createSet(InstructionFactory fact, Member signature) { short kind; if (Modifier.isStatic(signature.getModifiers())) { kind = Constants.PUTSTATIC; } else { kind = Constants.PUTFIELD; } return fact.createFieldAccess(signature.getDeclaringType().getName(), signature.getName(), BcelWorld.makeBcelType(signature.getReturnType()), kind); }
@Override public final boolean equals(Object other) { if (!(other instanceof Member)) { return false; } Member o = (Member) other; return (getKind() == o.getKind() && getName().equals(o.getName()) && getSignature().equals(o.getSignature()) && getDeclaringType() .equals(o.getDeclaringType())); }
/** * Create an invoke instruction * * @param fact * @param kind INVOKEINTERFACE, INVOKEVIRTUAL.. * @param member * @return */ public static Instruction createInvoke(InstructionFactory fact, short kind, Member member) { return fact.createInvoke(member.getDeclaringType().getName(), member.getName(), BcelWorld.makeBcelType(member.getReturnType()), BcelWorld.makeBcelTypes(member.getParameterTypes()), kind); }
@Override public ShadowMunger parameterizeWith(ResolvedType declaringType, Map<String, UnresolvedType> typeVariableMap) { Pointcut pc = getPointcut().parameterizeWith(typeVariableMap, declaringType.getWorld()); BcelAdvice ret = null; Member adviceSignature = signature; // allows for around advice where the return value is a type variable (see pr115250) if (signature instanceof ResolvedMember && signature.getDeclaringType().isGenericType()) { adviceSignature = ((ResolvedMember) signature).parameterizedWith(declaringType.getTypeParameters(), declaringType, declaringType.isParameterizedType()); } ret = new BcelAdvice(this.attribute, pc, adviceSignature, this.concreteAspect); return ret; }