Remove the @Inclubating annotation from UnstableApiUsage inspection

Also remove `@Suppress("UnstableApiUsage)"` where it was relevant
This commit is contained in:
Sergey Igushkin
2019-08-21 19:04:07 +03:00
parent ffd0b438da
commit 50e758cbb7
15 changed files with 19 additions and 28 deletions
+15
View File
@@ -436,6 +436,21 @@
<inspection_tool class="UnnecessaryLabelOnContinueStatement" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="UnnecessaryLabelOnContinueStatement" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryQualifierForThis" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="UnnecessaryQualifierForThis" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UnnecessaryUnboxing" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="UnnecessaryUnboxing" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnstableApiUsage" enabled="true" level="WARNING" enabled_by_default="true">
<option name="unstableApiAnnotations">
<set>
<option value="com.google.common.annotations.Beta" />
<option value="io.reactivex.annotations.Beta" />
<option value="io.reactivex.annotations.Experimental" />
<option value="org.apache.http.annotation.Beta" />
<option value="org.jetbrains.annotations.ApiStatus.Experimental" />
<option value="org.jetbrains.annotations.ApiStatus.Internal" />
<option value="org.jetbrains.annotations.ApiStatus.ScheduledForRemoval" />
<option value="rx.annotations.Beta" />
<option value="rx.annotations.Experimental" />
</set>
</option>
</inspection_tool>
<inspection_tool class="UseOfPropertiesAsHashtable" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="UseOfPropertiesAsHashtable" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UtilityClassWithPublicConstructor" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="UtilityClassWithPublicConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="VolatileLongOrDoubleField" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="VolatileLongOrDoubleField" enabled="true" level="WARNING" enabled_by_default="true" />
@@ -186,7 +186,6 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
val getConfigurationName = dependencyHolderClass.getMethodOrNull(configurationNameAccessor) ?: return emptyList() val getConfigurationName = dependencyHolderClass.getMethodOrNull(configurationNameAccessor) ?: return emptyList()
val configurationName = getConfigurationName(dependencyHolder) as? String ?: return emptyList() val configurationName = getConfigurationName(dependencyHolder) as? String ?: return emptyList()
val configuration = project.configurations.findByName(configurationName) ?: return emptyList() val configuration = project.configurations.findByName(configurationName) ?: return emptyList()
@Suppress("UnstableApiUsage")
if (!configuration.isCanBeResolved) return emptyList() if (!configuration.isCanBeResolved) return emptyList()
val dependencyAdjuster = val dependencyAdjuster =
@@ -512,7 +511,6 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
return (getCompileClasspath(compileKotlinTask) as? Collection<File>)?.map { it.path } ?: emptyList() return (getCompileClasspath(compileKotlinTask) as? Collection<File>)?.map { it.path } ?: emptyList()
} }
@Suppress("UnstableApiUsage")
private fun buildCompilationOutput( private fun buildCompilationOutput(
gradleCompilation: Named, gradleCompilation: Named,
compileKotlinTask: Task compileKotlinTask: Task
@@ -580,7 +578,6 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
} }
} }
@Suppress("UnstableApiUsage")
private class DependencyAdjuster( private class DependencyAdjuster(
private val configuration: Configuration, private val configuration: Configuration,
private val scope: String, private val scope: String,
@@ -196,7 +196,6 @@ internal open class GradleCompilerRunner(protected val task: Task) {
project.buildDir, project.buildDir,
taskData.buildHistoryFile taskData.buildHistoryFile
) )
@Suppress("UnstableApiUsage")
dirToModule[taskData.destinationDir.get()] = module dirToModule[taskData.destinationDir.get()] = module
taskData.javaOutputDir?.let { dirToModule[it] = module } taskData.javaOutputDir?.let { dirToModule[it] = module }
@@ -475,7 +475,6 @@ class Kapt3KotlinGradleSubplugin : KotlinGradleSubplugin<KotlinCompile> {
val kaptTaskName = getKaptTaskName("kaptGenerateStubs") val kaptTaskName = getKaptTaskName("kaptGenerateStubs")
KotlinCompileTaskData.register(kaptTaskName, KotlinCompileTaskData.get(project, kotlinCompile.name).compilation).apply { KotlinCompileTaskData.register(kaptTaskName, KotlinCompileTaskData.get(project, kotlinCompile.name).compilation).apply {
@Suppress("UnstableApiUsage")
useModuleDetection.set(KotlinCompileTaskData.get(project, kotlinCompile.name).useModuleDetection) useModuleDetection.set(KotlinCompileTaskData.get(project, kotlinCompile.name).useModuleDetection)
} }
@@ -85,7 +85,6 @@ internal abstract class KotlinSourceSetProcessor<T : AbstractKotlinCompile<*>>(
logger.kotlinDebug("Creating kotlin compile task $name") logger.kotlinDebug("Creating kotlin compile task $name")
KotlinCompileTaskData.register(name, kotlinCompilation).apply { KotlinCompileTaskData.register(name, kotlinCompilation).apply {
@Suppress("UnstableApiUsage")
destinationDir.set(project.provider { defaultKotlinDestinationDir }) destinationDir.set(project.provider { defaultKotlinDestinationDir })
} }
@@ -920,7 +919,6 @@ abstract class AbstractAndroidProjectHandler<V>(private val kotlinConfigurationT
KotlinCompileTaskData.register(kotlinTaskName, compilation).apply { KotlinCompileTaskData.register(kotlinTaskName, compilation).apply {
// store kotlin classes in separate directory. They will serve as class-path to java compiler // store kotlin classes in separate directory. They will serve as class-path to java compiler
@Suppress("UnstableApiUsage")
destinationDir.set(project.provider { File(project.buildDir, "tmp/kotlin-classes/$variantDataName") }) destinationDir.set(project.provider { File(project.buildDir, "tmp/kotlin-classes/$variantDataName") })
} }
@@ -31,7 +31,6 @@ internal class SourceSetVisibilityProvider(
* If the [resolvedMppDependency] is a project dependency, its project should be passed as [resolvedToOtherProject], as * If the [resolvedMppDependency] is a project dependency, its project should be passed as [resolvedToOtherProject], as
* the Gradle API for dependency variants behaves differently for project dependencies and published ones. * the Gradle API for dependency variants behaves differently for project dependencies and published ones.
*/ */
@Suppress("UnstableApiUsage")
fun getVisibleSourceSetNames( fun getVisibleSourceSetNames(
visibleFrom: KotlinSourceSet, visibleFrom: KotlinSourceSet,
dependencyScopes: Iterable<KotlinDependencyScope>, dependencyScopes: Iterable<KotlinDependencyScope>,
@@ -217,7 +217,6 @@ internal fun KotlinSourceSet.disambiguateName(simpleName: String): String {
private fun createDefaultSourceDirectorySet(project: Project, name: String?, resolver: FileResolver?): SourceDirectorySet { private fun createDefaultSourceDirectorySet(project: Project, name: String?, resolver: FileResolver?): SourceDirectorySet {
if (isGradleVersionAtLeast(5, 0)) { if (isGradleVersionAtLeast(5, 0)) {
@Suppress("UnstableApiUsage")
val objects = project.objects val objects = project.objects
val sourceDirectorySetMethod = objects.javaClass.methods.single { it.name == "sourceDirectorySet" && it.parameterCount == 2 } val sourceDirectorySetMethod = objects.javaClass.methods.single { it.name == "sourceDirectorySet" && it.parameterCount == 2 }
return sourceDirectorySetMethod(objects, name, name) as SourceDirectorySet return sourceDirectorySetMethod(objects, name, name) as SourceDirectorySet
@@ -64,7 +64,6 @@ open class KotlinPackageJsonTask : DefaultTask() {
task.description = "Create package.json file for $compilation" task.description = "Create package.json file for $compilation"
task.group = NodeJsRootPlugin.TASKS_GROUP_NAME task.group = NodeJsRootPlugin.TASKS_GROUP_NAME
@Suppress("UnstableApiUsage")
task.dependsOn(target.project.provider { task.findDependentTasks() }) task.dependsOn(target.project.provider { task.findDependentTasks() })
task.mustRunAfter(rootClean) task.mustRunAfter(rootClean)
} }
@@ -270,7 +270,6 @@ class KotlinMetadataTargetConfigurator(kotlinPluginVersion: String) :
* dependencies during the transformation. */ * dependencies during the transformation. */
private fun GranularMetadataTransformation.applyToConfiguration(configuration: Configuration) { private fun GranularMetadataTransformation.applyToConfiguration(configuration: Configuration) {
// Run this action immediately before the configuration first takes part in dependency resolution: // Run this action immediately before the configuration first takes part in dependency resolution:
@Suppress("UnstableApiUsage")
configuration.withDependencies { configuration.withDependencies {
val (unrequested, requested) = metadataDependencyResolutions val (unrequested, requested) = metadataDependencyResolutions
.partition { it is MetadataDependencyResolution.ExcludeAsUnrequested } .partition { it is MetadataDependencyResolution.ExcludeAsUnrequested }
@@ -25,7 +25,6 @@ abstract class KotlinTest : AbstractTestTask() {
@Input @Input
var excludes = mutableSetOf<String>() var excludes = mutableSetOf<String>()
@Suppress("UnstableApiUsage")
protected val filterExt: DefaultTestFilter protected val filterExt: DefaultTestFilter
@Internal get() = filter as DefaultTestFilter @Internal get() = filter as DefaultTestFilter
@@ -142,7 +142,6 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractKo
private val taskData: KotlinCompileTaskData private val taskData: KotlinCompileTaskData
get() = KotlinCompileTaskData.get(project, name) get() = KotlinCompileTaskData.get(project, name)
@Suppress("UnstableApiUsage")
@get:Input @get:Input
internal open var useModuleDetection: Boolean internal open var useModuleDetection: Boolean
get() = taskData.useModuleDetection.get() get() = taskData.useModuleDetection.get()
@@ -185,21 +184,17 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractKo
get() = project.extensions.findByType(KotlinProjectExtension::class.java)!! get() = project.extensions.findByType(KotlinProjectExtension::class.java)!!
override fun getDestinationDir(): File = override fun getDestinationDir(): File =
@Suppress("UnstableApiUsage")
taskData.destinationDir.get() taskData.destinationDir.get()
@Suppress("UnstableApiUsage")
override fun setDestinationDir(provider: Provider<File>) { override fun setDestinationDir(provider: Provider<File>) {
taskData.destinationDir.set(provider) taskData.destinationDir.set(provider)
} }
fun setDestinationDir(provider: () -> File) { fun setDestinationDir(provider: () -> File) {
@Suppress("UnstableApiUsage")
taskData.destinationDir.set(project.provider(provider)) taskData.destinationDir.set(project.provider(provider))
} }
override fun setDestinationDir(destinationDir: File) { override fun setDestinationDir(destinationDir: File) {
@Suppress("UnstableApiUsage")
taskData.destinationDir.set(destinationDir) taskData.destinationDir.set(destinationDir)
} }
@@ -512,21 +507,21 @@ open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), Kotl
@CacheableTask @CacheableTask
internal open class KotlinCompileWithWorkers @Inject constructor( internal open class KotlinCompileWithWorkers @Inject constructor(
@Suppress("UnstableApiUsage") private val workerExecutor: WorkerExecutor private val workerExecutor: WorkerExecutor
) : KotlinCompile() { ) : KotlinCompile() {
override fun compilerRunner() = GradleCompilerRunnerWithWorkers(this, workerExecutor) override fun compilerRunner() = GradleCompilerRunnerWithWorkers(this, workerExecutor)
} }
@CacheableTask @CacheableTask
internal open class Kotlin2JsCompileWithWorkers @Inject constructor( internal open class Kotlin2JsCompileWithWorkers @Inject constructor(
@Suppress("UnstableApiUsage") private val workerExecutor: WorkerExecutor private val workerExecutor: WorkerExecutor
) : Kotlin2JsCompile() { ) : Kotlin2JsCompile() {
override fun compilerRunner() = GradleCompilerRunnerWithWorkers(this, workerExecutor) override fun compilerRunner() = GradleCompilerRunnerWithWorkers(this, workerExecutor)
} }
@CacheableTask @CacheableTask
internal open class KotlinCompileCommonWithWorkers @Inject constructor( internal open class KotlinCompileCommonWithWorkers @Inject constructor(
@Suppress("UnstableApiUsage") private val workerExecutor: WorkerExecutor private val workerExecutor: WorkerExecutor
) : KotlinCompileCommon() { ) : KotlinCompileCommon() {
override fun compilerRunner() = GradleCompilerRunnerWithWorkers(this, workerExecutor) override fun compilerRunner() = GradleCompilerRunnerWithWorkers(this, workerExecutor)
} }
@@ -14,9 +14,7 @@ import java.io.File
internal open class KotlinCompileTaskData( internal open class KotlinCompileTaskData(
val taskName: String, val taskName: String,
val compilation: AbstractKotlinCompilation<*>, val compilation: AbstractKotlinCompilation<*>,
@Suppress("UnstableApiUsage")
val destinationDir: Property<File>, val destinationDir: Property<File>,
@Suppress("UnstableApiUsage")
val useModuleDetection: Property<Boolean> val useModuleDetection: Property<Boolean>
) { ) {
private val taskBuildDirectory: File private val taskBuildDirectory: File
@@ -121,7 +121,6 @@ open class KotlinTestReport : TestReport() {
} }
private fun reportOn(task: AbstractTestTask) { private fun reportOn(task: AbstractTestTask) {
@Suppress("UnstableApiUsage")
reportOn(task.binResultsDir) reportOn(task.binResultsDir)
} }
@@ -240,10 +239,8 @@ open class KotlinTestReport : TestReport() {
task.ignoreRunFailures = true task.ignoreRunFailures = true
} }
@Suppress("UnstableApiUsage")
task.reports.html.isEnabled = false task.reports.html.isEnabled = false
@Suppress("UnstableApiUsage")
task.reports.junitXml.isEnabled = false task.reports.junitXml.isEnabled = false
} }
} }
@@ -14,12 +14,11 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinTest
import org.jetbrains.kotlin.gradle.utils.isGradleVersionAtLeast import org.jetbrains.kotlin.gradle.utils.isGradleVersionAtLeast
import java.io.File import java.io.File
@Suppress("UnstableApiUsage")
internal val Project.testResultsDir: File internal val Project.testResultsDir: File
get() = project.buildDir.resolve(TestingBasePlugin.TEST_RESULTS_DIR_NAME) get() = project.buildDir.resolve(TestingBasePlugin.TEST_RESULTS_DIR_NAME)
internal val Project.reportsDir: File internal val Project.reportsDir: File
get() = project.extensions.getByType(ReportingExtension::class.java).baseDir get() = project.extensions.getByType(ReportingExtension::class.java).baseDir
@Suppress("UnstableApiUsage")
internal val Project.testReportsDir: File internal val Project.testReportsDir: File
get() = reportsDir.resolve(TestingBasePlugin.TESTS_DIR_NAME) get() = reportsDir.resolve(TestingBasePlugin.TESTS_DIR_NAME)
@@ -73,7 +73,6 @@ internal fun AbstractArchiveTask.setArchiveAppendixCompatible(appendixProvider:
internal val AbstractArchiveTask.archivePathCompatible: File internal val AbstractArchiveTask.archivePathCompatible: File
get() = get() =
if (isGradleVersionAtLeast(5, 1)) { if (isGradleVersionAtLeast(5, 1)) {
@Suppress("UnstableApiUsage")
archiveFile.get().asFile archiveFile.get().asFile
} else { } else {
@Suppress("DEPRECATION") @Suppress("DEPRECATION")