EventBus icon indicating copy to clipboard operation
EventBus copied to clipboard

why not use method but the string of method name in SubscriberMethodInfo

Open CoddZhang opened this issue 6 years ago • 1 comments

if use method can avoid using Java reflection, i think.

protected SubscriberMethod createSubscriberMethod(String methodName, Class<?> eventType, ThreadMode threadMode,
                                                      int priority, boolean sticky) {
        try {
           _###  **Method method = subscriberClass.getDeclaredMethod(methodName, eventType);**_
            return new SubscriberMethod(method, eventType, threadMode, priority, sticky);
        } catch (NoSuchMethodException e) {
            throw new EventBusException("Could not find subscriber method in " + subscriberClass +
                    ". Maybe a missing ProGuard rule?", e);
        }
    }

CoddZhang avatar May 10 '19 10:05 CoddZhang

even use Method..it is still invoke on Runtime ... so it's still use reflection

sunreview avatar Mar 16 '23 08:03 sunreview