private Type searchTypePath(Type type, TypeAnnotationState typeAnnotationState) { PathElementStack elements = typeAnnotationState.pathElements; PathElement element = elements.pop(); if (element == null) { return type; } switch (element.kind) { case ARRAY: { ArrayType arrayType = type.asArrayType(); int dimensions = arrayType.dimensions(); while (--dimensions > 0 && elements.size() > 0 && elements.peek().kind == PathElement.Kind.ARRAY) { elements.pop(); } assert dimensions == 0; return searchTypePath(arrayType.component(), typeAnnotationState); } case PARAMETERIZED: { ParameterizedType parameterizedType = type.asParameterizedType(); return searchTypePath(parameterizedType.argumentsArray()[element.pos], typeAnnotationState); } case WILDCARD_BOUND: { return searchTypePath(type.asWildcardType().bound(), typeAnnotationState); } case NESTED: { int depth = popNestedDepth(elements); return searchNestedType(type, depth, typeAnnotationState); } } throw new IllegalStateException("Unknown path element"); }
Type bound = resolveTypePath(wildcardType.bound(), typeAnnotationState); return intern(wildcardType.copyType(bound));
break; case WILDCARD_TYPE: addType(type.asWildcardType().bound()); break; case PARAMETERIZED_TYPE:
WildcardType wildcardType = type.asWildcardType(); stream.writePackedU32(wildcardType.isExtends() ? 1 : 0); writeReference(stream, wildcardType.bound(), false); break; case PARAMETERIZED_TYPE: