Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
76,400
void (@NotNull PsiJavaCodeReferenceElement ref, PsiElement parent, @NotNull QuickFixActionRegistrar registrar) { if ((parent instanceof PsiMethod || parent instanceof PsiField) && parent.getParent() instanceof PsiClass) { // record R() {} is parsed as method if records aren't supported // record R incomplete declaratio...
registerRecordLanguageLevelFix
76,401
void (@NotNull PsiJavaCodeReferenceElement ref, @NotNull HighlightingFeature feature, @NotNull QuickFixActionRegistrar registrar) { List<IntentionAction> fixes = new ArrayList<>(); HighlightUtil.registerIncreaseLanguageLevelFixes(ref, feature, fixes); for (IntentionAction fix : fixes) { registrar.register(fix); } }
registerIncreaseLevelFixes
76,402
void (@NotNull PsiJavaCodeReferenceElement ref, PsiElement parent, @NotNull QuickFixActionRegistrar registrar) { HighlightingFeature feature; if (parent instanceof PsiParameter && ((PsiParameter)parent).getDeclarationScope() instanceof PsiLambdaExpression) { feature = HighlightingFeature.VAR_LAMBDA_PARAMETER; } else { ...
registerVarLanguageLevelFix
76,403
Class<PsiJavaCodeReferenceElement> () { return PsiJavaCodeReferenceElement.class; }
getReferenceClass
76,404
void (PsiElement parent, @NotNull QuickFixActionRegistrar registrar) { PsiVariable variable = ObjectUtils.tryCast(parent, PsiVariable.class); if (variable == null) return; PsiParameterList parameterList = ObjectUtils.tryCast(variable.getParent(), PsiParameterList.class); if (parameterList == null) return; PsiLambdaExpr...
registerLambdaParametersFix
76,405
void (PsiElement parent, @NotNull QuickFixActionRegistrar registrar) { PsiVariable variable = ObjectUtils.tryCast(parent, PsiVariable.class); if (variable == null) return; PsiType type = inferType(variable); if (type == null) return; registrar.register(PriorityIntentionActionWrapper.highPriority(QuickFixFactory.getInst...
registerSetVariableTypeFix
76,406
String () { return JavaBundle.message("set.language.level.to.0", myLevel.getPresentableText()); }
getText
76,407
String () { return getText(); }
getName
76,408
String () { return JavaBundle.message("set.language.level"); }
getFamilyName
76,409
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement element = descriptor.getPsiElement(); invoke(project, null, element.getContainingFile()); }
applyFix
76,410
IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { Module module = Objects.requireNonNull(ModuleUtilCore.findModuleForFile(file.getOriginalFile())); return new IntentionPreviewInfo.Html( JavaBundle.message("increase.language.level.preview.description", module.getName(), myL...
generatePreview
76,411
boolean (@NotNull Project project, Editor editor, PsiFile file) { Module module = ModuleUtilCore.findModuleForFile(file); return module != null && JavaSdkUtil.isLanguageLevelAcceptable(project, module, myLevel); }
isAvailable
76,412
void () { JavaProjectModelModificationService.getInstance(project).changeLanguageLevel(module, oldLevel, true); }
undo
76,413
void () { JavaProjectModelModificationService.getInstance(project).changeLanguageLevel(module, myLevel, true); }
redo
76,414
PsiElement (@NotNull PsiFile file) { return null; }
getElementToMakeWritable
76,415
boolean () { return false; }
startInWriteAction
76,416
List<String> (@NotNull Nullability nullability) { return switch (nullability) { case NOT_NULL -> Arrays.asList("android.support.annotation.NonNull", "androidx.annotation.NonNull", "androidx.annotation.RecentlyNonNull", "com.android.annotations.NonNull"); case NULLABLE -> Arrays.asList("android.support.annotation.Nullab...
getNullabilityAnnotations
76,417
List<String> (@NotNull Nullability nullability) { return switch (nullability) { case NOT_NULL -> Collections.singletonList("org.eclipse.jdt.annotation.NonNull"); case NULLABLE -> Collections.singletonList("org.eclipse.jdt.annotation.Nullable"); default -> Collections.emptyList(); }; }
getNullabilityAnnotations
76,418
List<String> (@NotNull Nullability nullability) { return switch (nullability) { case NOT_NULL -> Collections.singletonList(AnnotationUtil.NOT_NULL); case NULLABLE -> Collections.singletonList(AnnotationUtil.NULLABLE); case UNKNOWN -> Collections.singletonList(AnnotationUtil.UNKNOWN_NULLABILITY); }; }
getNullabilityAnnotations
76,419
boolean () { return true; }
isTypeUseAnnotationLocationRestricted
76,420
List<String> (@NotNull Nullability nullability) { return switch (nullability) { case NOT_NULL -> List.of("jakarta.annotation.Nonnull"); case NULLABLE -> List.of("jakarta.annotation.Nullable"); default -> Collections.emptyList(); }; }
getNullabilityAnnotations
76,421
NullabilityAnnotationInfo (@NotNull PsiAnnotation anno, @NotNull PsiElement context, PsiAnnotation.TargetType @NotNull [] types, boolean superPackage) { if (context instanceof PsiTypeParameter) { // DefaultQualifier is not applicable to type parameter declarations return null; } if (anno.hasQualifiedName(DEFAULT_QUALIF...
getNullabilityByContainerAnnotation
76,422
boolean (PsiAnnotation.TargetType[] types, PsiAnnotationMemberValue locations) { Set<String> locationNames = ContainerUtil.map2SetNotNull(AnnotationUtil.arrayAttributeValues(locations), l -> l instanceof PsiReferenceExpression ? ((PsiReferenceExpression)l) .getReferenceName() : null); if (locationNames.contains("ALL"))...
hasAppropriateTarget
76,423
List<String> (@NotNull Nullability nullability) { return switch (nullability) { case NOT_NULL -> Arrays.asList("org.checkerframework.checker.nullness.qual.NonNull", "org.checkerframework.checker.nullness.compatqual.NonNullDecl", "org.checkerframework.checker.nullness.compatqual.NonNullType"); case NULLABLE -> Arrays.as...
getNullabilityAnnotations
76,424
NullabilityAnnotationInfo (@NotNull PsiAnnotation annotation, @NotNull PsiElement context, PsiAnnotation.TargetType @NotNull [] placeTargetTypes, boolean superPackage) { if (superPackage) return null; PsiClass declaration = annotation.resolveAnnotationType(); PsiModifierList modList = declaration == null ? null : decla...
getNullabilityByContainerAnnotation
76,425
Nullability (@NotNull PsiAnnotation qualifier) { String qName = qualifier.getQualifiedName(); if (qName == null) return null; NullableNotNullManager manager = NullableNotNullManager.getInstance(qualifier.getProject()); if (qName.equals(JAVAX_ANNOTATION_NULLABLE) && manager.getNullables().contains(qName)) { return Nulla...
getJsr305QualifierNullability
76,426
boolean (@NotNull PsiClass candidate) { String qname = candidate.getQualifiedName(); if (qname == null || qname.startsWith("javax.annotation.")) return false; return getNickNamedNullability(candidate) != null; }
isNullabilityNickName
76,427
List<String> (@NotNull Nullability nullability) { return switch (nullability) { case NOT_NULL -> Collections.singletonList(JAVAX_ANNOTATION_NONNULL); case NULLABLE -> Arrays.asList(JAVAX_ANNOTATION_NULLABLE, "javax.annotation.CheckForNull"); case UNKNOWN -> Collections.emptyList(); }; }
getNullabilityAnnotations
76,428
List<String> (@NotNull Nullability nullability) { return switch (nullability) { case NOT_NULL -> Collections.singletonList(NON_NULL); case NULLABLE -> Collections.singletonList(NULLABLE); default -> Collections.emptyList(); }; }
getNullabilityAnnotations
76,429
NullabilityAnnotationInfo (@NotNull PsiAnnotation anno, @NotNull PsiElement context, PsiAnnotation.TargetType @NotNull [] types, boolean superPackage) { if (superPackage) return null; String name = anno.getQualifiedName(); if (name == null) return null; if (ArrayUtil.contains(PsiAnnotation.TargetType.LOCAL_VARIABLE, ty...
getNullabilityByContainerAnnotation
76,430
List<String> (@NotNull Nullability nullability) { return switch (nullability) { case NOT_NULL -> Collections.singletonList(NOT_NULL); case NULLABLE -> Collections.singletonList(NULLABLE); case UNKNOWN -> List.of(NULLNESS_UNKNOWN); }; }
getNullabilityAnnotations
76,431
boolean () { return true; }
isTypeUseAnnotationLocationRestricted
76,432
boolean () { return false; }
canAnnotateLocals
76,433
PsiReference () { return this; }
getReference
76,434
PsiElement () { return this; }
getElement
76,435
PsiElement () { final ResolveResult[] results = multiResolve(false); return results.length == 1 ? results[0].getElement() : null; }
resolve
76,436
boolean (PsiScopeProcessor processor) { final T qualifier = getQualifier(); if (qualifier == null) { return processUnqualifiedVariants(processor); } final PsiElement psiElement = qualifier.resolve(); return psiElement == null || psiElement.processDeclarations(processor, ResolveState.initial(), null, this); }
processVariantsInner
76,437
boolean (final PsiScopeProcessor processor) { return PsiScopesUtil.treeWalkUp(processor, this, null); }
processUnqualifiedVariants
76,438
T () { return (T)findChildByClass(getClass()); }
getQualifier
76,439
boolean (final PsiMethod method) { final AbstractQualifiedReferenceResolvingProcessor processor = new AbstractQualifiedReferenceResolvingProcessor() { @Override protected void process(final PsiElement element) { if (getManager().areElementsEquivalent(element, method) && isAccessible(element)) { setFound(); } } }; proce...
isDirectlyVisible
76,440
void (final PsiElement element) { if (getManager().areElementsEquivalent(element, method) && isAccessible(element)) { setFound(); } }
process
76,441
AbstractQualifiedReference (final String newText) { final ASTNode newNode = parseReference(newText).getNode(); getNode().getTreeParent().replaceChild(getNode(), newNode); return (AbstractQualifiedReference)newNode.getPsi(); }
replaceReference
76,442
boolean (final PsiElement element) { if (element instanceof PsiMember member) { return JavaResolveUtil.isAccessible(member, member.getContainingClass(), member.getModifierList(), this, null, null); } return true; }
isAccessible
76,443
AbstractQualifiedReference () { final PsiElement refElement = resolve(); if (refElement instanceof PsiClass) { final PsiQualifiedReference reference = JavaReferenceAdjuster.getClassReferenceToShorten((PsiClass)refElement, false, this); if (reference instanceof AbstractQualifiedReference) { ((AbstractQualifiedReference<...
shortenReferences
76,444
void () { final AbstractQualifiedReference qualifier = getQualifier(); if (qualifier != null) { getNode().removeChild(qualifier.getNode()); final PsiElement separator = getSeparator(); if (separator != null) { final ASTNode separatorNode = separator.getNode(); if (separatorNode != null) { getNode().removeChild(separato...
dequalify
76,445
boolean (@NotNull final PsiElement element) { final PsiManager manager = getManager(); for (final ResolveResult result : multiResolve(false)) { if (manager.areElementsEquivalent(result.getElement(), element)) return true; } return false; }
isReferenceTo
76,446
TextRange () { final PsiElement element = getSeparator(); final int length = getTextLength(); return element == null ? TextRange.from(0, length) : new TextRange(element.getStartOffsetInParent() + element.getTextLength(), length); }
getRangeInElement
76,447
String () { final PsiElement element = getReferenceNameElement(); return element == null ? null : element.getText().trim(); }
getReferenceName
76,448
boolean () { return false; }
isSoft
76,449
boolean (@NotNull final PsiElement element, @NotNull final ResolveState state) { if (isFound()) return false; process(element); return true; }
execute
76,450
void (ResolveResult resolveResult) { myResults.add(resolveResult); }
addResult
76,451
boolean () { return myFound; }
isFound
76,452
void (@NotNull final Event event, final Object associated) { if ((event == JavaScopeProcessorEvent.SET_CURRENT_FILE_CONTEXT || event == Event.SET_DECLARATION_HOLDER) && !myResults.isEmpty()) { setFound(); } }
handleEvent
76,453
void () { myFound = true; }
setFound
76,454
Set<ResolveResult> () { return myResults; }
getResults
76,455
SearchScope (@NotNull VirtualFile file, @NotNull Project project) { if (project.isDefault()) { return null; } ProjectFileIndex index = ProjectFileIndex.getInstance(project); if (index.isInLibraryClasses(file) || index.isInContent(file)) { return null; } String fileExtension = file.getExtension(); if ("class".equals(fil...
getAdditionalResolveScope
76,456
ProjectIconsAccessor (Project project) { return project.getService(ProjectIconsAccessor.class); }
getInstance
76,457
VirtualFile (UElement initializerElement) { if (initializerElement == null) return null; final List<FileReference> refs = new ArrayList<>(); initializerElement.accept(new AbstractUastVisitor() { @Override public boolean visitLiteralExpression(@NotNull ULiteralExpression node) { PsiElement psi = UastLiteralUtils.getSour...
resolveIconFile
76,458
boolean (@NotNull ULiteralExpression node) { PsiElement psi = UastLiteralUtils.getSourceInjectionHost(node); if (psi != null) { for (PsiReference ref : psi.getReferences()) { if (ref instanceof FileReference) { refs.add((FileReference)ref); } } } super.visitLiteralExpression(node); return true; }
visitLiteralExpression
76,459
boolean (PsiType type) { return InheritanceUtil.isInheritor(type, JAVAX_SWING_ICON); }
isIconClassType
76,460
boolean (String extension) { return extension != null && ICON_EXTENSIONS.contains(StringUtil.toLowerCase(extension)); }
isIconFileExtension
76,461
boolean (Icon icon) { return icon.getIconHeight() <= JBUIScale.scale(ICON_MAX_HEIGHT) && icon.getIconWidth() <= JBUIScale.scale(ICON_MAX_WEIGHT); }
hasProperSize
76,462
boolean (@Nullable Project project) { if (project == null) return false; VirtualFile baseDir = project.getBaseDir(); //has copy in devkit plugin: org.jetbrains.idea.devkit.util.PsiUtil.isIntelliJBasedDir return baseDir != null && (baseDir.findChild("idea.iml") != null || baseDir.findChild("community-main.iml") != null ...
isIdeaProject
76,463
String (String fqName) { return StringUtil.getShortName(fqName); }
extractClassName
76,464
String (String fqName) { int i = fqName.lastIndexOf('.'); return i == -1 ? "" : fqName.substring(0, i); }
extractPackage
76,465
String (String aPackage, String className) { String fq = aPackage; if (!"".equals(aPackage)) { fq += "."; } fq += className; return fq; }
makeFQName
76,466
PsiClass (@Nullable PsiDirectory classDirectory, @Nullable final Module module, final String className, final String templateName) { if (classDirectory == null && module != null) { try { classDirectory = PackageUtil.findOrCreateDirectoryForPackage(module, "", null, false); } catch (IncorrectOperationException e) { retu...
createClassFromCustomTemplate
76,467
PsiPackage (PsiElement position) { PsiFile file = position.getContainingFile(); if (file == null) return null; PsiFile originalFile = file.getOriginalFile(); while (true) { PsiElement context = originalFile.getContext(); if (context == null) { PsiDirectory parent = originalFile.getParent(); if (parent != null) { return...
getContextPackage
76,468
ImportWeight (@NotNull final PsiElement element, @NotNull final ProximityLocation location) { final PsiElement position = location.getPosition(); if (position == null){ return ImportWeight.UNKNOWN; } PsiUtilCore.ensureValid(position); final PsiFile elementFile = element.getContainingFile(); final PsiFile positionFile =...
weigh
76,469
boolean (List<String> importedNames, final String pkg) { return ContainerUtil.or(importedNames, s -> s.startsWith(pkg + '.') || s.equals(pkg)); }
containsImport
76,470
AccessibilityLevel (@NotNull PsiElement element, @NotNull ProximityLocation location) { if (element instanceof PsiDocCommentOwner member) { PsiElement position = location.getPosition(); Project project = location.getProject(); if (project != null && !DumbService.isDumb(project)) { if (position != null && !JavaPsiFacade...
weigh
76,471
Preference (@NotNull final PsiElement position) { if (INSIDE_REFERENCE_LIST.accepts(position)) { PsiReferenceList list = (PsiReferenceList)position.getParent().getParent(); PsiReferenceList.Role role = list.getRole(); if (shouldContainInterfaces(list, role)) { return Preference.Interfaces; } if (role == PsiReferenceLis...
getPreferredCondition
76,472
boolean (PsiReferenceList list, PsiReferenceList.Role role) { if (role == PsiReferenceList.Role.EXTENDS_LIST) { PsiElement parent = list.getParent(); return parent instanceof PsiClass && ((PsiClass)parent).isInterface(); } if (role == PsiReferenceList.Role.IMPLEMENTS_LIST) { return true; } return false; }
shouldContainInterfaces
76,473
ReferenceListApplicability (@NotNull PsiElement element, @NotNull ProximityLocation location) { if (element instanceof PsiClass && location.getPosition() != null) { return getApplicability((PsiClass)element, location.getPosition()); } return unknown; }
weigh
76,474
ReferenceListApplicability (@NotNull PsiClass aClass, @NotNull PsiElement position) { Preference condition = getPreferredCondition(position); if (aClass.hasModifierProperty(PsiModifier.FINAL)) { if (condition == Preference.Interfaces || condition == Preference.Classes) { return inapplicable; } } if (condition == Prefer...
getApplicability
76,475
Comparable (@NotNull final PsiElement element, @NotNull final ProximityLocation location) { Project project = location.getProject(); if (project == null) return 0; Comparable tests = getTestFrameworkWeight(element, location, project); if (tests != null) return tests; if (element instanceof PsiMember && JavaCompletionUt...
weigh
76,476
Integer (@NotNull PsiElement element, @NotNull ProximityLocation location, @NotNull Project project) { if (element instanceof PsiClass) { final String qualifiedName = ((PsiClass)element).getQualifiedName(); if (qualifiedName != null) { if (qualifiedName.startsWith("org.testng.internal")) { return -1; } VirtualFile loca...
getTestFrameworkWeight
76,477
boolean (PsiMethod method) { return "getClass".equals(method.getName()) && method.getParameterList().getParametersCount() <= 0; }
isGetClass
76,478
Integer (@Nullable PsiClass element) { String qname = element == null ? null : element.getQualifiedName(); if (qname == null) return null; if (isDispreferredName(qname)) return -1; if (element.getContainingClass() != null) return 0; String pkg = StringUtil.getPackageName(qname); if (qname.equals(JAVA_LANG_OBJECT)) retu...
getJdkClassProximity
76,479
boolean (String qname) { return qname.startsWith("com.") || qname.startsWith("net."); }
isDispreferredName
76,480
Comparable (@NotNull final PsiElement element, @NotNull final ProximityLocation location) { if (location.getPosition() == null || !(element instanceof PsiClass)) { return null; } if (isTooGeneral((PsiClass)element)) return false; Set<String> superClasses = PLACE_SUPER_CLASSES.getValue(location); if (superClasses.isEmpt...
weigh
76,481
PsiClass (PsiElement element, PsiElement position) { if (position.getParent() instanceof PsiReferenceExpression) { final PsiExpression qualifierExpression = ((PsiReferenceExpression)position.getParent()).getQualifierExpression(); if (qualifierExpression != null) { final PsiType type = qualifierExpression.getType(); if ...
findPlaceClass
76,482
boolean (@Nullable final PsiClass element) { if (element == null) return true; @NonNls final String qname = element.getQualifiedName(); return qname == null || qname.startsWith("java.lang."); }
isTooGeneral
76,483
PsiMethod () { return myMethod; }
getMethod
76,484
PsiSubstitutor () { return mySubstitutor; }
getSubstitutor
76,485
MethodCandidateInfo (@NotNull final PsiMethod method, @NotNull final PsiSubstitutor substitutor, final boolean staticProblem, final boolean accessible, final boolean varargs) { return JavaMethodResolveHelper.this .createCandidateInfo(method, substitutor, staticProblem, myCurrentFileContext, !accessible, argumentList, a...
createCandidateInfo
76,486
boolean (@NotNull final PsiMethod candidate) { return !candidate.isConstructor(); }
isAccepted
76,487
MethodCandidateInfo (@NotNull PsiMethod method, PsiSubstitutor substitutor, boolean staticProblem, PsiElement currentFileContext, boolean accessProblem, PsiElement argumentList, PsiType[] argumentTypes, @NotNull LanguageLevel languageLevel, boolean vararg) { return new MethodCandidateInfo(method, substitutor, accessPro...
createCandidateInfo
76,488
boolean () { return vararg; }
isVarargs
76,489
void (@NotNull PsiMethod method, @NotNull PsiSubstitutor substitutor, boolean staticError) { if (myDuplicates.add(method.getSignature(substitutor))) { myProcessor.addMethod(method, substitutor, staticError); } }
addMethod
76,490
ErrorType () { final List<CandidateInfo> candidates = getCandidates(); if (candidates.size() != 1) return ErrorType.RESOLVE; if (!candidates.get(0).isStaticsScopeCorrect()) return ErrorType.STATIC; return getResolveError((MethodCandidateInfo)candidates.get(0)); }
getResolveError
76,491
List<CandidateInfo> () { return Arrays.asList(myProcessor.getCandidates()); }
getCandidates
76,492
ErrorType (MethodCandidateInfo info) { if (myArgumentTypes == null) return ErrorType.NONE; if (!info.isApplicable()) { boolean hasNulls = false; final PsiParameter[] parameters = info.getElement().getParameterList().getParameters(); if (myArgumentTypes.length == parameters.length) { for (int i = 0; i < myArgumentTypes....
getResolveError
76,493
void (final PsiScopeProcessor.Event event, final Object associated) { myProcessor.handleEvent(event, associated); }
handleEvent
76,494
Collection<JavaMethodCandidateInfo> () { return ContainerUtil.mapNotNull(getCandidates(), (Function<JavaResolveResult, JavaMethodCandidateInfo>)javaResolveResult -> new JavaMethodCandidateInfo((PsiMethod)javaResolveResult.getElement(), javaResolveResult.getSubstitutor())); }
getMethods
76,495
String (final Lexer lexer) { if (lexer.getTokenType() != ScopeTokenTypes.IDENTIFIER) return PatternPackageSet.Scope.ANY.getId(); String id = getTokenText(lexer); PatternPackageSet.Scope scope; if (id.trim().isEmpty()) { scope = PatternPackageSet.Scope.ANY; } else { scope = ContainerUtil.find(PatternPackageSet.Scope.val...
parseScope
76,496
String (Lexer lexer) { int start = lexer.getTokenStart(); int end = lexer.getTokenEnd(); return lexer.getBufferSequence().subSequence(start, end).toString(); }
getTokenText
76,497
String () { return myId; }
getId
76,498
boolean (@NotNull VirtualFile file, @NotNull Project project, @Nullable NamedScopesHolder holder) { ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex(); if (!matchesScope(file, project, fileIndex)) { return false; } if (myPattern == null) { return true; } String packageName = getPackageN...
contains
76,499
boolean (@NotNull VirtualFile file, @NotNull Project project, @NotNull ProjectFileIndex fileIndex) { boolean isSource = fileIndex.isInSourceContent(file); return switch (myScope) { case ANY -> fileIndex.isInContent(file) && matchesModule(file, fileIndex); case SOURCE -> isSource && !TestSourcesFilter.isTestSources(file...
matchesScope