@Override
 public List<LightweightTypeReference> getTypeArguments() {
   if (lowerBound != null) return lowerBound.getTypeArguments();
   if (upperBounds != null && upperBounds.size() == 1) {
     return upperBounds.get(0).getTypeArguments();
   }
   return super.getTypeArguments();
 }
Пример #2
0
 /* @Nullable */
 private ArrayTypeReference doTryConvertToArray(ParameterizedTypeReference typeReference) {
   LightweightTypeReference parameterizedIterable = typeReference.getSuperType(Iterable.class);
   if (parameterizedIterable != null) {
     ITypeReferenceOwner owner = typeReference.getOwner();
     if (parameterizedIterable.isRawType()) {
       // return Object[]
       List<LightweightTypeReference> superTypes = parameterizedIterable.getSuperTypes();
       if (superTypes.isEmpty()) {
         return null;
       }
       LightweightTypeReference objectType = superTypes.get(0);
       ArrayTypeReference array = owner.newArrayTypeReference(objectType);
       return array;
     } else {
       LightweightTypeReference componentType =
           parameterizedIterable.getTypeArguments().get(0).getUpperBoundSubstitute();
       ArrayTypeReference array = owner.newArrayTypeReference(componentType);
       return array;
     }
   }
   return null;
 }