Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
36,700
OptPane () { return pane( checkbox("ignoreOnVolatileVariables", GroovyBundle.message("checkbox.ignore.double.checked.locking.on.volatile.fields"))); }
getGroovyOptionsPane
36,701
BaseInspectionVisitor () { return new DoubleCheckedLockingVisitor(); }
buildVisitor
36,702
void (@NotNull GrIfStatement statement) { super.visitIfStatement(statement); final GrExpression outerCondition = statement.getCondition(); if (outerCondition == null) { return; } if (SideEffectChecker.mayHaveSideEffects(outerCondition)) { return; } GrStatement thenBranch = statement.getThenBranch(); if (thenBranch == n...
visitIfStatement
36,703
boolean ( GrIfStatement statement) { GrStatement innerThen = statement.getThenBranch(); innerThen = ControlFlowUtils.stripBraces(innerThen); if (!(innerThen instanceof GrAssignmentExpression assignmentExpression)) { return false; } final GrExpression lhs = assignmentExpression.getLValue(); if (!(lhs instanceof GrRefere...
ifStatementAssignsVolatileVariable
36,704
String (Object... args) { return GroovyBundle.message("inspection.message.nested.ref.statement"); }
buildErrorString
36,705
BaseInspectionVisitor () { return new Visitor(); }
buildVisitor
36,706
void (@NotNull GrSynchronizedStatement synchronizedStatement) { super.visitSynchronizedStatement(synchronizedStatement); final GrStatement parent = PsiTreeUtil.getParentOfType(synchronizedStatement, GrSynchronizedStatement.class, GrClosableBlock.class); if ((parent instanceof GrSynchronizedStatement)) { registerStateme...
visitSynchronizedStatement
36,707
String (Object... infos) { return GroovyBundle.message("inspection.message.non.private.field.accessed.in.synchronized.context"); }
buildErrorString
36,708
BaseInspectionVisitor () { return new PublicFieldAccessedInSynchronizedContextVisitor(); }
buildVisitor
36,709
void (@NotNull GrReferenceExpression expression) { final PsiElement element = expression.resolve(); if (!(element instanceof PsiField field)) { return; } if (field.hasModifierProperty(PsiModifier.PRIVATE) || field.hasModifierProperty(PsiModifier.FINAL)) { return; } if (!isInSynchronizedContext(expression)) { return; } ...
visitReferenceExpression
36,710
boolean (PsiElement element) { final PsiElement context = PsiTreeUtil.getParentOfType(element, GrMethod.class, GrSynchronizedStatement.class); if (context instanceof GrSynchronizedStatement) { return true; } if (context != null) { final PsiModifierListOwner modifierListOwner = (PsiModifierListOwner) context; if (modifi...
isInSynchronizedContext
36,711
String (Object... args) { return GroovyBundle.message("inspection.message.empty.ref.block"); }
buildErrorString
36,712
BaseInspectionVisitor () { return new Visitor(); }
buildVisitor
36,713
void (@NotNull GrSynchronizedStatement synchronizedStatement) { super.visitSynchronizedStatement(synchronizedStatement); final GrOpenBlock body = synchronizedStatement.getBody(); if (body == null || !isEmpty(body)) { return; } registerError(synchronizedStatement.getFirstChild()); }
visitSynchronizedStatement
36,714
boolean (GrOpenBlock body) { final GrStatement[] statements = body.getStatements(); return statements.length == 0; }
isEmpty
36,715
String (Object... infos) { return GroovyBundle.message("inspection.message.access.to.static.field.locked.on.instance.data"); }
buildErrorString
36,716
BaseInspectionVisitor () { return new Visitor(); }
buildVisitor
36,717
void (@NotNull GrReferenceExpression expression) { super.visitReferenceExpression(expression); boolean isLockedOnInstance = false; boolean isLockedOnClass = false; final GrMethod containingMethod = PsiTreeUtil.getParentOfType(expression, GrMethod.class); if (containingMethod != null && containingMethod.hasModifierPrope...
visitReferenceExpression
36,718
boolean (PsiField field) { return field.hasModifierProperty(PsiModifier.FINAL); }
isConstant
36,719
String (Object... args) { return GroovyBundle.message("inspection.message.synchronized.method.ref"); }
buildErrorString
36,720
BaseInspectionVisitor () { return new Visitor(); }
buildVisitor
36,721
void (@NotNull GrMethod grMethod) { super.visitMethod(grMethod); if (!grMethod.hasModifierProperty(PsiModifier.SYNCHRONIZED)) { return; } registerMethodError(grMethod); }
visitMethod
36,722
String (Object... args) { return GroovyBundle.message("inspection.message.synchronization.on.variable.ref.which.was.initialized.with.literal"); }
buildErrorString
36,723
BaseInspectionVisitor () { return new Visitor(); }
buildVisitor
36,724
void (@NotNull GrSynchronizedStatement synchronizedStatement) { super.visitSynchronizedStatement(synchronizedStatement); final GrExpression lock = synchronizedStatement.getMonitor(); if (!(lock instanceof GrReferenceExpression)) { return; } final PsiElement referent = ((PsiReference) lock).resolve(); if (referent insta...
visitSynchronizedStatement
36,725
String (Object... args) { return GroovyBundle.message("inspection.message.unsynchronized.method.ref.overrides.synchronized.method"); }
buildErrorString
36,726
BaseInspectionVisitor () { return new Visitor(); }
buildVisitor
36,727
void (@NotNull GrMethod method) { super.visitMethod(method); if (method.isConstructor()) { return; } if (method.hasModifierProperty(PsiModifier.SYNCHRONIZED)) { return; } if (method.getNameIdentifier() == null) { return; } final PsiMethod[] superMethods = method.findSuperMethods(); for (final PsiMethod superMethod : su...
visitMethod
36,728
String (Object... infos) { return GroovyBundle.message("inspection.message.call.to.thread.ref.in.a.loop"); }
buildErrorString
36,729
BaseInspectionVisitor () { return new BusyWaitVisitor(); }
buildVisitor
36,730
void (@NotNull GrMethodCallExpression grMethodCallExpression) { super.visitMethodCallExpression(grMethodCallExpression); final GrExpression methodExpression = grMethodCallExpression.getInvokedExpression(); if (!(methodExpression instanceof GrReferenceExpression reference)) { return; } final String name = reference.getR...
visitMethodCallExpression
36,731
String (Object... infos) { return GroovyBundle.message("inspection.message.unconditional.call.to.ref"); }
buildErrorString
36,732
BaseInspectionVisitor () { return new UnconditionalWaitVisitor(); }
buildVisitor
36,733
void (@NotNull GrMethod method) { super.visitMethod(method); if (!method.hasModifierProperty(PsiModifier.SYNCHRONIZED)) { return; } final GrCodeBlock body = method.getBlock(); if (body != null) { checkBody(body); } }
visitMethod
36,734
void (@NotNull GrSynchronizedStatement statement) { super.visitSynchronizedStatement(statement); final GrCodeBlock body = statement.getBody(); if (body != null) { checkBody(body); } }
visitSynchronizedStatement
36,735
void (GrCodeBlock body) { final GrStatement[] statements = body.getStatements(); for (final GrStatement statement : statements) { if (isConditional(statement)) { return; } if (!(statement instanceof GrMethodCallExpression methodCallExpression)) { continue; } final GrExpression methodExpression = methodCallExpression.ge...
checkBody
36,736
boolean (GrStatement statement) { return statement instanceof GrIfStatement; }
isConditional
36,737
String (Object... args) { return GroovyBundle.message("inspection.message.call.to.ref.outside.of.synchronized.context"); }
buildErrorString
36,738
BaseInspectionVisitor () { return new Visitor(); }
buildVisitor
36,739
void (@NotNull GrMethodCallExpression grMethodCallExpression) { super.visitMethodCallExpression(grMethodCallExpression); final GrExpression methodExpression = grMethodCallExpression.getInvokedExpression(); if (!(methodExpression instanceof GrReferenceExpression reference)) { return; } final String name = reference.getR...
visitMethodCallExpression
36,740
String (Object... args) { return GroovyBundle.message("inspection.message.call.to.ref.outside.synchronized.context"); }
buildErrorString
36,741
BaseInspectionVisitor () { return new Visitor(); }
buildVisitor
36,742
void (@NotNull GrMethodCallExpression grMethodCallExpression) { super.visitMethodCallExpression(grMethodCallExpression); final GrExpression methodExpression = grMethodCallExpression.getInvokedExpression(); if (!(methodExpression instanceof GrReferenceExpression reference)) { return; } final String name = reference.getR...
visitMethodCallExpression
36,743
String (Object... args) { return GroovyBundle.message("inspection.message.call.to.ref.outside.of.loop"); }
buildErrorString
36,744
BaseInspectionVisitor () { return new Visitor(); }
buildVisitor
36,745
void (@NotNull GrMethodCallExpression grMethodCallExpression) { super.visitMethodCallExpression(grMethodCallExpression); final GrExpression methodExpression = grMethodCallExpression.getInvokedExpression(); if (!(methodExpression instanceof GrReferenceExpression reference)) { return; } final String name = reference.getR...
visitMethodCallExpression
36,746
int () { return m_limit; }
getLimit
36,747
String (Object... args) { return GroovyBundle.message("inspection.message.method.ref.contains.too.many.parameters.0.1", args[0], args[1]); }
buildErrorString
36,748
BaseInspectionVisitor () { return new Visitor(); }
buildVisitor
36,749
void (@NotNull GrMethod grMethod) { super.visitMethod(grMethod); final GrParameter[] parameters = grMethod.getParameters(); final int limit = getLimit(); if (parameters.length <= limit) { return; } if (LibraryUtil.isOverrideOfLibraryMethod(grMethod)) { return; } registerMethodError(grMethod, parameters.length, limit); ...
visitMethod
36,750
void (@NotNull PsiElement element) { if (element instanceof GrBlockStatement || element instanceof GrOpenBlock) { super.visitElement(element); } else if (element instanceof GrStatement) { if (element.getParent() instanceof GrStatementOwner) { statementCount++; } super.visitElement(element); } }
visitElement
36,751
int () { return statementCount; }
getStatementCount
36,752
void (@NotNull GroovyPsiElement element) { int oldCount = 0; if (element instanceof GrMethod) { oldCount = negationCount; } super.visitElement(element); if (element instanceof GrMethod) { negationCount = oldCount; } }
visitElement
36,753
void (@NotNull GrBinaryExpression expression) { super.visitBinaryExpression(expression); final IElementType tokenType = expression.getOperationTokenType(); final GrExpression rhs = expression.getRightOperand(); if (rhs == null) { return; } if (GroovyTokenTypes.mNOT_EQUAL.equals(tokenType)) { negationCount++; } }
visitBinaryExpression
36,754
void (@NotNull GrUnaryExpression grUnaryExpression) { super.visitUnaryExpression(grUnaryExpression); final IElementType sign = grUnaryExpression.getOperationTokenType(); if (GroovyTokenTypes.mLNOT.equals(sign)) { negationCount++; } }
visitUnaryExpression
36,755
int () { return negationCount; }
getNegationCount
36,756
void (@NotNull GroovyPsiElement GrElement) { int oldComplexity = 0; if (GrElement instanceof GrMethod) { oldComplexity = complexity; } super.visitElement(GrElement); if (GrElement instanceof GrMethod) { complexity = oldComplexity; } }
visitElement
36,757
void (@NotNull GrForStatement statement) { super.visitForStatement(statement); complexity++; }
visitForStatement
36,758
void (@NotNull GrIfStatement statement) { super.visitIfStatement(statement); complexity++; }
visitIfStatement
36,759
void (@NotNull GrConditionalExpression expression) { super.visitConditionalExpression(expression); complexity++; }
visitConditionalExpression
36,760
void (@NotNull GrSwitchStatement statement) { super.visitSwitchStatement(statement); final GrCaseSection[] caseClauses = statement.getCaseSections(); for (GrCaseSection clause : caseClauses) { final GrStatement[] statements = clause.getStatements(); if (statements.length != 0) { complexity++; } } }
visitSwitchStatement
36,761
void (@NotNull GrWhileStatement statement) { super.visitWhileStatement(statement); complexity++; }
visitWhileStatement
36,762
int () { return complexity; }
getComplexity
36,763
String (Object... infos) { final Integer returnPointCount = (Integer) infos[0]; return GroovyBundle.message("inspection.message.ref.has.0.return.points", returnPointCount); }
buildErrorString
36,764
BaseInspectionVisitor () { return new MultipleReturnPointsVisitor(); }
buildVisitor
36,765
void (@NotNull GrMethod method) { // note: no call to super if (method.getNameIdentifier() == null) { return; } final int returnPointCount = calculateReturnPointCount(method); if (returnPointCount <= getLimit()) { return; } registerMethodError(method, Integer.valueOf(returnPointCount)); }
visitMethod
36,766
int (GrMethod method) { final ReturnPointCountVisitor visitor = new ReturnPointCountVisitor(); method.accept(visitor); final int count = visitor.getCount(); if (!mayFallThroughBottom(method)) { return count; } final GrCodeBlock body = method.getBlock(); if (body == null) { return count; } final GrStatement[] statements...
calculateReturnPointCount
36,767
boolean (GrMethod method) { if (method.isConstructor()) { return true; } final PsiType returnType = method.getReturnType(); return PsiTypes.voidType().equals(returnType); }
mayFallThroughBottom
36,768
void (@NotNull GrClosableBlock grClosableBlock) { //so as not to drill down }
visitClosure
36,769
void (@NotNull GrReturnStatement statement) { super.visitReturnStatement(statement); m_count++; }
visitReturnStatement
36,770
int () { return m_count; }
getCount
36,771
String (Object... args) { return GroovyBundle.message("inspection.message.method.ref.overly.nested.nesting.depth", args[0], args[1]); }
buildErrorString
36,772
BaseInspectionVisitor () { return new Visitor(); }
buildVisitor
36,773
void (@NotNull GrMethod grMethod) { super.visitMethod(grMethod); final int limit = getLimit(); final NestingDepthVisitor visitor = new NestingDepthVisitor(); final GrOpenBlock body = grMethod.getBlock(); if (body == null) { return; } body.accept(visitor); final int nestingDepth = visitor.getMaximumDepth(); if (nestingD...
visitMethod
36,774
void (@NotNull GrBlockStatement statement) { final PsiElement parent = statement.getParent(); final boolean isAlreadyCounted = parent instanceof GrWhileStatement || parent instanceof GrForStatement || parent instanceof GrIfStatement; if (!isAlreadyCounted) { enterScope(); } super.visitBlockStatement(statement); if (!is...
visitBlockStatement
36,775
void (@NotNull GrForStatement statement) { enterScope(); super.visitForStatement(statement); exitScope(); }
visitForStatement
36,776
void (@NotNull GrIfStatement statement) { boolean isAlreadyCounted = false; if (statement.getParent() instanceof GrIfStatement parent) { assert parent != null; final GrStatement elseBranch = parent.getElseBranch(); if (statement.equals(elseBranch)) { isAlreadyCounted = true; } } if (!isAlreadyCounted) { enterScope(); }...
visitIfStatement
36,777
void (@NotNull GrTryCatchStatement statement) { enterScope(); super.visitTryStatement(statement); exitScope(); }
visitTryStatement
36,778
void (@NotNull GrSwitchStatement statement) { enterScope(); super.visitSwitchStatement(statement); exitScope(); }
visitSwitchStatement
36,779
void (@NotNull GrWhileStatement statement) { enterScope(); super.visitWhileStatement(statement); exitScope(); }
visitWhileStatement
36,780
void () { m_currentDepth++; m_maximumDepth = Math.max(m_maximumDepth, m_currentDepth); }
enterScope
36,781
void () { m_currentDepth--; }
exitScope
36,782
int () { return m_maximumDepth; }
getMaximumDepth
36,783
String (Object... args) { return GroovyBundle.message("inspection.message.method.ref.too.long.statement.count", args[0], args[1]); }
buildErrorString
36,784
BaseInspectionVisitor () { return new Visitor(); }
buildVisitor
36,785
void (@NotNull GrMethod method) { super.visitMethod(method); final int limit = getLimit(); final StatementCountVisitor visitor = new StatementCountVisitor(); final GrOpenBlock block = method.getBlock(); if (block == null) return; block.accept(visitor); final int statementCount = visitor.getStatementCount(); if (stateme...
visitMethod
36,786
String (Object... args) { return GroovyBundle.message("inspection.message.method.ref.has.too.many.negations", args[0]); }
buildErrorString
36,787
BaseInspectionVisitor () { return new Visitor(); }
buildVisitor
36,788
void (@NotNull GrMethod grMethod) { super.visitMethod(grMethod); final NegationCountVisitor visitor = new NegationCountVisitor(); final GrOpenBlock body = grMethod.getBlock(); if (body == null) { return; } body.accept(visitor); final int numNegations = visitor.getNegationCount(); if (numNegations <= 3) { return; } regi...
visitMethod
36,789
String (Object... args) { return GroovyBundle.message("inspection.message.method.ref.overly.complex.cyclomatic.complexity", args[0], args[1]); }
buildErrorString
36,790
BaseInspectionVisitor () { return new Visitor(); }
buildVisitor
36,791
void (@NotNull GrMethod grMethod) { super.visitMethod(grMethod); final int limit = getLimit(); final CyclomaticComplexityVisitor visitor = new CyclomaticComplexityVisitor(); final GrOpenBlock body = grMethod.getBlock(); if (body == null) { return; } body.accept(visitor); final int complexity = visitor.getComplexity(); ...
visitMethod
36,792
OptPane () { return pane( checkbox("myIgnoreTraitMethods", GroovyBundle.message("method.may.be.static.option.ignore.trait.methods")), checkbox("myOnlyPrivateOrFinal", GroovyBundle.message("method.may.be.static.only.private.or.final.option")), checkbox("myIgnoreEmptyMethods", GroovyBundle.message("method.may.be.static.i...
getGroovyOptionsPane
36,793
BaseInspectionVisitor () { return new BaseInspectionVisitor() { @Override public void visitMethod(@NotNull GrMethod method) { if (checkMethod(method)) { final GrModifierFix modifierFix = new GrModifierFix(method, PsiModifier.STATIC, false, true, descriptor -> { final PsiElement element = descriptor.getPsiElement(); fin...
buildVisitor
36,794
void (@NotNull GrMethod method) { if (checkMethod(method)) { final GrModifierFix modifierFix = new GrModifierFix(method, PsiModifier.STATIC, false, true, descriptor -> { final PsiElement element = descriptor.getPsiElement(); final PsiElement parent = element.getParent(); assert parent instanceof GrMethod : "element: " ...
visitMethod
36,795
boolean (final GrMethod method) { if (method.hasModifierProperty(PsiModifier.STATIC)) return false; if (method.hasModifierProperty(PsiModifier.SYNCHRONIZED)) return false; if (method.getModifierList().hasExplicitModifier(PsiModifier.ABSTRACT)) return false; if (method.isConstructor()) return false; PsiClass containingC...
checkMethod
36,796
boolean (GrMethod method) { final GrParameter[] parameters = method.getParameters(); if (method.getName().equals("propertyMissing") && (parameters.length == 2 || parameters.length == 1)) return true; if (method.getName().equals("methodMissing") && (parameters.length == 2 || parameters.length == 1)) return true; if (met...
ignoreMethod
36,797
boolean (PsiElement element) { return element instanceof GrGdkMethod && ("print".equals(((PsiMethod)element).getName()) || "println".equals(((PsiMethod)element).getName())); }
isPrintOrPrintln
36,798
void (@NotNull GroovyPsiElement element) { if (myHaveInstanceRefs) return; super.visitElement(element); }
visitElement
36,799
void (@NotNull GrReferenceExpression referenceExpression) { if (myHaveInstanceRefs) return; if (PsiUtil.isSuperReference(referenceExpression)) { registerInstanceRef(); return; } if (PsiUtil.isThisReference(referenceExpression)) { if (!(referenceExpression.getParent() instanceof GrReferenceExpression)) {//if we have ref...
visitReferenceExpression