Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
34,600
boolean (@Nullable PsiElement exp) { if (!(exp instanceof GrUnaryExpression prefixExp)) { return false; } final IElementType sign = prefixExp.getOperationTokenType(); return GroovyTokenTypes.mLNOT.equals(sign); }
isNegation
34,601
GrExpression (GrExpression exp) { final GrUnaryExpression prefixExp = (GrUnaryExpression) exp; final GrExpression operand = prefixExp.getOperand(); return (GrExpression)PsiUtil.skipParentheses(operand, false); }
getNegated
34,602
String (GrExpression condition) { if (isNegation(condition)) { final GrExpression negated = getNegated(condition); return negated.getText(); } else if (ComparisonUtils.isComparison(condition)) { final GrBinaryExpression binaryExpression = (GrBinaryExpression) condition; final IElementType sign = binaryExpression.getOpe...
getNegatedExpressionText
34,603
int (@NotNull IElementType sign) { Integer result = BINARY_PRECEDENCES.get(sign); return result != null ? result : 0; }
precedenceForBinaryOperator
34,604
int (GrExpression expr) { if (expr instanceof GrUnaryExpression) return ((GrUnaryExpression)expr).isPostfix() ? POSTFIX_PRECEDENCE : PREFIX_PRECEDENCE; if (expr instanceof GrTypeCastExpression) return TYPE_CAST_PRECEDENCE; if (expr instanceof GrRangeExpression) return RANGE_PRECEDENCE; if (expr instanceof GrConditional...
getPrecedence
34,605
GrExpression (@NotNull GrExpression expression) { return parenthesize(expression, null); }
parenthesize
34,606
GrExpression (@NotNull GrExpression expression, @Nullable PsiElement context) { GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(expression.getProject()); return factory.createParenthesizedExpr(expression, context); }
parenthesize
34,607
GrExpression (@NotNull GrExpression expression) { GrExpression currentExpression = expression; while (currentExpression instanceof GrParenthesizedExpression) { GrExpression operand = ((GrParenthesizedExpression)currentExpression).getOperand(); if (operand != null) { currentExpression = operand; } else { return currentE...
unparenthesize
34,608
boolean (int childPrecedence, @NotNull IElementType parentToken, boolean isRhs) { int parentPrecedence = precedenceForBinaryOperator(parentToken); return parentPrecedence < childPrecedence || parentPrecedence == childPrecedence && parentPrecedence != 0 && isRhs; }
checkPrecedenceForBinaryOps
34,609
boolean (@NotNull GrExpression newExpr, int parentPrecedence) { return checkPrecedenceForNonBinaryOps(getPrecedence(newExpr), parentPrecedence); }
checkPrecedenceForNonBinaryOps
34,610
boolean (int precedence, int parentPrecedence) { return precedence > parentPrecedence; }
checkPrecedenceForNonBinaryOps
34,611
boolean (int precedence, @NotNull GrExpression oldExpr) { PsiElement parent = oldExpr.getParent(); if (parent instanceof GrArgumentList) { parent = parent.getParent(); } if (!(parent instanceof GrExpression oldParent)) return false; if (oldParent instanceof GrBinaryExpression binaryExpression) { GrExpression rightOpera...
checkPrecedence
34,612
boolean (@NotNull GrExpression newExpr, @NotNull GrExpression oldExpr) { return checkPrecedence(getPrecedence(newExpr), oldExpr); }
checkPrecedence
34,613
void (Map<GrMethod, List<GrMethod>> map, HashSet<? super GrMethod> duplicateMethodsWarning, HashSet<? super GrMethod> duplicateMethodsErrors) { for (GrMethod method : map.keySet()) { List<GrMethod> duplicateMethods = map.get(method); if (duplicateMethods != null && duplicateMethods.size() > 1) { HashMap<PsiType, GrMeth...
collectMethodDuplicates
34,614
GrStatement (GrStatement branch) { if (branch instanceof GrBlockStatement block) { final GrOpenBlock codeBlock = block.getBlock(); final GrStatement[] statements = codeBlock.getStatements(); if (statements.length == 1) { return statements[0]; } else { return block; } } else { return branch; } }
stripBraces
34,615
void (@NotNull GroovyElementVisitor visitor) { visitor.visitListOrMap(this); }
accept
34,616
String () { return "Generalized list"; }
toString
34,617
ASTNode (ASTNode first, ASTNode last, ASTNode anchor, Boolean before) { if (getInitializers().length == 0) { return super.addInternal(first, last, getNode().getFirstChildNode(), false); } final ASTNode lastChild = getNode().getLastChildNode(); getNode().addLeaf(GroovyTokenTypes.mCOMMA, ",", lastChild); return super.add...
addInternal
34,618
void (@NotNull ASTNode child) { final PsiElement psi = child.getPsi(); if (psi instanceof GrExpression || psi instanceof GrNamedArgument) { PsiElement prev = PsiUtil.getPrevNonSpace(psi); PsiElement next = PsiUtil.getNextNonSpace(psi); if (prev != null && prev.getNode() != null && prev.getNode().getElementType() == Gro...
deleteChildInternal
34,619
boolean () { return findChildByType(MAP_LITERAL_TOKEN_SET) != null; }
isMap
34,620
boolean () { return getInitializers().length == 0 && getNamedArguments().length == 0; }
isEmpty
34,621
PsiElement () { return findNotNullChildByType(GroovyTokenTypes.mLBRACK); }
getLBrack
34,622
PsiElement () { return findChildByType(GroovyTokenTypes.mRBRACK); }
getRBrack
34,623
GrNamedArgument (@NotNull String label) { return PsiImplUtil.findNamedArgument(this, label); }
findNamedArgument
34,624
PsiReference () { return getConstructorReference(); }
getReference
34,625
GroovyConstructorReference () { return myConstructorReference.resolveClass() != null ? myConstructorReference : null; }
getConstructorReference
34,626
void () { myInitializers = null; myNamedArguments = null; }
subtreeChanged
34,627
IElementType () { return GroovyTokenTypes.mIDENT; }
getTokenType
34,628
String () { return myText; }
getText
34,629
PsiElement () { return new GrLightIdentifier(getManager(), myText); }
copy
34,630
String () { return "PsiIdentifier:" + getText(); }
toString
34,631
TextRange () { final PsiElement identifier = myStatement.getLabelIdentifier(); if (identifier == null) { return new TextRange(-1, -2); } final int offsetInParent = identifier.getStartOffsetInParent(); return new TextRange(offsetInParent, offsetInParent + identifier.getTextLength()); }
getRangeInElement
34,632
boolean (@NotNull PsiElement element) { return resolve() == element; }
isReferenceTo
34,633
String () { final String name = myStatement.getLabelName(); if (name == null) return ""; return name; }
getCanonicalText
34,634
boolean () { return false; }
isSoft
34,635
GrFlowInterruptingStatement () { return myStatement; }
getElement
34,636
PsiElement () { return myStatement.resolveLabel(); }
resolve
34,637
IElementType () { return GroovyTokenTypes.kTHROWS; }
getKeywordType
34,638
void (@NotNull GroovyElementVisitor visitor) { visitor.visitThrowsClause(this); }
accept
34,639
String () { return "Throw clause"; }
toString
34,640
Role () { return Role.THROWS_LIST; }
getRole
34,641
void (@NotNull GroovyElementVisitor visitor) { visitor.visitModifierList(this); }
accept
34,642
String () { return "Modifiers"; }
toString
34,643
int () { final GrModifierListStub stub = getGreenStub(); if (stub != null) { return stub.getModifiersFlags(); } else { return CachedValuesManager.getCachedValue(this, () -> { int flags = 0; for (PsiElement modifier : findChildrenByType(TokenSets.MODIFIERS)) { flags |= NAME_TO_MODIFIER_FLAG_MAP.getInt(modifier.getText()...
getModifierFlags
34,644
PsiElement (@GrModifierConstant @NotNull @NonNls String name) { return findChildByType(NAME_TO_MODIFIER_ELEMENT_TYPE.get(name)); }
getModifier
34,645
boolean () { return GrModifierListUtil.hasExplicitVisibilityModifiers(this); }
hasExplicitVisibilityModifiers
34,646
boolean (@NotNull String name) { return GrModifierListUtil.hasModifierProperty(this, name); }
hasModifierProperty
34,647
boolean (@NotNull String name) { return GrModifierListUtil.hasExplicitModifier(this, name); }
hasExplicitModifier
34,648
void (String name, boolean doSet) { if (doSet) { if (isEmptyModifierList()) { final PsiElement nextSibling = getNextSibling(); if (nextSibling != null && !PsiImplUtil.isWhiteSpaceOrNls(nextSibling)) { getNode().getTreeParent().addLeaf(TokenType.WHITE_SPACE, " ", nextSibling.getNode()); } } PsiElement modifier = GroovyP...
setModifierPropertyInternal
34,649
ASTNode (ASTNode first, ASTNode last, ASTNode anchor, Boolean before) { final ASTNode node = super.addInternal(first, last, anchor, before); final PsiElement sibling = getNextSibling(); if (sibling != null && sibling.getText().contains("\n")) { sibling.replace(GroovyPsiElementFactory.getInstance(getProject()).createWhi...
addInternal
34,650
boolean () { return getTextLength() == 0 || getModifiers().length == 0 && getRawAnnotations().length == 0; }
isEmptyModifierList
34,651
PsiElement (String name) { final int myPriority = PRIORITY.getInt(name); PsiElement anchor = null; for (PsiElement modifier : getModifiers()) { final int otherPriority = PRIORITY.getInt(modifier.getText()); if (otherPriority <= myPriority) { anchor = modifier; } else if (anchor != null) { break; } } return anchor; }
findAnchor
34,652
PsiAnnotation (@NotNull @NonNls String qualifiedName) { for (GrAnnotation annotation : getAnnotations()) { if (annotation.hasQualifiedName(qualifiedName)) { return annotation; } } return null; }
findAnnotation
34,653
GrAnnotation (@NotNull @NonNls String qualifiedName) { final PsiClass psiClass = JavaPsiFacade.getInstance(getProject()).findClass(qualifiedName, getResolveScope()); final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(getProject()); GrAnnotation annotation; if (psiClass != null) { annotation = (...
addAnnotation
34,654
Set<String> (@NotNull List<? super GrAnnotation> list, @NotNull GrAnnotation alias, @NotNull PsiAnnotation annotationCollector) { final PsiModifierList modifierList = (PsiModifierList)annotationCollector.getParent(); Map<String, Map<String, PsiNameValuePair>> annotations = new LinkedHashMap<>(); collectAliasedAnnotatio...
collectAnnotations
34,655
void (@NotNull PsiModifierList modifierList, @NotNull Map<String, Map<String, PsiNameValuePair>> annotations) { PsiAnnotation[] rawAnnotations = modifierList instanceof GrModifierList ? ((GrModifierList)modifierList).getRawAnnotations() : modifierList.getAnnotations(); for (PsiAnnotation annotation : rawAnnotations) { ...
collectAliasedAnnotationsFromAnnotationCollectorAnnotations
34,656
void (@NotNull PsiAnnotation annotationCollector, @NotNull Map<String, Map<String, PsiNameValuePair>> annotations) { final PsiAnnotationMemberValue annotationsFromValue = annotationCollector.findAttributeValue("value"); if (annotationsFromValue instanceof GrAnnotationArrayInitializer) { for (GrAnnotationMemberValue mem...
collectAliasedAnnotationsFromAnnotationCollectorValueAttribute
34,657
PsiAnnotation (@Nullable PsiClass clazz) { if (clazz != null) { final PsiModifierList modifierList = clazz.getModifierList(); if (modifierList != null) { PsiAnnotation[] annotations = modifierList instanceof GrModifierList ? ((GrModifierList)modifierList).getRawAnnotations() : modifierList.getAnnotations(); for (PsiAnn...
findAnnotationCollector
34,658
PsiAnnotation (@NotNull GrAnnotation annotation) { if (!mayHaveAnnotationCollector(annotation)) { return null; } PsiElement resolved = annotation.getClassReference().resolve(); if (resolved instanceof ClsClassImpl) { return findAnnotationCollector(((ClsClassImpl)resolved).getSourceMirrorClass()); } else if (resolved in...
findAnnotationCollector
34,659
boolean (GrAnnotation @NotNull [] rawAnnotations) { for (GrAnnotation annotation : rawAnnotations) { if (mayHaveAnnotationCollector(annotation)) { return true; } } return false; }
mayHaveAnnotationCollector
34,660
boolean (@NotNull GrAnnotation annotation) { String shortName = annotation.getShortName(); Set<String> allNames = allCollectorNames(annotation.getProject()); return allNames.contains(shortName) || ContainerUtil.exists(getAliasedShortNames(annotation, shortName), allNames::contains); }
mayHaveAnnotationCollector
34,661
Set<String> (@NotNull Project project) { return CachedValuesManager.getManager(project).getCachedValue(project, () -> { Set<String> result = new HashSet<>(); GlobalSearchScope scope = GlobalSearchScope.allScope(project); for (PsiClass collector : JavaPsiFacade.getInstance(project).findClasses(GROOVY_TRANSFORM_ANNOTATIO...
allCollectorNames
34,662
boolean (@NotNull List<? super GrAnnotation> list, @NotNull GrAnnotation alias) { String fqn = alias.getQualifiedName(); if (GROOVY_TRANSFORM_IMMUTABLE.equals(fqn)) { GrImmutableUtils.collectImmutableAnnotations(alias, list); return true; } return collectCompileDynamic(list, alias); }
collectHardcoded
34,663
boolean (@NotNull List<? super GrAnnotation> list, @NotNull GrAnnotation alias) { if (GROOVY_TRANSFORM_COMPILE_DYNAMIC.equals(alias.getQualifiedName())) { PsiAnnotationOwner owner = alias.getOwner(); if (owner != null) { GrLightAnnotation annotation = new GrLightAnnotation( owner, alias, GROOVY_TRANSFORM_COMPILE_STATIC...
collectCompileDynamic
34,664
GrLiteral (@NotNull String value, @NotNull PsiElement context) { return (GrLiteral)GroovyPsiElementFactory.getInstance(context.getProject()) .createExpressionFromText("\"" + StringUtil.escapeStringCharacters(value) + "\""); }
createLiteralValue
34,665
void (@NotNull GroovyElementVisitor visitor) { visitor.visitAnnotationNameValuePair(this); }
accept
34,666
String () { return "Annotation member value pair"; }
toString
34,667
String () { GrNameValuePairStub stub = getStub(); if (stub != null) { return stub.getName(); } final PsiElement nameId = getNameIdentifierGroovy(); return nameId != null ? nameId.getText() : null; }
getName
34,668
String () { return null; }
getLiteralValue
34,669
PsiElement () { PsiElement child = getFirstChild(); if (child == null) return null; IElementType type = child.getNode().getElementType(); if (TokenSets.CODE_REFERENCE_ELEMENT_NAME_TOKENS.contains(type)) return child; return null; }
getNameIdentifierGroovy
34,670
PsiIdentifier () { return null; }
getNameIdentifier
34,671
PsiAnnotationMemberValue () { GrNameValuePairStub stub = getStub(); if (stub != null) { String text = stub.getValue(); if (text == null) { return null; } PsiAnnotationMemberValue result = dereference(myDetachedValue); if (result == null) { GrAnnotationNameValuePair attribute = GroovyPsiElementFactory.getInstance(getPro...
getDetachedValue
34,672
void () { super.subtreeChanged(); myDetachedValue = null; }
subtreeChanged
34,673
GrAnnotationMemberValue () { return findChildByClass(GrAnnotationMemberValue.class); }
getValue
34,674
PsiAnnotationMemberValue (@NotNull PsiAnnotationMemberValue newValue) { GrAnnotationMemberValue value = getValue(); if (value == null) { return (PsiAnnotationMemberValue)add(newValue); } else { return (PsiAnnotationMemberValue)value.replace(newValue); } }
setValue
34,675
PsiReference () { return getNameIdentifierGroovy() == null ? null : new GrAnnotationMethodReference(this); }
getReference
34,676
void (@NotNull GroovyElementVisitor visitor) { visitor.visitAnnotation(this); }
accept
34,677
String () { return "Annotation"; }
toString
34,678
GrAnnotationArgumentList () { return getRequiredStubOrPsiChild(GroovyEmptyStubElementTypes.ANNOTATION_ARGUMENT_LIST); }
getParameterList
34,679
String () { final GrAnnotationStub stub = getStub(); if (stub != null) { return stub.getPsiElement().getQualifiedName(); } final GrCodeReferenceElement nameRef = getClassReference(); final PsiElement resolved = nameRef.resolve(); if (resolved instanceof PsiClass) return ((PsiClass)resolved).getQualifiedName(); return n...
getQualifiedName
34,680
PsiJavaCodeReferenceElement () { final GroovyResolveResult resolveResult = getClassReference().advancedResolve(); final PsiElement resolved = resolveResult.getElement(); if (!(resolved instanceof PsiClass)) return null; return new LightClassReference(getManager(), getClassReference().getText(), (PsiClass)resolved, reso...
getNameReferenceElement
34,681
PsiAnnotationMemberValue (@Nullable String attributeName) { return PsiImplUtil.findAttributeValue(this, attributeName); }
findAttributeValue
34,682
PsiAnnotationMemberValue (@NonNls final String attributeName) { return PsiImplUtil.findDeclaredAttributeValue(this, attributeName); }
findDeclaredAttributeValue
34,683
GrCodeReferenceElement () { final GrAnnotationStub stub = getStub(); if (stub != null) { return stub.getPsiElement().getClassReference(); } return findNotNullChildByClass(GrCodeReferenceElement.class); }
getClassReference
34,684
String () { final GrAnnotationStub stub = getStub(); if (stub != null) { return PsiAnnotationImpl.getAnnotationShortName(stub.getText()); } final String referenceName = getClassReference().getReferenceName(); assert referenceName != null; return referenceName; }
getShortName
34,685
PsiAnnotationOwner () { PsiElement parent = getParent(); return parent instanceof PsiAnnotationOwner ? (PsiAnnotationOwner)parent : null; }
getOwner
34,686
boolean (@NotNull String qualifiedName) { return mayHaveQualifiedName(qualifiedName) && qualifiedName.equals(getQualifiedName()); }
hasQualifiedName
34,687
boolean (@NotNull String qualifiedName) { String shortName = getShortName(); return shortName.equals(StringUtil.getShortName(qualifiedName)) || getAliasedFullyQualifiedNames(this, shortName).contains(qualifiedName); }
mayHaveQualifiedName
34,688
boolean (GrAnnotation annotation, TargetType @NotNull ... elementTypeFields) { return elementTypeFields.length == 0 || AnnotationTargetUtil.findAnnotationTarget(annotation, elementTypeFields) != null; }
isAnnotationApplicableTo
34,689
void (@NotNull GroovyElementVisitor visitor) { visitor.visitAnnotationArgumentList(this); }
accept
34,690
String () { return "Annotation arguments"; }
toString
34,691
ASTNode (ASTNode first, ASTNode last, ASTNode anchor, Boolean before) { if (first.getElementType() == GroovyStubElementTypes.ANNOTATION_MEMBER_VALUE_PAIR && last.getElementType() == GroovyStubElementTypes.ANNOTATION_MEMBER_VALUE_PAIR) { ASTNode lparenth = getNode().getFirstChildNode(); ASTNode rparenth = getNode().getL...
addInternal
34,692
void (@NotNull GroovyElementVisitor visitor) { visitor.visitAnnotationArrayInitializer(this); }
accept
34,693
String () { return "Annotation array initializer"; }
toString
34,694
ASTNode (ASTNode first, ASTNode last, ASTNode anchor, Boolean before) { final GrAnnotationMemberValue[] initializers = getInitializers(); if (initializers.length == 0) { return super.addInternal(first, last, getNode().getFirstChildNode(), false); } final ASTNode lastChild = getNode().getLastChildNode(); getNode().addLe...
addInternal
34,695
SearchScope (@NotNull PsiElement element) { if (element instanceof PsiField && ((PsiField)element).hasModifierProperty(PsiModifier.PRIVATE)) { PsiClass containingClass = ((PsiField)element).getContainingClass(); if (containingClass != null && PsiUtil.isLocalOrAnonymousClass(containingClass)) return null; final GlobalSe...
getAdditionalUseScope
34,696
boolean (@NotNull final VirtualFile file) { return super.contains(file) && (myIndex == null || myIndex.isInSourceContent(file)) && FileTypeRegistry.getInstance().isFileOfType(file, GroovyFileType.GROOVY_FILE_TYPE); }
contains
34,697
PsiType () { return myReceiverType; }
getReceiverType
34,698
PsiMethod () { return myMethod; }
getStaticMethod
34,699
boolean () { return myMethod.hasTypeParameters(); }
hasTypeParameters