Returns the array type of componentType.
(Type componentType)
| 66 | /** Returns the array type of {@code componentType}. */ |
| 67 | |
| 68 | static Type newArrayType(Type componentType) { |
| 69 | if (componentType instanceof WildcardType) { |
| 70 | WildcardType wildcard = (WildcardType) componentType; |
| 71 | Type[] lowerBounds = wildcard.getLowerBounds(); |
| 72 | checkArgument(lowerBounds.length <= 1, "Wildcard cannot have more than one lower bounds."); |
| 73 | if (lowerBounds.length == 1) { |
| 74 | return supertypeOf(newArrayType(lowerBounds[0])); |
| 75 | } else { |
| 76 | Type[] upperBounds = wildcard.getUpperBounds(); |
| 77 | checkArgument(upperBounds.length == 1, "Wildcard should have only one upper bound."); |
| 78 | return subtypeOf(newArrayType(upperBounds[0])); |
| 79 | } |
| 80 | } |
| 81 | return JavaVersion.CURRENT.newArrayType(componentType); |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * Returns a type where {@code rawType} is parameterized by {@code arguments} and is owned by |
no test coverage detected