String resolvedTypeName= JavaModelUtil.getResolvedTypeName(refTypeSig, declaringType); if (resolvedTypeName != null) { StringBuffer buf= new StringBuffer(); if (imports != null) { buf.append(imports.addImport(resolvedTypeName)); } else { buf.append(resolvedTypeName);
if (refTypeSig.length() > 0) { switch (refTypeSig.charAt(0)) { case Signature.C_ARRAY : int arrayCount= Signature.getArrayCount(refTypeSig); StringBuffer buf= new StringBuffer(); buf.append(resolveAndAdd(Signature.getElementType(refTypeSig), declaringType, imports)); for (int i= 0; i < arrayCount; i++) { buf.append("[]"); } return buf.toString(); case Signature.C_RESOLVED: case Signature.C_UNRESOLVED: String resolvedTypeName= JavaModelUtil.getResolvedTypeName(refTypeSig, declaringType); if (resolvedTypeName != null) { if (imports == null) { return resolvedTypeName; } else { return imports.addImport(resolvedTypeName); } } break; case Signature.C_EXTENDS: return "? extends " + resolveAndAdd(refTypeSig.substring(1), declaringType, imports); case Signature.C_SUPER: return "? super " + resolveAndAdd(refTypeSig.substring(1), declaringType, imports);
	private static String resolveAndAdd(String refTypeSig, IType declaringType, IImportsStructure imports) throws JavaModelException {		String[] typeParameters= Signature.getTypeParameters(refTypeSig);		if (typeParameters.length > 0) {			// see bug 68847 		}		String resolvedTypeName= JavaModelUtil.getResolvedTypeName(refTypeSig, declaringType);		if (resolvedTypeName != null) {			StringBuffer buf= new StringBuffer();			if (imports != null) {				buf.append(imports.addImport(resolvedTypeName));			} else {				buf.append(resolvedTypeName);			}			int arrayCount= Signature.getArrayCount(refTypeSig);			for (int i= 0; i < arrayCount; i++) {				buf.append("[]"); //$NON-NLS-1$			}			return buf.toString();		}		return Signature.toString(refTypeSig);	}