byte-buddy
byte-buddy copied to clipboard
can not match lamda method
When I need to do an target code usage search for all the methods in a certain class. I can't match to the lamda method, so some object codes cannot be replaced. Is there any way I can match to the lambda method.
ex: memberSubstitution.on(isMethod())
@raphw
This would require to match a invokedynamic instruction. This is not possible today, but could be added.
This is how we do it now: @raphw
// byte buddy will ignore the method which is lambda. replace method need search all method(include lambda).
private void removeIgnoredMethods(DynamicType.Builder<?> builder) {
try {
if (ignoredMethods == null) {
ignoredMethods = DynamicType.Builder.AbstractBase.Adapter.class.getDeclaredField("ignoredMethods");
ignoredMethods.setAccessible(true);
}
ignoredMethods.set(builder, new LatentMatcher.Resolved<MethodDescription>(none()));
} catch (Exception e) {
LogManager.warn("removeIgnoredMethods", e);
}
}