Build: got rid of @TestOnly annotations on fields and classes

This commit is contained in:
Sergey Rostov
2019-02-22 14:31:01 +03:00
parent c89d1af9fa
commit 17c0422d8f
13 changed files with 17 additions and 18 deletions
@@ -58,7 +58,7 @@ open class KtUltraLightClass(classOrObject: KtClassOrObject, internal val suppor
// This property may be removed once IntelliJ versions earlier than 2018.3 become unsupported // This property may be removed once IntelliJ versions earlier than 2018.3 become unsupported
// And usages of that property may be replaced with relevant registry key // And usages of that property may be replaced with relevant registry key
@Volatile @Volatile
@TestOnly @get:TestOnly
var forceUsingUltraLightClasses = false var forceUsingUltraLightClasses = false
} }
@@ -408,7 +408,7 @@ private fun getAnnotationName(callee: KtExpression): String? {
return null return null
} }
@TestOnly @get:TestOnly
var accessAnnotationsClsDelegateIsAllowed = false var accessAnnotationsClsDelegateIsAllowed = false
@TestOnly @TestOnly
@@ -62,11 +62,11 @@ class PsiBasedClassResolver @TestOnly constructor(private val targetClassFqName:
private var forceAmbiguityForNonAnnotations: Boolean = false private var forceAmbiguityForNonAnnotations: Boolean = false
companion object { companion object {
@TestOnly @get:TestOnly
val attempts = AtomicInteger() val attempts = AtomicInteger()
@TestOnly @get:TestOnly
val trueHits = AtomicInteger() val trueHits = AtomicInteger()
@TestOnly @get:TestOnly
val falseHits = AtomicInteger() val falseHits = AtomicInteger()
private val PSI_BASED_CLASS_RESOLVER_KEY = Key<CachedValue<PsiBasedClassResolver>>("PsiBasedClassResolver") private val PSI_BASED_CLASS_RESOLVER_KEY = Key<CachedValue<PsiBasedClassResolver>>("PsiBasedClassResolver")
@@ -72,7 +72,7 @@ class ExpressionsOfTypeProcessor(
private val possibleMatchHandler: (KtExpression) -> Unit, private val possibleMatchHandler: (KtExpression) -> Unit,
private val possibleMatchesInScopeHandler: (SearchScope) -> Unit private val possibleMatchesInScopeHandler: (SearchScope) -> Unit
) { ) {
@TestOnly /** For tests only */
enum class Mode { enum class Mode {
ALWAYS_SMART, ALWAYS_SMART,
ALWAYS_PLAIN, ALWAYS_PLAIN,
@@ -80,9 +80,10 @@ class ExpressionsOfTypeProcessor(
} }
companion object { companion object {
@TestOnly @get:TestOnly
var mode = if (ApplicationManager.getApplication().isUnitTestMode) Mode.ALWAYS_SMART else Mode.PLAIN_WHEN_NEEDED var mode = if (ApplicationManager.getApplication().isUnitTestMode) Mode.ALWAYS_SMART else Mode.PLAIN_WHEN_NEEDED
@TestOnly
@get:TestOnly
var testLog: MutableList<String>? = null var testLog: MutableList<String>? = null
inline fun testLog(s: () -> String) { inline fun testLog(s: () -> String) {
@@ -53,7 +53,7 @@ import java.util.*
class CompletionBindingContextProvider(project: Project) { class CompletionBindingContextProvider(project: Project) {
private val LOG = Logger.getInstance(CompletionBindingContextProvider::class.java) private val LOG = Logger.getInstance(CompletionBindingContextProvider::class.java)
@TestOnly @get:TestOnly
internal var TEST_LOG: StringBuilder? = null internal var TEST_LOG: StringBuilder? = null
companion object { companion object {
@@ -44,7 +44,7 @@ import org.jetbrains.kotlin.utils.addIfNotNull
import java.util.* import java.util.*
object DebuggerUtils { object DebuggerUtils {
@TestOnly @get:TestOnly
var forceRanking = false var forceRanking = false
fun findSourceFileForClassIncludeLibrarySources( fun findSourceFileForClassIncludeLibrarySources(
@@ -286,7 +286,7 @@ class KotlinCodeFragmentFactory : CodeFragmentFactory() {
companion object { companion object {
private val LOG = Logger.getInstance(this::class.java) private val LOG = Logger.getInstance(this::class.java)
@TestOnly @get:TestOnly
val DEBUG_CONTEXT_FOR_TESTS: Key<DebuggerContextImpl> = Key.create("DEBUG_CONTEXT_FOR_TESTS") val DEBUG_CONTEXT_FOR_TESTS: Key<DebuggerContextImpl> = Key.create("DEBUG_CONTEXT_FOR_TESTS")
const val FAKE_JAVA_CONTEXT_FUNCTION_NAME = "_java_locals_debug_fun_" const val FAKE_JAVA_CONTEXT_FUNCTION_NAME = "_java_locals_debug_fun_"
@@ -168,7 +168,6 @@ private class ScratchToolWindowFactory : ToolWindowFactory {
} }
} }
@TestOnly
private object TestOutputHandler : ScratchOutputHandlerAdapter() { private object TestOutputHandler : ScratchOutputHandlerAdapter() {
override fun handle(file: ScratchFile, expression: ScratchExpression, output: ScratchOutput) { override fun handle(file: ScratchFile, expression: ScratchExpression, output: ScratchOutput) {
testPrint(file, output.text, expression) testPrint(file, output.text, expression)
@@ -376,6 +376,6 @@ class KotlinCopyPasteReferenceProcessor : CopyPastePostProcessor<KotlinReference
} }
companion object { companion object {
@TestOnly var declarationsToImportSuggested: Collection<String> = emptyList() @get:TestOnly var declarationsToImportSuggested: Collection<String> = emptyList()
} }
} }
@@ -80,7 +80,7 @@ class KtPostfixTemplateProvider : PostfixTemplateProvider {
/** /**
* In tests only one expression should be suggested, so in case there are many of them, save relevant items * In tests only one expression should be suggested, so in case there are many of them, save relevant items
*/ */
@TestOnly @get:TestOnly
@Volatile @Volatile
var previouslySuggestedExpressions = emptyList<String>() var previouslySuggestedExpressions = emptyList<String>()
} }
@@ -195,7 +195,7 @@ class ConvertJavaCopyPasteProcessor : CopyPastePostProcessor<TextBlockTransferab
} }
companion object { companion object {
@TestOnly var conversionPerformed: Boolean = false @get:TestOnly var conversionPerformed: Boolean = false
} }
} }
@@ -281,6 +281,6 @@ class ConvertTextJavaCopyPasteProcessor : CopyPastePostProcessor<TextBlockTransf
} }
companion object { companion object {
@TestOnly var conversionPerformed: Boolean = false @get:TestOnly var conversionPerformed: Boolean = false
} }
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * Copyright 2010-2019 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. * that can be found in the license/LICENSE.txt file.
*/ */
@@ -27,7 +27,6 @@ fun UsefulTestCase.forceUsingUltraLightClassesForTest() {
}) })
} }
@TestOnly
object UltraLightChecker { object UltraLightChecker {
fun checkClassEquivalence(file: KtFile) { fun checkClassEquivalence(file: KtFile) {
for (ktClass in allClasses(file)) { for (ktClass in allClasses(file)) {