Cleanup: apply RemoveRedundantQualifierNameInspection to idea

This commit is contained in:
Dmitry Gridin
2019-06-20 19:31:23 +07:00
parent f1e2ba728f
commit 8c84f885ac
57 changed files with 227 additions and 244 deletions
@@ -309,8 +309,8 @@ class ReflectionLookup(val classLoader: ClassLoader) {
Type.BOOLEAN -> java.lang.Boolean.TYPE
Type.BYTE -> java.lang.Byte.TYPE
Type.SHORT -> java.lang.Short.TYPE
Type.CHAR -> java.lang.Character.TYPE
Type.INT -> java.lang.Integer.TYPE
Type.CHAR -> Character.TYPE
Type.INT -> Integer.TYPE
Type.LONG -> java.lang.Long.TYPE
Type.FLOAT -> java.lang.Float.TYPE
Type.DOUBLE -> java.lang.Double.TYPE
@@ -31,7 +31,6 @@ import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Key
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.xdebugger.breakpoints.XBreakpoint
import com.sun.jdi.AbsentInformationException
@@ -72,7 +71,7 @@ class KotlinFieldBreakpoint(
private var breakpointType: BreakpointType = BreakpointType.FIELD
override fun isValid(): Boolean {
if (!BreakpointWithHighlighter.isPositionValid(xBreakpoint.sourcePosition)) return false
if (!isPositionValid(xBreakpoint.sourcePosition)) return false
return runReadAction {
val field = getField()
@@ -12,7 +12,6 @@ import com.intellij.debugger.impl.DebuggerContextImpl
import com.intellij.psi.PsiElement
import com.sun.jdi.*
import com.sun.tools.jdi.LocalVariableImpl
import org.jetbrains.kotlin.codegen.binding.CodegenBinding
import org.jetbrains.kotlin.codegen.binding.CodegenBinding.asmTypeForAnonymousClass
import org.jetbrains.kotlin.codegen.coroutines.DO_RESUME_METHOD_NAME
import org.jetbrains.kotlin.codegen.coroutines.INVOKE_SUSPEND_METHOD_NAME
@@ -20,16 +19,15 @@ import org.jetbrains.kotlin.codegen.coroutines.continuationAsmTypes
import org.jetbrains.kotlin.codegen.inline.KOTLIN_STRATA_NAME
import org.jetbrains.kotlin.idea.core.KotlinFileTypeFactory
import org.jetbrains.kotlin.idea.core.util.CodeInsightUtils
import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinDebuggerCaches
import org.jetbrains.kotlin.idea.core.util.getLineEndOffset
import org.jetbrains.kotlin.idea.core.util.getLineStartOffset
import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinDebuggerCaches
import org.jetbrains.kotlin.idea.util.application.runReadAction
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.load.java.JvmAbi
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.inline.InlineUtil
import org.jetbrains.org.objectweb.asm.Type as AsmType
import java.util.*
fun Location.isInKotlinSources(): Boolean {
@@ -88,7 +86,7 @@ fun <T : Any> DebugProcessImpl.invokeInManagerThread(f: (DebuggerContextImpl) ->
}
private fun lambdaOrdinalByArgument(elementAt: KtFunction, context: BindingContext): Int {
val type = CodegenBinding.asmTypeForAnonymousClass(context, elementAt)
val type = asmTypeForAnonymousClass(context, elementAt)
return type.className.substringAfterLast("$").toInt()
}
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinSequenceTypes
class FilterIsInstanceHandler(num: Int, call: IntermediateStreamCall, dsl: Dsl) : HandlerBase.Intermediate(dsl) {
private companion object {
fun createHandler(num: Int, call: IntermediateStreamCall, dsl: Dsl): HandlerBase.Intermediate =
fun createHandler(num: Int, call: IntermediateStreamCall, dsl: Dsl): Intermediate =
if (call.arguments.isEmpty()) MyWithGenericsHandler(num, call, dsl)
else PeekTraceHandler(num, call.name, call.typeBefore, call.typeAfter, dsl)
}
@@ -39,7 +39,7 @@ class FilterIsInstanceHandler(num: Int, call: IntermediateStreamCall, dsl: Dsl)
/*
* Transforms filterIsInstance<ClassName> -> filter { it is ClassName }.map { it as ClassName }
*/
private class MyWithGenericsHandler(num: Int, private val call: IntermediateStreamCall, dsl: Dsl) : HandlerBase.Intermediate(dsl) {
private class MyWithGenericsHandler(num: Int, private val call: IntermediateStreamCall, dsl: Dsl) : Intermediate(dsl) {
private val peekHandler = PeekTraceHandler(num, "filterIsInstance", call.typeBefore, call.typeAfter, dsl)
override fun additionalCallsAfter(): List<IntermediateStreamCall> {
val mapperType = functionalType(call.typeBefore.genericTypeName, call.typeAfter.genericTypeName)
@@ -31,7 +31,6 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.varargParameterPosition
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
import org.jetbrains.kotlin.utils.keysToMap
import kotlin.jvm.internal.FunctionBase
import org.jetbrains.org.objectweb.asm.Type as AsmType
object FileRankingCalculatorForIde : FileRankingCalculator() {
override fun analyze(element: KtElement) = element.analyze(BodyResolveMode.PARTIAL)
@@ -106,7 +105,7 @@ abstract class FileRankingCalculator(private val checkClassFqName: Boolean = tru
}
private fun rankingForClassName(fqName: String, descriptor: ClassDescriptor, bindingContext: BindingContext): Ranking {
if (DescriptorUtils.isLocal(descriptor)) return Ranking.ZERO
if (DescriptorUtils.isLocal(descriptor)) return ZERO
val expectedFqName = makeTypeMapper(bindingContext).mapType(descriptor).className
return when {
@@ -28,8 +28,8 @@ import com.intellij.psi.util.CachedValuesManager
import com.intellij.psi.util.PsiModificationTracker
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.util.containers.MultiMap
import org.jetbrains.annotations.TestOnly
import org.apache.log4j.Logger
import org.jetbrains.annotations.TestOnly
import org.jetbrains.eval4j.Value
import org.jetbrains.kotlin.analyzer.AnalysisResult
import org.jetbrains.kotlin.codegen.ClassBuilderFactories
@@ -221,7 +221,7 @@ class KotlinDebuggerCaches(project: Project) {
class ComputedClassNames(val classNames: List<String>, val shouldBeCached: Boolean) {
@Suppress("FunctionName")
companion object {
val EMPTY = ComputedClassNames.Cached(emptyList())
val EMPTY = Cached(emptyList())
fun Cached(classNames: List<String>) = ComputedClassNames(classNames, true)
fun Cached(className: String) = ComputedClassNames(Collections.singletonList(className), true)