summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Hao <jeffhao@google.com>2014-04-24 16:06:08 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-04-24 16:06:08 +0000
commitd413447f8639ed0b3606ef86bf9bac1319e204ad (patch)
treee8a306e41fc0ec79b2aadc2d02b34e62d599f6a6
parent940ad9d1b5c89c5db932c7865ffec4ffb872c82b (diff)
parent793b9ef91876cb7bea31ddf74f110ac45302f1dd (diff)
downloadlibcore-d413447f8639ed0b3606ef86bf9bac1319e204ad.zip
libcore-d413447f8639ed0b3606ef86bf9bac1319e204ad.tar.gz
libcore-d413447f8639ed0b3606ef86bf9bac1319e204ad.tar.bz2
Merge "Fix Class.newInstance to not wrap its exceptions."
-rw-r--r--libart/src/main/java/java/lang/Class.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/libart/src/main/java/java/lang/Class.java b/libart/src/main/java/java/lang/Class.java
index ea41d6e..c66b01a 100644
--- a/libart/src/main/java/java/lang/Class.java
+++ b/libart/src/main/java/java/lang/Class.java
@@ -62,6 +62,7 @@ import libcore.reflect.Types;
import libcore.util.BasicLruCache;
import libcore.util.CollectionUtils;
import libcore.util.EmptyArray;
+import libcore.util.SneakyThrow;
/**
* The in-memory representation of a Java class. This representation serves as
@@ -1568,11 +1569,10 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe
throw new IllegalAccessException(init + " is not accessible from " + caller);
}
try {
- return init.newInstance(null, init.isAccessible());
+ return init.newInstance(null, init.isAccessible());
} catch (InvocationTargetException e) {
- InstantiationException t = new InstantiationException(this);
- t.initCause(e);
- throw t;
+ SneakyThrow.sneakyThrow(e.getCause());
+ return null; // Unreachable.
}
}