From 14be9407fb693620774b2faafda295b2839e09a2 Mon Sep 17 00:00:00 2001 From: Daniil Ovchinnikov Date: Wed, 10 Oct 2018 16:09:19 +0300 Subject: [PATCH] [groovy] make properties private --- .../lang/resolve/processors/inference/ClosureConstraint.kt | 3 ++- .../lang/resolve/processors/inference/ExpressionConstraint.kt | 3 ++- .../processors/inference/GroovyInferenceSessionBuilder.kt | 2 +- .../lang/resolve/processors/inference/MethodCallConstraint.kt | 2 +- .../lang/resolve/processors/inference/MethodCandidate.kt | 4 ++-- .../lang/resolve/processors/inference/TypeConstraint.kt | 3 ++- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/ClosureConstraint.kt b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/ClosureConstraint.kt index 4bcadefeb55c..6fcc58b78897 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/ClosureConstraint.kt +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/ClosureConstraint.kt @@ -14,7 +14,8 @@ import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames import org.jetbrains.plugins.groovy.lang.sam.findSingleAbstractMethod import org.jetbrains.plugins.groovy.lang.sam.isSamConversionAllowed -class ClosureConstraint(val closure: GrClosableBlock, val leftType: PsiType) : ConstraintFormula { +class ClosureConstraint(private val closure: GrClosableBlock, private val leftType: PsiType) : ConstraintFormula { + override fun reduce(session: InferenceSession, constraints: MutableList): Boolean { if ((session as GroovyInferenceSession).skipClosureBlock || session.closureSkipList.contains(findCall(closure))) { //TODO:add explicit typed closure constraints diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/ExpressionConstraint.kt b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/ExpressionConstraint.kt index 0060c7945deb..575c66ce8d6b 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/ExpressionConstraint.kt +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/ExpressionConstraint.kt @@ -10,7 +10,8 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpres import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression -class ExpressionConstraint(val expression: GrExpression, val leftType: PsiType?) : ConstraintFormula { +class ExpressionConstraint(private val expression: GrExpression, private val leftType: PsiType?) : ConstraintFormula { + override fun reduce(session: InferenceSession, constraints: MutableList): Boolean { when (expression) { is GrMethodCall -> { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/GroovyInferenceSessionBuilder.kt b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/GroovyInferenceSessionBuilder.kt index 6cb0aba93d5a..8028ec545ade 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/GroovyInferenceSessionBuilder.kt +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/GroovyInferenceSessionBuilder.kt @@ -24,7 +24,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefini import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil -class GroovyInferenceSessionBuilder(val ref: GrReferenceExpression, val candidate: MethodCandidate) { +class GroovyInferenceSessionBuilder(private val ref: GrReferenceExpression, private val candidate: MethodCandidate) { private var closureSkipList = mutableListOf() diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/MethodCallConstraint.kt b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/MethodCallConstraint.kt index 5fd4f2d51fca..6814b1088897 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/MethodCallConstraint.kt +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/MethodCallConstraint.kt @@ -6,7 +6,7 @@ import com.intellij.psi.impl.source.resolve.graphInference.InferenceSession import com.intellij.psi.impl.source.resolve.graphInference.constraints.ConstraintFormula import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression -class MethodCallConstraint(private val callRef: GrReferenceExpression, val candidate: MethodCandidate) : ConstraintFormula { +class MethodCallConstraint(private val callRef: GrReferenceExpression, private val candidate: MethodCandidate) : ConstraintFormula { override fun reduce(session: InferenceSession, constraints: MutableList): Boolean { processArguments(constraints) diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/MethodCandidate.kt b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/MethodCandidate.kt index ad0a2b459476..657531069713 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/MethodCandidate.kt +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/MethodCandidate.kt @@ -17,8 +17,8 @@ import java.util.* class MethodCandidate(val method: PsiMethod, val siteSubstitutor: PsiSubstitutor, - val arguments: List, - val context: GroovyPsiElement) { + private val arguments: List, + private val context: GroovyPsiElement) { val argumentMapping: Map> by lazy { mapArguments(typeComputer) diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/TypeConstraint.kt b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/TypeConstraint.kt index 6d6c9939bd6c..7bb2108a0950 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/TypeConstraint.kt +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/inference/TypeConstraint.kt @@ -13,7 +13,8 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType import org.jetbrains.plugins.groovy.lang.psi.impl.GrTupleType import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil -class TypeConstraint(val leftType: PsiType, private val rightType: PsiType?, val context: PsiElement) : ConstraintFormula { +class TypeConstraint(private val leftType: PsiType, private val rightType: PsiType?, private val context: PsiElement) : ConstraintFormula { + override fun reduce(session: InferenceSession, constraints: MutableList): Boolean { if (session !is GroovyInferenceSession) return true var argType = rightType ?: PsiType.NULL