From f23f00a13a1bda593c24bef33c691a950501c1fa Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 24 May 2011 11:15:18 +0900 Subject: [PATCH] Fix reflection method invokation Either of Method.invoke, Field.get and Field.set can accept null as receiver. Change-Id: I4539dcc95a794f6ee84cf4e7aabf4e8f0206728f --- java/src/com/android/inputmethod/compat/CompatUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java/src/com/android/inputmethod/compat/CompatUtils.java b/java/src/com/android/inputmethod/compat/CompatUtils.java index 0b532f7f0..10b2a106f 100644 --- a/java/src/com/android/inputmethod/compat/CompatUtils.java +++ b/java/src/com/android/inputmethod/compat/CompatUtils.java @@ -108,7 +108,7 @@ public class CompatUtils { public static Object invoke( Object receiver, Object defaultValue, Method method, Object... args) { - if (receiver == null || method == null) return defaultValue; + if (method == null) return defaultValue; try { return method.invoke(receiver, args); } catch (IllegalArgumentException e) { @@ -124,7 +124,7 @@ public class CompatUtils { } public static Object getFieldValue(Object receiver, Object defaultValue, Field field) { - if (receiver == null || field == null) return defaultValue; + if (field == null) return defaultValue; try { return field.get(receiver); } catch (IllegalArgumentException e) { @@ -137,7 +137,7 @@ public class CompatUtils { } public static void setFieldValue(Object receiver, Field field, Object value) { - if (receiver == null || field == null) return; + if (field == null) return; try { field.set(receiver, value); } catch (IllegalArgumentException e) {