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

Method TypeToken

output/java_guava/1.4.17/TypeToken.java:119–124  ·  view source on GitHub ↗

Constructs a new type token of T. Clients create an empty anonymous subclass. Doing so embeds the type parameter in the anonymous class's type hierarchy so we can reconstitute it at runtime despite erasure. For example: {@code TypeToken > t = new TypeToken<List<

()

Source from the content-addressed store, hash-verified

117
118
119 protected TypeToken() {
120 this.runtimeType = capture();
121 checkState(!(runtimeType instanceof TypeVariable),
122 "Cannot construct a TypeToken for a type variable.\n"
123 + "You probably meant to call new TypeToken<%s>(getClass()) " + "that can resolve the type variable for you.\n" + "If you do need to create a TypeToken of a type variable, " + "please use TypeToken.of() instead.", runtimeType);
124 }
125
126 /**
127 * Constructs a new type token of {@code T} while resolving free type variables in the context of

Callers

nothing calls this directly

Calls 5

ofMethod · 0.95
captureMethod · 0.45
checkStateMethod · 0.45
resolveTypeMethod · 0.45
checkNotNullMethod · 0.45

Tested by

no test coverage detected