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

Method getComponentType

output/java_guava/1.4.18/Types.java:189–216  ·  view source on GitHub ↗
(Type type)

Source from the content-addressed store, hash-verified

187 }
188
189 @Nullable
190 static Type getComponentType(Type type) {
191 checkNotNull(type);
192
193 final AtomicReference<Type> result = new AtomicReference<Type>();
194 new TypeVisitor() {
195 @Override
196 void visitTypeVariable(TypeVariable<?> t) {
197 result.set(subtypeOfComponentType(t.getBounds()));
198 }
199
200 @Override
201 void visitWildcardType(WildcardType t) {
202 result.set(subtypeOfComponentType(t.getUpperBounds()));
203 }
204
205 @Override
206 void visitGenericArrayType(GenericArrayType t) {
207 result.set(t.getGenericComponentType());
208 }
209
210 @Override
211 void visitClass(Class<?> t) {
212 result.set(t.getComponentType());
213 }
214 }.visit(type);
215 return result.get();
216 }
217
218 /**
219 * 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