Is there any way how to debug / print method signatures that were matched by ElementMatchers in transformation class?
Example implementation:
public class InterruptionTransformer implements Plugin {
@Override
public boolean matches(TypeDescription target) {
return true;
}
@Nonnull
@Override
public DynamicType.Builder<?> apply(
DynamicType.Builder<?> builder,
@Nonnull TypeDescription typeDescription,
@Nonnull ClassFileLocator classFileLocator
) {
return builder.method(
ElementMatchers.isAnnotatedWith(Interruptible.class)
.or(ElementMatchers.isOverriddenFrom(ElementMatchers.isAnnotatedWith(Interruptible.class)))
.and(ElementMatchers.not(ElementMatchers.isAbstract()))
)
.intercept(Advice.to(InterruptionAdvice.class));
}
@Override
public void close() {
// No resources to release
}
public static class InterruptionAdvice {
@Advice.OnMethodEnter
public static void onMethodEnter() {
if (Thread.currentThread().isInterrupted()) {
throw new RuntimeException("Thread interrupted");
}
}
}
}
So that it’s clear during the build time to which classes / methods the part from the aspect got really injected?
This question is related to: Maven plugin instead of javaagent for Byte Buddy?