captureNullable(parameterizedType.getOwnerType()),
(Class<?>) parameterizedType.getRawType(),
capture(parameterizedType.getActualTypeArguments()));
}
if (type instanceof WildcardType) {
WildcardType wildcardType = (WildcardType) type;
Type[] lowerBounds = wildcardType.getLowerBounds();
if (lowerBounds.length == 0) { // ? extends something changes to capture-of
Type[] upperBounds = wildcardType.getUpperBounds();
String name = "capture#" + id.incrementAndGet() + "-of ? extends "
+ Joiner.on('&').join(upperBounds);
return Types.newArtificialTypeVariable(
WildcardCapturer.class, name, wildcardType.getUpperBounds());
} else {
// TODO(benyu): handle ? super T somehow.
return type;
}
}