@Override public int dimensions() { return getType().dimensions(); }
private static String getBindingKey(ArrayType type) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < type.dimensions(); i++) { sb.append('['); } sb.append(getGeneralTypeBindingKey(type.component())); return null; }
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"); }
case ARRAY: { ArrayType arrayType = type.asArrayType(); int dimensions = arrayType.dimensions(); while (--dimensions > 0 && elements.size() > 0 && elements.peek().kind == PathElement.Kind.ARRAY) { elements.pop(); nested = resolveTypePath(nested, typeAnnotationState); return intern(arrayType.copyType(nested, arrayType.dimensions() - dimensions));
case ARRAY: ArrayType arrayType = type.asArrayType(); stream.writePackedU32(arrayType.dimensions()); writeReference(stream, arrayType.component(), false); // TODO - full should not be necessary break;