Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
33,700
boolean (@NotNull String chars, @NotNull StringBuilder outChars, int @Nullable [] sourceOffsets, boolean escapeSlash) { assert sourceOffsets == null || sourceOffsets.length == chars.length() + 1; if (chars.indexOf('\\') < 0) { outChars.append(chars); if (sourceOffsets != null) { for (int i = 0; i < sourceOffsets.length...
parseRegexCharacters
33,701
boolean (@NotNull String chars, @NotNull StringBuilder outChars, int @Nullable [] sourceOffsets) { assert sourceOffsets == null || sourceOffsets.length == chars.length()+1; if (chars.indexOf('\\') < 0) { outChars.append(chars); if (sourceOffsets != null) { for (int i = 0; i < sourceOffsets.length; i++) { sourceOffsets[...
parseStringCharacters
33,702
GrLiteral (@NotNull GrLiteral regex) { final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(regex.getProject()); if (regex instanceof GrRegex) { StringBuilder builder = new StringBuilder(); String quote = regex.getText().indexOf('\n') >= 0 ? TRIPLE_DOUBLE_QUOTES : DOUBLE_QUOTES; builder.append(qu...
createStringFromRegex
33,703
boolean (PsiElement element) { final String text = element.getText(); if (!(text.endsWith("'") || text.endsWith("\"") || text.endsWith("'''") || text.endsWith("\"\"\"") || text.endsWith("/") || text.endsWith("/$"))) { return false; } final IElementType type = element.getNode().getElementType(); if (TokenSets.STRING_LIT...
isWellEndedString
33,704
void (StringBuilder builder, int position) { for (int i = builder.indexOf("'''", position); i >= 0; i = builder.indexOf("'''", i)) { builder.replace(i + 2, i + 3, "\\'"); } }
fixAllTripleQuotes
33,705
void (StringBuilder builder, int position) { for (int i = builder.indexOf("\"\"\"", position); i >= 0; i = builder.indexOf("\"\"\"", i)) { builder.replace(i + 2, i + 3, "\\\""); } }
fixAllTripleDoubleQuotes
33,706
boolean (GrLiteral literal) { String quote = getStartQuote(literal.getText()); return TRIPLE_QUOTES.equals(quote) || TRIPLE_DOUBLE_QUOTES.equals(quote) || SLASH.equals(quote) || DOLLAR_SLASH.equals(quote); }
isMultilineStringLiteral
33,707
StringBuilder (String value) { StringBuilder buffer = new StringBuilder(); if (value.indexOf('\n') >= 0) { buffer.append("'''"); escapeStringCharacters(value.length(), value, "", false, true, buffer); buffer.append("'''"); } else { buffer.append("'"); escapeStringCharacters(value.length(), value, "'", false, true, buff...
getLiteralTextByValue
33,708
boolean (GrLiteral literal) { if (literal instanceof GrString) return true; if (literal instanceof GrLiteralImpl) { IElementType type = GrLiteralImpl.getLiteralType(literal); return TokenSets.STRING_LITERAL_SET.contains(type); } return false; }
isStringLiteral
33,709
boolean (GrLiteral literal) { if (literal instanceof GrRegex) return true; String quote = getStartQuote(literal.getText()); return SLASH.equals(quote) || DOLLAR_SLASH.equals(quote); }
isRegex
33,710
boolean (GrLiteral literal) { return SLASH.equals(getStartQuote(literal.getText())); }
isSlashyString
33,711
boolean (GrLiteral literal) { return DOLLAR_SLASH.equals(getStartQuote(literal.getText())); }
isDollarSlashyString
33,712
boolean (GrLiteral literal) { return QUOTE.equals(getStartQuote(literal.getText())); }
isSingleQuoteString
33,713
boolean (GrLiteral literal) { return DOUBLE_QUOTES.equals(getStartQuote(literal.getText())); }
isDoubleQuoteString
33,714
boolean (GrLiteral literal) { return TRIPLE_QUOTES.equals(getStartQuote(literal.getText())); }
isTripleQuoteString
33,715
boolean (GrLiteral literal) { return TRIPLE_DOUBLE_QUOTES.equals(getStartQuote(literal.getText())); }
isTripleDoubleQuoteString
33,716
Object (@Nullable GrExpression expression) { GrExpression operand = skipParenthesesDownOrNull(expression); if (operand instanceof GrLiteral) { return ((GrLiteral)operand).getValue(); } if (operand instanceof GrUnaryExpression) { var evaluatedOperand = evaluate(((GrUnaryExpression)operand).getOperand()); if (((GrUnaryEx...
evaluate
33,717
Object (@Nullable GrExpression expression) { GrExpression operand = skipParenthesesDownOrNull(expression); if (operand instanceof GrLiteral) { return ((GrLiteral)operand).getValue(); } return null; }
evaluateNoResolve
33,718
Object (PsiElement expression, boolean throwExceptionOnOverflow) { if (!(expression instanceof GrExpression)) return null; return evaluate((GrExpression)expression); }
computeConstantExpression
33,719
Object (PsiElement expression, boolean throwExceptionOnOverflow, @Nullable PsiConstantEvaluationHelper.AuxEvaluator auxEvaluator) { if (!(expression instanceof GrExpression)) return null; return evaluate((GrExpression)expression); }
computeExpression
33,720
void (@NotNull final GroovyFile file, @NotNull final Set<? super String> importedClasses, @NotNull final Set<? super String> staticallyImportedMembers, @NotNull final Set<? super GrImportStatement> usedImports, @NotNull final Set<? super GrImportStatement> unresolvedOnDemandImports, @NotNull final Set<? super String> i...
processFile
33,721
void (@NotNull PsiElement element) { if (!(element instanceof GrImportStatement) && !(element instanceof GrPackageDefinition)) { super.visitElement(element); } if (element instanceof GrReferenceElement) { visitRefElement((GrReferenceElement)element); } }
visitElement
33,722
void (GrReferenceElement refElement) { if (refElement.isQualified()) return; final String refName = refElement.getReferenceName(); if ("super".equals(refName)) return; final GroovyResolveResult[] resolveResults = refElement.multiResolve(false); if (resolveResults.length == 0 && refName != null) { if (PsiTreeUtil.getPar...
visitRefElement
33,723
void (PsiElement element) { final String qname = getTargetQualifiedName(element); if (qname != null) { implicitlyImported.add(qname); importedClasses.add(qname); } }
addImplicitClass
33,724
void (@NotNull GrImportStatement importStatement) { final String annotationText = importStatement.getAnnotationList().getText(); if (!StringUtil.isEmptyOrSpaces(annotationText)) { final String importRef = importStatement.getImportFqn(); annotations.put(importRef, annotationText); } }
visitImportStatement
33,725
String (PsiElement element) { if (element instanceof PsiClass) { return ((PsiClass)element).getQualifiedName(); } if (element instanceof PsiMethod && ((PsiMethod)element).isConstructor()) { PsiClass aClass = ((PsiMethod)element).getContainingClass(); if (aClass != null) { return aClass.getQualifiedName(); } } return nu...
getTargetQualifiedName
33,726
boolean (GrImportStatement anImport) { return !StringUtil.isEmptyOrSpaces(anImport.getAnnotationList().getText()); }
isAnnotatedImport
33,727
PsiType () { return myType; }
getType
33,728
boolean (PsiType type, @NotNull PsiElement context) { return TypesUtil.isAssignableByMethodCallConversion(getType(), type, context); }
satisfied
33,729
PsiType () { return myDefaultType; }
getDefaultType
33,730
SubtypeConstraint (@NotNull PsiType type) { return new SubtypeConstraint(type, type); }
create
33,731
SubtypeConstraint (String fqName, PsiElement context) { PsiClassType type = TypesUtil.createType(fqName, context); return new SubtypeConstraint(type, type); }
create
33,732
boolean (PsiType type, @NotNull PsiElement context) { return TypesUtil.isAssignableByMethodCallConversion(type, getType(), context); }
satisfied
33,733
PsiType () { return myDefaultType; }
getDefaultType
33,734
SupertypeConstraint (@NotNull PsiType type, @NotNull PsiType defaultType) { return new SupertypeConstraint(type, defaultType); }
create
33,735
SupertypeConstraint (@NotNull PsiType type) { return new SupertypeConstraint(type, type); }
create
33,736
TypeConstraint[] (@NotNull final GrExpression expression) { return TypeInferenceHelper.getCurrentContext().getCachedValue(expression, GroovyExpectedTypesProvider::doCalculateTypeConstraints); }
calculateTypeConstraints
33,737
TypeConstraint[] (@NotNull GrExpression expression) { MyCalculator calculator = new MyCalculator(expression); final PsiElement parent = expression.getParent(); if (parent instanceof GroovyPsiElement) { ((GroovyPsiElement)parent).accept(calculator); } else { parent.accept(new GroovyPsiElementVisitor(calculator)); } fina...
doCalculateTypeConstraints
33,738
List<PsiType> (@NotNull GrExpression element) { TypeConstraint[] constraints = calculateTypeConstraints(element); return ContainerUtil.map(constraints, constraint -> constraint.getDefaultType()); }
getDefaultExpectedTypes
33,739
void (@NotNull GrReturnStatement returnStatement) { GrParameterListOwner parent = PsiTreeUtil.getParentOfType(returnStatement, GrParameterListOwner.class); if (parent instanceof GrMethod) { GrTypeElement typeElement = ((GrMethod)parent).getReturnTypeElementGroovy(); if (typeElement != null) { PsiType type = typeElement...
visitReturnStatement
33,740
void (@NotNull GrVariable variable) { if (myExpression.equals(variable.getInitializerGroovy())) { PsiType type = variable.getType(); myResult = createSimpleSubTypeResult(type); } }
visitVariable
33,741
void (@NotNull GrNamedArgument argument) { GrArgumentLabel label = argument.getLabel(); if (label != null) { PsiElement pparent = argument.getParent().getParent(); if (pparent instanceof GrCall && resolvesToDefaultConstructor(((GrCall)pparent))) { final GroovyResolveResult resolveResult = label.advancedResolve(); PsiEl...
visitNamedArgument
33,742
boolean (GrCall call) { PsiMethod method = call.resolveMethod(); if (method != null && method.isConstructor() && method.getParameterList().isEmpty()) return true; if (call instanceof GrConstructorCall) { PsiElement resolved = PsiImplUtil.extractUniqueResult(((GrConstructorCall)call).multiResolveClass()).getElement(); i...
resolvesToDefaultConstructor
33,743
void (@NotNull GrMethodCallExpression methodCall) { final GrExpression invokedExpression = methodCall.getInvokedExpression(); if (myExpression.equals(invokedExpression)) { myResult = new TypeConstraint[]{SubtypeConstraint.create(GroovyCommonClassNames.GROOVY_LANG_CLOSURE, methodCall)}; return; } final GrClosableBlock[]...
visitMethodCallExpression
33,744
void (@NotNull GrOpenBlock block) { final GrStatement[] statements = block.getStatements(); if (statements.length > 0 && myExpression.equals(statements[statements.length - 1])) { checkExitPoint(); } }
visitOpenBlock
33,745
void (@NotNull GrTypeCastExpression typeCastExpression) { myResult = createSimpleSubTypeResult(TypesUtil.getJavaLangObject(typeCastExpression)); }
visitCastExpression
33,746
void (@NotNull GrAssertStatement assertStatement) { if (myExpression.equals(assertStatement.getAssertion())) { myResult = createSimpleSubTypeResult(PsiTypes.booleanType()); } if (myExpression.equals(assertStatement.getErrorMessage())) { myResult = createSimpleSubTypeResult(TypesUtil.createType(CommonClassNames.JAVA_LAN...
visitAssertStatement
33,747
void (@NotNull GrIfStatement ifStatement) { if (myExpression.equals(ifStatement.getCondition())) { myResult = new TypeConstraint[]{new SubtypeConstraint(TypesUtil.getJavaLangObject(ifStatement), PsiTypes.booleanType())}; } else if (myExpression.equals(ifStatement.getThenBranch()) || myExpression.equals(ifStatement.getE...
visitIfStatement
33,748
void (@NotNull GrAnnotationMethod method) { PsiType type = method.getReturnType(); if (type != null && isAcceptableAnnotationValueType(type)) { myResult = createSimpleSubTypeResult(type); } }
visitAnnotationMethod
33,749
void (@NotNull GrAnnotationArrayInitializer arrayInitializer) { final GrAnnotationNameValuePair nameValuePair = PsiTreeUtil.getParentOfType(arrayInitializer, GrAnnotationNameValuePair.class, true, GrAnnotationMethod.class); if (nameValuePair != null) { final PsiClass annot = ResolveUtil.resolveAnnotation(arrayInitializ...
visitAnnotationArrayInitializer
33,750
void (@NotNull GrAnnotationNameValuePair nameValuePair) { if (myExpression.equals(nameValuePair.getValue())) { final PsiClass annot = ResolveUtil.resolveAnnotation(nameValuePair.getParent()); if (annot != null) { final String name = nameValuePair.getName(); if (name != null) { createResultFromAttrName(annot, name); } e...
visitAnnotationNameValuePair
33,751
void (PsiClass annotation, String attrName) { final PsiMethod[] attrs = annotation.findMethodsByName(attrName, false); if (attrs.length > 0) { createResultFromAnnotationAttribute(attrs[0]); } }
createResultFromAttrName
33,752
void (PsiMethod attr) { PsiType type = attr.getReturnType(); while (type instanceof PsiArrayType) type = ((PsiArrayType)type).getComponentType(); if (type != null && isAcceptableAnnotationValueType(type)) { myResult = createSimpleSubTypeResult(type); } }
createResultFromAnnotationAttribute
33,753
boolean (PsiType type) { //noinspection ConstantConditions return type instanceof PsiPrimitiveType || type.equalsToText(CommonClassNames.JAVA_LANG_STRING) || type.equalsToText(CommonClassNames.JAVA_LANG_CLASS) || type instanceof PsiClassType && ((PsiClassType)type).resolve() != null && ((PsiClassType)type).resolve().is...
isAcceptableAnnotationValueType
33,754
void () { final PsiElement element = PsiTreeUtil.getParentOfType(myExpression, PsiMethod.class, GrClosableBlock.class); if (element instanceof GrMethod method) { ControlFlowUtils.visitAllExitPoints(method.getBlock(), new ControlFlowUtils.ExitPointVisitor() { @Override public boolean visitExitPoint(Instruction instructi...
checkExitPoint
33,755
boolean (Instruction instruction, @Nullable GrExpression returnValue) { if (returnValue == myExpression) { final PsiType returnType = method.getReturnType(); if (returnType != null) { myResult = createSimpleSubTypeResult(returnType); } return false; } return true; }
visitExitPoint
33,756
void (@NotNull GrWhileStatement whileStatement) { if (myExpression.equals(whileStatement.getCondition())) { myResult = new TypeConstraint[]{new SubtypeConstraint(TypesUtil.getJavaLangObject(whileStatement), PsiTypes.booleanType())}; } }
visitWhileStatement
33,757
void (@NotNull GrTraditionalForClause forClause) { if (myExpression.equals(forClause.getCondition())) { myResult = new TypeConstraint[]{new SubtypeConstraint(TypesUtil.getJavaLangObject(forClause), PsiTypes.booleanType())}; } }
visitTraditionalForClause
33,758
void (@NotNull GrArgumentList list) { processCallVariants(list, ResolveUtil.getCallVariants(list), list.getNamedArguments(), list.getExpressionArguments(), GrClosableBlock.EMPTY_ARRAY); }
visitArgumentList
33,759
void (@NotNull PsiElement place, GroovyResolveResult @NotNull [] variants, GrNamedArgument @NotNull [] namedArguments, GrExpression @NotNull [] expressionArguments, GrClosableBlock @NotNull [] closureArguments) { List<Pair<PsiParameter, PsiType>> expectedParams = ResolveUtil.collectExpectedParamsByArg(place, variants, ...
processCallVariants
33,760
void (List<Pair<PsiParameter, PsiType>> expectedParams) { List<TypeConstraint> constraints = new ArrayList<>(); for (Pair<PsiParameter, PsiType> pair : expectedParams) { final PsiType type = pair.second; if (type != null) { constraints.add(SubtypeConstraint.create(type)); if (type instanceof PsiArrayType && pair.first....
collectExpectedTypeFromPossibleParams
33,761
void (@NotNull GrBinaryExpression expression) { final IElementType type = expression.getOperationTokenType(); final GrExpression left = expression.getLeftOperand(); final GrExpression right = expression.getRightOperand(); final GrExpression other = myExpression == left ? right : left; final PsiType otherType = other !=...
visitBinaryExpression
33,762
void (@NotNull GrInstanceOfExpression expression) { final GrExpression operand = expression.getOperand(); final GrTypeElement typeElement = expression.getTypeElement(); if (typeElement == null) return; if (myExpression == operand) { final PsiType type = typeElement.getType(); myResult = new TypeConstraint[]{new Superty...
visitInstanceofExpression
33,763
void (@NotNull GrAssignmentExpression expression) { GrExpression rValue = expression.getRValue(); GrExpression lValue = expression.getLValue(); if (myExpression.equals(rValue)) { PsiType lType = lValue.getNominalType(); if (lType != null) { myResult = new TypeConstraint[]{SubtypeConstraint.create(lType)}; } else if (lV...
visitAssignmentExpression
33,764
void (@NotNull GrThrowStatement throwStatement) { final PsiClassType throwable = PsiType.getJavaLangThrowable(myExpression.getManager(), throwStatement.getResolveScope()); myResult = new TypeConstraint[]{SubtypeConstraint.create(throwable)}; }
visitThrowStatement
33,765
void (@NotNull final GrUnaryExpression expression) { TypeConstraint constraint = new TypeConstraint(PsiTypes.intType()) { @Override public boolean satisfied(PsiType type, @NotNull PsiElement context) { final PsiType boxed = TypesUtil.boxPrimitiveType(type, context.getManager(), context.getResolveScope()); final GroovyM...
visitUnaryExpression
33,766
boolean (PsiType type, @NotNull PsiElement context) { final PsiType boxed = TypesUtil.boxPrimitiveType(type, context.getManager(), context.getResolveScope()); final GroovyMethodCallReference reference = expression.getReference(); return !resolveWithArguments(new JustTypeArgument(boxed), reference.getMethodName(), refer...
satisfied
33,767
PsiType () { return PsiTypes.intType(); }
getDefaultType
33,768
void (@NotNull GrParenthesizedExpression expression) { final PsiElement parent = expression.getParent(); if (parent instanceof GroovyPsiElement) { ((GroovyPsiElement)parent).accept(this); } else { parent.accept(new GroovyPsiElementVisitor(this)); } }
visitParenthesizedExpression
33,769
void (@NotNull GrListOrMap listOrMap) { if (listOrMap.isMap()) return; final TypeConstraint[] constraints = calculateTypeConstraints(listOrMap); List<PsiType> result= new ArrayList<>(constraints.length); for (TypeConstraint constraint : constraints) { if (constraint instanceof SubtypeConstraint) { final PsiType type = ...
visitListOrMap
33,770
void (@NotNull GrSwitchStatement switchStatement) { final GrCaseSection[] sections = switchStatement.getCaseSections(); List<PsiType> types = new ArrayList<>(sections.length); for (GrCaseSection section : sections) { for (GrExpression value : section.getExpressions()) { if (value != null) { final PsiType type = value.g...
visitSwitchStatement
33,771
TypeConstraint[] () { return myResult; }
getResult
33,772
String () { return " Negating goto instruction, condition=" + getCondition().num() + getElement(); }
getElementPresentation
33,773
int () { return myDescriptor; }
getDescriptor
33,774
boolean () { return myIsWrite; }
isWrite
33,775
String () { return (isWrite() ? "WRITE " : "READ ") + myDescriptor; }
getElementPresentation
33,776
PsiElement () { return Objects.requireNonNull(super.getElement()); }
getElement
33,777
String () { return "instanceof: " + getElement().getText(); }
getElementPresentation
33,778
PsiType () { Pair<GrExpression, PsiType> instanceOf = getInstanceof(); if (instanceOf == null) return null; return instanceOf.getSecond(); }
inferMixinType
33,779
ReadWriteVariableInstruction (Instruction[] flow) { Pair<GrExpression, PsiType> instanceOf = getInstanceof(); if (instanceOf == null) return null; Instruction instruction = ControlFlowUtils.findInstruction(instanceOf.getFirst(), flow); if (instruction instanceof ReadWriteVariableInstruction) { return (ReadWriteVariable...
getInstructionToMixin
33,780
int () { Pair<GrExpression, PsiType> instanceOf = getInstanceof(); if (instanceOf == null || !(instanceOf.first instanceof GrReferenceExpression)) return 0; VariableDescriptor descriptor = VariableDescriptorFactory.createDescriptor((GrReferenceExpression)instanceOf.first); if (descriptor == null) { return 0; } Integer ...
getVariableDescriptor
33,781
ConditionInstruction () { return myCondition; }
getConditionInstruction
33,782
String () { return super.toString() + "AFTER CALL " + myCall.num(); }
toString
33,783
Iterable<Instruction> () { return Collections.singletonList(myReturnInstruction); }
allPredecessors
33,784
Iterable<Instruction> (@NotNull CallEnvironment environment) { environment.callStack(myReturnInstruction).push(myCall); return Collections.singletonList(myReturnInstruction); }
predecessors
33,785
String () { return ""; }
getElementPresentation
33,786
void (ReturnInstruction returnInstruction) { myReturnInstruction = returnInstruction; }
setReturnInstruction
33,787
String () { return super.toString() + " CALL " + myCallee.num(); }
toString
33,788
Iterable<Instruction> (@NotNull CallEnvironment environment) { environment.callStack(myCallee).push(this); return Collections.singletonList(myCallee); }
successors
33,789
Iterable<Instruction> () { return Collections.singletonList(myCallee); }
allSuccessors
33,790
String () { return ""; }
getElementPresentation
33,791
boolean (GrBinaryExpression binary) { if (binary instanceof GrInExpression) { GrExpression left = binary.getLeftOperand(); GrExpression right = binary.getRightOperand(); if (left instanceof GrReferenceExpression && ((GrReferenceExpression)left).getQualifier() == null && right instanceof GrReferenceExpression && findCla...
isInstanceOfBinary
33,792
boolean (GrReferenceExpression ref) { final String text = ref.getText(); final int i = text.indexOf('<'); String className = i == -1 ? text : text.substring(0, i); PsiClass[] names = PsiShortNamesCache.getInstance(ref.getProject()).getClassesByName(className, ref.getResolveScope()); if (names.length > 0) return true; P...
findClassByText
33,793
boolean (GrStatement st) { final PsiElement parent = st.getParent(); if (parent instanceof GrOpenBlock) { if (st != ArrayUtil.getLastElement(((GrOpenBlock)parent).getStatements())) return false; PsiElement pparent = parent.getParent(); if (pparent instanceof GrMethod) { return true; } if (pparent instanceof GrBlockStat...
isCertainlyReturnStatement
33,794
boolean (GrCaseSection caseSection, GrSwitchElement switchStatement) { final GrCaseSection[] sections = switchStatement.getCaseSections(); final int i = ArrayUtilRt.find(sections, caseSection); if (i == sections.length - 1) { return true; } for (int j = i + 1; j < sections.length; j++) { GrCaseSection section = section...
isLastStatementInCaseSection
33,795
boolean (GrStatement statement) { final PsiElement parent = statement.getParent(); if (parent instanceof GrOpenBlock || parent instanceof GrCaseSection) { if (statement != ArrayUtil.getLastElement(((GrStatementOwner)parent).getStatements())) return false; PsiElement pparent = parent.getParent(); if (parent instanceof G...
isCertainlyYieldStatement
33,796
ConditionInstruction () { return myCondition; }
getCondition
33,797
String () { return " Positive goto instruction, condition=" + myCondition.num() + getElement(); }
getElementPresentation
33,798
String () { return super.toString() + " RETURN"; }
toString
33,799
String () { return ""; }
getElementPresentation