MCPcopy Create free account
hub / github.com/antlr/codebuff / defaultValue

Method defaultValue

corpus/java/training/guava/base/Defaults.java:62–68  ·  view source on GitHub ↗

Returns the default value of type as defined by JLS --- 0 for numbers, false for boolean and '\0' for char. For non-primitive types and void, null is returned.

(Class<T> type)

Source from the content-addressed store, hash-verified

60 * {@code void}, {@code null} is returned.
61 */
62 @Nullable
63 public static <T> T defaultValue(Class<T> type) {
64 // Primitives.wrap(type).cast(...) would avoid the warning, but we can't use that from here
65 @SuppressWarnings("unchecked") // the put method enforces this key-value relationship
66 T t = (T) DEFAULTS.get(checkNotNull(type));
67 return t;
68 }
69}

Callers

nothing calls this directly

Calls 2

getMethod · 0.65
checkNotNullMethod · 0.45

Tested by

no test coverage detected