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

Method getComponentType

output/java_guava/1.4.19/Types.java:188–215  ·  view source on GitHub ↗
(Type type)

Source from the content-addressed store, hash-verified

186 }
187
188 @Nullable
189 static Type getComponentType(Type type) {
190 checkNotNull(type);
191
192 final AtomicReference<Type> result = new AtomicReference<Type>();
193 new TypeVisitor() {
194 @Override
195 void visitTypeVariable(TypeVariable<?> t) {
196 result.set(subtypeOfComponentType(t.getBounds()));
197 }
198
199 @Override
200 void visitWildcardType(WildcardType t) {
201 result.set(subtypeOfComponentType(t.getUpperBounds()));
202 }
203
204 @Override
205 void visitGenericArrayType(GenericArrayType t) {
206 result.set(t.getGenericComponentType());
207 }
208
209 @Override
210 void visitClass(Class<?> t) {
211 result.set(t.getComponentType());
212 }
213 }.visit(type);
214 return result.get();
215 }
216
217 /**
218 * Returns {@code ? extends X} if any of {@code bounds} is a subtype of {@code X[]}; or null

Callers 5

getComponentTypeMethod · 0.95
visitGenericArrayTypeMethod · 0.95
visitClassMethod · 0.45
usedInGenericTypeMethod · 0.45

Calls 3

visitMethod · 0.65
getMethod · 0.65
checkNotNullMethod · 0.45

Tested by

no test coverage detected