Sometimes it's needed to hook lots of different methods (about 50 in my case), so only one XposedInterface.Hooker class isn't enough, because dispatching between hooked methods will be ugly. Having anonymous implementation of XposedInterface.Hooker is more convenient, but it's now impossible:
hook(method, new @XposedHooker Hooker() {
@BeforeInvocation
public static @Nullable Hooker before(@NonNull Member member, @Nullable Object thisObject, @NonNull Object[] args) {
// Do something
return null;
}
}.getClass());
will not compile because of '@XposedHooker' not applicable to type use
It's also a bit problematic to create return value of before method as anonymous classes don't have constructors.
Another problem is that some methods need to be skipped (because of their side effects), and now it's also impossible.
So maybe before and after methods should include new parameter, which will contain functions returnAndSkip, setThrowable and others?