Cleanup bunch workarounds made for 181

This commit is contained in:
Vyacheslav Gerasimov
2019-04-19 20:50:03 +03:00
parent 2bc11cbd58
commit 210ee681a4
63 changed files with 104 additions and 414 deletions
@@ -49,7 +49,6 @@ import org.jetbrains.kotlin.idea.refactoring.j2k
import org.jetbrains.kotlin.idea.refactoring.j2kText
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
import org.jetbrains.kotlin.idea.util.application.progressIndicatorNullable
import org.jetbrains.kotlin.idea.util.application.runReadAction
import org.jetbrains.kotlin.idea.versions.getKotlinJvmRuntimeMarkerClass
import org.jetbrains.kotlin.j2k.AfterConversionPass
@@ -82,7 +81,7 @@ class KotlinCodeFragmentFactory : CodeFragmentFactory() {
semaphore.down()
val nameRef = AtomicReference<KotlinType>()
val worker = object : KotlinRuntimeTypeEvaluator(
null, expression, debuggerContext, ProgressManager.getInstance().progressIndicatorNullable!!
null, expression, debuggerContext, ProgressManager.getInstance().progressIndicator!!
) {
override fun typeCalculationFinished(type: KotlinType?) {
nameRef.set(type)
@@ -53,7 +53,6 @@ import org.jetbrains.kotlin.idea.references.mainReference
import org.jetbrains.kotlin.idea.runInReadActionWithWriteActionPriority
import org.jetbrains.kotlin.idea.search.usagesSearch.descriptor
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil
import org.jetbrains.kotlin.idea.util.application.progressIndicatorNullable
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.*
@@ -111,7 +110,7 @@ class KotlinLanguageInjector(
return computedInjection
}
if (ApplicationManager.getApplication().isReadAccessAllowed && ProgressManager.getInstance().progressIndicatorNullable == null) {
if (ApplicationManager.getApplication().isReadAccessAllowed && ProgressManager.getInstance().progressIndicator == null) {
// The action cannot be canceled by caller and by internal checkCanceled() calls.
// Force creating new indicator that is canceled on write action start, otherwise there might be lags in typing.
runInReadActionWithWriteActionPriority(::computeAndCache) ?: kotlinCachedInjection?.baseInjection ?: ABSENT_KOTLIN_INJECTION
@@ -57,7 +57,7 @@ class KotlinDecompilerServiceImpl : KotlinDecompilerService {
val decompiler = BaseDecompiler(bytecodeProvider, resultSaver, options, IdeaLogger())
for (path in bytecodeMap.keys) {
decompiler.addSpaceEx(path, true)
decompiler.addSource(path)
}
decompiler.decompileContext()
return resultSaver.resultText
@@ -1,22 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.internal
import org.jetbrains.java.decompiler.main.decompiler.BaseDecompiler
import java.io.File
/**
* `addSpace` method is deprecated in 182. `addSource` and `addLibrary` were introduced instead.
* BUNCH: 181
*/
@Suppress("IncompatibleAPI")
fun BaseDecompiler.addSpaceEx(file: File, isOwn: Boolean) {
if (isOwn) {
addSource(file)
} else {
addLibrary(file)
}
}