/** * {@inheritDoc} */ public MethodList<?> getInstrumentedMethods() { return new MethodList.Explicit<MethodDescription>(new ArrayList<MethodDescription>(implementations.keySet())).filter(not(isTypeInitializer())); }
/** * {@inheritDoc} */ public MethodList<?> getInstrumentedMethods() { return new MethodList.Explicit<MethodDescription>(new ArrayList<MethodDescription>(implementations.keySet())).filter(not(isTypeInitializer())); }
/** * Matches a method against its internal name such that constructors and type initializers are matched appropriately. * * @param internalName The internal name of the method. * @param <T> The type of the matched object. * @return A matcher for a method with the provided internal name. */ public static <T extends MethodDescription> ElementMatcher.Junction<T> hasMethodName(String internalName) { if (MethodDescription.CONSTRUCTOR_INTERNAL_NAME.equals(internalName)) { return isConstructor(); } else if (MethodDescription.TYPE_INITIALIZER_INTERNAL_NAME.equals(internalName)) { return isTypeInitializer(); } else { return named(internalName); } }
private static ForDeclaredMethods getDeclaredMethodMemberSubstitution() { // this should only be called if the security manager is enabled, thus the privileged calls return MemberSubstitution.relaxed() .method( ElementMatchers.is( AccessController.doPrivileged( new GetDeclaredMethodAction( Class.class, "getDeclaredMethod", String.class, Class[].class ) ) ) ) .replaceWith( AccessController.doPrivileged( new GetDeclaredMethodAction( HibernateMethodLookupDispatcher.class, "getDeclaredMethod", Class.class, String.class, Class[].class ) ) ) .on( ElementMatchers.isTypeInitializer() ); }
private static ForDeclaredMethods getMethodMemberSubstitution() { // this should only be called if the security manager is enabled, thus the privileged calls return MemberSubstitution.relaxed() .method( ElementMatchers.is( AccessController.doPrivileged( new GetDeclaredMethodAction( Class.class, "getMethod", String.class, Class[].class ) ) ) ) .replaceWith( AccessController.doPrivileged( new GetDeclaredMethodAction( HibernateMethodLookupDispatcher.class, "getMethod", Class.class, String.class, Class[].class ) ) ) .on( ElementMatchers.isTypeInitializer() ); }
Class.forName(byteBuddy.subclass(Object.class) .name(String.format("%s$%s$%d", source.getName(), "MockitoModuleProbe", Math.abs(random.nextInt()))) .invokable(isTypeInitializer()).intercept(implementation) .make() .load(source.getClassLoader(), loader.resolveStrategy(source, source.getClassLoader(), false))
protected ElementMatcher.Junction<MethodDescription> getMethodElementMatcher() { return not(isConstructor()) .and(not(isAbstract())) .and(not(isNative())) .and(not(isFinal())) .and(not(isSynthetic())) .and(not(isTypeInitializer())) .and(getExtraMethodElementMatcher()); }
private static ForDeclaredMethods getDeclaredMethodMemberSubstitution() { // this should only be called if the security manager is enabled, thus the privileged calls return MemberSubstitution.relaxed() .method( ElementMatchers.is( AccessController.doPrivileged( new GetDeclaredMethodAction( Class.class, "getDeclaredMethod", String.class, Class[].class ) ) ) ) .replaceWith( AccessController.doPrivileged( new GetDeclaredMethodAction( HibernateMethodLookupDispatcher.class, "getDeclaredMethod", Class.class, String.class, Class[].class ) ) ) .on( ElementMatchers.isTypeInitializer() ); }
private static ForDeclaredMethods getMethodMemberSubstitution() { // this should only be called if the security manager is enabled, thus the privileged calls return MemberSubstitution.relaxed() .method( ElementMatchers.is( AccessController.doPrivileged( new GetDeclaredMethodAction( Class.class, "getMethod", String.class, Class[].class ) ) ) ) .replaceWith( AccessController.doPrivileged( new GetDeclaredMethodAction( HibernateMethodLookupDispatcher.class, "getMethod", Class.class, String.class, Class[].class ) ) ) .on( ElementMatchers.isTypeInitializer() ); }
.and(not(isNative())) .and(not(isSynthetic())) .and(not(isTypeInitializer()));
.to(staticProxyAdvice(className)).on( isStatic() .and(not(isTypeInitializer())) .and(not(isConstructor())) ))