summaryrefslogtreecommitdiff
path: root/java/lang/Void.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/lang/Void.java')
-rw-r--r--java/lang/Void.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/java/lang/Void.java b/java/lang/Void.java
index 14268c78..8311ea8c 100644
--- a/java/lang/Void.java
+++ b/java/lang/Void.java
@@ -44,13 +44,24 @@ class Void {
* The {@code Class} object representing the pseudo-type corresponding to
* the keyword {@code void}.
*/
- // BEGIN Android-changed: Avoid use of removed Class.getPrimitiveClass method.
- // public static final Class<Void> TYPE = (Class<Void>) Class.getPrimitiveClass("void");
public static final Class<Void> TYPE = lookupType();
+ // Android-changed: Upstream code would use reflection to establish the value of "void.class".
+ // ART makes a native call instead because the reflection approach could lead to initialization
+ // of TYPE with the current, i.e. uninitialized, value of TYPE due to other Android changes.
@dalvik.annotation.optimization.FastNative
private static native Class<Void> lookupType();
- // END Android-changed: Avoid use of removed Class.getPrimitiveClass method.
+ /*
+ @SuppressWarnings("unchecked")
+ private static Class<Void> lookupType() {
+ try {
+ Method method = Runnable.class.getMethod("run", EmptyArray.CLASS);
+ return (Class<Void>) method.getReturnType();
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+ */
/*
* The Void class cannot be instantiated.