private static void createTypeParameters( ImportRewrite imports, ImportRewriteContext context, AST ast, IMethodBinding binding, MethodDeclaration decl) { ITypeBinding[] typeParams = binding.getTypeParameters(); List<TypeParameter> typeParameters = decl.typeParameters(); for (int i = 0; i < typeParams.length; i++) { ITypeBinding curr = typeParams[i]; TypeParameter newTypeParam = ast.newTypeParameter(); newTypeParam.setName(ast.newSimpleName(curr.getName())); ITypeBinding[] typeBounds = curr.getTypeBounds(); if (typeBounds.length != 1 || !"java.lang.Object".equals(typeBounds[0].getQualifiedName())) { // $NON-NLS-1$ List<Type> newTypeBounds = newTypeParam.typeBounds(); for (int k = 0; k < typeBounds.length; k++) { newTypeBounds.add(imports.addImport(typeBounds[k], ast, context)); } } typeParameters.add(newTypeParam); } }
private static void createTypeParameters(ImportRewrite imports, ImportRewriteContext context, AST ast, IMethodBinding binding, MethodDeclaration decl) { ITypeBinding[] typeParams= binding.getTypeParameters(); List<TypeParameter> typeParameters= decl.typeParameters(); for (int i= 0; i < typeParams.length; i++) { ITypeBinding curr= typeParams[i]; TypeParameter newTypeParam= ast.newTypeParameter(); newTypeParam.setName(ast.newSimpleName(curr.getName())); ITypeBinding[] typeBounds= curr.getTypeBounds(); if (typeBounds.length != 1 || !"java.lang.Object".equals(typeBounds[0].getQualifiedName())) {//$NON-NLS-1$ List<Type> newTypeBounds= newTypeParam.typeBounds(); for (int k= 0; k < typeBounds.length; k++) { newTypeBounds.add(imports.addImport(typeBounds[k], ast, context, TypeLocation.TYPE_BOUND)); } } typeParameters.add(newTypeParam); } }
private void insertAllMissingTypeTags(ASTRewrite rewriter, TypeDeclaration typeDecl) { AST ast= typeDecl.getAST(); Javadoc javadoc= typeDecl.getJavadoc(); ListRewrite tagsRewriter= rewriter.getListRewrite(javadoc, Javadoc.TAGS_PROPERTY); List<TypeParameter> typeParams= typeDecl.typeParameters(); for (int i= typeParams.size() - 1; i >= 0; i--) { TypeParameter decl= typeParams.get(i); String name= '<' + decl.getName().getIdentifier() + '>'; if (findTag(javadoc, TagElement.TAG_PARAM, name) == null) { TagElement newTag= ast.newTagElement(); newTag.setTagName(TagElement.TAG_PARAM); TextElement text= ast.newTextElement(); text.setText(name); newTag.fragments().add(text); insertTabStop(rewriter, newTag.fragments(), "typeParam" + i); //$NON-NLS-1$ insertTag(tagsRewriter, newTag, getPreviousTypeParamNames(typeParams, decl)); } } }
private void addTypeParameters( CompilationUnitRewrite imRewrite, List<TypeParameter> list, ITypeBinding parent) { ITypeBinding enclosing = parent.getDeclaringClass(); if (enclosing != null) addTypeParameters(imRewrite, list, enclosing); ITypeBinding[] typeParameters = parent.getTypeParameters(); for (int i = 0; i < typeParameters.length; i++) { TypeParameter ntp = imRewrite.getAST().newTypeParameter(); ntp.setName(imRewrite.getAST().newSimpleName(typeParameters[i].getName())); ITypeBinding[] bounds = typeParameters[i].getTypeBounds(); for (int j = 0; j < bounds.length; j++) if (!"java.lang.Object".equals(bounds[j].getQualifiedName())) // $NON-NLS-1$ ntp.typeBounds().add(imRewrite.getImportRewrite().addImport(bounds[j], imRewrite.getAST())); list.add(ntp); } }
/** * Copies the constructor's parent type's type parameters, if any, as method type parameters of * the new static factory method. (Recall that static methods can't refer to type arguments of the * enclosing class, since they have no instance to serve as a context.)<br> * Makes sure to copy the bounds from the owning type, to ensure that the return type of the * factory method satisfies the bounds of the type being instantiated.<br> * E.g., for ctor Foo() in the type Foo<T extends Number>, be sure that the factory method is * declared as<br> * <code>static <T extends Number> Foo<T> createFoo()</code><br> * and not simply<br> * <code>static <T> Foo<T> createFoo()</code><br> * or the compiler will bark. * * @param ast utility object needed to create ASTNode's for the new method * @param newMethod the method onto which to copy the type parameters */ private void copyTypeParameters(AST ast, MethodDeclaration newMethod) { ITypeBinding[] ctorOwnerTypeParms = fCtorBinding.getDeclaringClass().getTypeParameters(); List<TypeParameter> factoryMethodTypeParms = newMethod.typeParameters(); for (int i = 0; i < ctorOwnerTypeParms.length; i++) { TypeParameter newParm = ast.newTypeParameter(); ITypeBinding[] parmTypeBounds = ctorOwnerTypeParms[i].getTypeBounds(); List<Type> newParmBounds = newParm.typeBounds(); newParm.setName(ast.newSimpleName(ctorOwnerTypeParms[i].getName())); for (int b = 0; b < parmTypeBounds.length; b++) { if (parmTypeBounds[b].isClass() && parmTypeBounds[b].getSuperclass() == null) continue; Type newBound = fImportRewriter.addImport(parmTypeBounds[b], ast); newParmBounds.add(newBound); } factoryMethodTypeParms.add(newParm); } }
private void insertAllMissingTypeTags(ASTRewrite rewriter, TypeDeclaration typeDecl) { AST ast = typeDecl.getAST(); Javadoc javadoc = typeDecl.getJavadoc(); ListRewrite tagsRewriter = rewriter.getListRewrite(javadoc, Javadoc.TAGS_PROPERTY); List<TypeParameter> typeParams = typeDecl.typeParameters(); for (int i = typeParams.size() - 1; i >= 0; i--) { TypeParameter decl = typeParams.get(i); String name = '<' + decl.getName().getIdentifier() + '>'; if (findTag(javadoc, TagElement.TAG_PARAM, name) == null) { TagElement newTag = ast.newTagElement(); newTag.setTagName(TagElement.TAG_PARAM); TextElement text = ast.newTextElement(); text.setText(name); newTag.fragments().add(text); insertTabStop(rewriter, newTag.fragments(), "typeParam" + i); // $NON-NLS-1$ insertTag(tagsRewriter, newTag, getPreviousTypeParamNames(typeParams, decl)); } } }
private static void addTypeParameters(final CompilationUnit unit, final IType type, final Map<String, ITypeBinding> map) throws JavaModelException { Assert.isNotNull(unit); Assert.isNotNull(type); Assert.isNotNull(map); final AbstractTypeDeclaration declaration= ASTNodeSearchUtil.getAbstractTypeDeclarationNode(type, unit); if (declaration instanceof TypeDeclaration) { ITypeBinding binding= null; TypeParameter parameter= null; for (final Iterator<TypeParameter> iterator= ((TypeDeclaration) declaration).typeParameters().iterator(); iterator.hasNext();) { parameter= iterator.next(); binding= parameter.resolveBinding(); if (binding != null && !map.containsKey(binding.getKey())) map.put(binding.getKey(), binding); } final IType declaring= type.getDeclaringType(); if (declaring != null && !JdtFlags.isStatic(type)) addTypeParameters(unit, declaring, map); } }
private void addEnclosingInstanceTypeParameters(final ITypeBinding[] parameters, final AbstractTypeDeclaration declaration, final ASTRewrite rewrite) { Assert.isNotNull(parameters); Assert.isNotNull(declaration); Assert.isNotNull(rewrite); if (declaration instanceof TypeDeclaration) { final TypeDeclaration type= (TypeDeclaration) declaration; final List<TypeParameter> existing= type.typeParameters(); final Set<String> names= new HashSet<String>(); TypeParameter parameter= null; for (final Iterator<TypeParameter> iterator= existing.iterator(); iterator.hasNext();) { parameter= iterator.next(); names.add(parameter.getName().getIdentifier()); } final ListRewrite rewriter= rewrite.getListRewrite(type, TypeDeclaration.TYPE_PARAMETERS_PROPERTY); String name= null; for (int index= 0; index < parameters.length; index++) { name= parameters[index].getName(); if (!names.contains(name)) { parameter= type.getAST().newTypeParameter(); parameter.setName(type.getAST().newSimpleName(name)); rewriter.insertLast(parameter, null); } } } }
private void addTypeParameters(CompilationUnitRewrite imRewrite, List<TypeParameter> list, ITypeBinding parent) { ITypeBinding enclosing= parent.getDeclaringClass(); if (enclosing != null) addTypeParameters(imRewrite, list, enclosing); ITypeBinding[] typeParameters= parent.getTypeParameters(); for (int i= 0; i < typeParameters.length; i++) { TypeParameter ntp= imRewrite.getAST().newTypeParameter(); ntp.setName(imRewrite.getAST().newSimpleName(typeParameters[i].getName())); ITypeBinding[] bounds= typeParameters[i].getTypeBounds(); for (int j= 0; j < bounds.length; j++) if (!"java.lang.Object".equals(bounds[j].getQualifiedName())) //$NON-NLS-1$ ntp.typeBounds().add(imRewrite.getImportRewrite().addImport(bounds[j], imRewrite.getAST())); list.add(ntp); } }
/** * Copies the constructor's parent type's type parameters, if any, as * method type parameters of the new static factory method. (Recall * that static methods can't refer to type arguments of the enclosing * class, since they have no instance to serve as a context.)<br> * Makes sure to copy the bounds from the owning type, to ensure that the * return type of the factory method satisfies the bounds of the type * being instantiated.<br> * E.g., for ctor Foo() in the type Foo<T extends Number>, be sure that * the factory method is declared as<br> * <code>static <T extends Number> Foo<T> createFoo()</code><br> * and not simply<br> * <code>static <T> Foo<T> createFoo()</code><br> * or the compiler will bark. * @param ast utility object needed to create ASTNode's for the new method * @param newMethod the method onto which to copy the type parameters */ private void copyTypeParameters(AST ast, MethodDeclaration newMethod) { ITypeBinding[] ctorOwnerTypeParms= fCtorBinding.getDeclaringClass().getTypeParameters(); List<TypeParameter> factoryMethodTypeParms= newMethod.typeParameters(); for(int i= 0; i < ctorOwnerTypeParms.length; i++) { TypeParameter newParm= ast.newTypeParameter(); ITypeBinding[] parmTypeBounds= ctorOwnerTypeParms[i].getTypeBounds(); List<Type> newParmBounds= newParm.typeBounds(); newParm.setName(ast.newSimpleName(ctorOwnerTypeParms[i].getName())); for(int b=0; b < parmTypeBounds.length; b++) { if (parmTypeBounds[b].isClass() && parmTypeBounds[b].getSuperclass() == null) continue; Type newBound= fImportRewriter.addImport(parmTypeBounds[b], ast); newParmBounds.add(newBound); } factoryMethodTypeParms.add(newParm); } }
private static void createTypeParameters(ImportRewrite imports, ImportRewriteContext context, AST ast, IMethodBinding binding, MethodDeclaration decl) { ITypeBinding[] typeParams= binding.getTypeParameters(); List<TypeParameter> typeParameters= decl.typeParameters(); for (int i= 0; i < typeParams.length; i++) { ITypeBinding curr= typeParams[i]; TypeParameter newTypeParam= ast.newTypeParameter(); newTypeParam.setName(ast.newSimpleName(curr.getName())); ITypeBinding[] typeBounds= curr.getTypeBounds(); if (typeBounds.length != 1 || !"java.lang.Object".equals(typeBounds[0].getQualifiedName())) {//$NON-NLS-1$ List<Type> newTypeBounds= newTypeParam.typeBounds(); for (int k= 0; k < typeBounds.length; k++) { newTypeBounds.add(imports.addImport(typeBounds[k], ast, context)); } } typeParameters.add(newTypeParam); } }
private static void addTypeParameters(final CompilationUnit unit, final IType type, final Map<String, ITypeBinding> map) throws JavaModelException { Assert.isNotNull(unit); Assert.isNotNull(type); Assert.isNotNull(map); final AbstractTypeDeclaration declaration= ASTNodeSearchUtil.getAbstractTypeDeclarationNode(type, unit); if (declaration instanceof TypeDeclaration) { ITypeBinding binding= null; TypeParameter parameter= null; for (final Iterator<TypeParameter> iterator= ((TypeDeclaration) declaration).typeParameters().iterator(); iterator.hasNext();) { parameter= iterator.next(); binding= parameter.resolveBinding(); if (binding != null && !map.containsKey(binding.getKey())) map.put(binding.getKey(), binding); } final IType declaring= type.getDeclaringType(); if (declaring != null && !Flags.isStatic(type.getFlags())) addTypeParameters(unit, declaring, map); } }
/** * Write out the type parameters in the specified list, surrounded by "<" and ">". * * @param typeParameters list of TypeParameter objects * @param includeClassKeyword if true, each parameter is prefixed with "class " */ public void writeTypeParameters(List typeParameters, boolean includeClassKeyword) { // If we're writing the implementation of a generic method, include the "template<...>" prefix write("<"); forEach(typeParameters, (TypeParameter typeParameter, boolean first) -> { if (!first) write(", "); if (includeClassKeyword) write("class "); write(typeParameter.getName().getIdentifier()); }); write(">"); }
/** * Replaces a name of the parametric type in the superclass. */ protected void passOnTypes(List<TypeDeclaration> list) { // this list has no superclasses if (list.size() < 2) { return; } Type superType = list.get(0).getSuperclassType(); if (!superType.isParameterizedType()) { return; } ParameterizedType superT = (ParameterizedType)superType; TypeDeclaration parentTD = list.get(1); for (int i = 0; i < superT.typeArguments().size(); i++) { // get a new type Type newType = (Type)superT.typeArguments().get(i); // get an old type SimpleName oldTypeName = ((TypeParameter)parentTD.typeParameters().get(i)).getName(); String oldType = oldTypeName.getFullyQualifiedName(); // replace the old type with a new type ReplaceTypeVisitor visitor = new ReplaceTypeVisitor(newType, oldType); parentTD.accept(visitor); } }
/** * Initialise the replacements for this type * * For example: * T -> JavaObject * U extends Foo -> Foo * V extends U -> Foo * X extends Foo<K> -> Foo<K> * Y extends Foo<Y> -> _j2d_Foo * @param node */ private void initializeReplacements(TypeDeclaration node) { for (Object o : node.typeParameters()) { TypeParameter t = (TypeParameter)o; if (t.typeBounds().size() == 0) { getTypeState().typeReplacements.put(t.resolveBinding(), null); } else { // TODO This won't work for U extends T, T extends IFoobar // The first type in the list is the class, if any Type firstType = (Type)t.typeBounds().get(0); ITypeBinding itb = firstType.resolveBinding(); while (itb.isTypeVariable()) { itb = itb.getSuperclass(); } /*if (itb.isParameterizedType() && hasTypeVariableArgument(itb)) { itb = itb.getErasure(); }*/ getTypeState().typeReplacements.put(t.resolveBinding(), itb); } } }
public static TypeParameter newTypeParameter(AST ast, String content) { StringBuffer buffer= new StringBuffer(TYPEPARAM_HEADER); buffer.append(content); buffer.append(TYPEPARAM_FOOTER); ASTParser p= ASTParser.newParser(ast.apiLevel()); p.setSource(buffer.toString().toCharArray()); CompilationUnit root= (CompilationUnit) p.createAST(null); List<AbstractTypeDeclaration> list= root.types(); TypeDeclaration typeDecl= (TypeDeclaration) list.get(0); MethodDeclaration methodDecl= typeDecl.getMethods()[0]; TypeParameter tp= (TypeParameter) methodDecl.typeParameters().get(0); ASTNode result= ASTNode.copySubtree(ast, tp); result.accept(new PositionClearer()); return (TypeParameter) result; }
@Override public void endVisit(TypeParameter node) { if (skipNode(node)) { return; } GenericSequentialFlowInfo info = processSequential(node, node.getName()); process(info, node.typeBounds()); }
public static Set<String> getPreviousTypeParamNames(List<TypeParameter> typeParams, ASTNode missingNode) { Set<String> previousNames= new HashSet<>(); for (int i = 0; i < typeParams.size(); i++) { TypeParameter curr= typeParams.get(i); if (curr == missingNode) { return previousNames; } previousNames.add('<' + curr.getName().getIdentifier() + '>'); } return previousNames; }
@Override public boolean visit(TypeParameter node) { if (hasFlag(TYPES, fFlags) && node.getStartPosition() < fPosition) { fBreak = fRequestor.acceptBinding(node.getName().resolveBinding()); } return !fBreak; }
public static TypeParameter newTypeParameter(AST ast, String content) { StringBuffer buffer = new StringBuffer(TYPEPARAM_HEADER); buffer.append(content); buffer.append(TYPEPARAM_FOOTER); CheASTParser p = CheASTParser.newParser(ast.apiLevel()); p.setSource(buffer.toString().toCharArray()); CompilationUnit root = (CompilationUnit) p.createAST(null); List<AbstractTypeDeclaration> list = root.types(); TypeDeclaration typeDecl = (TypeDeclaration) list.get(0); MethodDeclaration methodDecl = typeDecl.getMethods()[0]; TypeParameter tp = (TypeParameter) methodDecl.typeParameters().get(0); ASTNode result = ASTNode.copySubtree(ast, tp); result.accept(new PositionClearer()); return (TypeParameter) result; }
@Override public final boolean visit(TypeParameter parameter) { ITypeBinding binding = parameter.resolveBinding(); if (binding != null) { // don't collect type parameters declared inside the anonymous fBindings.put(binding.getKey(), binding); } return false; }
private void copyTypeParameters(MethodDeclaration intermediary, CompilationUnitRewrite rew) { ITypeBinding[] typeParameters = fTargetMethodBinding.getTypeParameters(); for (int i = 0; i < typeParameters.length; i++) { ITypeBinding current = typeParameters[i]; TypeParameter parameter = rew.getAST().newTypeParameter(); parameter.setName(rew.getAST().newSimpleName(current.getName())); ITypeBinding[] bounds = current.getTypeBounds(); for (int j = 0; j < bounds.length; j++) if (!"java.lang.Object".equals(bounds[j].getQualifiedName())) // $NON-NLS-1$ parameter.typeBounds().add(rew.getImportRewrite().addImport(bounds[j], rew.getAST())); intermediary.typeParameters().add(parameter); } }
private static void appendTypeParameters(StringBuffer buf, List<TypeParameter> typeParameters) { int typeParametersCount = typeParameters.size(); if (typeParametersCount > 0) { buf.append('<'); for (int i = 0; i < typeParametersCount; i++) { TypeParameter typeParameter = typeParameters.get(i); buf.append(ASTNodes.asString(typeParameter)); if (i < typeParametersCount - 1) buf.append(','); } buf.append('>'); } }
public static Set<String> getPreviousTypeParamNames( List<TypeParameter> typeParams, ASTNode missingNode) { Set<String> previousNames = new HashSet<String>(); for (int i = 0; i < typeParams.size(); i++) { TypeParameter curr = typeParams.get(i); if (curr == missingNode) { return previousNames; } previousNames.add('<' + curr.getName().getIdentifier() + '>'); } return previousNames; }
/** * Creates the type parameters of the new supertype. * * @param targetRewrite * the target compilation unit rewrite * @param subType * the subtype * @param sourceDeclaration * the type declaration of the source type * @param targetDeclaration * the type declaration of the target type */ protected final void createTypeParameters(final CompilationUnitRewrite targetRewrite, final IType subType, final AbstractTypeDeclaration sourceDeclaration, final AbstractTypeDeclaration targetDeclaration) { Assert.isNotNull(targetRewrite); Assert.isNotNull(sourceDeclaration); Assert.isNotNull(targetDeclaration); if (sourceDeclaration instanceof TypeDeclaration) { TypeParameter parameter= null; final ListRewrite rewrite= targetRewrite.getASTRewrite().getListRewrite(targetDeclaration, TypeDeclaration.TYPE_PARAMETERS_PROPERTY); for (final Iterator<TypeParameter> iterator= ((TypeDeclaration) sourceDeclaration).typeParameters().iterator(); iterator.hasNext();) { parameter= iterator.next(); final ASTNode node= ASTNode.copySubtree(targetRewrite.getAST(), parameter); rewrite.insertLast(node, null); } } }
private void updateConstructorReference(ITypeBinding[] parameters, ParameterizedType type, CompilationUnitRewrite targetRewrite, ICompilationUnit cu, TextEditGroup group) throws CoreException { final ListRewrite rewrite= targetRewrite.getASTRewrite().getListRewrite(type, ParameterizedType.TYPE_ARGUMENTS_PROPERTY); TypeParameter parameter= null; for (int index= type.typeArguments().size(); index < parameters.length; index++) { parameter= targetRewrite.getRoot().getAST().newTypeParameter(); parameter.setName(targetRewrite.getRoot().getAST().newSimpleName(parameters[index].getName())); rewrite.insertLast(parameter, group); } if (type.getParent() instanceof ClassInstanceCreation) updateConstructorReference((ClassInstanceCreation) type.getParent(), targetRewrite, cu, group); }
/** * Creates a new generic reference finder. * * @param declaration * the method declaration */ public GenericReferenceFinder(final MethodDeclaration declaration) { Assert.isNotNull(declaration); ITypeBinding binding= null; TypeParameter parameter= null; for (final Iterator<TypeParameter> iterator= declaration.typeParameters().iterator(); iterator.hasNext();) { parameter= iterator.next(); binding= parameter.resolveBinding(); if (binding != null) fBindings.add(binding.getKey()); } }
/** * Creates the type parameters of the new supertype. * * @param targetRewrite * the target compilation unit rewrite * @param subType * the subtype * @param sourceDeclaration * the type declaration of the source type * @param targetDeclaration * the type declaration of the target type */ protected final void createTypeParameters(final ASTRewrite targetRewrite, final IType subType, final AbstractTypeDeclaration sourceDeclaration, final AbstractTypeDeclaration targetDeclaration) { Assert.isNotNull(targetRewrite); Assert.isNotNull(sourceDeclaration); Assert.isNotNull(targetDeclaration); if (sourceDeclaration instanceof TypeDeclaration) { TypeParameter parameter= null; final ListRewrite rewrite= targetRewrite.getListRewrite(targetDeclaration, TypeDeclaration.TYPE_PARAMETERS_PROPERTY); for (final Iterator<TypeParameter> iterator= ((TypeDeclaration) sourceDeclaration).typeParameters().iterator(); iterator.hasNext();) { parameter= iterator.next(); rewrite.insertLast(ASTNode.copySubtree(targetRewrite.getAST(), parameter), null); ImportRewriteUtil.collectImports(subType.getJavaProject(), sourceDeclaration, fTypeBindings, fStaticBindings, false); } } }
@Override public final boolean visit(TypeParameter parameter) { ITypeBinding binding= parameter.resolveBinding(); if (binding != null) { // don't collect type parameters declared inside the anonymous fBindings.put(binding.getKey(), binding); } return false; }
@Override public void endVisit(TypeParameter node) { if (skipNode(node)) return; GenericSequentialFlowInfo info= processSequential(node, node.getName()); process(info, node.typeBounds()); }
private void copyTypeParameters(MethodDeclaration intermediary, CompilationUnitRewrite rew) { ITypeBinding[] typeParameters= fTargetMethodBinding.getTypeParameters(); for (int i= 0; i < typeParameters.length; i++) { ITypeBinding current= typeParameters[i]; TypeParameter parameter= rew.getAST().newTypeParameter(); parameter.setName(rew.getAST().newSimpleName(current.getName())); ITypeBinding[] bounds= current.getTypeBounds(); for (int j= 0; j < bounds.length; j++) if (!"java.lang.Object".equals(bounds[j].getQualifiedName())) //$NON-NLS-1$ parameter.typeBounds().add(rew.getImportRewrite().addImport(bounds[j], rew.getAST())); intermediary.typeParameters().add(parameter); } }
private static void appendTypeParameters(StringBuffer buf, List<TypeParameter> typeParameters) { int typeParametersCount= typeParameters.size(); if (typeParametersCount > 0) { buf.append('<'); for (int i= 0; i < typeParametersCount; i++) { TypeParameter typeParameter= typeParameters.get(i); buf.append(ASTNodes.asString(typeParameter)); if (i < typeParametersCount - 1) buf.append(','); } buf.append('>'); } }
@Override public boolean visit(TypeParameter node) { if (hasFlag(TYPES, fFlags) && node.getStartPosition() < fPosition) { fBreak= fRequestor.acceptBinding(node.getName().resolveBinding()); } return !fBreak; }
public static Set<String> getPreviousTypeParamNames(List<TypeParameter> typeParams, ASTNode missingNode) { Set<String> previousNames= new HashSet<String>(); for (int i = 0; i < typeParams.size(); i++) { TypeParameter curr= typeParams.get(i); if (curr == missingNode) { return previousNames; } previousNames.add('<' + curr.getName().getIdentifier() + '>'); } return previousNames; }