summaryrefslogtreecommitdiff
path: root/android/arch/lifecycle/ClassesInfoCache.java
diff options
context:
space:
mode:
Diffstat (limited to 'android/arch/lifecycle/ClassesInfoCache.java')
-rw-r--r--android/arch/lifecycle/ClassesInfoCache.java16
1 files changed, 2 insertions, 14 deletions
diff --git a/android/arch/lifecycle/ClassesInfoCache.java b/android/arch/lifecycle/ClassesInfoCache.java
index d88e2762..f077daed 100644
--- a/android/arch/lifecycle/ClassesInfoCache.java
+++ b/android/arch/lifecycle/ClassesInfoCache.java
@@ -46,7 +46,7 @@ class ClassesInfoCache {
return mHasLifecycleMethods.get(klass);
}
- Method[] methods = getDeclaredMethods(klass);
+ Method[] methods = klass.getDeclaredMethods();
for (Method method : methods) {
OnLifecycleEvent annotation = method.getAnnotation(OnLifecycleEvent.class);
if (annotation != null) {
@@ -64,18 +64,6 @@ class ClassesInfoCache {
return false;
}
- private Method[] getDeclaredMethods(Class klass) {
- try {
- return klass.getDeclaredMethods();
- } catch (NoClassDefFoundError e) {
- throw new IllegalArgumentException("The observer class has some methods that use "
- + "newer APIs which are not available in the current OS version. Lifecycles "
- + "cannot access even other methods so you should make sure that your "
- + "observer classes only access framework classes that are available "
- + "in your min API level OR use lifecycle:compiler annotation processor.", e);
- }
- }
-
CallbackInfo getInfo(Class klass) {
CallbackInfo existing = mCallbackMap.get(klass);
if (existing != null) {
@@ -118,7 +106,7 @@ class ClassesInfoCache {
}
}
- Method[] methods = declaredMethods != null ? declaredMethods : getDeclaredMethods(klass);
+ Method[] methods = declaredMethods != null ? declaredMethods : klass.getDeclaredMethods();
boolean hasLifecycleMethods = false;
for (Method method : methods) {
OnLifecycleEvent annotation = method.getAnnotation(OnLifecycleEvent.class);