Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
37,500
void (AnnotationHolder holder, @NotNull GrTypeDefinition typeDefinition) { final PsiClass psiClass = InheritanceUtil.getCircularClass(typeDefinition); if (psiClass != null) { String qname = psiClass.getQualifiedName(); assert qname != null; holder.newAnnotation(HighlightSeverity.ERROR, GroovyBundle.message("cyclic.inhe...
checkCyclicInheritance
37,501
void (AnnotationHolder holder, @Nullable GrReferenceList clause) { if (clause == null) return; final GrCodeReferenceElement[] elements = clause.getReferenceElementsGroovy(); for (GrCodeReferenceElement element : elements) { final GrTypeArgumentList list = element.getTypeArgumentList(); if (list != null) { for (GrTypeEl...
checkForWildCards
37,502
void (GrTypeDefinition typeDefinition, AnnotationHolder holder) { final PsiClass containingClass = typeDefinition.getContainingClass(); String name = typeDefinition.getName(); if (containingClass != null) { final String containingClassName = containingClass.getName(); if (containingClassName != null && containingClassN...
checkDuplicateClass
37,503
GlobalSearchScope (GrTypeDefinition typeDefinition) { GlobalSearchScope defaultScope = typeDefinition.getResolveScope(); PsiFile file = typeDefinition.getContainingFile(); if (file instanceof GroovyFile && ((GroovyFile)file).isScript()) { Module module = ModuleUtilCore.findModuleForPsiElement(file); if (module != null)...
inferClassScopeForSearchingDuplicates
37,504
String (GrTypeDefinition typeDefinition) { final PsiFile file = typeDefinition.getContainingFile(); String packageName = "<default package>"; if (file instanceof GroovyFile) { final String name = ((GroovyFile)file).getPackageName(); if (!name.isEmpty()) packageName = name; } return packageName; }
getPackageName
37,505
boolean (PsiClass[] allClasses) { return allClasses.length == 2 && (allClasses[0] instanceof GroovyScriptClass || allClasses[1] instanceof GroovyScriptClass); }
isScriptGeneratedClass
37,506
void (@NotNull TextEditorHighlightingPassRegistrar registrar, @NotNull Project project) { registrar.registerTextEditorHighlightingPass(this, null, null, false, -1); }
registerHighlightingPassFactory
37,507
TextEditorHighlightingPass (@NotNull PsiFile file, @NotNull Editor editor) { PsiFile groovyFile = file.getViewProvider().getPsi(GroovyLanguage.INSTANCE); return groovyFile instanceof GroovyFileBase ? new GrReferenceHighlighter(file, (GroovyFileBase)groovyFile, editor.getDocument()) : null; }
createHighlightingPass
37,508
boolean (@NotNull PsiFile file) { return file instanceof GroovyFileBase && shouldHighlight((GroovyFileBase)file); }
shouldHighlight
37,509
boolean (@NotNull GroovyFileBase file) { return isSpecificScriptFile(file) || GrFileIndexUtil.isGroovySourceFile(file) || ScratchFileService.findRootType(file.getVirtualFile()) != null; }
shouldHighlight
37,510
boolean (@NotNull GroovyFileBase file) { return file instanceof GroovyFile && GroovyScriptTypeDetector.isScriptFile((GroovyFile)file); }
isSpecificScriptFile
37,511
void (@NotNull ProgressIndicator progress) { if (!shouldHighlight(myGroovyBaseFile)) return; List<HighlightInfo> myInfos = new ArrayList<>(); myGroovyBaseFile.accept(new InaccessibleElementVisitor(myGroovyBaseFile, myProject, (__, info) -> myInfos.add(info))); BackgroundUpdateHighlightersUtil.setHighlightersToEditor(my...
doCollectInformation
37,512
void () { }
doApplyInformationToEditor
37,513
Set<GrVariable> (final PsiElement scope) { return CachedValuesManager.getCachedValue(scope, () -> CachedValueProvider.Result.create(collectReassignedVariables(scope), scope)); }
getReassignedVariables
37,514
Set<GrVariable> (PsiElement scope) { final Set<GrVariable> result = new HashSet<>(); PsiTreeUtil.processElements(scope, new PsiElementProcessor() { @Override public boolean execute(@NotNull PsiElement element) { if (!(element instanceof GrReferenceExpression ref) || ((GrReferenceExpression)element).isQualified()) { ret...
collectReassignedVariables
37,515
boolean (@NotNull PsiElement element) { if (!(element instanceof GrReferenceExpression ref) || ((GrReferenceExpression)element).isQualified()) { return true; } if (isWriteAccess(ref)) { PsiElement target = ref.resolve(); if (target instanceof GrVariable && ((GrVariable)target).getInitializerGroovy() != null || target i...
execute
37,516
boolean (GrReferenceExpression element) { return PsiUtil.isLValue(element) || element.getParent() instanceof GrUnaryExpression && ((GrUnaryExpression)element.getParent()).isPostfix(); }
isWriteAccess
37,517
boolean (final GrVariable var) { LOG.assertTrue(!DumbService.getInstance(var.getProject()).isDumb()); PsiMethod method = PsiTreeUtil.getParentOfType(var, PsiMethod.class); PsiNamedElement scope = method == null ? var.getContainingFile() : method; return scope != null && getReassignedVariables(scope).contains(var); }
isReassigned
37,518
boolean (GrReferenceExpression refExpr) { return isAssignmentLhs(refExpr) && isScriptPropertyAccess(refExpr); }
isDeclarationAssignment
37,519
boolean (GrReferenceExpression refExpr) { return refExpr.getParent() instanceof GrAssignmentExpression && refExpr.equals(((GrAssignmentExpression)refExpr.getParent()).getLValue()); }
isAssignmentLhs
37,520
boolean (GrReferenceExpression refExpr) { final GrExpression qualifier = refExpr.getQualifierExpression(); if (qualifier == null) { final PsiClass clazz = PsiTreeUtil.getParentOfType(refExpr, PsiClass.class); if (clazz == null) { //script return true; } return false; //in class, a property should normally be defined, s...
isScriptPropertyAccess
37,521
TextRange (@NotNull PsiMethod method) { int startOffset = method.getTextRange().getStartOffset(); int endOffset = method.getParameterList().getTextRange().getEndOffset(); return new TextRange(startOffset, endOffset); }
getMethodHeaderTextRange
37,522
TextRange (GrTypeDefinition clazz) { final GrModifierList modifierList = clazz.getModifierList(); final int startOffset = modifierList != null ? modifierList.getTextOffset() : clazz.getTextOffset(); final GrImplementsClause implementsClause = clazz.getImplementsClause(); final int endOffset; if (implementsClause != nul...
getClassHeaderTextRange
37,523
TextRange (GrClassInitializer initializer) { final PsiModifierList modifierList = initializer.getModifierList(); final GrOpenBlock block = initializer.getBlock(); final TextRange textRange = modifierList.getTextRange(); LOG.assertTrue(textRange != null, initializer.getClass() + ":" + initializer.getText()); int startOf...
getInitializerHeaderTextRange
37,524
GrMember (@NotNull GrReferenceExpression ref, @NotNull PsiClass aClass) { for (PsiElement parent = ref.getParent(); parent != null && parent != aClass; parent = parent.getParent()) { if (parent instanceof GrMember && ((GrMember)parent).getContainingClass() == aClass) { return (GrMember)parent; } } return null; }
findClassMemberContainer
37,525
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { element.delete(); }
processIntention
37,526
PsiElementPredicate () { return new PsiElementPredicate() { @Override public boolean satisfiedBy(@NotNull PsiElement element) { return element instanceof GrAnnotation; } }; }
getElementPredicate
37,527
boolean (@NotNull PsiElement element) { return element instanceof GrAnnotation; }
satisfiedBy
37,528
void (@NotNull GrReferenceExpression referenceExpression) { final int oldValue = myTriggerCounter; super.visitReferenceExpression(referenceExpression); if (oldValue == myTriggerCounter) { HighlightInfo info = myReferenceChecker.checkReferenceExpression(referenceExpression); if (info != null) { myCallback.trigger(refere...
visitReferenceExpression
37,529
void (@NotNull GrCodeReferenceElement refElement) { final int oldValue = myTriggerCounter; super.visitCodeReferenceElement(refElement); if (oldValue == myTriggerCounter) { HighlightInfo info = myReferenceChecker.checkCodeReferenceElement(refElement); if (info != null) { myCallback.trigger(refElement, info); myTriggerCo...
visitCodeReferenceElement
37,530
String () { return GroovyBundle.message("move.class.0.from.method", myClass.getName()); }
getText
37,531
String () { return GroovyBundle.message("move.class.from.method.family.name"); }
getFamilyName
37,532
boolean (@NotNull Project project, Editor editor, PsiFile file) { return myClass.isValid(); }
isAvailable
37,533
IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { final GrTypeDefinition containingClass = PsiTreeUtil.getParentOfType(myClass, GrTypeDefinition.class); PsiNamedElement target; if (containingClass != null) { target = containingClass; } else { target = myClass.getContaining...
generatePreview
37,534
PsiElementPredicate () { return new PsiElementPredicate() { @Override public boolean satisfiedBy(@NotNull PsiElement element) { return myClass.isValid(); } }; }
getElementPredicate
37,535
boolean (@NotNull PsiElement element) { return myClass.isValid(); }
satisfiedBy
37,536
String (@NotNull PsiElement element) { return GroovyBundle.message("intention.name.replace.with.in"); }
getText
37,537
String () { return GroovyBundle.message("intention.family.name.replace.for.each.operator"); }
getFamilyName
37,538
void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { GrForStatement forStatement = PsiTreeUtil.getParentOfType(element, GrForStatement.class); if (forStatement == null) return; GrForClause clause = forStatement.getClause(); if (clause instanceof GrForInClause) { GrForStat...
processIntention
37,539
PsiElementPredicate () { return element -> true; }
getElementPredicate
37,540
String () { return GroovyBundle.message("change.implements.and.extends.classes"); }
getFamilyName
37,541
void (@NotNull ActionContext context, @NotNull GrTypeDefinition typeDef, @NotNull ModPsiUpdater updater) { Set<String> classes = new LinkedHashSet<>(); Set<String> interfaces = new LinkedHashSet<>(); Set<String> unknownClasses = new LinkedHashSet<>(); Set<String> unknownInterfaces = new LinkedHashSet<>(); GrExtendsClau...
invoke
37,542
void (GrCodeReferenceElement[] refs, Collection<? super String> classes, Collection<? super String> interfaces, Collection<? super String> unknown) { for (GrCodeReferenceElement ref : refs) { final PsiElement extendsElement = ref.resolve(); String canonicalText = ref.getCanonicalText(); if (extendsElement instanceof Ps...
collectRefs
37,543
String () { return GroovyBundle.message("try.catch.fix"); }
getFamilyName
37,544
GrTypeElement (@NotNull PsiElement at, int offset) { final GrDisjunctionTypeElement disjunction = PsiTreeUtil.getParentOfType(at, GrDisjunctionTypeElement.class); if (disjunction == null) return null; for (GrTypeElement element : disjunction.getTypeElements()) { if (element.getTextRange().contains(offset)) { return ele...
findTypeElementInDisjunction
37,545
GrCatchClause (@NotNull PsiElement at) { return PsiTreeUtil.getParentOfType(at, GrCatchClause.class); }
findCatch
37,546
void (@NotNull ActionContext context, @NotNull PsiElement at, @NotNull ModPsiUpdater updater) { if (myDisjunction) { final GrTypeElement element = findTypeElementInDisjunction(at, context.offset()); if (element != null) { element.delete(); } } else { final GrCatchClause aCatch = findCatch(at); if (aCatch != null) { aCa...
invoke
37,547
PsiClass (GrReferenceExpression refExpr) { if (refExpr.getQualifier() == null) { return PsiUtil.getContextClass(refExpr); } PsiType type = PsiImplUtil.getQualifierType(refExpr); if (ResolveUtil.resolvesToClass(refExpr.getQualifierExpression())) { PsiType classType = ResolveUtil.unwrapClassType(type); if (classType != n...
findTargetClass
37,548
boolean (GrReferenceExpression refExpr) { //todo: look more carefully GrExpression qualifierExpression = refExpr.getQualifierExpression(); if (!(qualifierExpression instanceof GrReferenceExpression referenceExpression)) return false; GroovyPsiElement resolvedElement = ResolveUtil.resolveProperty(referenceExpression, re...
isStaticCall
37,549
List<ParamInfo> (String[] names, PsiType[] types) { List<ParamInfo> result = new ArrayList<>(); if (names.length != types.length) return Collections.emptyList(); for (int i = 0; i < names.length; i++) { String name = names[i]; final PsiType type = types[i]; result.add(new ParamInfo(name, type.getCanonicalText())); } re...
swapArgumentsAndTypes
37,550
String[] (List<? extends ParamInfo> listOfPairs) { final List<String> result = new ArrayList<>(); if (listOfPairs == null) return ArrayUtilRt.EMPTY_STRING_ARRAY; for (ParamInfo listOfPair : listOfPairs) { String type = PsiTypesUtil.unboxIfPossible(listOfPair.type); result.add(type); } return ArrayUtilRt.toStringArray(r...
getArgumentsTypes
37,551
String[] (List<? extends ParamInfo> listOfPairs) { final ArrayList<String> result = new ArrayList<>(); for (ParamInfo listOfPair : listOfPairs) { String name = listOfPair.name; result.add(name); } return ArrayUtilRt.toStringArray(result); }
getArgumentsNames
37,552
DynamicElementSettings (GrReferenceExpression referenceExpression) { DynamicElementSettings settings = new DynamicElementSettings(); final PsiClass containingClass = findTargetClass(referenceExpression); assert containingClass != null; String className = containingClass.getQualifiedName(); className = className == null...
createSettings
37,553
DynamicElementSettings (GrArgumentLabel label, PsiClass targetClass) { DynamicElementSettings settings = new DynamicElementSettings(); assert targetClass != null; String className = targetClass.getQualifiedName(); className = className == null ? targetClass.getContainingFile().getName() : className; settings.setContain...
createSettings
37,554
List<IntentionAction> (@NotNull PsiElement highlightElement, LocalQuickFix @NotNull [] fixes) { InspectionManager inspectionManager = InspectionManager.getInstance(highlightElement.getProject()); // dummy problem descriptor, highlight element is only used ProblemDescriptor descriptor = inspectionManager.createProblemDe...
fixesToIntentions
37,555
String () { return GroovyBundle.message("replace.with.wrapper", myBoxedName); }
getName
37,556
String () { return GroovyBundle.message("replace.primitive.type.with.wrapper"); }
getFamilyName
37,557
void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { assert element instanceof GrTypeElement : element; GrTypeElement typeElement = (GrTypeElement)element; final PsiType type = typeElement.getType(); if (!(type instanceof PsiPrimitiveType)) return; final PsiClassType boxed = ((...
applyFix
37,558
int () { int hashCode = 0; if (name != null) { hashCode += name.hashCode(); } if (type != null) { hashCode += type.hashCode(); } return hashCode; }
hashCode
37,559
String () { return "<" + name + "," + type + ">"; }
toString
37,560
void (String newName) { myContainingClassName = newName; }
setContainingClassName
37,561
String () { return myType; }
getType
37,562
void (String type) { this.myType = type; }
setType
37,563
boolean () { return isMethod; }
isMethod
37,564
void (boolean method) { isMethod = method; }
setMethod
37,565
List<ParamInfo> () { return myParams; }
getParams
37,566
void (List<ParamInfo> pairs) { myParams = pairs; }
setParams
37,567
String () { return myName; }
getName
37,568
void (String name) { myName = name; }
setName
37,569
boolean () { return isStatic; }
isStatic
37,570
void (boolean aStatic) { isStatic = aStatic; }
setStatic
37,571
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DItemElement that = (DItemElement)o; if (myName != null ? !myName.equals(that.myName) : that.myName != null) return false; if (myType != null ? !myType.equals(that.myType) : that.myType != null) return false; if ...
equals
37,572
int () { int result; result = (myType != null ? myType.hashCode() : 0); result = 31 * result + (myName != null ? myName.hashCode() : 0); return result; }
hashCode
37,573
String () { return myType; }
getType
37,574
void (String type) { this.myType = type; clearCache(); }
setType
37,575
void (@NlsSafe String name) { this.myName = name; clearCache(); }
setName
37,576
Boolean () { return myStatic; }
isStatic
37,577
void (Boolean aStatic) { myStatic = aStatic; clearCache(); }
setStatic
37,578
int (Object o) { if (!(o instanceof DItemElement otherProperty)) return 0; return getName().compareTo(otherProperty.getName()) + getType().compareTo(otherProperty.getType()); }
compareTo
37,579
boolean (@NotNull AnnotationHolder holder, @NotNull GrAnnotation annotation) { if (!GroovyCommonClassNames.GROOVY_LANG_DELEGATE.equals(annotation.getQualifiedName())) return false; PsiElement annoParent = annotation.getParent(); PsiElement owner = annoParent instanceof PsiModifierList ? annoParent.getParent() : annoPar...
checkApplicability
37,580
boolean (@NotNull AnnotationHolder holder, @NotNull GrAnnotation annotation) { return GroovyCommonClassNames.GROOVY_LANG_NEWIFY.equals(annotation.getQualifiedName()) && annotation.getParameterList().getAttributes().length == 0; }
checkArgumentList
37,581
boolean (@NotNull AnnotationHolder holder, @NotNull GrAnnotation annotation) { final GrCodeReferenceElement classReference = annotation.getClassReference(); PsiElement resolved = classReference.resolve(); if (!(resolved instanceof PsiClass && GroovyCommonClassNames.GROOVY_TRANSFORM_TYPE_CHECKED.equals(((PsiClass)resolv...
checkArgumentList
37,582
boolean (@NotNull AnnotationHolder holder, @NotNull GrAnnotation annotation) { if (!GroovyCommonClassNames.GROOVY_LANG_DELEGATES_TO.equals(annotation.getQualifiedName())) return false; final PsiAnnotationMemberValue valueAttribute = annotation.findAttributeValue("value"); if (valueAttribute == null) { final PsiAnnotati...
checkArgumentList
37,583
boolean (@NotNull AnnotationHolder holder, @NotNull GrAnnotation annotation) { return GrabAnnos.GRAB_ANNO.equals(annotation.getQualifiedName()) || GrabAnnos.GRAPES_ANNO.equals(annotation.getQualifiedName()) || GrabAnnos.GRAB_EXCLUDE_ANNO.equals(annotation.getQualifiedName()) || GrabAnnos.GRAB_RESOLVER_ANNO.equals(annot...
checkArgumentList
37,584
boolean (@NotNull AnnotationHolder holder, @NotNull GrAnnotation annotation) {return false;}
checkArgumentList
37,585
boolean (@NotNull AnnotationHolder holder, @NotNull GrAnnotation annotation) {return false;}
checkApplicability
37,586
String (@NotNull GrAnnotation annotation, @Nullable PsiAnnotationOwner owner) { if (!(owner instanceof PsiElement)) return null; PsiElement ownerToUse = owner instanceof PsiModifierList ? ((PsiElement)owner).getParent() : (PsiElement)owner; PsiAnnotation.TargetType[] elementTypeFields = GrAnnotationImpl.getApplicableEl...
checkAnnotationApplicable
37,587
boolean (@Nullable PsiType type, @Nullable PsiType rtype, @NotNull GroovyPsiElement context, boolean skipArrays) { rtype = TypesUtil.unboxPrimitiveTypeWrapper(rtype); if (TypesUtil.isAssignableByMethodCallConversion(type, rtype, context)) return true; if (!(type instanceof PsiArrayType && skipArrays)) return false; fin...
isAnnoTypeAssignable
37,588
boolean (@NotNull AnnotationHolder holder, @NotNull GrAnnotation annotation) { final String qname = annotation.getQualifiedName(); if (!GroovyCommonClassNames.GROOVY_TRANSFORM_FIELD.equals(qname)) return false; checkScriptField(holder, annotation); PsiElement annoParent = annotation.getParent(); PsiElement ownerToUse =...
checkApplicability
37,589
void (AnnotationHolder holder, GrAnnotation annotation) { final PsiAnnotationOwner owner = annotation.getOwner(); final GrMember container = PsiTreeUtil.getParentOfType(((PsiElement)owner), GrMember.class); if (container != null) { String message; if (container.getContainingClass() instanceof GroovyScriptClass) { messa...
checkScriptField
37,590
boolean (@NotNull AnnotationHolder holder, @NotNull GrAnnotation annotation) { final ArrayList<GrAnnotation> aliasedAnnotations = getAliasedAnnotations(annotation); if (aliasedAnnotations == null) { return false; } GrCodeReferenceElement ref = annotation.getClassReference(); for (GrAnnotation aliased : aliasedAnnotatio...
checkApplicability
37,591
ArrayList<GrAnnotation> (GrAnnotation annotation) { final PsiAnnotation annotationCollector = GrAnnotationCollector.findAnnotationCollector(annotation); if (annotationCollector == null) return null; final ArrayList<GrAnnotation> aliasedAnnotations = new ArrayList<>(); GrAnnotationCollector.collectAnnotations(aliasedAnn...
getAliasedAnnotations
37,592
boolean (@NotNull AnnotationHolder holder, @NotNull GrAnnotation annotation) { final PsiAnnotation annotationCollector = GrAnnotationCollector.findAnnotationCollector(annotation); if (annotationCollector == null) { return false; } final ArrayList<GrAnnotation> annotations = new ArrayList<>(); final Set<String> usedAttr...
checkArgumentList
37,593
PsiElement (@NotNull PsiElement elt, @NotNull GrAnnotation alias, @NotNull GrCodeReferenceElement aliasReference) { if (PsiTreeUtil.isAncestor(alias, elt, true)) { return elt; } else { return aliasReference; } }
findCodeElement
37,594
void (@NotNull GrAnnotation annotation, @Nullable PsiAnnotationOwner owner, @NotNull AnnotationHolder holder, @NotNull PsiElement toHighlight) { final GrCodeReferenceElement ref = annotation.getClassReference(); final PsiElement resolved = ref.resolve(); if (resolved == null) return; assert resolved instanceof PsiClass...
checkApplicability
37,595
boolean (@NotNull AnnotationHolder holder, @NotNull GrAnnotation annotation) { if (GroovyCommonClassNames.GROOVY_TRANSFORM_BASE_SCRIPT.equals(annotation.getQualifiedName())) { PsiFile file = annotation.getContainingFile(); if (file instanceof GroovyFile && !(((GroovyFile)file).isScript())) { holder.newAnnotation(Highli...
checkApplicability
37,596
String (@Nullable PsiClass clazz) { if (clazz == null) { return CommonClassNames.JAVA_LANG_OBJECT; } String fqn = clazz.getQualifiedName(); if (fqn != null) { return fqn; } String name = clazz.getName(); if (name != null) { return name; } return CommonClassNames.JAVA_LANG_OBJECT; }
getTypeText
37,597
boolean (@NotNull AnnotationHolder holder, @NotNull GrAnnotation annotation) { if (!BuilderAnnotationContributor.BUILDER_FQN.equals(annotation.getQualifiedName())) return false; if(BuilderAnnotationContributor.isApplicable(annotation, SimpleBuilderStrategySupport.SIMPLE_STRATEGY_NAME) && BuilderAnnotationContributor.is...
checkApplicability
37,598
boolean (@NotNull AnnotationHolder holder, @NotNull GrAnnotation annotation) { return isInAliasDeclaration(annotation); }
checkApplicability
37,599
boolean (@NotNull AnnotationHolder holder, @NotNull GrAnnotation annotation) { if (!isInAliasDeclaration(annotation)) return false; final PsiClass clazz = (PsiClass)annotation.getClassReference().resolve(); if (clazz == null) return true; final GrAnnotationNameValuePair[] attributes = annotation.getParameterList().getA...
checkArgumentList