Fix after review KT-CR-4441 of cc5382b3

Simplify API of InlineConstTracker
In ConstLowering: Move transformer logic to another class to avoid mutable state. Avoid marking all files in module as module. Support of inner classes.

#KT-46506 Fixed
This commit is contained in:
Aleksei.Cherepanov
2021-09-16 00:30:16 +03:00
committed by teamcityserver
parent c2715d26f1
commit 47a1dd27dd
6 changed files with 53 additions and 55 deletions
@@ -1,16 +1,26 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.incremental.components
import org.jetbrains.kotlin.container.DefaultImplementation
import java.io.Serializable
@DefaultImplementation(InlineConstTracker.DoNothing::class)
/**
* InlineConstTracker is used to track Java constants used in Kotlin for correct build scope expansion in IC during JPS build.
*/
interface InlineConstTracker {
fun report(filePath: String, cRefs: Collection<ConstantRef>)
/**
* Report Java constant, which is defined as [name] in [owner] java class.
* This constant is used in Kotlin file [filePath].
* [constType] is one of Kotlin's [Byte, Short, Int, Long, Float, Double, Boolean, Char, String],
* that correspond to the eight primitive Java types or String
* Format of [owner] class is "package.Outer$Inner"
*/
fun report(filePath: String, owner: String, name: String, constType: String)
object DoNothing : InlineConstTracker {
override fun report(filePath: String, cRefs: Collection<ConstantRef>) {
override fun report(filePath: String, owner: String, name: String, constType: String) {
}
}
}
data class ConstantRef(var owner: String, var name: String, var constType: String) : Serializable