Skip to content

Commit 5c10696

Browse files
fix: fix this from within Types
1 parent 2328665 commit 5c10696

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

google-http-client/src/main/java/com/google/api/client/util/Data.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ public class Data {
9191
/** The single instance of the magic null object for a {@link DateTime}. */
9292
public static final DateTime NULL_DATE_TIME = new DateTime(0);
9393

94-
/** The single instance of the magic null object for a {@link Object}. */
95-
public static final Object NULL_OBJECT = new Object();
96-
9794
/** Cache of the magic null object for the given Java class. */
9895
private static final ConcurrentHashMap<Class<?>, Object> NULL_CACHE =
9996
new ConcurrentHashMap<Class<?>, Object>();
@@ -112,7 +109,6 @@ public class Data {
112109
NULL_CACHE.put(BigInteger.class, NULL_BIG_INTEGER);
113110
NULL_CACHE.put(BigDecimal.class, NULL_BIG_DECIMAL);
114111
NULL_CACHE.put(DateTime.class, NULL_DATE_TIME);
115-
NULL_CACHE.put(Object.class, NULL_OBJECT);
116112
}
117113

118114
/**

google-http-client/src/main/java/com/google/api/client/util/Types.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ public static boolean isAssignableToOrFrom(Class<?> classToCheck, Class<?> anoth
106106
* an array or an interface or be abstract. If an enclosing class, it must be static.
107107
*/
108108
public static <T> T newInstance(Class<T> clazz) {
109+
// This is a workaround for https://github.com/oracle/graal/issues/11429. Remove this line once
110+
// the GraalVM team has provided a solution or workaround for this.
111+
if (clazz.getName().equals("java.lang.Object")) {
112+
return new Object();
113+
}
114+
109115
// TODO(yanivi): investigate "sneaky" options for allocating the class that GSON uses, like
110116
// setting the constructor to be accessible, or possibly provide a factory method of a special
111117
// name

0 commit comments

Comments
 (0)