Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
74,600
int () { return myBracketsCount; }
getBracketsCount
74,601
PsiTypeLookupItem (@NotNull PsiType type, @Nullable PsiElement context) { final boolean diamond = isDiamond(type); return createLookupItem(type, context, diamond); }
createLookupItem
74,602
PsiTypeLookupItem (@NotNull PsiType type, @Nullable PsiElement context, boolean isDiamond) { return createLookupItem(type, context, isDiamond, DEFAULT_IMPORT_FIXER); }
createLookupItem
74,603
PsiTypeLookupItem (@NotNull PsiType type, @Nullable PsiElement context, boolean isDiamond, InsertHandler<PsiTypeLookupItem> importFixer) { int dim = 0; while (type instanceof PsiArrayType) { type = ((PsiArrayType)type).getComponentType(); dim++; } return doCreateItem(type, context, dim, isDiamond, importFixer); }
createLookupItem
74,604
PsiTypeLookupItem (final PsiType type, PsiElement context, int bracketsCount, boolean diamond, InsertHandler<PsiTypeLookupItem> importFixer) { if (type instanceof PsiClassType) { PsiClassType.ClassResolveResult classResolveResult = ((PsiClassType)type).resolveGenerics(); final PsiClass psiClass = classResolveResult.get...
doCreateItem
74,605
boolean (PsiType type) { boolean diamond = false; if (type instanceof PsiClassReferenceType) { final PsiReferenceParameterList parameterList = ((PsiClassReferenceType)type).getReference().getParameterList(); if (parameterList != null) { final PsiTypeElement[] typeParameterElements = parameterList.getTypeParameterElemen...
isDiamond
74,606
PsiSubstitutor () { return mySubstitutor; }
getSubstitutor
74,607
void (@NotNull LookupElementPresentation presentation) { final Object object = getObject(); if (object instanceof PsiClass) { JavaPsiClassReferenceElement.renderClassItem(presentation, this, (PsiClass)object, myDiamond, myLocationString, mySubstitutor); } else { assert object instanceof PsiType; if (!(object instanceof...
renderElement
74,608
PsiTypeLookupItem () { Object object = getObject(); if (object instanceof PsiClass) { myLocationString = " (" + PsiFormatUtil.getPackageDisplayName((PsiClass)object) + ")"; } return this; }
setShowPackage
74,609
void (InsertionContext context, PsiClass aClass) { if (aClass.getQualifiedName() == null) return; PsiFile file = context.getFile(); int startOffset = context.getStartOffset(); int tail = context.getTailOffset(); PsiJavaCodeReferenceElement ref = PsiTreeUtil.findElementOfClassAtOffset(file, tail - 1, PsiJavaCodeReferenc...
addImportForItem
74,610
Object () { return myPackage; }
getObject
74,611
String () { return myString; }
getLookupString
74,612
boolean () { return true; }
isValid
74,613
void (@NotNull LookupElementPresentation presentation) { super.renderElement(presentation); if (myAddDot) { presentation.setItemText(myString + "."); } presentation.setIcon(IconManager.getInstance().getPlatformIcon(PlatformIcons.Package)); }
renderElement
74,614
void (@NotNull InsertionContext context) { if (myAddDot) { context.setAddCompletionChar(false); TailTypes.dotType().processTail(context.getEditor(), context.getTailOffset()); } if (myAddDot || context.getCompletionChar() == '.') { AutoPopupController.getInstance(context.getProject()).scheduleAutoPopup(context.getEditor...
handleInsert
74,615
boolean (final Object element) { return element instanceof BeanPropertyElement; }
handlesItem
74,616
void (final LookupItem item, final Object element, final LookupElementPresentation presentation) { presentation.setIcon(DefaultLookupItemRenderer.getRawIcon(item)); presentation.setItemText(PsiUtilCore.getName((PsiElement)element)); presentation.setStrikeout(isToStrikeout(item)); presentation.setTailText((String)item.g...
renderElement
74,617
boolean (LookupElement item) { final List<PsiMethod> allMethods = JavaCompletionUtil.getAllMethods(item); if (allMethods != null){ for (PsiMethod method : allMethods) { if (!method.isValid()) { //? return false; } if (!JavaDeprecationUtils.isDeprecated(method, null)) { return false; } } return true; } PsiElement elemen...
isToStrikeout
74,618
boolean (@Nullable PsiElement element) { return element instanceof PsiDocCommentOwner && ((PsiDocCommentOwner)element).isDeprecated(); }
isDeprecated
74,619
String () { return JavaRefactoringBundle.message("replace.constructor.with.factory.method"); }
getFamilyName
74,620
ModCommand (@NotNull ActionContext context) { PsiElement element = context.findLeaf(); PsiMember constructorOrClass = getConstructorOrClass(element); if (constructorOrClass == null) return ModCommand.nop(); List<PsiClass> targets = StreamEx.iterate(constructorOrClass, Objects::nonNull, PsiMember::getContainingClass) .s...
perform
74,621
void (@NotNull PsiClass cls, @NotNull ModPsiUpdater updater, @NotNull SmartPsiElementPointer<PsiMember> constructorOrClassPtr) { PsiMember constructorOrClass = constructorOrClassPtr.getElement(); if (constructorOrClass == null) return; UsageData usages = findUsages(constructorOrClass); performRefactoring(constructorOrC...
invoke
74,622
void (@NotNull PsiMember constructorOrClass, @NotNull PsiClass targetClass, @NotNull UsageData usages, @NotNull ModPsiUpdater updater) { Project project = constructorOrClass.getProject(); PsiElementFactory factory = JavaPsiFacade.getElementFactory(project); PsiClass wrContainingClass = updater.getWritable( constructorO...
performRefactoring
74,623
List<String> (@NotNull PsiClass psiClass, @NotNull String baseName) { int i = 0; String[] baseNames = {"create" + baseName, "new" + baseName, "get" + baseName, "createInstance", "getInstance", "newInstance", "create"}; List<String> suggestions = new ArrayList<>(); while (suggestions.size() < baseNames.length) { for (St...
suggestNames
74,624
PsiMethod (@NotNull Project project, @NotNull PsiClass containingClass, @Nullable PsiMethod constructor, @NotNull String defaultFactoryName) { PsiElementFactory factory = JavaPsiFacade.getElementFactory(project); PsiClassType type = factory.createType(containingClass, PsiSubstitutor.EMPTY); PsiMethod factoryMethod = fa...
createFactoryMethod
74,625
UsageData (@NotNull PsiMember constructorOrClass) { List<PsiNewExpression> newUsages = new ArrayList<>(); List<PsiElement> otherUsages = new ArrayList<>(); for (PsiReference reference : ReferencesSearch.search(constructorOrClass, constructorOrClass.getUseScope(), false)) { PsiElement element = reference.getElement(); i...
findUsages
74,626
PsiMember (@Nullable PsiElement element) { if (element == null) return null; PsiMethod method = MethodUtils.getJavaMethodFromHeader(element); if (method != null) { if (!method.isConstructor()) return null; var containingClass = method.getContainingClass(); if (!isSuitableClass(containingClass)) return null; return meth...
getConstructorOrClass
74,627
boolean (PsiClass containingClass) { return containingClass != null && !containingClass.isInterface() && !containingClass.isEnum() && !containingClass.isRecord() && !containingClass.hasModifierProperty(PsiModifier.ABSTRACT) && containingClass.getQualifiedName() != null; }
isSuitableClass
74,628
boolean (@NotNull PsiPolyadicExpression expression, @NotNull PsiElement token) { List<PsiExpression> afterOperands = new ArrayList<>(); for (PsiElement after = token; after != null; after = after.getNextSibling()) { if (after instanceof PsiExpression) { afterOperands.add((PsiExpression)after); } } for (PsiElement child...
hasPatternVariablesUsedAfterSplit
74,629
String () { return JavaBundle.message("intention.split.filter.family"); }
getFamilyName
74,630
void (@NotNull ActionContext context, @NotNull PsiJavaToken token, @NotNull ModPsiUpdater updater) { final PsiPolyadicExpression expression = SplitConditionUtil.findCondition(token, true, false); final PsiLambdaExpression originalLambdaExpression = PsiTreeUtil.getParentOfType(expression, PsiLambdaExpression.class); LOG...
invoke
74,631
String () { return JavaBundle.message("intention.split.if.family"); }
getFamilyName
74,632
void (@NotNull ActionContext context, @NotNull PsiJavaToken token, @NotNull ModPsiUpdater updater) { LOG.assertTrue(token.getTokenType() == JavaTokenType.ANDAND || token.getTokenType() == JavaTokenType.OROR); PsiPolyadicExpression expression = (PsiPolyadicExpression)token.getParent(); PsiIfStatement ifStatement = PsiTr...
invoke
74,633
boolean (@NotNull PsiParameter parameter) { PsiElement scope = parameter.getDeclarationScope(); if (!(scope instanceof PsiMethod)) { return false; } PsiCodeBlock body = ((PsiMethod)scope).getBody(); if (body == null) return false; if (!myIsFix && !VariableAccessUtils.variableIsUsed(parameter, body) && isUnusedSymbolIns...
isAvailable
74,634
boolean (@NotNull PsiElement element) { HighlightDisplayKey unusedSymbolKey = HighlightDisplayKey.find(UnusedDeclarationInspectionBase.SHORT_NAME); PsiFile file = element.getContainingFile(); if (file == null) return false; InspectionProfile profile = InspectionProjectProfileManager.getInstance(file.getProject()).getCu...
isUnusedSymbolInspectionEnabled
74,635
PsiType (@NotNull PsiParameter parameter) { return FieldFromParameterUtils.getSubstitutedType(parameter); }
getSubstitutedType
74,636
PsiVariable (@NotNull Project project, @NotNull PsiClass targetClass, @NotNull PsiMethod method, @NotNull PsiParameter myParameter, PsiType type, @NotNull String fieldName, boolean methodStatic, boolean isFinal) { return FieldFromParameterUtils.createFieldAndAddAssignment(project, targetClass, method, myParameter, type...
createField
74,637
String () { return JavaBundle.message("intention.compose.function.family"); }
getFamilyName
74,638
void (@NotNull ActionContext context, @NotNull PsiMethodCallExpression call, @NotNull ModPsiUpdater updater) { PsiElement outer = call.getParent().getParent(); if(!(outer instanceof PsiMethodCallExpression outerCall)) return; PsiMethod outerMethod = outerCall.resolveMethod(); if(outerMethod == null) return; PsiClass ou...
invoke
74,639
boolean (@NotNull PsiElement left, @NotNull PsiElement right) { if (left instanceof PsiVariable leftVariable && right instanceof PsiVariable rightVariable) { if (left instanceof PsiParameter || right instanceof PsiParameter) return false; if (left instanceof PsiRecordComponent || right instanceof PsiRecordComponent) re...
flip
74,640
void (@NotNull ActionContext context, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiMethod method = getMethod(element); if (method == null) return; PsiClass recordClass = method.getContainingClass(); if (recordClass == null) return; PsiMethod prototype = generateCanonicalConstructor(method); PsiCode...
invoke
74,641
PsiMethod (@NotNull PsiMethod compactConstructor) { if (!JavaPsiRecordUtil.isCompactConstructor(compactConstructor)) { throw new IllegalArgumentException("Compact constructor required"); } PsiClass recordClass = Objects.requireNonNull(compactConstructor.getContainingClass()); PsiMethod prototype = new RecordConstructor...
generateCanonicalConstructor
74,642
PsiMethod (@NotNull PsiElement element) { return PsiTreeUtil.getParentOfType(element, PsiMethod.class, true, PsiLambdaExpression.class, PsiMember.class); }
getMethod
74,643
String () { return JavaBundle.message("intention.convert.compact.constructor.to.canonical"); }
getFamilyName
74,644
String () { return SimplifyBooleanExpressionFix.getFamilyNameText(); }
getFamilyName
74,645
PsiExpression (@NotNull PsiExpression element) { PsiExpression expression = element; PsiElement parent = expression; while (parent instanceof PsiExpression parentExpression && !(parent instanceof PsiAssignmentExpression) && (PsiTypes.booleanType().equals(parentExpression.getType()) || parent instanceof PsiConditionalEx...
getExpressionToSimplify
74,646
void (@NotNull ActionContext context, @NotNull PsiExpression element, @NotNull ModPsiUpdater updater) { PsiExpression expression = getExpressionToSimplify(element); SimplifyBooleanExpressionFix.simplifyExpression(expression); }
invoke
74,647
String () { return JavaBundle.message("intention.family.name.add.main.method"); }
getFamilyName
74,648
void (@NotNull ActionContext context, @NotNull PsiUnnamedClass element, @NotNull ModPsiUpdater updater) { PsiMethod mainMethod = JavaPsiFacade.getInstance(context.project()).getElementFactory().createMethod("main", PsiTypes.voidType()); element.add(mainMethod); }
invoke
74,649
String () { return JavaBundle.message("intention.text.create.a.class.in.0", myPackageName); }
getText
74,650
String () { return JavaBundle.message("intention.family.create.a.class.in.package"); }
getFamilyName
74,651
boolean (@NotNull Project project, Editor editor, PsiFile file) { return ModuleManager.getInstance(project).findModuleByName(myModuleName) != null; }
isAvailable
74,652
IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { return new IntentionPreviewInfo.Html(JavaBundle.message("intention.text.create.a.class.in.package.preview", myPackageName)); }
generatePreview
74,653
PsiClass (@NotNull CreateClassKind kind, @NotNull PsiDirectory rootDir, @NotNull String name, @NotNull PsiElement contextElement) { PsiDirectory psiPackageDir = CreateServiceClassFixBase.getOrCreatePackageDirInRoot(myPackageName, rootDir); if (psiPackageDir != null) { return CreateFromUsageUtils.createClass(kind, psiPa...
createClassInPackage
74,654
boolean () { return false; }
startInWriteAction
74,655
IntentionAction (@NotNull Module module, @Nullable String packageName) { return StringUtil.isEmpty(packageName) ? null : new CreateClassInPackageInModuleFix(module.getName(), packageName); }
createFix
74,656
JComponent () { return null; }
createCenterPanel
74,657
JComponent () { return myNameTextField; }
getPreferredFocusedComponent
74,658
JComponent () { PanelGridBuilder builder = UI.PanelFactory.grid(); builder.add(UI.PanelFactory.panel(myNameTextField) .withLabel(CommonBundle.message("label.name") + ":") .withComment(JavaBundle.message("comment.the.class.will.be.created.in.the.package.0", myPackageName))); if (myRootDirCombo.getModel().getSize() > 1) ...
createNorthPanel
74,659
ValidationInfo () { String name = getName(); PsiDirectory rootDir = getRootDir(); LanguageLevel level = rootDir != null ? PsiUtil.getLanguageLevel(rootDir) : LanguageLevel.HIGHEST; if (PsiNameHelper.getInstance(myProject).isIdentifier(name, level)) { return null; } return new ValidationInfo(JavaBundle.message("error.te...
doValidate
74,660
String () { return myNameTextField.getText().trim(); }
getName
74,661
PsiDirectory () { return (PsiDirectory)myRootDirCombo.getSelectedItem(); }
getRootDir
74,662
CreateClassKind () { return CreateClassKind.valueOf(myKindCombo.getSelectedName()); }
getKind
74,663
boolean (@NotNull final Project project, final @NotNull Editor editor, @NotNull PsiElement element) { if (element instanceof PsiIdentifier || element instanceof PsiJavaCodeReferenceElement || element instanceof PsiJavaModuleReferenceElement) { PsiElement targetElement = PsiTreeUtil.skipParentsOfType(element, PsiIdentif...
isAvailable
74,664
String () { //noinspection DialogTitleCapitalization return JavaBundle.message("intention.family.add.javadoc"); }
getFamilyName
74,665
String () { //noinspection DialogTitleCapitalization return getFamilyName(); }
getText
74,666
String () { return JavaBundle.message("intention.assign.field.from.parameter.family"); }
getFamilyName
74,667
void (@NotNull ActionContext context, @NotNull PsiParameter myParameter, @NotNull ModPsiUpdater updater) { PsiField field = findFieldToAssign(context.project(), myParameter); if (field != null) { addFieldAssignmentStatement(context.project(), field, myParameter, updater); } }
invoke
74,668
PsiField (@NotNull Project project, @NotNull PsiParameter myParameter) { JavaCodeStyleManager styleManager = JavaCodeStyleManager.getInstance(project); String parameterName = myParameter.getName(); String propertyName = styleManager.variableNameToPropertyName(parameterName, VariableKind.PARAMETER); PsiMethod method = (...
findFieldToAssign
74,669
String () { return getText(); }
getFamilyName
74,670
boolean (@NotNull PsiField field) { if (hasUnsuitableModifiers(field)) return false; // Doesn't work for Groovy if (field.getLanguage() != JavaLanguage.INSTANCE) return false; PsiExpression initializer = field.getInitializer(); if (initializer == null || initializer.getNextSibling() instanceof PsiErrorElement) return f...
isAvailable
74,671
boolean (@NotNull PsiField field) { for (@PsiModifier.ModifierConstant String modifier : getUnsuitableModifiers()) { if (field.hasModifierProperty(modifier)) { return true; } } return false; }
hasUnsuitableModifiers
74,672
void (@NotNull ActionContext context, @NotNull PsiField field, @NotNull ModPsiUpdater updater) { final PsiClass aClass = field.getContainingClass(); if (aClass == null) return; final Collection<PsiMethod> methodsToAddInitialization = getOrCreateMethods(aClass); if (methodsToAddInitialization.isEmpty()) return; final Li...
invoke
74,673
List<PsiExpressionStatement> (@NotNull PsiField field, @NotNull Collection<? extends PsiMethod> methods) { final List<PsiExpressionStatement> assignments = new ArrayList<>(); for (PsiMethod method : methods) { assignments.add(addAssignment(getOrCreateMethodBody(method), field)); } return assignments; }
addFieldAssignments
74,674
PsiCodeBlock (@NotNull PsiMethod method) { PsiCodeBlock codeBlock = method.getBody(); if (codeBlock == null) { CreateFromUsageUtils.setupMethodBody(method); codeBlock = method.getBody(); } return codeBlock; }
getOrCreateMethodBody
74,675
PsiElement (PsiStatement @NotNull [] statements, @NotNull PsiField field) { for (PsiStatement blockStatement : statements) { if (!isSuperOrThisMethodCall(blockStatement) && containsReference(blockStatement, field)) { return blockStatement; } } return null; }
findFirstFieldUsage
74,676
boolean (@NotNull PsiStatement statement) { if (statement instanceof PsiExpressionStatement) { final PsiElement expression = ((PsiExpressionStatement)statement).getExpression(); return JavaPsiConstructorUtil.isConstructorCall(expression); } return false; }
isSuperOrThisMethodCall
74,677
boolean (final @NotNull PsiElement element, final @NotNull PsiField field) { final Ref<Boolean> result = new Ref<>(Boolean.FALSE); element.accept(new JavaRecursiveElementWalkingVisitor() { @Override public void visitReferenceExpression(@NotNull PsiReferenceExpression expression) { if (expression.resolve() == field) { r...
containsReference
74,678
void (@NotNull PsiReferenceExpression expression) { if (expression.resolve() == field) { result.set(Boolean.TRUE); } super.visitReferenceExpression(expression); }
visitReferenceExpression
74,679
String () { return JavaBundle.message("intention.family.expand.static.import"); }
getFamilyName
74,680
PsiImportStaticStatement (PsiJavaCodeReferenceElement referenceElement) { PsiElement parent = referenceElement.getParent(); return parent instanceof PsiImportStaticStatement importStatic ? importStatic : ObjectUtils.tryCast(referenceElement.advancedResolve(true).getCurrentFileResolveScope(), PsiImportStaticStatement.cl...
getImportStaticStatement
74,681
ModCommand (@NotNull ActionContext context, @NotNull PsiIdentifier element) { final PsiJavaCodeReferenceElement refExpr = (PsiJavaCodeReferenceElement)element.getParent(); ThreeState expandAll = myExpandAll == ThreeState.UNSURE && refExpr.getParent() instanceof PsiImportStaticStatement ? ThreeState.YES : myExpandAll; r...
perform
74,682
void (@NotNull ActionContext context, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiLocalVariable variable = findVariable(element); if (variable != null) { processVariable(context.project(), updater, variable); } else { PsiExpression expression = findExpression(element); if (expression != null) { pr...
invoke
74,683
PsiLocalVariable (PsiElement element) { PsiLocalVariable variable = PsiTreeUtil.getNonStrictParentOfType(element, PsiLocalVariable.class); if (variable != null && variable.getParent() instanceof PsiDeclarationStatement && variable.getParent().getParent() instanceof PsiCodeBlock && rightType(variable.getType()) && valid...
findVariable
74,684
PsiExpression (PsiElement element) { PsiExpression expression = PsiTreeUtil.getNonStrictParentOfType(element, PsiExpression.class); if (expression != null && expression.getParent() instanceof PsiExpressionStatement && expression.getParent().getParent() instanceof PsiCodeBlock && validExpression(expression)) { return ex...
findExpression
74,685
boolean (PsiType type) { return InheritanceUtil.isInheritor(type, CommonClassNames.JAVA_LANG_AUTO_CLOSEABLE); }
rightType
74,686
boolean (PsiExpression expression) { return expression != null && rightType(expression.getType()) && PsiTreeUtil.findChildOfType(expression, PsiErrorElement.class) == null; }
validExpression
74,687
void (Project project, ModPsiUpdater updater, PsiLocalVariable variable) { PsiExpression initializer = Objects.requireNonNull(variable.getInitializer()); PsiElement declaration = variable.getParent(); PsiElement codeBlock = declaration.getParent(); LocalSearchScope scope = new LocalSearchScope(codeBlock); PsiElement la...
processVariable
74,688
List<PsiElement> (PsiElement last, PsiElement declaration, PsiTryStatement armStatement) { PsiCodeBlock tryBlock = armStatement.getTryBlock(); assert tryBlock != null : armStatement.getText(); PsiElement parent = declaration.getParent(); LocalSearchScope scope = new LocalSearchScope(parent); List<PsiElement> toFormat =...
moveStatements
74,689
void (final Project project, ModPsiUpdater updater, PsiExpression expression) { PsiType type = Objects.requireNonNull(expression.getType()); final PsiType[] types = Stream.of(new TypeSelectorManagerImpl(project, type, expression, PsiExpression.EMPTY_ARRAY).getTypesForAll()) .filter(SurroundAutoCloseableAction::rightTyp...
processExpression
74,690
String () { return JavaBundle.message("intention.surround.resource.with.ARM.block"); }
getFamilyName
74,691
boolean () { return false; }
isExclusive
74,692
String () { return JavaBundle.message("intention.surround.with.ARM.block.template"); }
getTemplateDescription
74,693
boolean (PsiElement @NotNull [] elements) { return elements.length == 1 && (findExpression(elements[0]) != null || findVariable(elements[0]) != null); }
isApplicable
74,694
TextRange (@NotNull Project project, @NotNull Editor editor, PsiElement @NotNull [] elements) { if (elements.length == 1) { ActionContext context = ActionContext.from(editor, elements[0].getContainingFile()); ModCommand command = new SurroundAutoCloseableAction().perform(context, elements[0]); ModCommandExecutor.getIns...
surroundElements
74,695
void (@NotNull Project project, @NotNull PsiFile file, @Nullable Editor editor, @NotNull PsiElement startElement, @NotNull PsiElement endElement) { RefactoringActionHandler handler = LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE).getIntroduceVariableHandler(); assert handler != null; ((JavaIntro...
invoke
74,696
boolean () { return false; }
startInWriteAction
74,697
String () { return JavaBundle.message("intention.introduce.variable.text"); }
getText
74,698
String () { return getText(); }
getFamilyName
74,699
IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { PsiElement element = PsiTreeUtil.findSameElementInCopy(myStartElement.getElement(), file); if (element == null) return IntentionPreviewInfo.EMPTY; RefactoringActionHandler handler = LanguageRefactoringSupport.INSTANCE.forLa...
generatePreview