/** * Creates a stack manipulation that loads a method constant onto the operand stack using an {@link AccessController}. * * @param methodDescription The method to be loaded onto the stack. * @return A stack manipulation that assigns a method constant for the given method description. */ public static CanCache ofPrivileged(MethodDescription.InDefinedShape methodDescription) { if (methodDescription.isTypeInitializer()) { return CanCacheIllegal.INSTANCE; } else if (methodDescription.isConstructor()) { return new ForConstructor(methodDescription).privileged(); } else { return new ForMethod(methodDescription).privileged(); } }
/** * Creates a stack manipulation that loads a method constant onto the operand stack. * * @param methodDescription The method to be loaded onto the stack. * @return A stack manipulation that assigns a method constant for the given method description. */ public static CanCache of(MethodDescription.InDefinedShape methodDescription) { if (methodDescription.isTypeInitializer()) { return CanCacheIllegal.INSTANCE; } else if (methodDescription.isConstructor()) { return new ForConstructor(methodDescription); } else { return new ForMethod(methodDescription); } }