summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2019-02-23 01:10:32 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-02-23 01:10:32 +0000
commit3f9eff103e93d55fa26e16b067fb88b4c511f6aa (patch)
treea3111058531fcb25fb1c3b53e671501ac9c975e2
parentb8d804f074c905bdb27cb8c12aae078e45eae32c (diff)
parentc74a113d2831f82bd9eb86bf22572aa334f92625 (diff)
Merge "Re-throw reflective exceptions"
-rw-r--r--core/java/android/view/inspector/GeneratedInspectionCompanionProvider.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/java/android/view/inspector/GeneratedInspectionCompanionProvider.java b/core/java/android/view/inspector/GeneratedInspectionCompanionProvider.java
index 8faae1f1da98..d4b7e858bebd 100644
--- a/core/java/android/view/inspector/GeneratedInspectionCompanionProvider.java
+++ b/core/java/android/view/inspector/GeneratedInspectionCompanionProvider.java
@@ -40,8 +40,15 @@ public class GeneratedInspectionCompanionProvider implements InspectionCompanion
final Class<InspectionCompanion<T>> companionClass =
(Class<InspectionCompanion<T>>) cls.getClassLoader().loadClass(companionName);
return companionClass.newInstance();
- } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
+ } catch (ClassNotFoundException e) {
return null;
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (InstantiationException e) {
+ Throwable cause = e.getCause();
+ if (cause instanceof RuntimeException) throw (RuntimeException) cause;
+ if (cause instanceof Error) throw (Error) cause;
+ throw new RuntimeException(cause);
}
}
}