Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
34,200 | Self (@NotNull final ElementPattern pattern) { return with(new PatternCondition<>("ofType") { @Override public boolean accepts(@NotNull final T t, final ProcessingContext context) { return pattern.accepts(t.getType(), context); } }); } | ofType |
34,201 | boolean (@NotNull final T t, final ProcessingContext context) { return pattern.accepts(t.getType(), context); } | accepts |
34,202 | Self (final ElementPattern<? extends GrExpression> expressionPattern) { return with(new PatternCondition<>("skipParentheses") { @Override public boolean accepts(@NotNull T t, ProcessingContext context) { GrExpression expression = t; while (expression instanceof GrParenthesizedExpression) { expression = ((GrParenthesizedExpression)expression).getOperand(); } return expressionPattern.accepts(expression, context); } }); } | skipParentheses |
34,203 | boolean (@NotNull T t, ProcessingContext context) { GrExpression expression = t; while (expression instanceof GrParenthesizedExpression) { expression = ((GrParenthesizedExpression)expression).getOperand(); } return expressionPattern.accepts(expression, context); } | accepts |
34,204 | GroovyBinaryExpressionPattern (@NotNull final ElementPattern pattern) { return with(new PatternCondition<>("left") { @Override public boolean accepts(@NotNull final GrBinaryExpression psiBinaryExpression, final ProcessingContext context) { return pattern.accepts(psiBinaryExpression.getLeftOperand(), context); } }); } | left |
34,205 | boolean (@NotNull final GrBinaryExpression psiBinaryExpression, final ProcessingContext context) { return pattern.accepts(psiBinaryExpression.getLeftOperand(), context); } | accepts |
34,206 | GroovyBinaryExpressionPattern (@NotNull final ElementPattern pattern) { return with(new PatternCondition<>("right") { @Override public boolean accepts(@NotNull final GrBinaryExpression psiBinaryExpression, final ProcessingContext context) { return pattern.accepts(psiBinaryExpression.getRightOperand(), context); } }); } | right |
34,207 | boolean (@NotNull final GrBinaryExpression psiBinaryExpression, final ProcessingContext context) { return pattern.accepts(psiBinaryExpression.getRightOperand(), context); } | accepts |
34,208 | GroovyBinaryExpressionPattern (final ElementPattern pattern) { return with(new PatternCondition<>("operation") { @Override public boolean accepts(@NotNull final GrBinaryExpression psiBinaryExpression, final ProcessingContext context) { return pattern.accepts(psiBinaryExpression.getOperationTokenType(), context); } }); } | operation |
34,209 | boolean (@NotNull final GrBinaryExpression psiBinaryExpression, final ProcessingContext context) { return pattern.accepts(psiBinaryExpression.getOperationTokenType(), context); } | accepts |
34,210 | PsiMethod () { return (PsiMethod)super.getElement(); } | getElement |
34,211 | PsiSubstitutor () { return mySubstitutorComputer.compute(); } | getSubstitutor |
34,212 | PsiSubstitutor () { return super.getSubstitutor(); } | getPartialSubstitutor |
34,213 | boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; GroovyMethodResultImpl result = (GroovyMethodResultImpl)o; if (!mySubstitutorComputer.equals(result.mySubstitutorComputer)) return false; return true; } | equals |
34,214 | int () { int result = super.hashCode(); result = 31 * result + mySubstitutorComputer.hashCode(); return result; } | hashCode |
34,215 | String () { return GroovyCommonClassNames.JAVA_UTIL_LINKED_HASH_MAP; } | getJavaClassName |
34,216 | String () { Set<String> stringKeys = getStringKeys(); List<Couple<PsiType>> otherEntries = getOtherEntries(); if (stringKeys.isEmpty()) { if (otherEntries.isEmpty()) return "[:]"; String name = getJavaClassName(); final PsiType[] params = getParameters(); if (params.length == 2) { return name + "<" + getInternalText(params[0]) + ", " + getInternalText(params[1]) + ">"; } else { return name; } } List<String> components = new ArrayList<>(); for (String s : stringKeys) { components.add("'" + s + "':" + getInternalCanonicalText(getTypeByStringKey(s))); } for (Couple<PsiType> entry : otherEntries) { components.add(getInternalCanonicalText(entry.first) + ":" + getInternalCanonicalText(entry.second)); } boolean tooMany = components.size() > 2; final List<String> theFirst = ContainerUtil.getFirstItems(components, 2); return "[" + StringUtil.join(theFirst, ", ") + (tooMany ? ",..." : "") + "]"; } | getInternalCanonicalText |
34,217 | String (@Nullable PsiType param) { return param == null ? "null" : param.getInternalCanonicalText(); } | getInternalText |
34,218 | boolean (@NotNull PsiType type) { return type instanceof GrMapType || super.isAssignableFrom(type); } | isAssignableFrom |
34,219 | GrMapType (GrMapType l, GrMapType r) { final GlobalSearchScope scope = l.getResolveScope().intersectWith(r.getResolveScope()); final LinkedHashMap<String, PsiType> strings = new LinkedHashMap<>(); strings.putAll(l.getStringEntries()); strings.putAll(r.getStringEntries()); List<Couple<PsiType>> other = new ArrayList<>(); other.addAll(l.getOtherEntries()); other.addAll(r.getOtherEntries()); return create(l.myFacade, scope, strings, other); } | merge |
34,220 | GrMapType (JavaPsiFacade facade, GlobalSearchScope scope, @NotNull LinkedHashMap<String, PsiType> stringEntries, @NotNull List<Couple<PsiType>> otherEntries) { return new GrMapTypeImpl(facade, scope, stringEntries, otherEntries, LanguageLevel.JDK_1_5); } | create |
34,221 | PsiClassType (@NotNull LanguageLevel languageLevel) { return new GrMapTypeImpl(myFacade, getResolveScope(), getStringEntries(), getOtherEntries(), languageLevel); } | setLanguageLevel |
34,222 | GrMapType (PsiElement context, GrNamedArgument[] args) { return new GrMapTypeFromNamedArgs(context, args); } | createFromNamedArgs |
34,223 | String () { return "map type"; } | toString |
34,224 | void (@NotNull GroovyElementVisitor visitor) { visitor.visitElement(this); } | accept |
34,225 | void (@NotNull GroovyElementVisitor visitor) { GroovyPsiElementImpl.acceptGroovyChildren(this, visitor); } | acceptChildren |
34,226 | GlobalSearchScope () { final PsiFile containingFile = getContainingFile(); final GlobalSearchScope elementScope = super.getResolveScope(); return GrFileIndexUtil.isGroovySourceFile(containingFile) ? elementScope : GlobalSearchScope.fileScope(containingFile).union(elementScope); } | getResolveScope |
34,227 | boolean () { for (PsiType initializer : myComponentTypes) { if (initializer != null && !initializer.isValid()) return false; } return true; } | isValid |
34,228 | List<PsiType> () { return myComponentTypes; } | inferComponents |
34,229 | List<PsiType> () { return myComponentTypes; } | getComponentTypes |
34,230 | GrAnnotationMemberValue (PsiAnnotationMemberValue value) { final StringBuilder buffer = new StringBuilder(); buffer.append("@A("); generateText(value, buffer); buffer.append(")"); String text = buffer.toString(); try { GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(value.getProject()); return factory.createAnnotationFromText(text).getParameterList().getAttributes()[0].getValue(); } catch (IncorrectOperationException | ArrayIndexOutOfBoundsException e) { LOG.error("Text: \"" + text + "\"", e); return null; } } | convert |
34,231 | void (PsiAnnotationMemberValue value, final @NlsSafe StringBuilder buffer) { value.accept(new JavaElementVisitor() { @Override public void visitAnnotation(@NotNull PsiAnnotation annotation) { buffer.append("@"); PsiJavaCodeReferenceElement ref = annotation.getNameReferenceElement(); if (ref == null) return; PsiElement resolved = ref.resolve(); if (resolved instanceof PsiClass && ((PsiClass)resolved).getQualifiedName() != null) { buffer.append(((PsiClass)resolved).getQualifiedName()); } else { buffer.append(ref.getText()); } PsiAnnotationParameterList parameterList = annotation.getParameterList(); parameterList.accept(this); } @Override public void visitAnnotationParameterList(@NotNull PsiAnnotationParameterList list) { PsiNameValuePair[] attributes = list.getAttributes(); if (attributes.length > 0) { buffer.append('('); for (PsiNameValuePair attribute : attributes) { attribute.accept(this); buffer.append(','); } buffer.replace(buffer.length() - 1, buffer.length(), ")"); } } @Override public void visitNameValuePair(@NotNull PsiNameValuePair pair) { String name = pair.getName(); PsiAnnotationMemberValue value = pair.getValue(); if (name != null) { buffer.append(name); buffer.append('='); } if (value != null) { value.accept(this); } } @Override public void visitExpression(@NotNull PsiExpression expression) { buffer.append(expression.getText()); } @Override public void visitAnnotationArrayInitializer(@NotNull PsiArrayInitializerMemberValue initializer) { PsiAnnotationMemberValue[] initializers = initializer.getInitializers(); processInitializers(initializers); } @Override public void visitNewExpression(@NotNull PsiNewExpression expression) { PsiArrayInitializerExpression arrayInitializer = expression.getArrayInitializer(); if (arrayInitializer == null) { super.visitNewExpression(expression); } else { PsiType type = expression.getType(); if (type == null) { type = PsiType.getJavaLangObject(expression.getManager(), expression.getResolveScope()).createArrayType(); } buffer.append('('); arrayInitializer.accept(this); buffer.append(" as "); buffer.append(type.getCanonicalText()); buffer.append(")"); } } @Override public void visitArrayInitializerExpression(@NotNull PsiArrayInitializerExpression arrayInitializer) { processInitializers(arrayInitializer.getInitializers()); } private void processInitializers(PsiAnnotationMemberValue[] initializers) { buffer.append('['); for (PsiAnnotationMemberValue initializer : initializers) { initializer.accept(this); buffer.append(','); } if (initializers.length > 0) { buffer.delete(buffer.length() - 1, buffer.length()); } buffer.append(']'); } }); } | generateText |
34,232 | void (@NotNull PsiAnnotation annotation) { buffer.append("@"); PsiJavaCodeReferenceElement ref = annotation.getNameReferenceElement(); if (ref == null) return; PsiElement resolved = ref.resolve(); if (resolved instanceof PsiClass && ((PsiClass)resolved).getQualifiedName() != null) { buffer.append(((PsiClass)resolved).getQualifiedName()); } else { buffer.append(ref.getText()); } PsiAnnotationParameterList parameterList = annotation.getParameterList(); parameterList.accept(this); } | visitAnnotation |
34,233 | void (@NotNull PsiAnnotationParameterList list) { PsiNameValuePair[] attributes = list.getAttributes(); if (attributes.length > 0) { buffer.append('('); for (PsiNameValuePair attribute : attributes) { attribute.accept(this); buffer.append(','); } buffer.replace(buffer.length() - 1, buffer.length(), ")"); } } | visitAnnotationParameterList |
34,234 | void (@NotNull PsiNameValuePair pair) { String name = pair.getName(); PsiAnnotationMemberValue value = pair.getValue(); if (name != null) { buffer.append(name); buffer.append('='); } if (value != null) { value.accept(this); } } | visitNameValuePair |
34,235 | void (@NotNull PsiExpression expression) { buffer.append(expression.getText()); } | visitExpression |
34,236 | void (@NotNull PsiArrayInitializerMemberValue initializer) { PsiAnnotationMemberValue[] initializers = initializer.getInitializers(); processInitializers(initializers); } | visitAnnotationArrayInitializer |
34,237 | void (@NotNull PsiNewExpression expression) { PsiArrayInitializerExpression arrayInitializer = expression.getArrayInitializer(); if (arrayInitializer == null) { super.visitNewExpression(expression); } else { PsiType type = expression.getType(); if (type == null) { type = PsiType.getJavaLangObject(expression.getManager(), expression.getResolveScope()).createArrayType(); } buffer.append('('); arrayInitializer.accept(this); buffer.append(" as "); buffer.append(type.getCanonicalText()); buffer.append(")"); } } | visitNewExpression |
34,238 | void (@NotNull PsiArrayInitializerExpression arrayInitializer) { processInitializers(arrayInitializer.getInitializers()); } | visitArrayInitializerExpression |
34,239 | void (PsiAnnotationMemberValue[] initializers) { buffer.append('['); for (PsiAnnotationMemberValue initializer : initializers) { initializer.accept(this); buffer.append(','); } if (initializers.length > 0) { buffer.delete(buffer.length() - 1, buffer.length()); } buffer.append(']'); } | processInitializers |
34,240 | GrExpression (GrExpression expr) { final Project project = expr.getProject(); final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(project); boolean copied = false; if (expr instanceof GrApplicationStatement) { expr = convertAppInternal(factory, (GrApplicationStatement)expr); copied = true; } if (expr instanceof GrReferenceExpression && ((GrReferenceExpression)expr).getDotToken() == null && ((GrReferenceExpression)expr).getQualifier() != null) { expr = convertRefInternal(factory, ((GrReferenceExpression)expr)); copied = true; } if (!shouldManage(expr)) return expr; if (!copied) expr = (GrExpression)expr.copy(); for (PsiElement child = expr.getFirstChild(); child != null; child = child.getFirstChild()) { if (child instanceof GrApplicationStatement) { child = child.replace(convertAppInternal(factory, (GrApplicationStatement)child)); } else if (child instanceof GrReferenceExpression && ((GrReferenceExpression)child).getDotToken() == null && ((GrReferenceExpression)child).getQualifier() != null) { child = child.replace(convertRefInternal(factory, ((GrReferenceExpression)child))); } } return expr; } | convertToMethodCallExpression |
34,241 | boolean (GrExpression expr) { for (PsiElement child = expr.getFirstChild(); child != null; child = child.getFirstChild()) { if (child instanceof GrApplicationStatement) { return true; } else if (child instanceof GrReferenceExpression && ((GrReferenceExpression)child).getDotToken() == null && ((GrReferenceExpression)child).getQualifier() != null) { return true; } } return false; } | shouldManage |
34,242 | GrReferenceExpression (GroovyPsiElementFactory factory, GrReferenceExpression ref) { ref.addAfter(factory.createDotToken("."), ref.getQualifier()); return ref; } | convertRefInternal |
34,243 | GrMethodCallExpression (GroovyPsiElementFactory factory, GrApplicationStatement app) { final GrCommandArgumentList list = app.getArgumentList(); final GrMethodCallExpression prototype = (GrMethodCallExpression)factory.createExpressionFromText("foo()"); prototype.getInvokedExpression().replace(app.getInvokedExpression()); final GrArgumentList pList = prototype.getArgumentList(); final PsiElement anchor = pList.getRightParen(); for (GroovyPsiElement arg : list.getAllArguments()) { pList.addBefore(arg, anchor); } return prototype; } | convertAppInternal |
34,244 | PsiElement () { return findChildByType(GroovyTokenTypes.mIDENT); } | getNameElement |
34,245 | String () { PsiElement nameElement = getNameElement(); return nameElement == null ? null : nameElement.getText(); } | getName |
34,246 | ClassResolveResult () { return new ClassResolveResult() { private final PsiClass myBaseClass = resolve(); private final NotNullLazyValue<PsiSubstitutor> mySubstitutor = NotNullLazyValue.lazy(() -> { return inferSubstitutor(myBaseClass); }); @Override public PsiClass getElement() { return myBaseClass; } @Override @NotNull public PsiSubstitutor getSubstitutor() { PsiSubstitutor substitutor = doPreventingRecursion(GrLiteralClassType.this, false, () -> mySubstitutor.getValue()); return substitutor == null ? PsiSubstitutor.EMPTY : substitutor; } @Override public boolean isPackagePrefixPackageReference() { return false; } @Override public boolean isAccessible() { return true; } @Override public boolean isStaticsScopeCorrect() { return true; } @Override @Nullable public PsiElement getCurrentFileResolveScope() { return null; } @Override public boolean isValidResult() { return isStaticsScopeCorrect() && isAccessible(); } }; } | resolveGenerics |
34,247 | PsiClass () { return myBaseClass; } | getElement |
34,248 | PsiSubstitutor () { PsiSubstitutor substitutor = doPreventingRecursion(GrLiteralClassType.this, false, () -> mySubstitutor.getValue()); return substitutor == null ? PsiSubstitutor.EMPTY : substitutor; } | getSubstitutor |
34,249 | boolean () { return false; } | isPackagePrefixPackageReference |
34,250 | boolean () { return true; } | isAccessible |
34,251 | boolean () { return true; } | isStaticsScopeCorrect |
34,252 | PsiElement () { return null; } | getCurrentFileResolveScope |
34,253 | boolean () { return isStaticsScopeCorrect() && isAccessible(); } | isValidResult |
34,254 | PsiSubstitutor (@Nullable PsiClass myBaseClass) { if (myBaseClass != null) { final PsiType[] typeArgs = getParameters(); final PsiTypeParameter[] typeParams = myBaseClass.getTypeParameters(); if (typeParams.length == typeArgs.length) { return PsiSubstitutor.EMPTY.putAll(myBaseClass, typeArgs); } else { return PsiSubstitutor.EMPTY.putAll(myBaseClass, createArray(typeParams.length)); } } else { return PsiSubstitutor.EMPTY; } } | inferSubstitutor |
34,255 | String () { return getShortName(getJavaClassName()); } | getClassName |
34,256 | String () { String name = getClassName(); final PsiType[] params = getParameters(); if (params.length == 0 || params[0] == null) return name; Function<PsiType, String> f = psiType -> psiType == this ? getClassName() : psiType.getPresentableText(); return name + "<" + StringUtil.join(params, f, ", ") + ">"; } | getPresentableText |
34,257 | String () { String name = getJavaClassName(); final PsiType[] params = getParameters(); if (params.length == 0 || params[0] == null) return name; final Function<PsiType, String> f = psiType -> psiType == this ? getJavaClassName() : psiType.getCanonicalText(); return name + "<" + StringUtil.join(params, f, ", ") + ">"; } | getCanonicalText |
34,258 | LanguageLevel () { return myLanguageLevel; } | getLanguageLevel |
34,259 | PsiClass () { return myFacade.findClass(getJavaClassName(), getResolveScope()); } | resolve |
34,260 | PsiClassType () { return myGroovyPsiManager.createTypeByFQClassName(getJavaClassName(), myScope); } | rawType |
34,261 | boolean (@NotNull @NonNls String text) { return text.equals(getJavaClassName()); } | equalsToText |
34,262 | GlobalSearchScope () { return myScope; } | getResolveScope |
34,263 | String (@Nullable PsiType type) { return type == null ? CommonClassNames.JAVA_LANG_OBJECT : type.getInternalCanonicalText(); } | getInternalCanonicalText |
34,264 | PsiType (PsiType... psiTypes) { PsiType result = null; final PsiManager manager = getPsiManager(); for (final PsiType other : psiTypes) { result = TypesUtil.getLeastUpperBoundNullable(result, other, manager); } return result == null ? LazyFqnClassType .getLazyType(CommonClassNames.JAVA_LANG_OBJECT, getLanguageLevel(), getResolveScope(), myFacade) : result; } | getLeastUpperBound |
34,265 | PsiManager () { return PsiManager.getInstance(myFacade.getProject()); } | getPsiManager |
34,266 | String () { return myQualifiedName; } | getJavaClassName |
34,267 | PsiType[] () { if (myIterationType == null) return EMPTY_ARRAY; PsiClass resolved = resolve(); if (resolved == null || resolved.getTypeParameters().length == 0) return EMPTY_ARRAY; return new PsiType[]{myIterationType}; } | inferParameters |
34,268 | PsiClassType (@NotNull LanguageLevel languageLevel) { return new GrRangeType(languageLevel, myScope, myFacade, myLeft, myRight); } | setLanguageLevel |
34,269 | String () { return "[" + (myLeft == null ? PsiKeyword.NULL : myLeft.getInternalCanonicalText()) + ".." + (myRight == null ? PsiKeyword.NULL : myRight.getInternalCanonicalText()) + "]"; } | getInternalCanonicalText |
34,270 | boolean () { return (myLeft == null || myLeft.isValid()) && (myRight == null || myRight.isValid()); } | isValid |
34,271 | PsiType () { return myIterationType; } | getIterationType |
34,272 | PsiType () { return myLeft; } | getLeft |
34,273 | PsiType () { return myRight; } | getRight |
34,274 | GroovyCodeStyleManager (Project project) { return project.getService(GroovyCodeStyleManager.class); } | getInstance |
34,275 | PsiType () { return myExprType; } | getExprType |
34,276 | List<PsiType> () { return myTraitTypes; } | getTraitTypes |
34,277 | String () { return myExprType.getPresentableText() + " as " + StringUtil.join(ContainerUtil.map(myTraitTypes, type -> type.getPresentableText()), ", "); } | getPresentableText |
34,278 | String () { return myDelegate.getCanonicalText(); } | getCanonicalText |
34,279 | String () { return myExprType.getCanonicalText() + " as " + StringUtil.join(ContainerUtil.map(myTraitTypes, type -> type.getInternalCanonicalText()), ", "); } | getInternalCanonicalText |
34,280 | boolean () { return myDelegate.isValid(); } | isValid |
34,281 | boolean (@NotNull @NonNls String text) { return myDelegate.equalsToText(text); } | equalsToText |
34,282 | GlobalSearchScope () { return myDelegate.getResolveScope(); } | getResolveScope |
34,283 | PsiType (@NotNull PsiType type, @NotNull List<? extends PsiType> traits) { return createTraitType(ContainerUtil.prepend(traits, type instanceof GrTraitType ? ((GrTraitType)type).myDelegate : type)); } | createTraitType |
34,284 | PsiType (@NotNull List<PsiType> types) { return createTraitType(types.toArray(PsiType.createArray(types.size()))); } | createTraitType |
34,285 | PsiType (PsiType @NotNull [] types) { final Set<PsiType> flattened = PsiIntersectionType.flatten(types, new LinkedHashSet<>() { @Override public boolean add(PsiType type) { remove(type); return super.add(type); } }); final PsiType[] conjuncts = flattened.toArray(PsiType.createArray(flattened.size())); if (conjuncts.length == 1) { return conjuncts[0]; } else { return new GrTraitType((PsiIntersectionType)PsiIntersectionType.createIntersection(false, conjuncts)); } } | createTraitType |
34,286 | boolean (PsiType type) { remove(type); return super.add(type); } | add |
34,287 | String () { return getCanonicalText(); } | getPresentableText |
34,288 | String () { return "?"; } | getCanonicalText |
34,289 | boolean () { return true; } | isValid |
34,290 | boolean (@NotNull String text) { return false; } | equalsToText |
34,291 | GlobalSearchScope () { return null; } | getResolveScope |
34,292 | boolean (@Nullable String text) { if (text == null) return false; Lexer lexer = new GroovyLexer(); lexer.start(text); if (lexer.getTokenType() != GroovyTokenTypes.mIDENT) return false; lexer.advance(); return lexer.getTokenType() == null; } | isIdentifier |
34,293 | boolean (@Nullable String text, boolean afterDot, Project project) { if (text == null) return false; try { GroovyPsiElementFactory.getInstance(project).createReferenceExpressionFromText(afterDot ? "foo." + text : text); return true; } catch (Exception e) { return false; } } | isValidReference |
34,294 | ArrayList<String> (String str) { ArrayList<String> res = new ArrayList<>(); StringBuilder sb = new StringBuilder(); Matcher matcher = PATTERN.matcher(str); while (matcher.find()) { res.add(StringUtil.toLowerCase(matcher.group())); sb.append(matcher.group()); } if (!isIdentifier(sb.toString())) { res.clear(); } return res; } | camelizeString |
34,295 | String (String tempString) { return tempString.replaceAll("[^a-zA-Z]", ""); } | deleteNonLetterFromString |
34,296 | String (String str) { if (str.isEmpty()) return ""; if (str.length() == 1) return StringUtil.toLowerCase(str); char c = Character.toLowerCase(str.charAt(0)); if (c == str.charAt(0)) return str; return c + str.substring(1); } | fromLowerLetter |
34,297 | String (final String string) { return StringUtil.join(camelizeString(string), s -> StringUtil.decapitalize(s), "-"); } | camelToSnake |
34,298 | boolean (@NotNull String name) { final GroovyLexer lexer = new GroovyLexer(); lexer.start(name); final IElementType type = lexer.getTokenType(); return TokenSets.KEYWORDS.contains(type); } | isKeyword |
34,299 | String[] (Project project, PsiType[] types) { Set<String> uniqNames = new LinkedHashSet<>(); Set<String> nonUniqNames = new HashSet<>(); for (PsiType type : types) { final SuggestedNameInfo nameInfo = JavaCodeStyleManager.getInstance(project).suggestVariableName(VariableKind.PARAMETER, null, null, type); final String name = nameInfo.names[0]; if (uniqNames.contains(name)) { int i = 2; while (uniqNames.contains(name + i)) i++; uniqNames.add(name + i); nonUniqNames.add(name); } else { uniqNames.add(name); } } final String[] result = new String[uniqNames.size()]; int i = 0; for (String name : uniqNames) { result[i] = nonUniqNames.contains(name) ? name + 1 : name; i++; } return result; } | getMethodArgumentsNames |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.