public UnresolvedType[] getExceptions() { return realMember.getExceptions(); }
public UnresolvedType[] getExceptions(World world) { return realMember.getExceptions(world); }
public UnresolvedType[] getExceptions(World world) { ResolvedMember resolved = resolve(world); if (resolved == null) { reportDidntFindMember(world); return UnresolvedType.NONE; } return resolved.getExceptions(); }
public static ResolvedMember interConstructor(ResolvedType targetType, ResolvedMember constructor, UnresolvedType aspectType) { // // ResolvedType targetType, // UnresolvedType[] argTypes, // int modifiers) // { ResolvedMember ret = new ResolvedMemberImpl(Member.CONSTRUCTOR, targetType, Modifier.PUBLIC, UnresolvedType.VOID, "<init>", constructor.getParameterTypes(), constructor.getExceptions()); // System.out.println("ret: " + ret + " mods: " + Modifier.toString(modifiers)); if (Modifier.isPublic(constructor.getModifiers())) { return ret; } while (true) { ret = addCookieTo(ret, aspectType); if (targetType.lookupMemberNoSupers(ret) == null) { return ret; } } }
public static ResolvedMember superAccessMethod(UnresolvedType baseType, ResolvedMember method) { UnresolvedType[] paramTypes = method.getParameterTypes(); // if (!method.isStatic()) { // paramTypes = UnresolvedType.insert(method.getDeclaringType(), paramTypes); // } return new ResolvedMemberImpl(Member.METHOD, baseType, Modifier.PUBLIC, method.getReturnType(), NameMangler.superDispatchMethod(baseType, method.getName()), paramTypes, method.getExceptions()); }
@Override public Collection<ResolvedType> getThrownExceptions() { if (thrownExceptions == null) { // ??? can we really lump in Around here, how does this interact with Throwable if (concreteAspect != null && concreteAspect.getWorld() != null && // null tests for test harness (getKind().isAfter() || getKind() == AdviceKind.Before || getKind() == AdviceKind.Around)) { World world = concreteAspect.getWorld(); ResolvedMember m = world.resolve(signature); if (m == null) { thrownExceptions = Collections.emptyList(); } else { thrownExceptions = collectCheckedExceptions(m.getExceptions()); } } else { thrownExceptions = Collections.emptyList(); } } return thrownExceptions; }
protected static LazyMethodGen makeBridgeMethod(LazyClassGen gen, ResolvedMember member) { // remove abstract modifier int mods = member.getModifiers(); if (Modifier.isAbstract(mods)) { mods = mods - Modifier.ABSTRACT; } LazyMethodGen ret = new LazyMethodGen(mods, BcelWorld.makeBcelType(member.getReturnType()), member.getName(), BcelWorld.makeBcelTypes(member.getParameterTypes()), UnresolvedType.getNames(member.getExceptions()), gen); // 43972 : Static crosscutting makes interfaces unusable for javac // ret.makeSynthetic(); return ret; }
public static ResolvedMember privilegedAccessMethodForMethod(UnresolvedType aspectType, ResolvedMember method) { return new ResolvedMemberImpl(Member.METHOD, method.getDeclaringType(), Modifier.PUBLIC | (Modifier.isStatic(method.getModifiers()) ? Modifier.STATIC : 0), method.getReturnType(), NameMangler.privilegedAccessMethodForMethod(method.getName(), method.getDeclaringType(), aspectType), method.getParameterTypes(), method.getExceptions()); }
public static ResolvedMember inlineAccessMethodForMethod(UnresolvedType aspectType, ResolvedMember method) { UnresolvedType[] paramTypes = method.getParameterTypes(); if (!Modifier.isStatic(method.getModifiers())) { paramTypes = UnresolvedType.insert(method.getDeclaringType(), paramTypes); } return new ResolvedMemberImpl(Member.METHOD, aspectType, PUBLIC_STATIC, // ??? what about privileged and super access // ???Modifier.PUBLIC | (method.isStatic() ? Modifier.STATIC : 0), method.getReturnType(), NameMangler.inlineAccessMethodForMethod(method.getName(), method.getDeclaringType(), aspectType), paramTypes, method.getExceptions()); }
private static ResolvedMember addCookieTo(ResolvedMember ret, UnresolvedType aspectType) { UnresolvedType[] params = ret.getParameterTypes(); UnresolvedType[] freshParams = UnresolvedType.add(params, aspectType); return new ResolvedMemberImpl(ret.getKind(), ret.getDeclaringType(), ret.getModifiers(), ret.getReturnType(), ret.getName(), freshParams, ret.getExceptions()); }
protected LazyMethodGen makeMethodGen(LazyClassGen gen, ResolvedMember member) { try { Type returnType = BcelWorld.makeBcelType(member.getReturnType()); Type[] parameterTypes = BcelWorld.makeBcelTypes(member.getParameterTypes()); LazyMethodGen ret = new LazyMethodGen(member.getModifiers(), returnType, member.getName(), parameterTypes, UnresolvedType.getNames(member .getExceptions()), gen); // 43972 : Static crosscutting makes interfaces unusable for javac // ret.makeSynthetic(); return ret; } catch (ClassFormatException cfe) { throw new RuntimeException("Problem with makeMethodGen for method "+member.getName()+" in type "+gen.getName()+" ret="+member.getReturnType(),cfe); } }
/** * This static method goes on the declaring aspect of the inter-type method. The implementation calls the interMethodBody() * method on the aspect. */ public static ResolvedMember interMethodDispatcher(ResolvedMember meth, UnresolvedType aspectType) { UnresolvedType[] paramTypes = meth.getParameterTypes(); if (!Modifier.isStatic(meth.getModifiers())) { paramTypes = UnresolvedType.insert(meth.getDeclaringType(), paramTypes); } ResolvedMemberImpl rmi = new ResolvedMemberImpl(Member.METHOD, aspectType, PUBLIC_STATIC, meth.getReturnType(), NameMangler.interMethodDispatcher(aspectType, meth.getDeclaringType(), meth.getName()), paramTypes, meth.getExceptions()); rmi.setParameterNames(meth.getParameterNames()); rmi.setTypeVariables(meth.getTypeVariables()); return rmi; }
/** * Sometimes the intertyped method requires a bridge method alongside it. For example if the method 'N SomeI<N>.m()' is put onto * an interface 'interface I<N extends Number>' and then a concrete implementation is 'class C implements I<Float>' then the ITD * on the interface will be 'Number m()', whereas the ITD on the 'topmostimplementor' will be 'Float m()'. A bridge method needs * to be created in the topmostimplementor 'Number m()' that delegates to 'Float m()' */ public static ResolvedMember bridgerToInterMethod(ResolvedMember meth, UnresolvedType aspectType) { int modifiers = makePublicNonFinal(meth.getModifiers()); ResolvedMemberImpl rmi = new ResolvedMemberImpl(Member.METHOD, aspectType, modifiers, meth.getReturnType(), NameMangler.interMethod(meth.getModifiers(), aspectType, meth.getDeclaringType(), meth.getName()), meth.getParameterTypes(), meth.getExceptions()); rmi.setTypeVariables(meth.getTypeVariables()); return rmi; }
/** * This method goes on the target type of the inter-type method. (and possibly the topmost-implementors, if the target type is * an interface). The implementation will call the interMethodDispatch method on the aspect. */ public static ResolvedMember interMethod(ResolvedMember meth, UnresolvedType aspectType, boolean onInterface) { if (Modifier.isPublic(meth.getModifiers()) && !onInterface) { return meth; } int modifiers = makePublicNonFinal(meth.getModifiers()); if (onInterface) { modifiers |= Modifier.ABSTRACT; } ResolvedMemberImpl rmi = new ResolvedMemberImpl(Member.METHOD, meth.getDeclaringType(), modifiers, meth.getReturnType(), NameMangler.interMethod(meth.getModifiers(), aspectType, meth.getDeclaringType(), meth.getName()), meth.getParameterTypes(), meth.getExceptions()); rmi.setParameterNames(meth.getParameterNames()); rmi.setTypeVariables(meth.getTypeVariables()); return rmi; }
/** * This method goes on the declaring aspect of the inter-type method. It contains the real body of the ITD method. */ public static ResolvedMember interMethodBody(ResolvedMember meth, UnresolvedType aspectType) { UnresolvedType[] paramTypes = meth.getParameterTypes(); if (!Modifier.isStatic(meth.getModifiers())) { paramTypes = UnresolvedType.insert(meth.getDeclaringType(), paramTypes); } int modifiers = PUBLIC_STATIC; if (Modifier.isStrict(meth.getModifiers())) { modifiers |= Modifier.STRICT; } ResolvedMemberImpl rmi = new ResolvedMemberImpl(Member.METHOD, aspectType, modifiers, meth.getReturnType(), NameMangler.interMethodBody(aspectType, meth.getDeclaringType(), meth.getName()), paramTypes, meth.getExceptions()); rmi.setParameterNames(meth.getParameterNames()); rmi.setTypeVariables(meth.getTypeVariables()); return rmi; }
/** * This method goes on the target type of the inter-type method. (and possibly the topmost-implementors, if the target type is * an interface). The implementation will call the interMethodDispatch method on the aspect. */ public static ResolvedMember interMethodBridger(ResolvedMember meth, UnresolvedType aspectType, boolean onInterface) { // if (Modifier.isPublic(meth.getModifiers()) && !onInterface) // return meth; int modifiers = makePublicNonFinal(meth.getModifiers()) | BRIDGE; if (onInterface) { modifiers |= Modifier.ABSTRACT; } ResolvedMemberImpl rmi = new ResolvedMemberImpl(Member.METHOD, meth.getDeclaringType(), modifiers, meth.getReturnType(), NameMangler.interMethod(meth.getModifiers(), aspectType, meth.getDeclaringType(), meth.getName()), meth.getParameterTypes(), meth.getExceptions()); rmi.setTypeVariables(meth.getTypeVariables()); return rmi; }
.getExceptions()), onGen); InstructionList body = mg.getBody();
ResolvedType[] childExceptions = world.resolve(child.getExceptions()); ResolvedType[] parentExceptions = world.resolve(parent.getExceptions()); ResolvedType runtimeException = world.resolve("java.lang.RuntimeException"); ResolvedType error = world.resolve("java.lang.Error");
BcelWorld.makeBcelTypesAsClassNames(introduced.getExceptions()), gen);