Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
31,900
void (@NotNull GrMethod method) { GrOpenBlock block = method.getBlock(); if (block != null) { GroovyControlFlow flow = ControlFlowUtils.getGroovyControlFlow(block); collectRefs(variable, flow.getFlow(), ControlFlowUtils.inferWriteAccessMap(flow, variable), -1, toInline); } }
visitMethod
31,901
void (@NotNull GrClassInitializer initializer) { GrOpenBlock block = initializer.getBlock(); GroovyControlFlow flow = ControlFlowUtils.getGroovyControlFlow(block); collectRefs(variable, flow.getFlow(), ControlFlowUtils.inferWriteAccessMap(flow, variable), -1, toInline); }
visitClassInitializer
31,902
void (UsageInfo @NotNull [] usages) { CommonRefactoringUtil.sortDepthFirstRightLeftOrder(usages); final GrExpression initializer = mySettings.getInitializer(); GrExpression initializerToUse = GrIntroduceHandlerBase.insertExplicitCastIfNeeded(myLocal, mySettings.getInitializer()); for (UsageInfo usage : usages) { GrVari...
performRefactoring
31,903
String () { return RefactoringBundle.message("inline.command", myLocal.getName()); }
getCommandName
31,904
boolean (GrCallExpression call) { GrStatement stmt = call; PsiElement parent = call.getParent(); // return statement if (parent instanceof GrReturnStatement) { stmt = ((GrReturnStatement) parent); parent = parent.getParent(); } // method body result if (parent instanceof GrOpenBlock) { if (parent.getParent() instanceof...
isTailMethodCall
31,905
boolean () { return dialog.isInlineThisOnly(); }
isOnlyOneReferenceToInline
31,906
boolean () { return true; }
isOnlyOneReferenceToInline
31,907
boolean (GrMethod method) { Collection<GrStatement> returnStatements = ControlFlowUtils.collectReturns(method.getBlock()); GrOpenBlock block = method.getBlock(); if (block == null || returnStatements.isEmpty()) return false; boolean checked = checkTailOpenBlock(block, returnStatements); return !(checked && returnStatem...
hasBadReturns
31,908
boolean (GrIfStatement ifStatement, Collection<GrStatement> returnStatements) { GrStatement thenBranch = ifStatement.getThenBranch(); GrStatement elseBranch = ifStatement.getElseBranch(); if (elseBranch == null) return false; boolean tb = false; boolean eb = false; if (thenBranch instanceof GrReturnStatement) { tb = re...
checkTailIfStatement
31,909
boolean (GrOpenBlock block, Collection<GrStatement> returnStatements) { if (block == null) return false; GrStatement[] statements = block.getStatements(); if (statements.length == 0) return false; GrStatement last = statements[statements.length - 1]; if (returnStatements.contains(last)) { returnStatements.remove(last);...
checkTailOpenBlock
31,910
void (@DialogMessage String message, final Project project, Editor editor) { CommonRefactoringUtil.showErrorHint(project, editor, message, getRefactoringName(), HelpID.INLINE_METHOD); }
showErrorMessage
31,911
Collection<ReferenceExpressionInfo> (GrMethod method) { ArrayList<ReferenceExpressionInfo> list = new ArrayList<>(); collectReferenceInfoImpl(list, method, method); return list; }
collectReferenceInfo
31,912
void (Collection<ReferenceExpressionInfo> infos, PsiElement elem, GrMethod method) { if (elem instanceof GrReferenceExpression expr) { PsiReference ref = expr.getReference(); if (ref != null) { PsiElement declaration = ref.resolve(); if (declaration instanceof GrMember member) { int offsetInMethod = expr.getTextRange()...
collectReferenceInfoImpl
31,913
boolean (GrExpression qualifier) { if (!(qualifier instanceof GrReferenceExpression)) return false; GrExpression qual = ((GrReferenceExpression) qualifier).getQualifierExpression(); return qual == null || isSimpleReference(qual); }
isSimpleReference
31,914
boolean () { return declaration.hasModifierProperty(PsiModifier.STATIC); }
isStatic
31,915
boolean (GrMethod method) { return checkCalls(method.getBlock(), method); }
checkMethodForRecursion
31,916
boolean (PsiElement scope, PsiMethod method) { if (scope instanceof GrMethodCall) { PsiMethod refMethod = ((GrMethodCall)scope).resolveMethod(); if (method.equals(refMethod)) return true; } for (PsiElement child = scope.getFirstChild(); child != null; child = child.getNextSibling()) { if (checkCalls(child, method)) ret...
checkCalls
31,917
String () { return GroovyRefactoringBundle.message("inline.method.border.title"); }
getBorderTitle
31,918
String () { return GroovyRefactoringBundle.message("inline.method.label", GroovyRefactoringUtil.getMethodSignature(myMethod)); }
getNameLabelText
31,919
String () { return myMethod.isWritable() ? GroovyRefactoringBundle.message("all.invocations.and.remove.the.method") : GroovyRefactoringBundle.message("all.invocations.in.project"); }
getInlineAllText
31,920
String () { return GroovyRefactoringBundle.message("this.invocation.only.and.keep.the.method"); }
getInlineThisText
31,921
boolean () { return false; }
isInlineThis
31,922
void () { if (getOKAction().isEnabled()) { close(OK_EXIT_CODE); } }
doAction
31,923
String () { return HelpID.INLINE_METHOD; }
getHelpId
31,924
boolean () { return myAllowInlineThisOnly; }
canInlineThisOnly
31,925
GrExpression (GrSignature signature, GrParameter[] parameters, GrParameter parameter, GrClosureSignatureUtil.ArgInfo<PsiElement> argInfo, Project project) { if (argInfo == null) return null; List<PsiElement> arguments = argInfo.args; if (argInfo.isMultiArg) { //arguments for Map and varArg final PsiType type = paramete...
inferArg
31,926
boolean (GrParameter p, GrParameter[] parameters) { return parameters[parameters.length - 1] == p && p.getType() instanceof PsiArrayType; }
isVararg
31,927
void (GrMethod method, GrCallExpression call, GrExpression oldExpression, GrParameter parameter) { Collection<PsiReference> refs = ReferencesSearch.search(parameter, new LocalSearchScope(method), false).findAll(); final GroovyPsiElementFactory elementFactory = GroovyPsiElementFactory.getInstance(call.getProject()); GrE...
replaceAllOccurrencesWithExpression
31,928
String (GrParameter parameter, GrExpression expression, String varName) { StringBuilder buffer = new StringBuilder(); final PsiModifierList modifierList = parameter.getModifierList(); buffer.append(modifierList.getText().trim()); if (buffer.length() > 0) buffer.append(' '); final GrTypeElement typeElement = parameter.g...
createVariableDefinitionText
31,929
boolean (Collection<PsiReference> refs) { for (PsiReference ref : refs) { final PsiElement element = ref.getElement(); final PsiElement parent = element.getParent(); if (parent instanceof GrAssignmentExpression && ((GrAssignmentExpression)parent).getLValue() == element) return true; if (parent instanceof GrUnaryExpress...
containsWriteAccess
31,930
boolean (Collection<PsiReference> refs, GrExpression expression) { if (containsWriteAccess(refs)) { if (expression instanceof GrReferenceExpression) { final PsiElement resolved = ((GrReferenceExpression)expression).resolve(); if (resolved instanceof GrVariable && !(resolved instanceof PsiField)) { final boolean isFinal...
hasUnresolvableWriteAccess
31,931
boolean () { return invokedOnReference; }
isOnlyOneReferenceToInline
31,932
boolean () { return dialog.isInlineThisOnly(); }
isOnlyOneReferenceToInline
31,933
String (@NotNull String startName, @Nullable GrMethod method, @NotNull PsiElement call, String... otherNames) { String newName; int i = 1; PsiElement parent = call.getParent(); while (!(parent instanceof GrVariableDeclarationOwner) && parent != null) { parent = parent.getParent(); } if (parent == null || isValidName(st...
suggestNewName
31,934
boolean (@Nullable String name, String ... otherNames) { for (String otherName : otherNames) { if (otherName.equals(name)) { return false; } } return true; }
isValid
31,935
boolean (@NotNull String name, @NotNull GrMethod method) { for (GrParameter parameter : method.getParameters()) { if (name.equals(parameter.getName())) return false; } final GrOpenBlock block = method.getBlock(); if (block != null) { return isValidNameDown(name, block, null); } return true; }
isValidNameInMethod
31,936
boolean (@NotNull String name, @NotNull PsiElement scopeElement, PsiElement call) { if (isValidNameDown(name, scopeElement, call)) { if (!(scopeElement instanceof GroovyFileBase)) { return isValidNameUp(name, scopeElement, call); } else { return true; } } else { return false; } }
isValidName
31,937
boolean (@NotNull String name, @NotNull PsiElement startElement, @Nullable PsiElement call) { PsiElement child = startElement.getFirstChild(); while (child != null) { // Do not check defined classes, methods, closures and blocks before if (child instanceof GrTypeDefinition || child instanceof GrMethod || call != null &...
isValidNameDown
31,938
boolean (@NotNull String name, @NotNull PsiElement startElement, @Nullable PsiElement call) { if (startElement instanceof PsiFile) { return true; } PsiElement prevSibling = startElement.getPrevSibling(); while (prevSibling != null) { if (!isValidNameDown(name, prevSibling, call)) { return false; } prevSibling = prevSib...
isValidNameUp
31,939
void (@NotNull final UsageInfo usage, @NotNull final PsiElement referenced) { inlineReference(usage, referenced, myTempExpr); }
inlineUsage
31,940
void (UsageInfo usage, PsiElement referenced, GrExpression initializer) { if (initializer == null) return; GrExpression exprToBeReplaced = (GrExpression)usage.getElement(); if (exprToBeReplaced == null) return; if ((referenced instanceof GrAccessorMethod || referenced instanceof GrField) && exprToBeReplaced instanceof ...
inlineReference
31,941
GrExpression () { return myInitializer; }
getInitializer
31,942
int () { return myWriteInstructionNumber; }
getWriteInstructionNumber
31,943
GroovyControlFlow () { return myFlow; }
getFlow
31,944
String () { @SuppressWarnings("StaticFieldReferencedViaSubclass") String fieldText = PsiFormatUtil.formatVariable(myField, PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_TYPE, PsiSubstitutor.EMPTY); return JavaRefactoringBundle.message("inline.field.field.name.label", fieldText, ""); }
getNameLabelText
31,945
String () { return RefactoringBundle.message("inline.field.border.title"); }
getBorderTitle
31,946
String () { return JavaRefactoringBundle.message("this.reference.only.and.keep.the.field"); }
getInlineThisText
31,947
String () { return JavaRefactoringBundle.message("all.references.and.remove.the.field"); }
getInlineAllText
31,948
boolean () { return JavaRefactoringSettings.getInstance().INLINE_FIELD_THIS; }
isInlineThis
31,949
void () { if (getOKAction().isEnabled()) { JavaRefactoringSettings settings = JavaRefactoringSettings.getInstance(); if (myRbInlineThisOnly.isEnabled() && myRbInlineAll.isEnabled()) { settings.INLINE_FIELD_THIS = isInlineThisOnly(); } close(OK_EXIT_CODE); } }
doAction
31,950
String () { return HelpID.INLINE_FIELD; }
getHelpId
31,951
void (@NotNull UsageInfo usage, @NotNull PsiElement referenced) { PsiElement element=usage.getElement(); if (!(element instanceof GrExpression && element.getParent() instanceof GrCallExpression call)) return; final Editor editor = getCurrentEditorIfApplicable(element); RangeMarker marker = inlineReferenceImpl(call, myM...
inlineUsage
31,952
Editor (@NotNull PsiElement element) { final Project project = element.getProject(); final Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor(); if (editor != null && editor.getDocument() == PsiDocumentManager.getInstance(project).getDocument(element.getContainingFile())) { return editor; } re...
getCurrentEditorIfApplicable
31,953
RangeMarker (@NotNull GrCallExpression call, @NotNull GrMethod method, boolean resultOfCallExplicitlyUsed, boolean isTailMethodCall, @Nullable Editor editor) { try { GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(call.getProject()); final Project project = call.getProject(); // Variable declarati...
inlineReferenceImpl
31,954
String (@NotNull GrCallExpression call, @Nullable GrMethod method, @NotNull final Project project, @NotNull GrExpression qualifier) { String[] possibleNames = GroovyNameSuggestionUtil.suggestVariableNames(qualifier, new NameValidator() { @Override public String validateName(String name, boolean increaseNumber) { return...
generateQualifierName
31,955
String (String name, boolean increaseNumber) { return name; }
validateName
31,956
Project () { return project; }
getProject
31,957
void (@Nullable PsiElement element, ArrayList<PsiNamedElement> defintions) { if (element == null) return; for (PsiElement child : element.getChildren()) { if (child instanceof GrVariable && !(child instanceof GrParameter)) { defintions.add((GrVariable) child); } if (!(child instanceof GrClosableBlock)) { collectInnerDe...
collectInnerDefinitions
31,958
GrExpression (@NotNull GrMethod method) { GrOpenBlock body = method.getBlock(); assert body != null; GrStatement[] statements = body.getStatements(); if (statements.length == 1) { if (statements[0] instanceof GrExpression) return (GrExpression) statements[0]; if (statements[0] instanceof GrReturnStatement) { GrExpressi...
getAloneResultExpression
31,959
boolean (@NotNull GrCallExpression call) { PsiElement parent = call.getParent(); if (!(parent instanceof GrVariableDeclarationOwner owner)) { return true; } // tail calls in methods and closures if (owner instanceof GrClosableBlock || owner instanceof GrOpenBlock && owner.getParent() instanceof GrMethod) { GrStatement[...
isOnExpressionOrReturnPlace
31,960
Template (PsiField f, Object expectedTypes, PsiClass targetClass, Editor editor, PsiElement context, boolean createConstantField, @NotNull PsiSubstitutor substitutor) { GrVariableDeclaration fieldDecl = (GrVariableDeclaration)f.getParent(); GrField field = (GrField)fieldDecl.getVariables()[0]; Project project = field.g...
setupTemplateImpl
31,961
GrField (@NotNull PsiClass targetClass, @NotNull PsiField field, @Nullable PsiElement place) { if (targetClass instanceof GroovyScriptClass) { PsiElement added = targetClass.getContainingFile().add(field.getParent()); return (GrField)((GrVariableDeclaration)added).getVariables()[0]; } else { return (GrField)targetClass...
insertFieldImpl
31,962
IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { final List<PsiClass> classes = getTargetClasses(); if (classes.size() == 0) { return IntentionPreviewInfo.EMPTY; } PsiClass targetClass = classes.get(0); final CreateFieldFix fix = new CreateFieldFix(targetClass); PsiField ...
generatePreview
31,963
String[] (@NotNull PsiClass targetClass) { final GrReferenceExpression myRefExpression = getRefExpr(); if (myRefExpression != null && GrStaticChecker.isInStaticContext(myRefExpression, targetClass)) { return new String[]{PsiModifier.STATIC}; } return ArrayUtilRt.EMPTY_STRING_ARRAY; }
generateModifiers
31,964
TypeConstraint[] () { return GroovyExpectedTypesProvider.calculateTypeConstraints(getRefExpr()); }
calculateTypeConstrains
31,965
String () { return GroovyBundle.message("create.field.from.usage.family.name"); }
getFamilyName
31,966
String () { return GroovyBundle.message("create.field.from.usage", myReferenceName); }
getText
31,967
void (Project project, @NotNull PsiClass targetClass) { final CreateFieldFix fix = new CreateFieldFix(targetClass); fix.doFix(targetClass.getProject(), generateModifiers(targetClass), myReferenceName, calculateTypeConstrains(), getRefExpr()); }
invokeImpl
31,968
boolean (PsiClass psiClass) { return super.canBeTargetClass(psiClass) && !psiClass.isInterface() && !psiClass.isAnnotationType(); }
canBeTargetClass
31,969
PsiType[] () { return PsiType.EMPTY_ARRAY; }
getArgumentTypes
31,970
String () { return GroovyPropertyUtils.getGetterNameNonBoolean(getRefExpr().getReferenceName()); }
getMethodName
31,971
void (ActionEvent event) { PackageChooserDialog chooser = new PackageChooserDialog(GroovyBundle.message("dialog.create.class.package.chooser.title"), myProject); chooser.selectPackage(myPackageTextField.getText()); chooser.show(); PsiPackage aPackage = chooser.getSelectedPackage(); if (aPackage != null) { myPackageText...
actionPerformed
31,972
void () { myPackageTextField = new EditorTextField(); myPackageChooseButton = new FixedSizeButton(myPackageTextField); }
createUIComponents
31,973
JComponent () { myPackageTextField.getDocument().addDocumentListener(new DocumentListener() { @Override public void documentChanged(@NotNull DocumentEvent e) { PsiNameHelper nameHelper = PsiNameHelper.getInstance(myProject); String packageName = getPackageName(); getOKAction().setEnabled(nameHelper.isQualifiedName(pack...
createCenterPanel
31,974
void (@NotNull DocumentEvent e) { PsiNameHelper nameHelper = PsiNameHelper.getInstance(myProject); String packageName = getPackageName(); getOKAction().setEnabled(nameHelper.isQualifiedName(packageName) || packageName.isEmpty()); }
documentChanged
31,975
void (@NotNull AnActionEvent e) { myPackageChooseButton.doClick(); }
actionPerformed
31,976
JComponent () { return myContentPane; }
getContentPane
31,977
PsiDirectory () { return myTargetDirectory; }
getTargetDirectory
31,978
JComponent () { return myPackageTextField; }
getPreferredFocusedComponent
31,979
String () { return myPackageTextField.getText().trim(); }
getPackageName
31,980
void () { final String packageName = getPackageName(); final Ref<@DialogMessage String> errorStringRef = new Ref<>(); CommandProcessor.getInstance().executeCommand(myProject, () -> { try { final PsiDirectory baseDir = myModule == null ? null : PackageUtil.findPossiblePackageDirectoryInModule(myModule, packageName); myT...
doOKAction
31,981
String () { return myClassName; }
getClassName
31,982
GrReferenceExpression () { return myRefExpression.getElement(); }
getRefExpr
31,983
boolean (@NotNull Project project, Editor editor, PsiFile file) { final GrReferenceExpression element = myRefExpression.getElement(); if (element == null || !element.isValid()) { return false; } List<PsiClass> targetClasses = getTargetClasses(); return !targetClasses.isEmpty(); }
isAvailable
31,984
PsiElementPredicate () { return new PsiElementPredicate() { @Override public boolean satisfiedBy(@NotNull PsiElement element) { return element instanceof GrReferenceExpression; } }; }
getElementPredicate
31,985
boolean (@NotNull PsiElement element) { return element instanceof GrReferenceExpression; }
satisfiedBy
31,986
void (List<PsiClass> classes, Editor editor) { final Project project = classes.get(0).getProject(); PsiClassListCellRenderer renderer = new PsiClassListCellRenderer(); final IPopupChooserBuilder<PsiClass> builder = JBPopupFactory.getInstance() .createPopupChooserBuilder(classes) .setRenderer(renderer) .setSelectionMode...
chooseClass
31,987
List<PsiClass> () { final GrReferenceExpression ref = getRefExpr(); final PsiClass targetClass = QuickfixUtil.findTargetClass(ref); if (targetClass == null || !canBeTargetClass(targetClass)) return Collections.emptyList(); final ArrayList<PsiClass> classes = new ArrayList<>(); collectSupers(targetClass, classes); retur...
getTargetClasses
31,988
void (PsiClass psiClass, ArrayList<PsiClass> classes) { classes.add(psiClass); final PsiClass[] supers = psiClass.getSupers(); for (PsiClass aSuper : supers) { if (classes.contains(aSuper)) continue; if (canBeTargetClass(aSuper)) { collectSupers(aSuper, classes); } } }
collectSupers
31,989
boolean (PsiClass psiClass) { return psiClass.getManager().isInProject(psiClass); }
canBeTargetClass
31,990
String () { return GroovyBundle.message("create.method.from.usage.family.name"); }
getFamilyName
31,991
String () { return GroovyBundle.message("create.method.from.usage", getMethodName()); }
getText
31,992
IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { final List<PsiClass> classes = getTargetClasses(); if (classes.size() == 0) { return IntentionPreviewInfo.EMPTY; } Data data = generateMethod(classes.get(0), true); return new IntentionPreviewInfo.CustomDiff(GroovyFileType....
generatePreview
31,993
void (Project project, @NotNull PsiClass targetClass) { Data data = generateMethod(targetClass, false); final PsiElement context = PsiTreeUtil.getParentOfType(getRefExpr(), PsiClass.class, PsiMethod.class, PsiFile.class); IntentionUtils.createTemplateForMethod(data.paramTypesExpressions, data.method, targetClass, data....
invokeImpl
31,994
Data (@NotNull PsiClass targetClass, boolean readOnly) { final JVMElementFactory factory = JVMElementFactories.getFactory(targetClass.getLanguage(), targetClass.getProject()); assert factory != null; PsiMethod method = factory.createMethod(getMethodName(), PsiTypes.voidType()); final GrReferenceExpression ref = getRefE...
generateMethod
31,995
PsiType[] () { return PsiUtil.getArgumentTypes(getRefExpr(), false); }
getArgumentTypes
31,996
String () { return getRefExpr().getReferenceName(); }
getMethodName
31,997
boolean (PsiClass aClass) { return aClass.isInterface() && !GrTraitUtil.isTrait(aClass); }
shouldBeAbstract
31,998
PsiElement (PsiGenerationInfo<PsiMethod> info, PsiClass targetClass) { PsiElement parent = targetClass instanceof GroovyScriptClass ? ((GroovyScriptClass)targetClass).getContainingFile() : targetClass; if (PsiTreeUtil.isAncestor(parent, getRefExpr(), false)) { return info.findInsertionAnchor(targetClass, getRefExpr());...
findInsertionAnchor
31,999
String () { return getText(); }
getFamilyName