private void resolveTypeList(ArrayList<Type> list) { int size = list.size(); for (int i = 0; i < size; i++) { Type type = resolveType(list.get(i)); if (type != null) { list.set(i, type); typeParameters.put(type.asTypeVariable().identifier(), type.asTypeVariable()); } } }
private TypeVariable resolveBounds(Type type) { TypeVariable typeVariable = type.asTypeVariable(); Type[] bounds = typeVariable.boundArray(); for (int i = 0; i < bounds.length; i++) { Type newType = resolveType(bounds[i]); if (newType != null && newType != bounds[i]) { typeVariable = typeVariable.copyType(i, newType); } } return typeVariable; }
/** * @param i * @return * @throws SerianalyzerException */ static String makeSignature ( MethodInfo i, boolean fix ) throws SerianalyzerException { StringBuilder sb = new StringBuilder(); sb.append('('); ClassInfo declaringImpl = i.declaringClass(); if ( fix && "<init>".equals(i.name()) && declaringImpl.nestingType() == NestingType.INNER ) { //$NON-NLS-1$ // there seems to be some sort of bug, missing the the outer instance parameter in the constructor if ( !Modifier.isStatic(declaringImpl.flags()) ) { org.jboss.jandex.Type enclosingClass = org.jboss.jandex.Type.create(declaringImpl.enclosingClass(), Kind.CLASS); org.jboss.jandex.Type firstArg = i.parameters().size() > 0 ? i.parameters().get(0) : null; if ( firstArg instanceof TypeVariable ) { firstArg = firstArg.asTypeVariable().bounds().get(0); } if ( firstArg == null || !firstArg.equals(enclosingClass) ) { sb.append(toString(enclosingClass)); } } } for ( org.jboss.jandex.Type p : i.parameters() ) { sb.append(toString(p)); } sb.append(')'); sb.append(toString(i.returnType())); return sb.toString(); }
public static IJavaType wrap(Type type) { switch (type.kind()) { case ARRAY: return new ArrayTypeWrapper(type.asArrayType()); case CLASS: return new ClassTypeWrapper(type.asClassType()); case PARAMETERIZED_TYPE: return new ParameterizedTypeWrapper(type.asParameterizedType()); case PRIMITIVE: return wrap(type.asPrimitiveType()); case TYPE_VARIABLE: return new TypeVariableWrapper(type.asTypeVariable()); case UNRESOLVED_TYPE_VARIABLE: return new UnresolvedTypeVariableWrapper(type.asUnresolvedTypeVariable()); case VOID: return IVoidType.DEFAULT; case WILDCARD_TYPE: return new WildcardTypeWrapper(type.asWildcardType()); } throw new IllegalArgumentException("Invalid Java Type " + type.toString()); }
public static String getGeneralTypeBindingKey(Type type) { switch (type.kind()) { case ARRAY: return getBindingKey(type.asArrayType()); case CLASS: return getBindingKey(type.asClassType()); case PARAMETERIZED_TYPE: return getBindingKey(type.asParameterizedType()); case PRIMITIVE: return getBindingKey(type.asPrimitiveType()); case TYPE_VARIABLE: return getBindingKey(type.asTypeVariable()); case UNRESOLVED_TYPE_VARIABLE: return getBindingKey(type.asUnresolvedTypeVariable()); case VOID: return getBindingKey(type.asVoidType()); case WILDCARD_TYPE: return getBindingKey(type.asWildcardType()); default: break; } return ""; }
TypeParameterBoundTypeTarget boundTarget = target.asTypeParameterBound(); type = getTypeParameters(enclosingTarget)[boundTarget.position()] .asTypeVariable().boundArray()[boundTarget.boundPosition()]; break;
break; case TYPE_VARIABLE: { TypeVariable typeVariable = type.asTypeVariable(); addString(typeVariable.identifier()); addTypeList(typeVariable.boundArray());
TypeVariable type = types[index].asTypeVariable(); int boundIndex = bound.boundPosition(); if (boundIndex >= type.boundArray().length) {
break; case TYPE_VARIABLE: TypeVariable typeVariable = type.asTypeVariable(); stream.writePackedU32(positionOf(typeVariable.identifier())); writeReferenceOrFull(stream, typeVariable.boundArray());