Cleanup: fix some compiler warnings (mostly deprecations, javaClass)
This commit is contained in:
@@ -29,8 +29,8 @@ internal object KotlinAntTaskUtil {
|
|||||||
|
|
||||||
private val libPath: File by lazy {
|
private val libPath: File by lazy {
|
||||||
// Find path of kotlin-ant.jar in the filesystem and find kotlin-compiler.jar in the same directory
|
// Find path of kotlin-ant.jar in the filesystem and find kotlin-compiler.jar in the same directory
|
||||||
val resourcePath = "/" + javaClass.name.replace('.', '/') + ".class"
|
val resourcePath = "/" + this::class.java.name.replace('.', '/') + ".class"
|
||||||
val jarConnection = javaClass.getResource(resourcePath).openConnection() as? JarURLConnection
|
val jarConnection = this::class.java.getResource(resourcePath).openConnection() as? JarURLConnection
|
||||||
?: throw UnsupportedOperationException("Kotlin compiler Ant task should be loaded from the JAR file")
|
?: throw UnsupportedOperationException("Kotlin compiler Ant task should be loaded from the JAR file")
|
||||||
val antTaskJarPath = File(jarConnection.jarFileURL.toURI())
|
val antTaskJarPath = File(jarConnection.jarFileURL.toURI())
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ internal object KotlinAntTaskUtil {
|
|||||||
val cached = classLoaderRef.get()
|
val cached = classLoaderRef.get()
|
||||||
if (cached != null) return cached
|
if (cached != null) return cached
|
||||||
|
|
||||||
val myLoader = javaClass.classLoader
|
val myLoader = this::class.java.classLoader
|
||||||
if (myLoader !is AntClassLoader) return myLoader
|
if (myLoader !is AntClassLoader) return myLoader
|
||||||
|
|
||||||
val classLoader = ClassPreloadingUtils.preloadClasses(listOf(compilerJar), Preloader.DEFAULT_CLASS_NUMBER_ESTIMATE, myLoader, null)
|
val classLoader = ClassPreloadingUtils.preloadClasses(listOf(compilerJar), Preloader.DEFAULT_CLASS_NUMBER_ESTIMATE, myLoader, null)
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ import org.jetbrains.kotlin.serialization.deserialization.TypeTable
|
|||||||
import org.jetbrains.kotlin.serialization.deserialization.supertypes
|
import org.jetbrains.kotlin.serialization.deserialization.supertypes
|
||||||
import org.jetbrains.kotlin.serialization.jvm.BitEncoding
|
import org.jetbrains.kotlin.serialization.jvm.BitEncoding
|
||||||
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
|
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
|
||||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
|
||||||
import org.jetbrains.org.objectweb.asm.*
|
import org.jetbrains.org.objectweb.asm.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
@@ -272,7 +271,7 @@ open class IncrementalCacheImpl<Target>(
|
|||||||
ProtoBuf.Class::getPropertyList
|
ProtoBuf.Class::getPropertyList
|
||||||
) + classData.classProto.enumEntryList.map { classData.nameResolver.getString(it.name) }
|
) + classData.classProto.enumEntryList.map { classData.nameResolver.getString(it.name) }
|
||||||
|
|
||||||
val companionObjectChanged = createChangeInfo(classFqName.parent(), classFqName.shortName().asString().singletonOrEmptyList())
|
val companionObjectChanged = createChangeInfo(classFqName.parent(), listOfNotNull(classFqName.shortName().asString()))
|
||||||
val companionObjectMembersChanged = createChangeInfo(classFqName, memberNames)
|
val companionObjectMembersChanged = createChangeInfo(classFqName, memberNames)
|
||||||
|
|
||||||
listOf(companionObjectMembersChanged, companionObjectChanged)
|
listOf(companionObjectMembersChanged, companionObjectChanged)
|
||||||
@@ -780,7 +779,7 @@ sealed class ChangeInfo(val fqName: FqName) {
|
|||||||
protected open fun toStringProperties(): String = "fqName = $fqName"
|
protected open fun toStringProperties(): String = "fqName = $fqName"
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return this.javaClass.simpleName + "(${toStringProperties()})"
|
return this::class.java.simpleName + "(${toStringProperties()})"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,5 +50,5 @@ class LocalFileKotlinClass private constructor(
|
|||||||
|
|
||||||
override fun hashCode(): Int = file.hashCode()
|
override fun hashCode(): Int = file.hashCode()
|
||||||
override fun equals(other: Any?): Boolean = other is LocalFileKotlinClass && file == other.file
|
override fun equals(other: Any?): Boolean = other is LocalFileKotlinClass && file == other.file
|
||||||
override fun toString(): String = "$javaClass: $file"
|
override fun toString(): String = "${this::class.java}: $file"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ fun LookupStorage.update(
|
|||||||
filesToCompile: Iterable<File>,
|
filesToCompile: Iterable<File>,
|
||||||
removedFiles: Iterable<File>
|
removedFiles: Iterable<File>
|
||||||
) {
|
) {
|
||||||
if (lookupTracker !is LookupTrackerImpl) throw AssertionError("Lookup tracker is expected to be LookupTrackerImpl, got ${lookupTracker.javaClass}")
|
if (lookupTracker !is LookupTrackerImpl) throw AssertionError("Lookup tracker is expected to be LookupTrackerImpl, got ${lookupTracker::class.java}")
|
||||||
|
|
||||||
removeLookupsFrom(filesToCompile.asSequence() + removedFiles.asSequence())
|
removeLookupsFrom(filesToCompile.asSequence() + removedFiles.asSequence())
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ abstract class BasicMap<K : Comparable<K>, V>(
|
|||||||
fun dump(): String {
|
fun dump(): String {
|
||||||
return with(StringBuilder()) {
|
return with(StringBuilder()) {
|
||||||
with(Printer(this)) {
|
with(Printer(this)) {
|
||||||
println(this@BasicMap.javaClass.simpleName)
|
println(this@BasicMap::class.java.simpleName)
|
||||||
pushIndent()
|
pushIndent()
|
||||||
|
|
||||||
for (key in storage.keys.sorted()) {
|
for (key in storage.keys.sorted()) {
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ object ConstantsMapExternalizer : DataExternalizer<Map<String, Any>> {
|
|||||||
output.writeByte(Kind.STRING.ordinal)
|
output.writeByte(Kind.STRING.ordinal)
|
||||||
IOUtil.writeString(value, output)
|
IOUtil.writeString(value, output)
|
||||||
}
|
}
|
||||||
else -> throw IllegalStateException("Unexpected constant class: ${value.javaClass}")
|
else -> throw IllegalStateException("Unexpected constant class: ${value::class.java}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -144,7 +144,7 @@ private fun classFileToString(classFile: File): String {
|
|||||||
|
|
||||||
out.write("\n------ string table types proto -----\n${DebugJvmProtoBuf.StringTableTypes.parseDelimitedFrom(input)}")
|
out.write("\n------ string table types proto -----\n${DebugJvmProtoBuf.StringTableTypes.parseDelimitedFrom(input)}")
|
||||||
|
|
||||||
if (!classHeader!!.metadataVersion.isCompatible()) {
|
if (!classHeader.metadataVersion.isCompatible()) {
|
||||||
error("Incompatible class ($classHeader): $classFile")
|
error("Incompatible class ($classHeader): $classFile")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -81,8 +81,8 @@ fun getModificationsToPerform(
|
|||||||
|
|
||||||
val rules = mapOf<String, (String, File) -> Modification>(
|
val rules = mapOf<String, (String, File) -> Modification>(
|
||||||
newSuffix to { path, file -> ModifyContent(path, file) },
|
newSuffix to { path, file -> ModifyContent(path, file) },
|
||||||
touchSuffix to { path, file -> TouchFile(path, touchPolicy) },
|
touchSuffix to { path, _ -> TouchFile(path, touchPolicy) },
|
||||||
deleteSuffix to { path, file -> DeleteFile(path) }
|
deleteSuffix to { path, _ -> DeleteFile(path) }
|
||||||
)
|
)
|
||||||
|
|
||||||
val modifications = ArrayList<Modification>()
|
val modifications = ArrayList<Modification>()
|
||||||
@@ -130,7 +130,7 @@ fun getModificationsToPerform(
|
|||||||
abstract class Modification(val path: String) {
|
abstract class Modification(val path: String) {
|
||||||
abstract fun perform(workDir: File, mapping: MutableMap<File, File>)
|
abstract fun perform(workDir: File, mapping: MutableMap<File, File>)
|
||||||
|
|
||||||
override fun toString(): String = "${javaClass.simpleName} $path"
|
override fun toString(): String = "${this::class.java.simpleName} $path"
|
||||||
}
|
}
|
||||||
|
|
||||||
class ModifyContent(path: String, val dataFile: File) : Modification(path) {
|
class ModifyContent(path: String, val dataFile: File) : Modification(path) {
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ object CodegenUtil {
|
|||||||
else if (traitMember is PropertyDescriptor) {
|
else if (traitMember is PropertyDescriptor) {
|
||||||
for (traitAccessor in traitMember.accessors) {
|
for (traitAccessor in traitMember.accessors) {
|
||||||
for (inheritedAccessor in (copy as PropertyDescriptor).accessors) {
|
for (inheritedAccessor in (copy as PropertyDescriptor).accessors) {
|
||||||
if (inheritedAccessor.javaClass == traitAccessor.javaClass) { // same accessor kind
|
if (inheritedAccessor::class.java == traitAccessor::class.java) { // same accessor kind
|
||||||
result.put(traitAccessor, inheritedAccessor)
|
result.put(traitAccessor, inheritedAccessor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getParentCall
|
|||||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.overriddenTreeAsSequence
|
import org.jetbrains.kotlin.resolve.descriptorUtil.overriddenTreeAsSequence
|
||||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class BridgeForBuiltinSpecial<out Signature : Any>(
|
class BridgeForBuiltinSpecial<out Signature : Any>(
|
||||||
@@ -76,7 +75,7 @@ object BuiltinSpecialBridgesUtil {
|
|||||||
else null
|
else null
|
||||||
|
|
||||||
val commonBridges = reachableDeclarations.mapTo(LinkedHashSet<Signature>(), signatureByDescriptor)
|
val commonBridges = reachableDeclarations.mapTo(LinkedHashSet<Signature>(), signatureByDescriptor)
|
||||||
commonBridges.removeAll(specialBridgesSignaturesInSuperClass + specialBridge?.from.singletonOrEmptyList())
|
commonBridges.removeAll(specialBridgesSignaturesInSuperClass + listOfNotNull(specialBridge?.from))
|
||||||
|
|
||||||
if (fake) {
|
if (fake) {
|
||||||
for (overridden in function.overriddenDescriptors.map { it.original }) {
|
for (overridden in function.overriddenDescriptors.map { it.original }) {
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
|||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.kotlin.types.typeUtil.makeNullable
|
import org.jetbrains.kotlin.types.typeUtil.makeNullable
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
|
||||||
import org.jetbrains.org.objectweb.asm.Label
|
import org.jetbrains.org.objectweb.asm.Label
|
||||||
import org.jetbrains.org.objectweb.asm.MethodVisitor
|
import org.jetbrains.org.objectweb.asm.MethodVisitor
|
||||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||||
@@ -289,8 +288,8 @@ class CoroutineCodegen private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun allFunctionParameters() =
|
private fun allFunctionParameters() =
|
||||||
originalSuspendFunctionDescriptor.extensionReceiverParameter.singletonOrEmptyList() +
|
listOfNotNull(originalSuspendFunctionDescriptor.extensionReceiverParameter) +
|
||||||
originalSuspendFunctionDescriptor.valueParameters.orEmpty()
|
originalSuspendFunctionDescriptor.valueParameters.orEmpty()
|
||||||
|
|
||||||
private fun ParameterDescriptor.getFieldInfoForCoroutineLambdaParameter() =
|
private fun ParameterDescriptor.getFieldInfoForCoroutineLambdaParameter() =
|
||||||
createHiddenFieldInfo(type, COROUTINE_LAMBDA_PARAMETER_PREFIX + (this.safeAs<ValueParameterDescriptor>()?.index ?: ""))
|
createHiddenFieldInfo(type, COROUTINE_LAMBDA_PARAMETER_PREFIX + (this.safeAs<ValueParameterDescriptor>()?.index ?: ""))
|
||||||
|
|||||||
+1
-1
@@ -294,7 +294,7 @@ class CoroutineTransformerMethodVisitor(
|
|||||||
get() {
|
get() {
|
||||||
assert(suspensionCallEnd.next is LabelNode) {
|
assert(suspensionCallEnd.next is LabelNode) {
|
||||||
"Next instruction after ${this} should be a label, but " +
|
"Next instruction after ${this} should be a label, but " +
|
||||||
"${suspensionCallEnd.next.javaClass}/${suspensionCallEnd.next.opcode} was found"
|
"${suspensionCallEnd.next::class.java}/${suspensionCallEnd.next.opcode} was found"
|
||||||
}
|
}
|
||||||
|
|
||||||
return suspensionCallEnd.next as LabelNode
|
return suspensionCallEnd.next as LabelNode
|
||||||
|
|||||||
+1
-1
@@ -217,7 +217,7 @@ private class VarExpectedTypeFrame(maxLocals: Int) : VarFrame<VarExpectedTypeFra
|
|||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
if (other?.javaClass != javaClass) return false
|
if (other == null || other::class.java != this::class.java) return false
|
||||||
|
|
||||||
other as VarExpectedTypeFrame
|
other as VarExpectedTypeFrame
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class SMAPBuilder(
|
|||||||
private fun generateDebugStrata(realMappings: List<FileMapping>): String {
|
private fun generateDebugStrata(realMappings: List<FileMapping>): String {
|
||||||
val combinedMapping = FileMapping(source, path)
|
val combinedMapping = FileMapping(source, path)
|
||||||
realMappings.forEach { fileMapping ->
|
realMappings.forEach { fileMapping ->
|
||||||
fileMapping.lineMappings.filter { it.callSiteMarker != null }.forEach { (source, dest, range, callSiteMarker) ->
|
fileMapping.lineMappings.filter { it.callSiteMarker != null }.forEach { (_, dest, range, callSiteMarker) ->
|
||||||
combinedMapping.addRangeMapping(RangeMapping(
|
combinedMapping.addRangeMapping(RangeMapping(
|
||||||
callSiteMarker!!.lineNumber, dest, range
|
callSiteMarker!!.lineNumber, dest, range
|
||||||
))
|
))
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ internal val classId: ClassId =
|
|||||||
ClassId.topLevel(FqName("org.jetbrains.kotlin.codegen.intrinsics.IntrinsicArrayConstructorsKt"))
|
ClassId.topLevel(FqName("org.jetbrains.kotlin.codegen.intrinsics.IntrinsicArrayConstructorsKt"))
|
||||||
|
|
||||||
internal val bytecode: ByteArray by lazy {
|
internal val bytecode: ByteArray by lazy {
|
||||||
val stream = object {}.javaClass.classLoader.getResourceAsStream("${classId.asString()}.class")
|
val stream = object {}::class.java.classLoader.getResourceAsStream("${classId.asString()}.class")
|
||||||
stream.readBytes().apply {
|
stream.readBytes().apply {
|
||||||
stream.close()
|
stream.close()
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -20,7 +20,6 @@ import com.intellij.openapi.util.Pair
|
|||||||
import org.jetbrains.kotlin.codegen.AsmUtil
|
import org.jetbrains.kotlin.codegen.AsmUtil
|
||||||
import org.jetbrains.kotlin.codegen.optimization.common.StrictBasicValue
|
import org.jetbrains.kotlin.codegen.optimization.common.StrictBasicValue
|
||||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
|
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
|
||||||
import org.jetbrains.kotlin.utils.toReadOnlyList
|
|
||||||
import org.jetbrains.org.objectweb.asm.Type
|
import org.jetbrains.org.objectweb.asm.Type
|
||||||
import org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode
|
import org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|||||||
+1
-1
@@ -52,7 +52,7 @@ open class StrictBasicValue(type: Type?) : BasicValue(type) {
|
|||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
if (other?.javaClass != javaClass) return false
|
if (other == null || other::class.java != this::class.java) return false
|
||||||
if (!super.equals(other)) return false
|
if (!super.equals(other)) return false
|
||||||
|
|
||||||
other as StrictBasicValue
|
other as StrictBasicValue
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ fun AbstractInsnNode.isLoadOperation(): Boolean = opcode in Opcodes.ILOAD..Opcod
|
|||||||
|
|
||||||
val AbstractInsnNode?.insnText get() = InlineCodegenUtil.getInsnText(this)
|
val AbstractInsnNode?.insnText get() = InlineCodegenUtil.getInsnText(this)
|
||||||
val AbstractInsnNode?.debugText get() =
|
val AbstractInsnNode?.debugText get() =
|
||||||
if (this == null) "<null>" else "${this.javaClass.simpleName}: $insnText"
|
if (this == null) "<null>" else "${this::class.java.simpleName}: $insnText"
|
||||||
|
|
||||||
internal inline fun <reified T : AbstractInsnNode> AbstractInsnNode.isInsn(opcode: Int, condition: T.() -> Boolean): Boolean =
|
internal inline fun <reified T : AbstractInsnNode> AbstractInsnNode.isInsn(opcode: Int, condition: T.() -> Boolean): Boolean =
|
||||||
takeInsnIf(opcode, condition) != null
|
takeInsnIf(opcode, condition) != null
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class GenerationState @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val extraJvmDiagnosticsTrace: BindingTrace = DelegatingBindingTrace(bindingContext, "For extra diagnostics in ${this.javaClass}", false)
|
val extraJvmDiagnosticsTrace: BindingTrace = DelegatingBindingTrace(bindingContext, "For extra diagnostics in ${this::class.java}", false)
|
||||||
private val interceptedBuilderFactory: ClassBuilderFactory
|
private val interceptedBuilderFactory: ClassBuilderFactory
|
||||||
private var used = false
|
private var used = false
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -37,23 +37,23 @@ import java.util.*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T : Any> copyBean(bean: T) = copyFields(bean, bean.javaClass.newInstance(), true, collectFieldsToCopy(bean.javaClass, false))
|
fun <T : Any> copyBean(bean: T) = copyFields(bean, bean::class.java.newInstance(), true, collectFieldsToCopy(bean::class.java, false))
|
||||||
|
|
||||||
fun <From : Any, To : From> mergeBeans(from: From, to: To): To {
|
fun <From : Any, To : From> mergeBeans(from: From, to: To): To {
|
||||||
// TODO: rewrite when updated version of com.intellij.util.xmlb is available on TeamCity
|
// TODO: rewrite when updated version of com.intellij.util.xmlb is available on TeamCity
|
||||||
return copyFields(from, XmlSerializerUtil.createCopy(to), false, collectFieldsToCopy(from.javaClass, false))
|
return copyFields(from, XmlSerializerUtil.createCopy(to), false, collectFieldsToCopy(from::class.java, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <From : Any, To : Any> copyInheritedFields(from: From, to: To) = copyFields(from, to, true, collectFieldsToCopy(from.javaClass, true))
|
fun <From : Any, To : Any> copyInheritedFields(from: From, to: To) = copyFields(from, to, true, collectFieldsToCopy(from::class.java, true))
|
||||||
|
|
||||||
fun <From : Any, To : Any> copyFieldsSatisfying(from: From, to: To, predicate: (Field) -> Boolean) =
|
fun <From : Any, To : Any> copyFieldsSatisfying(from: From, to: To, predicate: (Field) -> Boolean) =
|
||||||
copyFields(from, to, true, collectFieldsToCopy(from.javaClass, false).filter(predicate))
|
copyFields(from, to, true, collectFieldsToCopy(from::class.java, false).filter(predicate))
|
||||||
|
|
||||||
private fun <From : Any, To : Any> copyFields(from: From, to: To, deepCopyWhenNeeded: Boolean, fieldsToCopy: List<Field>): To {
|
private fun <From : Any, To : Any> copyFields(from: From, to: To, deepCopyWhenNeeded: Boolean, fieldsToCopy: List<Field>): To {
|
||||||
if (from == to) return to
|
if (from == to) return to
|
||||||
|
|
||||||
for (fromField in fieldsToCopy) {
|
for (fromField in fieldsToCopy) {
|
||||||
val toField = to.javaClass.getField(fromField.name)
|
val toField = to::class.java.getField(fromField.name)
|
||||||
val fromValue = fromField.get(from)
|
val fromValue = fromField.get(from)
|
||||||
toField.set(to, if (deepCopyWhenNeeded) fromValue?.copyValueIfNeeded() else fromValue)
|
toField.set(to, if (deepCopyWhenNeeded) fromValue?.copyValueIfNeeded() else fromValue)
|
||||||
}
|
}
|
||||||
@@ -72,14 +72,14 @@ private fun Any.copyValueIfNeeded(): Any {
|
|||||||
is DoubleArray -> Arrays.copyOf(this, size)
|
is DoubleArray -> Arrays.copyOf(this, size)
|
||||||
is BooleanArray -> Arrays.copyOf(this, size)
|
is BooleanArray -> Arrays.copyOf(this, size)
|
||||||
|
|
||||||
is Array<*> -> java.lang.reflect.Array.newInstance(javaClass.componentType, size).apply {
|
is Array<*> -> java.lang.reflect.Array.newInstance(this::class.java.componentType, size).apply {
|
||||||
this as Array<Any?>
|
this as Array<Any?>
|
||||||
(this@copyValueIfNeeded as Array<Any?>).forEachIndexed { i, value -> this[i] = value?.copyValueIfNeeded() }
|
(this@copyValueIfNeeded as Array<Any?>).forEachIndexed { i, value -> this[i] = value?.copyValueIfNeeded() }
|
||||||
}
|
}
|
||||||
|
|
||||||
is MutableCollection<*> -> (this as Collection<Any?>).mapTo(javaClass.newInstance() as MutableCollection<Any?>) { it?.copyValueIfNeeded() }
|
is MutableCollection<*> -> (this as Collection<Any?>).mapTo(this::class.java.newInstance() as MutableCollection<Any?>) { it?.copyValueIfNeeded() }
|
||||||
|
|
||||||
is MutableMap<*, *> -> (javaClass.newInstance() as MutableMap<Any?, Any?>).apply {
|
is MutableMap<*, *> -> (this::class.java.newInstance() as MutableMap<Any?, Any?>).apply {
|
||||||
for ((k, v) in this@copyValueIfNeeded.entries) {
|
for ((k, v) in this@copyValueIfNeeded.entries) {
|
||||||
put(k?.copyValueIfNeeded(), v?.copyValueIfNeeded())
|
put(k?.copyValueIfNeeded(), v?.copyValueIfNeeded())
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -35,7 +35,7 @@ interface KotlinJsr223JvmInvocableScriptEngine : Invocable {
|
|||||||
val evalState = state.asState(GenericReplEvaluatorState::class.java)
|
val evalState = state.asState(GenericReplEvaluatorState::class.java)
|
||||||
return evalState.history.map { it.item }.filter { it.instance != null }.reversed().ensureNotEmpty("no script ").let { history ->
|
return evalState.history.map { it.item }.filter { it.instance != null }.reversed().ensureNotEmpty("no script ").let { history ->
|
||||||
if (receiverInstance != null) {
|
if (receiverInstance != null) {
|
||||||
val receiverKlass = receiverClass ?: receiverInstance.javaClass.kotlin
|
val receiverKlass = receiverClass ?: receiverInstance::class.java.kotlin
|
||||||
val receiverInHistory = history.find { it.instance == receiverInstance } ?:
|
val receiverInHistory = history.find { it.instance == receiverInstance } ?:
|
||||||
EvalClassWithInstanceAndLoader(receiverKlass, receiverInstance, receiverKlass.java.classLoader, history.first().invokeWrapper)
|
EvalClassWithInstanceAndLoader(receiverKlass, receiverInstance, receiverKlass.java.classLoader, history.first().invokeWrapper)
|
||||||
listOf(receiverInHistory) + history.filterNot { it == receiverInHistory }
|
listOf(receiverInHistory) + history.filterNot { it == receiverInHistory }
|
||||||
@@ -54,7 +54,7 @@ interface KotlinJsr223JvmInvocableScriptEngine : Invocable {
|
|||||||
override fun invokeMethod(thiz: Any?, name: String?, vararg args: Any?): Any? {
|
override fun invokeMethod(thiz: Any?, name: String?, vararg args: Any?): Any? {
|
||||||
if (name == null) throw java.lang.NullPointerException("method name cannot be null")
|
if (name == null) throw java.lang.NullPointerException("method name cannot be null")
|
||||||
if (thiz == null) throw IllegalArgumentException("cannot invoke method on the null object")
|
if (thiz == null) throw IllegalArgumentException("cannot invoke method on the null object")
|
||||||
return invokeImpl(prioritizedHistory(thiz.javaClass.kotlin, thiz), name, args)
|
return invokeImpl(prioritizedHistory(thiz::class.java.kotlin, thiz), name, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun invokeImpl(prioritizedCallOrder: List<EvalClassWithInstanceAndLoader>, name: String, args: Array<out Any?>): Any? {
|
private fun invokeImpl(prioritizedCallOrder: List<EvalClassWithInstanceAndLoader>, name: String, args: Array<out Any?>): Any? {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ fun makeScriptBaseName(codeLine: ReplCodeLine) =
|
|||||||
fun renderReplStackTrace(cause: Throwable, startFromMethodName: String): String {
|
fun renderReplStackTrace(cause: Throwable, startFromMethodName: String): String {
|
||||||
val newTrace = arrayListOf<StackTraceElement>()
|
val newTrace = arrayListOf<StackTraceElement>()
|
||||||
var skip = true
|
var skip = true
|
||||||
for ((_, element) in cause.stackTrace.withIndex().reversed()) {
|
for (element in cause.stackTrace.reversed()) {
|
||||||
if ("${element.className}.${element.methodName}" == startFromMethodName) {
|
if ("${element.className}.${element.methodName}" == startFromMethodName) {
|
||||||
skip = false
|
skip = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,14 +34,14 @@ fun OutputFileCollection.writeAll(outputDir: File, report: (file: OutputFile, so
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val REPORT_NOTHING = { file: OutputFile, sources: List<File>, output: File -> }
|
private val REPORT_NOTHING: (OutputFile, List<File>, File) -> Unit = { _, _, _ -> }
|
||||||
|
|
||||||
fun OutputFileCollection.writeAllTo(outputDir: File) {
|
fun OutputFileCollection.writeAllTo(outputDir: File) {
|
||||||
writeAll(outputDir, REPORT_NOTHING)
|
writeAll(outputDir, REPORT_NOTHING)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun OutputFileCollection.writeAll(outputDir: File, messageCollector: MessageCollector) {
|
fun OutputFileCollection.writeAll(outputDir: File, messageCollector: MessageCollector) {
|
||||||
writeAll(outputDir) { file, sources, output ->
|
writeAll(outputDir) { _, sources, output ->
|
||||||
messageCollector.report(CompilerMessageSeverity.OUTPUT, OutputMessageUtil.formatOutputMessage(sources, output), CompilerMessageLocation.NO_LOCATION)
|
messageCollector.report(CompilerMessageSeverity.OUTPUT, OutputMessageUtil.formatOutputMessage(sources, output), CompilerMessageLocation.NO_LOCATION)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ object PluginCliParser {
|
|||||||
?.map { File(it).toURI().toURL() }
|
?.map { File(it).toURI().toURL() }
|
||||||
?.toTypedArray()
|
?.toTypedArray()
|
||||||
?: arrayOf<URL>(),
|
?: arrayOf<URL>(),
|
||||||
javaClass.classLoader
|
this::class.java.classLoader
|
||||||
)
|
)
|
||||||
|
|
||||||
val componentRegistrars = ServiceLoader.load(ComponentRegistrar::class.java, classLoader).toMutableList()
|
val componentRegistrars = ServiceLoader.load(ComponentRegistrar::class.java, classLoader).toMutableList()
|
||||||
|
|||||||
+1
-2
@@ -44,7 +44,6 @@ import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
|||||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||||
import org.jetbrains.kotlin.util.slicedMap.ReadOnlySlice
|
import org.jetbrains.kotlin.util.slicedMap.ReadOnlySlice
|
||||||
import org.jetbrains.kotlin.util.slicedMap.WritableSlice
|
import org.jetbrains.kotlin.util.slicedMap.WritableSlice
|
||||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
|
||||||
import kotlin.properties.Delegates
|
import kotlin.properties.Delegates
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -147,7 +146,7 @@ class CliLightClassGenerationSupport(project: Project) : LightClassGenerationSup
|
|||||||
val filesForFacade = findFilesForFacade(facadeFqName, scope)
|
val filesForFacade = findFilesForFacade(facadeFqName, scope)
|
||||||
if (filesForFacade.isEmpty()) return emptyList()
|
if (filesForFacade.isEmpty()) return emptyList()
|
||||||
|
|
||||||
return emptyOrSingletonList<PsiClass>(
|
return listOfNotNull<PsiClass>(
|
||||||
KtLightClassForFacade.createForFacade(psiManager, facadeFqName, scope, filesForFacade))
|
KtLightClassForFacade.createForFacade(psiManager, facadeFqName, scope, filesForFacade))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import org.jetbrains.kotlin.name.ClassId
|
|||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.MetadataPackageFragment
|
import org.jetbrains.kotlin.serialization.deserialization.MetadataPackageFragment
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
|
|
||||||
class CliVirtualFileFinder(
|
class CliVirtualFileFinder(
|
||||||
@@ -61,6 +60,6 @@ class CliVirtualFileFinder(
|
|||||||
|
|
||||||
private fun findBinaryClass(classId: ClassId, fileName: String): VirtualFile? =
|
private fun findBinaryClass(classId: ClassId, fileName: String): VirtualFile? =
|
||||||
index.findClass(classId, acceptedRootTypes = JavaRoot.OnlyBinary) { dir, _ ->
|
index.findClass(classId, acceptedRootTypes = JavaRoot.OnlyBinary) { dir, _ ->
|
||||||
dir.findChild(fileName)?.check(VirtualFile::isValid)
|
dir.findChild(fileName)?.takeIf(VirtualFile::isValid)
|
||||||
}?.check { it in scope }
|
}?.takeIf { it in scope }
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-7
@@ -32,7 +32,6 @@ import org.jetbrains.kotlin.name.ClassId
|
|||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.resolve.jvm.KotlinCliJavaFileManager
|
import org.jetbrains.kotlin.resolve.jvm.KotlinCliJavaFileManager
|
||||||
import org.jetbrains.kotlin.util.PerformanceCounter
|
import org.jetbrains.kotlin.util.PerformanceCounter
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.properties.Delegates
|
import kotlin.properties.Delegates
|
||||||
|
|
||||||
@@ -50,7 +49,7 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ
|
|||||||
val classNameWithInnerClasses = classId.relativeClassName.asString()
|
val classNameWithInnerClasses = classId.relativeClassName.asString()
|
||||||
index.findClass(classId) { dir, type ->
|
index.findClass(classId) { dir, type ->
|
||||||
findClassGivenPackage(allScope, dir, classNameWithInnerClasses, type)
|
findClassGivenPackage(allScope, dir, classNameWithInnerClasses, type)
|
||||||
}?.check { it.containingFile.virtualFile in searchScope }
|
}?.takeIf { it.containingFile.virtualFile in searchScope }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +87,7 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ
|
|||||||
override fun findPackage(packageName: String): PsiPackage? {
|
override fun findPackage(packageName: String): PsiPackage? {
|
||||||
var found = false
|
var found = false
|
||||||
val packageFqName = packageName.toSafeFqName() ?: return null
|
val packageFqName = packageName.toSafeFqName() ?: return null
|
||||||
index.traverseDirectoriesInPackage(packageFqName) { dir, rootType ->
|
index.traverseDirectoriesInPackage(packageFqName) { _, _ ->
|
||||||
found = true
|
found = true
|
||||||
//abort on first found
|
//abort on first found
|
||||||
false
|
false
|
||||||
@@ -149,10 +148,7 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ
|
|||||||
var curClass = topLevelClass
|
var curClass = topLevelClass
|
||||||
while (segments.hasNext()) {
|
while (segments.hasNext()) {
|
||||||
val innerClassName = segments.next()
|
val innerClassName = segments.next()
|
||||||
val innerClass = curClass.findInnerClassByName(innerClassName, false)
|
val innerClass = curClass.findInnerClassByName(innerClassName, false) ?: return null
|
||||||
if (innerClass == null) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
curClass = innerClass
|
curClass = innerClass
|
||||||
}
|
}
|
||||||
return curClass
|
return curClass
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class JvmDependenciesIndexImpl(_roots: List<JavaRoot>): JvmDependenciesIndex {
|
|||||||
): Set<String> {
|
): Set<String> {
|
||||||
val result = hashSetOf<String>()
|
val result = hashSetOf<String>()
|
||||||
traverseDirectoriesInPackage(packageFqName, continueSearch = {
|
traverseDirectoriesInPackage(packageFqName, continueSearch = {
|
||||||
dir, rootType ->
|
dir, _ ->
|
||||||
|
|
||||||
for (child in dir.children) {
|
for (child in dir.children) {
|
||||||
if (child.extension != "class" && child.extension != "java") continue
|
if (child.extension != "class" && child.extension != "java") continue
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ open class GenericReplCompiler(disposable: Disposable,
|
|||||||
val scriptDescriptor = when (analysisResult) {
|
val scriptDescriptor = when (analysisResult) {
|
||||||
is ReplCodeAnalyzer.ReplLineAnalysisResult.WithErrors -> return ReplCompileResult.Error(errorHolder.renderedDiagnostics)
|
is ReplCodeAnalyzer.ReplLineAnalysisResult.WithErrors -> return ReplCompileResult.Error(errorHolder.renderedDiagnostics)
|
||||||
is ReplCodeAnalyzer.ReplLineAnalysisResult.Successful -> analysisResult.scriptDescriptor
|
is ReplCodeAnalyzer.ReplLineAnalysisResult.Successful -> analysisResult.scriptDescriptor
|
||||||
else -> error("Unexpected result ${analysisResult.javaClass}")
|
else -> error("Unexpected result ${analysisResult::class.java}")
|
||||||
}
|
}
|
||||||
|
|
||||||
val generationState = GenerationState(
|
val generationState = GenerationState(
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class ReplInterpreter(
|
|||||||
val scriptDescriptor = when (analysisResult) {
|
val scriptDescriptor = when (analysisResult) {
|
||||||
is ReplCodeAnalyzer.ReplLineAnalysisResult.WithErrors -> return LineResult.Error.CompileTime(errorHolder.renderedDiagnostics)
|
is ReplCodeAnalyzer.ReplLineAnalysisResult.WithErrors -> return LineResult.Error.CompileTime(errorHolder.renderedDiagnostics)
|
||||||
is ReplCodeAnalyzer.ReplLineAnalysisResult.Successful -> analysisResult.scriptDescriptor
|
is ReplCodeAnalyzer.ReplLineAnalysisResult.Successful -> analysisResult.scriptDescriptor
|
||||||
else -> error("Unexpected result ${analysisResult.javaClass}")
|
else -> error("Unexpected result ${analysisResult::class.java}")
|
||||||
}
|
}
|
||||||
|
|
||||||
val state = GenerationState(
|
val state = GenerationState(
|
||||||
@@ -185,7 +185,7 @@ class ReplInterpreter(
|
|||||||
private fun renderStackTrace(cause: Throwable, startFromMethodName: String): String {
|
private fun renderStackTrace(cause: Throwable, startFromMethodName: String): String {
|
||||||
val newTrace = arrayListOf<StackTraceElement>()
|
val newTrace = arrayListOf<StackTraceElement>()
|
||||||
var skip = true
|
var skip = true
|
||||||
for ((_, element) in cause.stackTrace.withIndex().reversed()) {
|
for (element in cause.stackTrace.reversed()) {
|
||||||
if ("${element.className}.${element.methodName}" == startFromMethodName) {
|
if ("${element.className}.${element.methodName}" == startFromMethodName) {
|
||||||
skip = false
|
skip = false
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@ class Preprocessor(val logger: Logger = SystemOutLogger) {
|
|||||||
override fun toString(): String = "Modify(${modifications.size})"
|
override fun toString(): String = "Modify(${modifications.size})"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString() = this.javaClass.simpleName
|
override fun toString() = this::class.java.simpleName
|
||||||
}
|
}
|
||||||
|
|
||||||
fun processSources(sourceRoot: File, profile: Profile) {
|
fun processSources(sourceRoot: File, profile: Profile) {
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ import java.lang.reflect.*
|
|||||||
class InstanceComponentDescriptor(val instance: Any) : ComponentDescriptor {
|
class InstanceComponentDescriptor(val instance: Any) : ComponentDescriptor {
|
||||||
|
|
||||||
override fun getValue(): Any = instance
|
override fun getValue(): Any = instance
|
||||||
override fun getRegistrations(): Iterable<Type> = instance.javaClass.getInfo().registrations
|
override fun getRegistrations(): Iterable<Type> = instance::class.java.getInfo().registrations
|
||||||
|
|
||||||
override fun getDependencies(context: ValueResolveContext): Collection<Class<*>> = emptyList()
|
override fun getDependencies(context: ValueResolveContext): Collection<Class<*>> = emptyList()
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "Instance: ${instance.javaClass.simpleName}"
|
return "Instance: ${instance::class.java.simpleName}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,7 +174,7 @@ class ComponentStorage(val myId: String, parent: ComponentStorage?) : ValueResol
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun injectProperties(instance: Any, context: ValueResolveContext) {
|
private fun injectProperties(instance: Any, context: ValueResolveContext) {
|
||||||
val classInfo = instance.javaClass.getInfo()
|
val classInfo = instance::class.java.getInfo()
|
||||||
|
|
||||||
classInfo.setterInfos.forEach { (method) ->
|
classInfo.setterInfos.forEach { (method) ->
|
||||||
val methodBinding = method.bindToMethod(context)
|
val methodBinding = method.bindToMethod(context)
|
||||||
|
|||||||
+5
-6
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
|||||||
import org.jetbrains.kotlin.daemon.common.*
|
import org.jetbrains.kotlin.daemon.common.*
|
||||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
|
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
|
||||||
import org.jetbrains.kotlin.progress.CompilationCanceledStatus
|
import org.jetbrains.kotlin.progress.CompilationCanceledStatus
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.OutputStream
|
import java.io.OutputStream
|
||||||
import java.io.PrintStream
|
import java.io.PrintStream
|
||||||
@@ -60,11 +59,11 @@ object KotlinCompilerClient {
|
|||||||
checkId: Boolean = true
|
checkId: Boolean = true
|
||||||
): CompileService? {
|
): CompileService? {
|
||||||
val flagFile = System.getProperty(COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY)
|
val flagFile = System.getProperty(COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY)
|
||||||
?.let(String::trimQuotes)
|
?.let(String::trimQuotes)
|
||||||
?.check { !it.isBlank() }
|
?.takeIf { !it.isBlank() }
|
||||||
?.let(::File)
|
?.let(::File)
|
||||||
?.check(File::exists)
|
?.takeIf(File::exists)
|
||||||
?: makeAutodeletingFlagFile(baseDir = File(daemonOptions.runFilesPathOrDefault))
|
?: makeAutodeletingFlagFile(baseDir = File(daemonOptions.runFilesPathOrDefault))
|
||||||
return connectToCompileService(compilerId, flagFile, daemonJVMOptions, daemonOptions, reportingTargets, autostart)
|
return connectToCompileService(compilerId, flagFile, daemonJVMOptions, daemonOptions, reportingTargets, autostart)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ private inline fun tryConnectToDaemon(port: Int, report: (DaemonReportCategory,
|
|||||||
when (daemon) {
|
when (daemon) {
|
||||||
null -> report(DaemonReportCategory.EXCEPTION, "daemon not found")
|
null -> report(DaemonReportCategory.EXCEPTION, "daemon not found")
|
||||||
is CompileService -> return daemon
|
is CompileService -> return daemon
|
||||||
else -> report(DaemonReportCategory.EXCEPTION, "Unable to cast compiler service, actual class received: ${daemon.javaClass.name}")
|
else -> report(DaemonReportCategory.EXCEPTION, "Unable to cast compiler service, actual class received: ${daemon::class.java.name}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e: Throwable) {
|
catch (e: Throwable) {
|
||||||
|
|||||||
+4
-4
@@ -44,22 +44,22 @@ interface CompileService : Remote {
|
|||||||
class Good<out R>(val result: R) : CallResult<R>() {
|
class Good<out R>(val result: R) : CallResult<R>() {
|
||||||
override fun get(): R = result
|
override fun get(): R = result
|
||||||
override fun equals(other: Any?): Boolean = other is Good<*> && this.result == other.result
|
override fun equals(other: Any?): Boolean = other is Good<*> && this.result == other.result
|
||||||
override fun hashCode(): Int = this.javaClass.hashCode() + (result?.hashCode() ?: 1)
|
override fun hashCode(): Int = this::class.java.hashCode() + (result?.hashCode() ?: 1)
|
||||||
}
|
}
|
||||||
class Ok : CallResult<Nothing>() {
|
class Ok : CallResult<Nothing>() {
|
||||||
override fun get(): Nothing = throw IllegalStateException("Get is inapplicable to Ok call result")
|
override fun get(): Nothing = throw IllegalStateException("Get is inapplicable to Ok call result")
|
||||||
override fun equals(other: Any?): Boolean = other is Ok
|
override fun equals(other: Any?): Boolean = other is Ok
|
||||||
override fun hashCode(): Int = this.javaClass.hashCode() + 1 // avoiding clash with the hash of class itself
|
override fun hashCode(): Int = this::class.java.hashCode() + 1 // avoiding clash with the hash of class itself
|
||||||
}
|
}
|
||||||
class Dying : CallResult<Nothing>() {
|
class Dying : CallResult<Nothing>() {
|
||||||
override fun get(): Nothing = throw IllegalStateException("Service is dying")
|
override fun get(): Nothing = throw IllegalStateException("Service is dying")
|
||||||
override fun equals(other: Any?): Boolean = other is Dying
|
override fun equals(other: Any?): Boolean = other is Dying
|
||||||
override fun hashCode(): Int = this.javaClass.hashCode() + 1 // see comment to Ok.hashCode
|
override fun hashCode(): Int = this::class.java.hashCode() + 1 // see comment to Ok.hashCode
|
||||||
}
|
}
|
||||||
class Error(val message: String) : CallResult<Nothing>() {
|
class Error(val message: String) : CallResult<Nothing>() {
|
||||||
override fun get(): Nothing = throw Exception(message)
|
override fun get(): Nothing = throw Exception(message)
|
||||||
override fun equals(other: Any?): Boolean = other is Error && this.message == other.message
|
override fun equals(other: Any?): Boolean = other is Error && this.message == other.message
|
||||||
override fun hashCode(): Int = this.javaClass.hashCode() + message.hashCode()
|
override fun hashCode(): Int = this::class.java.hashCode() + message.hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
val isGood: Boolean get() = this is Good<*>
|
val isGood: Boolean get() = this is Good<*>
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ import org.jetbrains.kotlin.incremental.*
|
|||||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
|
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
|
||||||
import org.jetbrains.kotlin.modules.Module
|
import org.jetbrains.kotlin.modules.Module
|
||||||
import org.jetbrains.kotlin.progress.CompilationCanceledStatus
|
import org.jetbrains.kotlin.progress.CompilationCanceledStatus
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
|
||||||
import org.jetbrains.kotlin.utils.stackTraceStr
|
import org.jetbrains.kotlin.utils.stackTraceStr
|
||||||
import java.io.BufferedOutputStream
|
import java.io.BufferedOutputStream
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
@@ -352,7 +351,7 @@ class CompileServiceImpl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
CompilerMode.NON_INCREMENTAL_COMPILER -> {
|
CompilerMode.NON_INCREMENTAL_COMPILER -> {
|
||||||
doCompile(sessionId, daemonReporter, tracer = null) { eventManger, profiler ->
|
doCompile(sessionId, daemonReporter, tracer = null) { _, _ ->
|
||||||
execCompiler(targetPlatform, Services.EMPTY, k2PlatformArgs, messageCollector)
|
execCompiler(targetPlatform, Services.EMPTY, k2PlatformArgs, messageCollector)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -366,7 +365,7 @@ class CompileServiceImpl(
|
|||||||
val gradleIncrementalServicesFacade = servicesFacade as IncrementalCompilerServicesFacade
|
val gradleIncrementalServicesFacade = servicesFacade as IncrementalCompilerServicesFacade
|
||||||
|
|
||||||
withIC {
|
withIC {
|
||||||
doCompile(sessionId, daemonReporter, tracer = null) { eventManger, profiler ->
|
doCompile(sessionId, daemonReporter, tracer = null) { _, _ ->
|
||||||
execIncrementalCompiler(k2jvmArgs, gradleIncrementalArgs, gradleIncrementalServicesFacade, compilationResults!!,
|
execIncrementalCompiler(k2jvmArgs, gradleIncrementalArgs, gradleIncrementalServicesFacade, compilationResults!!,
|
||||||
messageCollector, daemonReporter)
|
messageCollector, daemonReporter)
|
||||||
}
|
}
|
||||||
@@ -647,7 +646,7 @@ class CompileServiceImpl(
|
|||||||
|
|
||||||
ifAlive {
|
ifAlive {
|
||||||
|
|
||||||
val aliveWithOpts = walkDaemons(File(daemonOptions.runFilesPathOrDefault), compilerId, runFile, filter = { f, p -> p != port }, report = { _, msg -> log.info(msg) }).toList()
|
val aliveWithOpts = walkDaemons(File(daemonOptions.runFilesPathOrDefault), compilerId, runFile, filter = { _, p -> p != port }, report = { _, msg -> log.info(msg) }).toList()
|
||||||
val comparator = compareByDescending<DaemonWithMetadata, DaemonJVMOptions>(DaemonJVMOptionsMemoryComparator(), { it.jvmOptions })
|
val comparator = compareByDescending<DaemonWithMetadata, DaemonJVMOptions>(DaemonJVMOptionsMemoryComparator(), { it.jvmOptions })
|
||||||
.thenBy(FileAgeComparator()) { it.runFile }
|
.thenBy(FileAgeComparator()) { it.runFile }
|
||||||
aliveWithOpts.maxWith(comparator)?.let { bestDaemonWithMetadata ->
|
aliveWithOpts.maxWith(comparator)?.let { bestDaemonWithMetadata ->
|
||||||
@@ -745,7 +744,7 @@ class CompileServiceImpl(
|
|||||||
operationsTracer: RemoteOperationsTracer?,
|
operationsTracer: RemoteOperationsTracer?,
|
||||||
body: (PrintStream, EventManager, Profiler) -> ExitCode): CompileService.CallResult<Int> =
|
body: (PrintStream, EventManager, Profiler) -> ExitCode): CompileService.CallResult<Int> =
|
||||||
ifAlive {
|
ifAlive {
|
||||||
withValidClientOrSessionProxy(sessionId) { _ ->
|
withValidClientOrSessionProxy(sessionId) {
|
||||||
operationsTracer?.before("compile")
|
operationsTracer?.before("compile")
|
||||||
val rpcProfiler = if (daemonOptions.reportPerf) WallAndThreadTotalProfiler() else DummyProfiler()
|
val rpcProfiler = if (daemonOptions.reportPerf) WallAndThreadTotalProfiler() else DummyProfiler()
|
||||||
val eventManger = EventManagerImpl()
|
val eventManger = EventManagerImpl()
|
||||||
@@ -775,7 +774,7 @@ class CompileServiceImpl(
|
|||||||
tracer: RemoteOperationsTracer?,
|
tracer: RemoteOperationsTracer?,
|
||||||
body: (EventManager, Profiler) -> ExitCode): CompileService.CallResult<Int> =
|
body: (EventManager, Profiler) -> ExitCode): CompileService.CallResult<Int> =
|
||||||
ifAlive {
|
ifAlive {
|
||||||
withValidClientOrSessionProxy(sessionId) { _ ->
|
withValidClientOrSessionProxy(sessionId) {
|
||||||
tracer?.before("compile")
|
tracer?.before("compile")
|
||||||
val rpcProfiler = if (daemonOptions.reportPerf) WallAndThreadTotalProfiler() else DummyProfiler()
|
val rpcProfiler = if (daemonOptions.reportPerf) WallAndThreadTotalProfiler() else DummyProfiler()
|
||||||
val eventManger = EventManagerImpl()
|
val eventManger = EventManagerImpl()
|
||||||
@@ -907,8 +906,6 @@ class CompileServiceImpl(
|
|||||||
@JvmName("withValidRepl1")
|
@JvmName("withValidRepl1")
|
||||||
private inline fun<R> withValidRepl(sessionId: Int, body: KotlinJvmReplService.() -> CompileService.CallResult<R>): CompileService.CallResult<R> =
|
private inline fun<R> withValidRepl(sessionId: Int, body: KotlinJvmReplService.() -> CompileService.CallResult<R>): CompileService.CallResult<R> =
|
||||||
withValidClientOrSessionProxy(sessionId) { session ->
|
withValidClientOrSessionProxy(sessionId) { session ->
|
||||||
(session?.data as? KotlinJvmReplService?)?.let {
|
(session?.data as? KotlinJvmReplService?)?.body() ?: CompileService.CallResult.Error("Not a REPL session $sessionId")
|
||||||
it.body()
|
|
||||||
} ?: CompileService.CallResult.Error("Not a REPL session $sessionId")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ open class KotlinJvmReplService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected fun makeScriptDefinition(templateClasspath: List<File>, templateClassName: String): KotlinScriptDefinition? {
|
protected fun makeScriptDefinition(templateClasspath: List<File>, templateClassName: String): KotlinScriptDefinition? {
|
||||||
val classloader = URLClassLoader(templateClasspath.map { it.toURI().toURL() }.toTypedArray(), this.javaClass.classLoader)
|
val classloader = URLClassLoader(templateClasspath.map { it.toURI().toURL() }.toTypedArray(), this::class.java.classLoader)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val cls = classloader.loadClass(templateClassName)
|
val cls = classloader.loadClass(templateClassName)
|
||||||
|
|||||||
+1
-2
@@ -21,7 +21,6 @@ import org.jetbrains.kotlin.types.Variance
|
|||||||
import org.jetbrains.kotlin.types.replace
|
import org.jetbrains.kotlin.types.replace
|
||||||
import org.jetbrains.kotlin.types.typeUtil.asTypeProjection
|
import org.jetbrains.kotlin.types.typeUtil.asTypeProjection
|
||||||
import org.jetbrains.kotlin.types.typeUtil.contains
|
import org.jetbrains.kotlin.types.typeUtil.contains
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
|
||||||
|
|
||||||
// If type 'samType' contains no projection, then it's non-projection parametrization is 'samType' itself
|
// If type 'samType' contains no projection, then it's non-projection parametrization is 'samType' itself
|
||||||
// Else each projection type argument 'out/in A_i' (but star projections) is replaced with it's bound 'A_i'
|
// Else each projection type argument 'out/in A_i' (but star projections) is replaced with it's bound 'A_i'
|
||||||
@@ -43,7 +42,7 @@ internal fun nonProjectionParametrization(samType: SimpleType): SimpleType? {
|
|||||||
projection.projectionKind == Variance.INVARIANT -> projection
|
projection.projectionKind == Variance.INVARIANT -> projection
|
||||||
|
|
||||||
projection.isStarProjection ->
|
projection.isStarProjection ->
|
||||||
parameter.upperBounds.first().check {
|
parameter.upperBounds.first().takeIf {
|
||||||
t -> !t.contains { it.constructor.declarationDescriptor in parametersSet }
|
t -> !t.contains { it.constructor.declarationDescriptor in parametersSet }
|
||||||
}?.asTypeProjection() ?: return@nonProjectionParametrization null
|
}?.asTypeProjection() ?: return@nonProjectionParametrization null
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -111,7 +111,7 @@ class JavaClassImpl(psiClass: PsiClass) : JavaClassifierImpl<PsiClass>(psiClass)
|
|||||||
val psiClass = psi
|
val psiClass = psi
|
||||||
if (psiClass !is KtLightClassMarker) return
|
if (psiClass !is KtLightClassMarker) return
|
||||||
|
|
||||||
val message = "Querying members of JavaClass created for $psiClass of type ${psiClass.javaClass} defined in file ${psiClass.containingFile?.virtualFile?.canonicalPath}"
|
val message = "Querying members of JavaClass created for $psiClass of type ${psiClass::class.java} defined in file ${psiClass.containingFile?.virtualFile?.canonicalPath}"
|
||||||
LOGGER.error(message)
|
LOGGER.error(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ class VirtualFileKotlinClass private constructor(
|
|||||||
|
|
||||||
override fun equals(other: Any?) = other is VirtualFileKotlinClass && other.file == file
|
override fun equals(other: Any?) = other is VirtualFileKotlinClass && other.file == file
|
||||||
override fun hashCode() = file.hashCode()
|
override fun hashCode() = file.hashCode()
|
||||||
override fun toString() = "${javaClass.simpleName}: $file"
|
override fun toString() = "${this::class.java.simpleName}: $file"
|
||||||
|
|
||||||
companion object Factory {
|
companion object Factory {
|
||||||
private val LOG = Logger.getInstance(VirtualFileKotlinClass::class.java)
|
private val LOG = Logger.getInstance(VirtualFileKotlinClass::class.java)
|
||||||
|
|||||||
+1
-2
@@ -34,7 +34,6 @@ import org.jetbrains.kotlin.serialization.deserialization.DeserializationCompone
|
|||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedPackageMemberScope
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedPackageMemberScope
|
||||||
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
|
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
|
||||||
import org.jetbrains.kotlin.storage.StorageManager
|
import org.jetbrains.kotlin.storage.StorageManager
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.singletonOrEmptyList
|
|
||||||
import org.jetbrains.kotlin.utils.keysToMap
|
import org.jetbrains.kotlin.utils.keysToMap
|
||||||
|
|
||||||
class IncrementalPackageFragmentProvider(
|
class IncrementalPackageFragmentProvider(
|
||||||
@@ -53,7 +52,7 @@ class IncrementalPackageFragmentProvider(
|
|||||||
override fun getSubPackagesOf(fqName: FqName, nameFilter: (Name) -> Boolean): Collection<FqName> = emptySet()
|
override fun getSubPackagesOf(fqName: FqName, nameFilter: (Name) -> Boolean): Collection<FqName> = emptySet()
|
||||||
|
|
||||||
override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> {
|
override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> {
|
||||||
return fqNameToPackageFragment[fqName].singletonOrEmptyList()
|
return listOfNotNull(fqNameToPackageFragment[fqName])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import org.jetbrains.kotlin.resolve.CompilerEnvironment
|
|||||||
import org.jetbrains.kotlin.resolve.MultiTargetPlatform
|
import org.jetbrains.kotlin.resolve.MultiTargetPlatform
|
||||||
import org.jetbrains.kotlin.resolve.TargetEnvironment
|
import org.jetbrains.kotlin.resolve.TargetEnvironment
|
||||||
import org.jetbrains.kotlin.resolve.TargetPlatform
|
import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class ResolverForModule(
|
class ResolverForModule(
|
||||||
@@ -179,7 +178,7 @@ abstract class AnalyzerFacade<in P : PlatformAnalysisParameters> {
|
|||||||
val resolverForProject = createResolverForProject()
|
val resolverForProject = createResolverForProject()
|
||||||
|
|
||||||
fun computeDependencyDescriptors(module: M): List<ModuleDescriptorImpl> {
|
fun computeDependencyDescriptors(module: M): List<ModuleDescriptorImpl> {
|
||||||
val orderedDependencies = firstDependency.singletonOrEmptyList() + module.dependencies()
|
val orderedDependencies = listOfNotNull(firstDependency) + module.dependencies()
|
||||||
val dependenciesDescriptors = orderedDependencies.mapTo(ArrayList<ModuleDescriptorImpl>()) {
|
val dependenciesDescriptors = orderedDependencies.mapTo(ArrayList<ModuleDescriptorImpl>()) {
|
||||||
dependencyInfo ->
|
dependencyInfo ->
|
||||||
resolverForProject.descriptorForModule(dependencyInfo as M)
|
resolverForProject.descriptorForModule(dependencyInfo as M)
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class ConstructorConsistencyChecker private constructor(
|
|||||||
.filterIsInstance<PropertyDescriptor>()
|
.filterIsInstance<PropertyDescriptor>()
|
||||||
.filter { trace.get(BindingContext.BACKING_FIELD_REQUIRED, it) == true }
|
.filter { trace.get(BindingContext.BACKING_FIELD_REQUIRED, it) == true }
|
||||||
pseudocode.traverse(
|
pseudocode.traverse(
|
||||||
TraversalOrder.FORWARD, variablesData.variableInitializers, { instruction, enterData, exitData ->
|
TraversalOrder.FORWARD, variablesData.variableInitializers, { instruction, enterData, _ ->
|
||||||
|
|
||||||
fun firstUninitializedNotNullProperty() = propertyDescriptors.firstOrNull {
|
fun firstUninitializedNotNullProperty() = propertyDescriptors.firstOrNull {
|
||||||
!it.type.isMarkedNullable && !KotlinBuiltIns.isPrimitiveType(it.type) &&
|
!it.type.isMarkedNullable && !KotlinBuiltIns.isPrimitiveType(it.type) &&
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ class ControlFlowInformationProvider private constructor(
|
|||||||
pseudocode.traverse(TraversalOrder.BACKWARD, variableStatusData) {
|
pseudocode.traverse(TraversalOrder.BACKWARD, variableStatusData) {
|
||||||
instruction: Instruction,
|
instruction: Instruction,
|
||||||
enterData: Map<VariableDescriptor, VariableUseState>,
|
enterData: Map<VariableDescriptor, VariableUseState>,
|
||||||
exitData: Map<VariableDescriptor, VariableUseState> ->
|
_: Map<VariableDescriptor, VariableUseState> ->
|
||||||
|
|
||||||
val ctxt = VariableUseContext(instruction, reportedDiagnosticMap)
|
val ctxt = VariableUseContext(instruction, reportedDiagnosticMap)
|
||||||
val declaredVariables = pseudocodeVariablesData.getDeclaredVariables(instruction.owner, false)
|
val declaredVariables = pseudocodeVariablesData.getDeclaredVariables(instruction.owner, false)
|
||||||
|
|||||||
@@ -1026,7 +1026,7 @@ class ControlFlowProcessor(private val trace: BindingTrace) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun isBlockInDoWhile(expression: KtBlockExpression): Boolean {
|
private fun isBlockInDoWhile(expression: KtBlockExpression): Boolean {
|
||||||
val parent = expression.parent ?: return false
|
val parent = expression.parent
|
||||||
return parent.parent is KtDoWhileExpression
|
return parent.parent is KtDoWhileExpression
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -17,17 +17,16 @@
|
|||||||
package org.jetbrains.kotlin.cfg.pseudocode.instructions
|
package org.jetbrains.kotlin.cfg.pseudocode.instructions
|
||||||
|
|
||||||
import org.jetbrains.kotlin.psi.KtElement
|
import org.jetbrains.kotlin.psi.KtElement
|
||||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
|
||||||
|
|
||||||
abstract class InstructionWithNext(
|
abstract class InstructionWithNext(
|
||||||
element: KtElement,
|
element: KtElement,
|
||||||
blockScope: BlockScope
|
blockScope: BlockScope
|
||||||
) : KtElementInstructionImpl(element, blockScope) {
|
) : KtElementInstructionImpl(element, blockScope) {
|
||||||
var next: Instruction? = null
|
var next: Instruction? = null
|
||||||
set(value: Instruction?) {
|
set(value) {
|
||||||
field = outgoingEdgeTo(value)
|
field = outgoingEdgeTo(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val nextInstructions: Collection<Instruction>
|
override val nextInstructions: Collection<Instruction>
|
||||||
get() = emptyOrSingletonList(next)
|
get() = listOfNotNull(next)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-3
@@ -22,7 +22,6 @@ import org.jetbrains.kotlin.cfg.pseudocode.instructions.BlockScope
|
|||||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.KtElementInstructionImpl
|
import org.jetbrains.kotlin.cfg.pseudocode.instructions.KtElementInstructionImpl
|
||||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionImpl
|
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionImpl
|
||||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.Instruction
|
import org.jetbrains.kotlin.cfg.pseudocode.instructions.Instruction
|
||||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
|
||||||
|
|
||||||
abstract class AbstractJumpInstruction(
|
abstract class AbstractJumpInstruction(
|
||||||
element: KtElement,
|
element: KtElement,
|
||||||
@@ -30,7 +29,7 @@ abstract class AbstractJumpInstruction(
|
|||||||
blockScope: BlockScope
|
blockScope: BlockScope
|
||||||
) : KtElementInstructionImpl(element, blockScope), JumpInstruction {
|
) : KtElementInstructionImpl(element, blockScope), JumpInstruction {
|
||||||
var resolvedTarget: Instruction? = null
|
var resolvedTarget: Instruction? = null
|
||||||
set(value: Instruction?) {
|
set(value) {
|
||||||
field = outgoingEdgeTo(value)
|
field = outgoingEdgeTo(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,5 +44,5 @@ abstract class AbstractJumpInstruction(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override val nextInstructions: Collection<Instruction>
|
override val nextInstructions: Collection<Instruction>
|
||||||
get() = emptyOrSingletonList(resolvedTarget)
|
get() = listOfNotNull(resolvedTarget)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-4
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.cfg.pseudocode.instructions.BlockScope
|
|||||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.Instruction
|
import org.jetbrains.kotlin.cfg.pseudocode.instructions.Instruction
|
||||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionVisitorWithResult
|
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionVisitorWithResult
|
||||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionVisitor
|
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionVisitor
|
||||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
|
||||||
|
|
||||||
class ConditionalJumpInstruction(
|
class ConditionalJumpInstruction(
|
||||||
element: KtElement,
|
element: KtElement,
|
||||||
@@ -37,13 +36,13 @@ class ConditionalJumpInstruction(
|
|||||||
|
|
||||||
var nextOnTrue: Instruction
|
var nextOnTrue: Instruction
|
||||||
get() = _nextOnTrue!!
|
get() = _nextOnTrue!!
|
||||||
set(value: Instruction) {
|
set(value) {
|
||||||
_nextOnTrue = outgoingEdgeTo(value)
|
_nextOnTrue = outgoingEdgeTo(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
var nextOnFalse: Instruction
|
var nextOnFalse: Instruction
|
||||||
get() = _nextOnFalse!!
|
get() = _nextOnFalse!!
|
||||||
set(value: Instruction) {
|
set(value) {
|
||||||
_nextOnFalse = outgoingEdgeTo(value)
|
_nextOnFalse = outgoingEdgeTo(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +50,7 @@ class ConditionalJumpInstruction(
|
|||||||
get() = Arrays.asList(nextOnFalse, nextOnTrue)
|
get() = Arrays.asList(nextOnFalse, nextOnTrue)
|
||||||
|
|
||||||
override val inputValues: List<PseudoValue>
|
override val inputValues: List<PseudoValue>
|
||||||
get() = emptyOrSingletonList(conditionValue)
|
get() = listOfNotNull(conditionValue)
|
||||||
|
|
||||||
override fun accept(visitor: InstructionVisitor) {
|
override fun accept(visitor: InstructionVisitor) {
|
||||||
visitor.visitConditionalJump(this)
|
visitor.visitConditionalJump(this)
|
||||||
|
|||||||
+2
-3
@@ -27,7 +27,6 @@ import org.jetbrains.kotlin.cfg.pseudocode.instructions.Instruction
|
|||||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionVisitor
|
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionVisitor
|
||||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionVisitorWithResult
|
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionVisitorWithResult
|
||||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionImpl
|
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionImpl
|
||||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
|
||||||
|
|
||||||
class NondeterministicJumpInstruction(
|
class NondeterministicJumpInstruction(
|
||||||
element: KtElement,
|
element: KtElement,
|
||||||
@@ -48,7 +47,7 @@ class NondeterministicJumpInstruction(
|
|||||||
|
|
||||||
var next: Instruction
|
var next: Instruction
|
||||||
get() = _next!!
|
get() = _next!!
|
||||||
set(value: Instruction) {
|
set(value) {
|
||||||
_next = outgoingEdgeTo(value)
|
_next = outgoingEdgeTo(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +59,7 @@ class NondeterministicJumpInstruction(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override val inputValues: List<PseudoValue>
|
override val inputValues: List<PseudoValue>
|
||||||
get() = emptyOrSingletonList(inputValue)
|
get() = listOfNotNull(inputValue)
|
||||||
|
|
||||||
override fun accept(visitor: InstructionVisitor) {
|
override fun accept(visitor: InstructionVisitor) {
|
||||||
visitor.visitNondeterministicJump(this)
|
visitor.visitNondeterministicJump(this)
|
||||||
|
|||||||
+1
-2
@@ -20,7 +20,6 @@ import org.jetbrains.kotlin.descriptors.*
|
|||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.singletonList
|
|
||||||
|
|
||||||
sealed class LocalVariableAccessorDescriptor(
|
sealed class LocalVariableAccessorDescriptor(
|
||||||
final override val correspondingVariable: LocalVariableDescriptor,
|
final override val correspondingVariable: LocalVariableDescriptor,
|
||||||
@@ -38,7 +37,7 @@ sealed class LocalVariableAccessorDescriptor(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
val valueParameters =
|
val valueParameters =
|
||||||
if (isGetter) emptyList() else createValueParameter(Name.identifier("value"), correspondingVariable.type).singletonList()
|
if (isGetter) emptyList() else listOf(createValueParameter(Name.identifier("value"), correspondingVariable.type))
|
||||||
initialize(null, null, emptyList(), valueParameters, correspondingVariable.type, Modality.FINAL, Visibilities.LOCAL)
|
initialize(null, null, emptyList(), valueParameters, correspondingVariable.type, Modality.FINAL, Visibilities.LOCAL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ object PositioningStrategies {
|
|||||||
is KtPropertyAccessor -> element.namePlaceholder
|
is KtPropertyAccessor -> element.namePlaceholder
|
||||||
is KtAnonymousInitializer -> element
|
is KtAnonymousInitializer -> element
|
||||||
else -> throw IllegalArgumentException(
|
else -> throw IllegalArgumentException(
|
||||||
"Can't find text range for element '${element.javaClass.canonicalName}' with the text '${element.text}'")
|
"Can't find text range for element '${element::class.java.canonicalName}' with the text '${element.text}'")
|
||||||
}
|
}
|
||||||
return markElement(elementToMark)
|
return markElement(elementToMark)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -59,7 +59,7 @@ sealed class RenderingContext {
|
|||||||
is DiagnosticWithParameters1<*, *> -> listOf(d.a)
|
is DiagnosticWithParameters1<*, *> -> listOf(d.a)
|
||||||
is DiagnosticWithParameters2<*, *, *> -> listOf(d.a, d.b)
|
is DiagnosticWithParameters2<*, *, *> -> listOf(d.a, d.b)
|
||||||
is DiagnosticWithParameters3<*, *, *, *> -> listOf(d.a, d.b, d.c)
|
is DiagnosticWithParameters3<*, *, *, *> -> listOf(d.a, d.b, d.c)
|
||||||
is ParametrizedDiagnostic<*> -> error("Unexpected diagnostic: ${d.javaClass}")
|
is ParametrizedDiagnostic<*> -> error("Unexpected diagnostic: ${d::class.java}")
|
||||||
else -> listOf()
|
else -> listOf()
|
||||||
}
|
}
|
||||||
return Impl(parameters)
|
return Impl(parameters)
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@ private class AdaptiveClassifierNamePolicy(private val ambiguousNames: List<Name
|
|||||||
val index = typeParametersWithSameName.indexOf(classifier)
|
val index = typeParametersWithSameName.indexOf(classifier)
|
||||||
renderer.renderAmbiguousTypeParameter(classifier, index + 1, isFirstOccurence)
|
renderer.renderAmbiguousTypeParameter(classifier, index + 1, isFirstOccurence)
|
||||||
}
|
}
|
||||||
else -> error("Unexpected classifier: ${classifier.javaClass}")
|
else -> error("Unexpected classifier: ${classifier::class.java}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ fun KtElement.getDebugText(): String {
|
|||||||
|
|
||||||
private object DebugTextBuildingVisitor : KtVisitor<String, Unit>() {
|
private object DebugTextBuildingVisitor : KtVisitor<String, Unit>() {
|
||||||
|
|
||||||
private val LOG = Logger.getInstance(this.javaClass)
|
private val LOG = Logger.getInstance(this::class.java)
|
||||||
|
|
||||||
override fun visitKtFile(file: KtFile, data: Unit?): String? {
|
override fun visitKtFile(file: KtFile, data: Unit?): String? {
|
||||||
return "STUB file: ${file.name}"
|
return "STUB file: ${file.name}"
|
||||||
@@ -48,7 +48,7 @@ private object DebugTextBuildingVisitor : KtVisitor<String, Unit>() {
|
|||||||
|
|
||||||
override fun visitKtElement(element: KtElement, data: Unit?): String? {
|
override fun visitKtElement(element: KtElement, data: Unit?): String? {
|
||||||
if (element is KtElementImplStub<*>) {
|
if (element is KtElementImplStub<*>) {
|
||||||
LOG.error("getDebugText() is not defined for ${element.javaClass}")
|
LOG.error("getDebugText() is not defined for ${element::class.java}")
|
||||||
}
|
}
|
||||||
return element.text
|
return element.text
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ abstract class KtClassOrObject :
|
|||||||
return getOrCreateBody().addBefore(declaration, anchorAfter) as T
|
return getOrCreateBody().addBefore(declaration, anchorAfter) as T
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isTopLevel(): Boolean = stub?.isTopLevel() ?: (parent == null || parent is KtFile)
|
fun isTopLevel(): Boolean = stub?.isTopLevel() ?: (parent is KtFile)
|
||||||
|
|
||||||
override fun isLocal(): Boolean = stub?.isLocal() ?: KtPsiUtil.isLocal(this)
|
override fun isLocal(): Boolean = stub?.isLocal() ?: KtPsiUtil.isLocal(this)
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import com.intellij.testFramework.LightVirtualFile
|
|||||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext
|
import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
abstract class KtCodeFragment(
|
abstract class KtCodeFragment(
|
||||||
@@ -175,7 +174,7 @@ abstract class KtCodeFragment(
|
|||||||
private fun initImports(imports: String?) {
|
private fun initImports(imports: String?) {
|
||||||
if (imports != null && !imports.isEmpty()) {
|
if (imports != null && !imports.isEmpty()) {
|
||||||
|
|
||||||
val importsWithPrefix = imports.split(IMPORT_SEPARATOR).map { it.check { it.startsWith("import ") } ?: "import ${it.trim()}" }
|
val importsWithPrefix = imports.split(IMPORT_SEPARATOR).map { it.takeIf { it.startsWith("import ") } ?: "import ${it.trim()}" }
|
||||||
importsWithPrefix.forEach {
|
importsWithPrefix.forEach {
|
||||||
addImport(it)
|
addImport(it)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ private val SUPPORTED_ARGUMENT_TYPES = listOf(
|
|||||||
fun <TElement : KtElement> createByPattern(pattern: String, vararg args: Any, factory: (String) -> TElement): TElement {
|
fun <TElement : KtElement> createByPattern(pattern: String, vararg args: Any, factory: (String) -> TElement): TElement {
|
||||||
val argumentTypes = args.map { arg ->
|
val argumentTypes = args.map { arg ->
|
||||||
SUPPORTED_ARGUMENT_TYPES.firstOrNull { it.klass.isInstance(arg) }
|
SUPPORTED_ARGUMENT_TYPES.firstOrNull { it.klass.isInstance(arg) }
|
||||||
?: throw IllegalArgumentException("Unsupported argument type: ${arg.javaClass}, should be one of: ${SUPPORTED_ARGUMENT_TYPES.map { it.klass.simpleName }.joinToString()}")
|
?: throw IllegalArgumentException("Unsupported argument type: ${arg::class.java}, should be one of: ${SUPPORTED_ARGUMENT_TYPES.map { it.klass.simpleName }.joinToString()}")
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert arguments that can be converted into plain text
|
// convert arguments that can be converted into plain text
|
||||||
@@ -105,7 +105,7 @@ fun <TElement : KtElement> createByPattern(pattern: String, vararg args: Any, fa
|
|||||||
val args = args.zip(argumentTypes).map {
|
val args = args.zip(argumentTypes).map {
|
||||||
val (arg, type) = it
|
val (arg, type) = it
|
||||||
if (type is PlainTextArgumentType)
|
if (type is PlainTextArgumentType)
|
||||||
(type.toPlainText as Function1<in Any, String>).invoke(arg) // TODO: see KT-7833
|
(type.toPlainText as Function1<Any, String>).invoke(arg) // TODO: see KT-7833
|
||||||
else
|
else
|
||||||
arg
|
arg
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ fun <TElement : KtElement> createByPattern(pattern: String, vararg args: Any, fa
|
|||||||
if (arg is String) continue // already in the text
|
if (arg is String) continue // already in the text
|
||||||
val expectedElementType = (argumentTypes[n] as PsiElementPlaceholderArgumentType<*, *>).placeholderClass
|
val expectedElementType = (argumentTypes[n] as PsiElementPlaceholderArgumentType<*, *>).placeholderClass
|
||||||
|
|
||||||
for ((range, text) in placeholders) {
|
for ((range, _) in placeholders) {
|
||||||
val token = resultElement.findElementAt(range.startOffset)!!
|
val token = resultElement.findElementAt(range.startOffset)!!
|
||||||
for (element in token.parentsWithSelf) {
|
for (element in token.parentsWithSelf) {
|
||||||
val elementRange = element.textRange.shiftRight(-start)
|
val elementRange = element.textRange.shiftRight(-start)
|
||||||
|
|||||||
@@ -28,5 +28,5 @@ internal fun KtElement.deleteSemicolon() {
|
|||||||
if (sibling == null || sibling.node.elementType != KtTokens.SEMICOLON) return
|
if (sibling == null || sibling.node.elementType != KtTokens.SEMICOLON) return
|
||||||
|
|
||||||
val lastSiblingToDelete = PsiTreeUtil.skipSiblingsForward(sibling, PsiWhiteSpace::class.java)?.prevSibling ?: sibling
|
val lastSiblingToDelete = PsiTreeUtil.skipSiblingsForward(sibling, PsiWhiteSpace::class.java)?.prevSibling ?: sibling
|
||||||
parent?.deleteChildRange(nextSibling, lastSiblingToDelete)
|
parent.deleteChildRange(nextSibling, lastSiblingToDelete)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ fun StubBasedPsiElementBase<out KotlinClassOrObjectStub<out KtClassOrObject>>.ge
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
require(this is KtClassOrObject) { "it should be ${KtClassOrObject::class} but it is a ${this.javaClass.name}" }
|
require(this is KtClassOrObject) { "it should be ${KtClassOrObject::class} but it is a ${this::class.java.name}" }
|
||||||
|
|
||||||
val stub = stub
|
val stub = stub
|
||||||
if (stub != null) {
|
if (stub != null) {
|
||||||
@@ -339,12 +339,12 @@ fun KtModifierListOwner.isProtected(): Boolean = hasModifier(KtTokens.PROTECTED_
|
|||||||
|
|
||||||
fun KtSimpleNameExpression.isImportDirectiveExpression(): Boolean {
|
fun KtSimpleNameExpression.isImportDirectiveExpression(): Boolean {
|
||||||
val parent = parent
|
val parent = parent
|
||||||
return parent is KtImportDirective || parent?.parent is KtImportDirective
|
return parent is KtImportDirective || parent.parent is KtImportDirective
|
||||||
}
|
}
|
||||||
|
|
||||||
fun KtSimpleNameExpression.isPackageDirectiveExpression(): Boolean {
|
fun KtSimpleNameExpression.isPackageDirectiveExpression(): Boolean {
|
||||||
val parent = parent
|
val parent = parent
|
||||||
return parent is KtPackageDirective || parent?.parent is KtPackageDirective
|
return parent is KtPackageDirective || parent.parent is KtPackageDirective
|
||||||
}
|
}
|
||||||
|
|
||||||
fun KtExpression.isInImportDirective(): Boolean {
|
fun KtExpression.isInImportDirective(): Boolean {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ val STUB_TO_STRING_PREFIX = "KotlinStub$"
|
|||||||
open class KotlinStubBaseImpl<T : KtElementImplStub<*>>(parent: StubElement<*>?, elementType: IStubElementType<*, *>) : StubBase<T>(parent, elementType) {
|
open class KotlinStubBaseImpl<T : KtElementImplStub<*>>(parent: StubElement<*>?, elementType: IStubElementType<*, *>) : StubBase<T>(parent, elementType) {
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val stubInterface = this.javaClass.interfaces.filter { it.name.contains("Stub") }.single()
|
val stubInterface = this::class.java.interfaces.filter { it.name.contains("Stub") }.single()
|
||||||
val propertiesValues = renderPropertyValues(stubInterface)
|
val propertiesValues = renderPropertyValues(stubInterface)
|
||||||
if (propertiesValues.isEmpty()) {
|
if (propertiesValues.isEmpty()) {
|
||||||
return "$STUB_TO_STRING_PREFIX$stubType"
|
return "$STUB_TO_STRING_PREFIX$stubType"
|
||||||
|
|||||||
+1
-1
@@ -86,7 +86,7 @@ class SyntheticClassOrObjectDescriptor(
|
|||||||
override fun getSealedSubclasses() = emptyList<ClassDescriptor>()
|
override fun getSealedSubclasses() = emptyList<ClassDescriptor>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
assert(modality != Modality.SEALED) { "Implement getSealedSubclasses() for this class: $javaClass" }
|
assert(modality != Modality.SEALED) { "Implement getSealedSubclasses() for this class: ${this::class.java}" }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getDeclaredCallableMembers(): List<CallableMemberDescriptor> =
|
override fun getDeclaredCallableMembers(): List<CallableMemberDescriptor> =
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class AllUnderImportScope(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun printStructure(p: Printer) {
|
override fun printStructure(p: Printer) {
|
||||||
p.println(javaClass.simpleName)
|
p.println(this::class.java.simpleName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.resolve
|
|||||||
import org.jetbrains.kotlin.psi.KtNamedFunction
|
import org.jetbrains.kotlin.psi.KtNamedFunction
|
||||||
|
|
||||||
interface BodyResolveCache {
|
interface BodyResolveCache {
|
||||||
open fun resolveFunctionBody(function: KtNamedFunction): BindingContext
|
fun resolveFunctionBody(function: KtNamedFunction): BindingContext
|
||||||
|
|
||||||
object ThrowException : BodyResolveCache {
|
object ThrowException : BodyResolveCache {
|
||||||
override fun resolveFunctionBody(function: KtNamedFunction): BindingContext {
|
override fun resolveFunctionBody(function: KtNamedFunction): BindingContext {
|
||||||
|
|||||||
@@ -34,13 +34,11 @@ import org.jetbrains.kotlin.resolve.BindingContext.*
|
|||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.classCanHaveAbstractMembers
|
import org.jetbrains.kotlin.resolve.DescriptorUtils.classCanHaveAbstractMembers
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.classCanHaveOpenMembers
|
import org.jetbrains.kotlin.resolve.DescriptorUtils.classCanHaveOpenMembers
|
||||||
import org.jetbrains.kotlin.resolve.calls.results.TypeSpecificityComparator
|
import org.jetbrains.kotlin.resolve.calls.results.TypeSpecificityComparator
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.hasDefaultValue
|
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||||
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
|
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
|
||||||
import org.jetbrains.kotlin.types.*
|
import org.jetbrains.kotlin.types.*
|
||||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
||||||
import org.jetbrains.kotlin.types.typeUtil.*
|
import org.jetbrains.kotlin.types.typeUtil.*
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
internal class DeclarationsCheckerBuilder(
|
internal class DeclarationsCheckerBuilder(
|
||||||
@@ -189,7 +187,7 @@ class DeclarationsChecker(
|
|||||||
private fun getUsedTypeAliasParameters(type: KotlinType, typeAlias: TypeAliasDescriptor): Set<TypeParameterDescriptor> =
|
private fun getUsedTypeAliasParameters(type: KotlinType, typeAlias: TypeAliasDescriptor): Set<TypeParameterDescriptor> =
|
||||||
type.constituentTypes().mapNotNullTo(HashSet()) {
|
type.constituentTypes().mapNotNullTo(HashSet()) {
|
||||||
val descriptor = it.constructor.declarationDescriptor as? TypeParameterDescriptor
|
val descriptor = it.constructor.declarationDescriptor as? TypeParameterDescriptor
|
||||||
descriptor?.check { it.containingDeclaration == typeAlias }
|
descriptor?.takeIf { it.containingDeclaration == typeAlias }
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TypeAliasDeclarationCheckingReportStrategy(
|
private class TypeAliasDeclarationCheckingReportStrategy(
|
||||||
@@ -271,10 +269,10 @@ class DeclarationsChecker(
|
|||||||
if (visibilityModifier != null && visibilityModifier.node?.elementType != KtTokens.PRIVATE_KEYWORD) {
|
if (visibilityModifier != null && visibilityModifier.node?.elementType != KtTokens.PRIVATE_KEYWORD) {
|
||||||
val classDescriptor = constructorDescriptor.containingDeclaration
|
val classDescriptor = constructorDescriptor.containingDeclaration
|
||||||
if (classDescriptor.kind == ClassKind.ENUM_CLASS) {
|
if (classDescriptor.kind == ClassKind.ENUM_CLASS) {
|
||||||
trace.report(NON_PRIVATE_CONSTRUCTOR_IN_ENUM.on(visibilityModifier));
|
trace.report(NON_PRIVATE_CONSTRUCTOR_IN_ENUM.on(visibilityModifier))
|
||||||
}
|
}
|
||||||
else if (classDescriptor.modality == Modality.SEALED) {
|
else if (classDescriptor.modality == Modality.SEALED) {
|
||||||
trace.report(NON_PRIVATE_CONSTRUCTOR_IN_SEALED.on(visibilityModifier));
|
trace.report(NON_PRIVATE_CONSTRUCTOR_IN_SEALED.on(visibilityModifier))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
|||||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||||
import org.jetbrains.kotlin.utils.Printer
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
|
||||||
|
|
||||||
class LazyExplicitImportScope(
|
class LazyExplicitImportScope(
|
||||||
private val packageOrClassDescriptor: DeclarationDescriptor,
|
private val packageOrClassDescriptor: DeclarationDescriptor,
|
||||||
@@ -68,7 +67,7 @@ class LazyExplicitImportScope(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun printStructure(p: Printer) {
|
override fun printStructure(p: Printer) {
|
||||||
p.println(javaClass.simpleName, ": ", aliasName)
|
p.println(this::class.java.simpleName, ": ", aliasName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// should be called only once
|
// should be called only once
|
||||||
@@ -113,5 +112,5 @@ class LazyExplicitImportScope(
|
|||||||
|
|
||||||
private fun <D : CallableMemberDescriptor> Collection<D>.choseOnlyVisibleOrAll() =
|
private fun <D : CallableMemberDescriptor> Collection<D>.choseOnlyVisibleOrAll() =
|
||||||
filter { isVisible(it, packageFragmentForVisibilityCheck, position = QualifierPosition.IMPORT) }.
|
filter { isVisible(it, packageFragmentForVisibilityCheck, position = QualifierPosition.IMPORT) }.
|
||||||
check { it.isNotEmpty() } ?: this
|
takeIf { it.isNotEmpty() } ?: this
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,6 @@ import org.jetbrains.kotlin.name.FqNameUnsafe
|
|||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.resolve.calls.tower.getTypeAliasConstructors
|
import org.jetbrains.kotlin.resolve.calls.tower.getTypeAliasConstructors
|
||||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class OverloadResolver(
|
class OverloadResolver(
|
||||||
@@ -38,7 +37,7 @@ class OverloadResolver(
|
|||||||
fun checkOverloads(c: BodiesResolveContext) {
|
fun checkOverloads(c: BodiesResolveContext) {
|
||||||
val inClasses = findConstructorsInNestedClassesAndTypeAliases(c)
|
val inClasses = findConstructorsInNestedClassesAndTypeAliases(c)
|
||||||
|
|
||||||
for ((key, value) in c.declaredClasses) {
|
for (value in c.declaredClasses.values) {
|
||||||
checkOverloadsInClass(value, inClasses.get(value))
|
checkOverloadsInClass(value, inClasses.get(value))
|
||||||
}
|
}
|
||||||
checkOverloadsInPackages(c)
|
checkOverloadsInPackages(c)
|
||||||
@@ -115,7 +114,7 @@ class OverloadResolver(
|
|||||||
scope, name ->
|
scope, name ->
|
||||||
val variables = scope.getContributedVariables(name, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
val variables = scope.getContributedVariables(name, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
||||||
val classifier = scope.getContributedClassifier(name, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
val classifier = scope.getContributedClassifier(name, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
||||||
variables + classifier.singletonOrEmptyList()
|
variables + listOfNotNull(classifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
return packageMembersByName
|
return packageMembersByName
|
||||||
@@ -215,7 +214,7 @@ class OverloadResolver(
|
|||||||
val bySourceFile = members.groupBy { DescriptorUtils.getContainingSourceFile(it) }
|
val bySourceFile = members.groupBy { DescriptorUtils.getContainingSourceFile(it) }
|
||||||
|
|
||||||
var hasGroupIncludingNonPrivateMembers = false
|
var hasGroupIncludingNonPrivateMembers = false
|
||||||
for ((sourceFile, membersInFile) in bySourceFile) {
|
for (membersInFile in bySourceFile.values) {
|
||||||
// File member groups are interesting in redeclaration check if at least one file member is private.
|
// File member groups are interesting in redeclaration check if at least one file member is private.
|
||||||
if (membersInFile.any { it.isPrivate() }) {
|
if (membersInFile.any { it.isPrivate() }) {
|
||||||
hasGroupIncludingNonPrivateMembers = true
|
hasGroupIncludingNonPrivateMembers = true
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import org.jetbrains.kotlin.resolve.scopes.utils.memberScopeAsImportingScope
|
|||||||
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
|
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
|
||||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext
|
import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext
|
||||||
import org.jetbrains.kotlin.types.expressions.isWithoutValueArguments
|
import org.jetbrains.kotlin.types.expressions.isWithoutValueArguments
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
|
||||||
|
|
||||||
class QualifiedExpressionResolver {
|
class QualifiedExpressionResolver {
|
||||||
fun resolvePackageHeader(
|
fun resolvePackageHeader(
|
||||||
@@ -418,12 +417,12 @@ class QualifiedExpressionResolver {
|
|||||||
val qualifierDescriptor = when (receiver) {
|
val qualifierDescriptor = when (receiver) {
|
||||||
is PackageQualifier -> {
|
is PackageQualifier -> {
|
||||||
val childPackageFQN = receiver.descriptor.fqName.child(name)
|
val childPackageFQN = receiver.descriptor.fqName.child(name)
|
||||||
receiver.descriptor.module.getPackage(childPackageFQN).check { !it.isEmpty() } ?:
|
receiver.descriptor.module.getPackage(childPackageFQN).takeIf { !it.isEmpty() } ?:
|
||||||
receiver.descriptor.memberScope.getContributedClassifier(name, location)
|
receiver.descriptor.memberScope.getContributedClassifier(name, location)
|
||||||
}
|
}
|
||||||
is ClassQualifier -> receiver.staticScope.getContributedClassifier(name, location)
|
is ClassQualifier -> receiver.staticScope.getContributedClassifier(name, location)
|
||||||
null -> context.scope.findClassifier(name, location) ?:
|
null -> context.scope.findClassifier(name, location) ?:
|
||||||
context.scope.ownerDescriptor.module.getPackage(FqName.ROOT.child(name)).check { !it.isEmpty() }
|
context.scope.ownerDescriptor.module.getPackage(FqName.ROOT.child(name)).takeIf { !it.isEmpty() }
|
||||||
is ReceiverValue -> receiver.type.memberScope.memberScopeAsImportingScope().findClassifier(name, location)
|
is ReceiverValue -> receiver.type.memberScope.memberScopeAsImportingScope().findClassifier(name, location)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
@@ -549,7 +548,7 @@ class QualifiedExpressionResolver {
|
|||||||
trace: BindingTrace,
|
trace: BindingTrace,
|
||||||
position: QualifierPosition
|
position: QualifierPosition
|
||||||
) {
|
) {
|
||||||
path.foldRight(packageView) { (name, expression), currentView ->
|
path.foldRight(packageView) { (_, expression), currentView ->
|
||||||
storeResult(trace, expression, currentView, shouldBeVisibleFrom = null, position = position)
|
storeResult(trace, expression, currentView, shouldBeVisibleFrom = null, position = position)
|
||||||
currentView.containingDeclaration
|
currentView.containingDeclaration
|
||||||
?: error("Containing Declaration must be not null for package with fqName: ${currentView.fqName}, " +
|
?: error("Containing Declaration must be not null for package with fqName: ${currentView.fqName}, " +
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ abstract class PlatformConfigurator(
|
|||||||
|
|
||||||
abstract fun configureModuleComponents(container: StorageComponentContainer)
|
abstract fun configureModuleComponents(container: StorageComponentContainer)
|
||||||
|
|
||||||
val platformSpecificContainer = composeContainer(this.javaClass.simpleName) {
|
val platformSpecificContainer = composeContainer(this::class.java.simpleName) {
|
||||||
useInstance(dynamicTypesSettings)
|
useInstance(dynamicTypesSettings)
|
||||||
declarationCheckers.forEach { useInstance(it) }
|
declarationCheckers.forEach { useInstance(it) }
|
||||||
callCheckers.forEach { useInstance(it) }
|
callCheckers.forEach { useInstance(it) }
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ class TypeResolver(
|
|||||||
override fun getVisibility() = Visibilities.LOCAL
|
override fun getVisibility() = Visibilities.LOCAL
|
||||||
|
|
||||||
override fun substitute(substitutor: TypeSubstitutor): VariableDescriptor? {
|
override fun substitute(substitutor: TypeSubstitutor): VariableDescriptor? {
|
||||||
throw UnsupportedOperationException("Should not be called for descriptor of type $javaClass")
|
throw UnsupportedOperationException("Should not be called for descriptor of type ${this::class.java}")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isVar() = false
|
override fun isVar() = false
|
||||||
@@ -415,7 +415,7 @@ class TypeResolver(
|
|||||||
}
|
}
|
||||||
is ClassDescriptor -> resolveTypeForClass(c, annotations, descriptor, element, qualifierResolutionResult)
|
is ClassDescriptor -> resolveTypeForClass(c, annotations, descriptor, element, qualifierResolutionResult)
|
||||||
is TypeAliasDescriptor -> resolveTypeForTypeAlias(c, annotations, descriptor, element, qualifierResolutionResult)
|
is TypeAliasDescriptor -> resolveTypeForTypeAlias(c, annotations, descriptor, element, qualifierResolutionResult)
|
||||||
else -> error("Unexpected classifier type: ${descriptor.javaClass}")
|
else -> error("Unexpected classifier type: ${descriptor::class.java}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -727,7 +727,7 @@ class TypeResolver(
|
|||||||
Math.min(classifierChainLastIndex + 1, reversedQualifierParts.size),
|
Math.min(classifierChainLastIndex + 1, reversedQualifierParts.size),
|
||||||
reversedQualifierParts.size)
|
reversedQualifierParts.size)
|
||||||
|
|
||||||
for ((name, expression, typeArguments) in nonClassQualifierParts) {
|
for ((_, _, typeArguments) in nonClassQualifierParts) {
|
||||||
if (typeArguments != null) {
|
if (typeArguments != null) {
|
||||||
c.trace.report(TYPE_ARGUMENTS_NOT_ALLOWED.on(typeArguments, "here"))
|
c.trace.report(TYPE_ARGUMENTS_NOT_ALLOWED.on(typeArguments, "here"))
|
||||||
return null
|
return null
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ class VarianceCheckerCore(
|
|||||||
(accessor as PropertyAccessorDescriptorImpl).visibility = Visibilities.PRIVATE_TO_THIS
|
(accessor as PropertyAccessorDescriptorImpl).visibility = Visibilities.PRIVATE_TO_THIS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> throw IllegalStateException("Unexpected descriptor type: ${descriptor.javaClass.name}")
|
else -> throw IllegalStateException("Unexpected descriptor type: ${descriptor::class.java.name}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -94,11 +94,11 @@ open class ConstraintSystemBuilderImpl(private val mode: Mode = ConstraintSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ((descriptor, typeVariable) in typeParameters.zip(typeVariables)) {
|
for ((_, typeVariable) in typeParameters.zip(typeVariables)) {
|
||||||
allTypeParameterBounds.put(typeVariable, TypeBoundsImpl(typeVariable))
|
allTypeParameterBounds.put(typeVariable, TypeBoundsImpl(typeVariable))
|
||||||
}
|
}
|
||||||
|
|
||||||
for ((typeVariable, typeBounds) in allTypeParameterBounds) {
|
for ((typeVariable, _) in allTypeParameterBounds) {
|
||||||
for (declaredUpperBound in typeVariable.freshTypeParameter.upperBounds) {
|
for (declaredUpperBound in typeVariable.freshTypeParameter.upperBounds) {
|
||||||
if (declaredUpperBound.isDefaultBound()) continue //todo remove this line (?)
|
if (declaredUpperBound.isDefaultBound()) continue //todo remove this line (?)
|
||||||
val context = ConstraintContext(TYPE_BOUND_POSITION.position(typeVariable.originalTypeParameter.index))
|
val context = ConstraintContext(TYPE_BOUND_POSITION.position(typeVariable.originalTypeParameter.index))
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ interface TypeBounds {
|
|||||||
) {
|
) {
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
if (other == null || javaClass != other.javaClass) return false
|
if (other == null || this::class.java != other::class.java) return false
|
||||||
|
|
||||||
val bound = other as Bound
|
val bound = other as Bound
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -123,7 +123,7 @@ object DataFlowValueFactory {
|
|||||||
receiverValue.getType(),
|
receiverValue.getType(),
|
||||||
bindingContext,
|
bindingContext,
|
||||||
containingDeclarationOrModule)
|
containingDeclarationOrModule)
|
||||||
else -> throw UnsupportedOperationException("Unsupported receiver value: " + receiverValue.javaClass.name)
|
else -> throw UnsupportedOperationException("Unsupported receiver value: " + receiverValue::class.java.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@@ -242,7 +242,7 @@ object DataFlowValueFactory {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
IdentifierInfo.qualified(receiverInfo, implicitReceiver.type,
|
IdentifierInfo.qualified(receiverInfo, implicitReceiver.type,
|
||||||
selectorInfo, resolvedCall?.call?.isSafeCall() ?: false)
|
selectorInfo, resolvedCall.call.isSafeCall())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class DynamicCallableDescriptors(storageManager: StorageManager, builtIns: Kotli
|
|||||||
|
|
||||||
fun createDynamicDescriptorScope(call: Call, owner: DeclarationDescriptor) = object : MemberScopeImpl() {
|
fun createDynamicDescriptorScope(call: Call, owner: DeclarationDescriptor) = object : MemberScopeImpl() {
|
||||||
override fun printScopeStructure(p: Printer) {
|
override fun printScopeStructure(p: Printer) {
|
||||||
p.println(javaClass.simpleName, ": dynamic candidates for " + call)
|
p.println(this::class.java.simpleName, ": dynamic candidates for " + call)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getContributedFunctions(name: Name, location: LookupLocation): Collection<SimpleFunctionDescriptor> {
|
override fun getContributedFunctions(name: Name, location: LookupLocation): Collection<SimpleFunctionDescriptor> {
|
||||||
|
|||||||
+1
-2
@@ -56,7 +56,6 @@ import org.jetbrains.kotlin.types.ErrorUtils
|
|||||||
import org.jetbrains.kotlin.types.expressions.OperatorConventions
|
import org.jetbrains.kotlin.types.expressions.OperatorConventions
|
||||||
import org.jetbrains.kotlin.types.isDynamic
|
import org.jetbrains.kotlin.types.isDynamic
|
||||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
|
||||||
import org.jetbrains.kotlin.utils.sure
|
import org.jetbrains.kotlin.utils.sure
|
||||||
import java.lang.IllegalStateException
|
import java.lang.IllegalStateException
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -449,7 +448,7 @@ class NewResolutionOldInference(
|
|||||||
functionContext.tracing.bindReference(variable.resolvedCall.trace, variable.resolvedCall)
|
functionContext.tracing.bindReference(variable.resolvedCall.trace, variable.resolvedCall)
|
||||||
// todo hacks
|
// todo hacks
|
||||||
val functionCall = CallTransformer.CallForImplicitInvoke(
|
val functionCall = CallTransformer.CallForImplicitInvoke(
|
||||||
basicCallContext.call.explicitReceiver?.check { useExplicitReceiver },
|
basicCallContext.call.explicitReceiver?.takeIf { useExplicitReceiver },
|
||||||
variableReceiver, basicCallContext.call, true)
|
variableReceiver, basicCallContext.call, true)
|
||||||
val tracingForInvoke = TracingStrategyForInvoke(calleeExpression, functionCall, variableReceiver.type)
|
val tracingForInvoke = TracingStrategyForInvoke(calleeExpression, functionCall, variableReceiver.type)
|
||||||
val basicCallResolutionContext = basicCallContext.replaceBindingTrace(variable.resolvedCall.trace)
|
val basicCallResolutionContext = basicCallContext.replaceBindingTrace(variable.resolvedCall.trace)
|
||||||
|
|||||||
@@ -144,9 +144,9 @@ fun KtElement.getCall(context: BindingContext): Call? {
|
|||||||
if (element is KtCallElement && element.calleeExpression == null) return null
|
if (element is KtCallElement && element.calleeExpression == null) return null
|
||||||
|
|
||||||
val parent = element.parent
|
val parent = element.parent
|
||||||
val reference: KtExpression? = when {
|
val reference: KtExpression? = when (parent) {
|
||||||
parent is KtInstanceExpressionWithLabel -> parent
|
is KtInstanceExpressionWithLabel -> parent
|
||||||
parent is KtUserType -> parent.parent?.parent as? KtConstructorCalleeExpression
|
is KtUserType -> parent.parent.parent as? KtConstructorCalleeExpression
|
||||||
else -> element.getCalleeExpressionIfAny()
|
else -> element.getCalleeExpressionIfAny()
|
||||||
}
|
}
|
||||||
if (reference != null) {
|
if (reference != null) {
|
||||||
|
|||||||
+1
-1
@@ -401,7 +401,7 @@ private class ConstantExpressionEvaluatorVisitor(
|
|||||||
is IntegerValueTypeConstant ->
|
is IntegerValueTypeConstant ->
|
||||||
compileTimeConstant.getType(expectedType)
|
compileTimeConstant.getType(expectedType)
|
||||||
else ->
|
else ->
|
||||||
throw IllegalStateException("Unexpected compileTimeConstant class: ${compileTimeConstant.javaClass.canonicalName}")
|
throw IllegalStateException("Unexpected compileTimeConstant class: ${compileTimeConstant::class.java.canonicalName}")
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!constantType.isSubtypeOf(expectedType)) return null
|
if (!constantType.isSubtypeOf(expectedType)) return null
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ interface Diagnostics : Iterable<Diagnostic> {
|
|||||||
//should not be called on readonly views
|
//should not be called on readonly views
|
||||||
//any Diagnostics object returned by BindingContext#getDiagnostics() should implement this property
|
//any Diagnostics object returned by BindingContext#getDiagnostics() should implement this property
|
||||||
val modificationTracker: ModificationTracker
|
val modificationTracker: ModificationTracker
|
||||||
get() = throw IllegalStateException("Trying to obtain modification tracker for Diagnostics object of class $javaClass")
|
get() = throw IllegalStateException("Trying to obtain modification tracker for Diagnostics object of class ${this::class.java}")
|
||||||
|
|
||||||
fun all(): Collection<Diagnostic>
|
fun all(): Collection<Diagnostic>
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class FunctionImportedFromObject(
|
|||||||
newOwner: DeclarationDescriptor?, modality: Modality?, visibility: Visibility?,
|
newOwner: DeclarationDescriptor?, modality: Modality?, visibility: Visibility?,
|
||||||
kind: CallableMemberDescriptor.Kind?, copyOverrides: Boolean
|
kind: CallableMemberDescriptor.Kind?, copyOverrides: Boolean
|
||||||
): FunctionDescriptor {
|
): FunctionDescriptor {
|
||||||
throw UnsupportedOperationException("copy() should not be called on ${this.javaClass.simpleName}, was called for $this")
|
throw UnsupportedOperationException("copy() should not be called on ${this::class.java.simpleName}, was called for $this")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ class PropertyImportedFromObject(
|
|||||||
newOwner: DeclarationDescriptor?, modality: Modality?, visibility: Visibility?,
|
newOwner: DeclarationDescriptor?, modality: Modality?, visibility: Visibility?,
|
||||||
kind: CallableMemberDescriptor.Kind?, copyOverrides: Boolean
|
kind: CallableMemberDescriptor.Kind?, copyOverrides: Boolean
|
||||||
): FunctionDescriptor {
|
): FunctionDescriptor {
|
||||||
throw UnsupportedOperationException("copy() should not be called on ${this.javaClass.simpleName}, was called for $this")
|
throw UnsupportedOperationException("copy() should not be called on ${this::class.java.simpleName}, was called for $this")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
|||||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||||
import org.jetbrains.kotlin.storage.StorageManager
|
import org.jetbrains.kotlin.storage.StorageManager
|
||||||
import org.jetbrains.kotlin.storage.getValue
|
import org.jetbrains.kotlin.storage.getValue
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
|
||||||
|
|
||||||
class DefaultImportProvider(
|
class DefaultImportProvider(
|
||||||
storageManager: StorageManager,
|
storageManager: StorageManager,
|
||||||
@@ -56,7 +55,7 @@ class DefaultImportProvider(
|
|||||||
defaultImports
|
defaultImports
|
||||||
.filter { it.isAllUnder }
|
.filter { it.isAllUnder }
|
||||||
.mapNotNull {
|
.mapNotNull {
|
||||||
it.fqnPart().check { !it.isSubpackageOf(KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME) }
|
it.fqnPart().takeIf { !it.isSubpackageOf(KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME) }
|
||||||
}
|
}
|
||||||
val nonKotlinAliasedTypeFqNames =
|
val nonKotlinAliasedTypeFqNames =
|
||||||
builtinTypeAliases
|
builtinTypeAliases
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ import org.jetbrains.kotlin.storage.StorageManager
|
|||||||
import org.jetbrains.kotlin.storage.getValue
|
import org.jetbrains.kotlin.storage.getValue
|
||||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||||
import org.jetbrains.kotlin.utils.Printer
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
|
||||||
|
|
||||||
data class FileScopes(val lexicalScope: LexicalScope, val importingScope: ImportingScope, val importResolver: ImportResolver)
|
data class FileScopes(val lexicalScope: LexicalScope, val importingScope: ImportingScope, val importResolver: ImportResolver)
|
||||||
|
|
||||||
@@ -176,7 +175,7 @@ class FileScopeFactory(
|
|||||||
if (name in excludedNames) return null
|
if (name in excludedNames) return null
|
||||||
val classifier = scope.getContributedClassifier(name, location) ?: return null
|
val classifier = scope.getContributedClassifier(name, location) ?: return null
|
||||||
val visible = Visibilities.isVisibleIgnoringReceiver(classifier as DeclarationDescriptorWithVisibility, fromDescriptor)
|
val visible = Visibilities.isVisibleIgnoringReceiver(classifier as DeclarationDescriptorWithVisibility, fromDescriptor)
|
||||||
return classifier.check { filteringKind == if (visible) FilteringKind.VISIBLE_CLASSES else FilteringKind.INVISIBLE_CLASSES }
|
return classifier.takeIf { filteringKind == if (visible) FilteringKind.VISIBLE_CLASSES else FilteringKind.INVISIBLE_CLASSES }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getContributedVariables(name: Name, location: LookupLocation): Collection<PropertyDescriptor> {
|
override fun getContributedVariables(name: Name, location: LookupLocation): Collection<PropertyDescriptor> {
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ class LazyImportScope(
|
|||||||
override fun toString() = "LazyImportScope: " + debugName
|
override fun toString() = "LazyImportScope: " + debugName
|
||||||
|
|
||||||
override fun printStructure(p: Printer) {
|
override fun printStructure(p: Printer) {
|
||||||
p.println(javaClass.simpleName, ": ", debugName, " {")
|
p.println(this::class.java.simpleName, ": ", debugName, " {")
|
||||||
p.pushIndent()
|
p.pushIndent()
|
||||||
|
|
||||||
p.popIndent()
|
p.popIndent()
|
||||||
|
|||||||
+6
-7
@@ -33,7 +33,6 @@ import org.jetbrains.kotlin.resolve.scopes.MemberScopeImpl
|
|||||||
import org.jetbrains.kotlin.storage.MemoizedFunctionToNotNull
|
import org.jetbrains.kotlin.storage.MemoizedFunctionToNotNull
|
||||||
import org.jetbrains.kotlin.storage.StorageManager
|
import org.jetbrains.kotlin.storage.StorageManager
|
||||||
import org.jetbrains.kotlin.utils.Printer
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
import org.jetbrains.kotlin.utils.toReadOnlyList
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
abstract class AbstractLazyMemberScope<out D : DeclarationDescriptor, out DP : DeclarationProvider>
|
abstract class AbstractLazyMemberScope<out D : DeclarationDescriptor, out DP : DeclarationProvider>
|
||||||
@@ -61,7 +60,7 @@ protected constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
getNonDeclaredClasses(name, result)
|
getNonDeclaredClasses(name, result)
|
||||||
return result.toReadOnlyList()
|
return result.toList()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
|
override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
|
||||||
@@ -92,7 +91,7 @@ protected constructor(
|
|||||||
|
|
||||||
getNonDeclaredFunctions(name, result)
|
getNonDeclaredFunctions(name, result)
|
||||||
|
|
||||||
return result.toReadOnlyList()
|
return result.toList()
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract fun getScopeForMemberDeclarationResolution(declaration: KtDeclaration): LexicalScope
|
protected abstract fun getScopeForMemberDeclarationResolution(declaration: KtDeclaration): LexicalScope
|
||||||
@@ -125,7 +124,7 @@ protected constructor(
|
|||||||
|
|
||||||
getNonDeclaredProperties(name, result)
|
getNonDeclaredProperties(name, result)
|
||||||
|
|
||||||
return result.toReadOnlyList()
|
return result.toList()
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract fun getNonDeclaredProperties(name: Name, result: MutableSet<PropertyDescriptor>)
|
protected abstract fun getNonDeclaredProperties(name: Name, result: MutableSet<PropertyDescriptor>)
|
||||||
@@ -142,7 +141,7 @@ protected constructor(
|
|||||||
getScopeForMemberDeclarationResolution(ktTypeAlias),
|
getScopeForMemberDeclarationResolution(ktTypeAlias),
|
||||||
ktTypeAlias,
|
ktTypeAlias,
|
||||||
trace)
|
trace)
|
||||||
}.toReadOnlyList()
|
}.toList()
|
||||||
|
|
||||||
protected fun computeDescriptorsFromDeclaredElements(
|
protected fun computeDescriptorsFromDeclaredElements(
|
||||||
kindFilter: DescriptorKindFilter,
|
kindFilter: DescriptorKindFilter,
|
||||||
@@ -193,7 +192,7 @@ protected constructor(
|
|||||||
}
|
}
|
||||||
else throw IllegalArgumentException("Unsupported declaration kind: " + declaration)
|
else throw IllegalArgumentException("Unsupported declaration kind: " + declaration)
|
||||||
}
|
}
|
||||||
return result.toReadOnlyList()
|
return result.toList()
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract fun recordLookup(name: Name, from: LookupLocation)
|
abstract fun recordLookup(name: Name, from: LookupLocation)
|
||||||
@@ -204,7 +203,7 @@ protected constructor(
|
|||||||
abstract override fun toString(): String
|
abstract override fun toString(): String
|
||||||
|
|
||||||
override fun printScopeStructure(p: Printer) {
|
override fun printScopeStructure(p: Printer) {
|
||||||
p.println(javaClass.simpleName, " {")
|
p.println(this::class.java.simpleName, " {")
|
||||||
p.pushIndent()
|
p.pushIndent()
|
||||||
|
|
||||||
p.println("thisDescriptor = ", thisDescriptor)
|
p.println("thisDescriptor = ", thisDescriptor)
|
||||||
|
|||||||
+1
-1
@@ -57,7 +57,7 @@ abstract class AbstractLocalRedeclarationChecker(val overloadChecker: OverloadCh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> throw IllegalStateException("Unexpected type of descriptor: ${newDescriptor.javaClass.name}, descriptor: $newDescriptor")
|
else -> throw IllegalStateException("Unexpected type of descriptor: ${newDescriptor::class.java.name}, descriptor: $newDescriptor")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ class TypeAliasQualifier(
|
|||||||
?.takeIf { DescriptorUtils.isEnumEntry(it) }
|
?.takeIf { DescriptorUtils.isEnumEntry(it) }
|
||||||
|
|
||||||
override fun printScopeStructure(p: Printer) {
|
override fun printScopeStructure(p: Printer) {
|
||||||
p.println(javaClass.simpleName, " {")
|
p.println(this::class.java.simpleName, " {")
|
||||||
p.pushIndent()
|
p.pushIndent()
|
||||||
p.println("descriptor = ", descriptor)
|
p.println("descriptor = ", descriptor)
|
||||||
p.popIndent()
|
p.popIndent()
|
||||||
|
|||||||
+3
-3
@@ -30,8 +30,8 @@ import org.jetbrains.kotlin.psi.KtScript
|
|||||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
import kotlin.reflect.memberFunctions
|
import kotlin.reflect.full.memberFunctions
|
||||||
import kotlin.reflect.primaryConstructor
|
import kotlin.reflect.full.primaryConstructor
|
||||||
|
|
||||||
open class KotlinScriptDefinitionFromAnnotatedTemplate(
|
open class KotlinScriptDefinitionFromAnnotatedTemplate(
|
||||||
template: KClass<out Any>,
|
template: KClass<out Any>,
|
||||||
@@ -95,7 +95,7 @@ open class KotlinScriptDefinitionFromAnnotatedTemplate(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun makeScriptContents() = BasicScriptContents(file, getAnnotations = {
|
fun makeScriptContents() = BasicScriptContents(file, getAnnotations = {
|
||||||
val classLoader = (template as Any).javaClass.classLoader
|
val classLoader = (template as Any)::class.java.classLoader
|
||||||
try {
|
try {
|
||||||
getAnnotationEntries(file, project)
|
getAnnotationEntries(file, project)
|
||||||
.mapNotNull { psiAnn ->
|
.mapNotNull { psiAnn ->
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.types.TypeUtils
|
|||||||
import org.jetbrains.kotlin.utils.tryCreateCallableMappingFromNamedArgs
|
import org.jetbrains.kotlin.utils.tryCreateCallableMappingFromNamedArgs
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
import kotlin.reflect.KParameter
|
import kotlin.reflect.KParameter
|
||||||
import kotlin.reflect.primaryConstructor
|
import kotlin.reflect.full.primaryConstructor
|
||||||
|
|
||||||
internal val KtAnnotationEntry.typeName: String get() = (typeReference?.typeElement as? KtUserType)?.referencedName.orAnonymous()
|
internal val KtAnnotationEntry.typeName: String get() = (typeReference?.typeElement as? KtUserType)?.referencedName.orAnonymous()
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -52,13 +52,13 @@ interface ScriptTemplatesProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun makeScriptDefsFromTemplatesProviderExtensions(project: Project,
|
fun makeScriptDefsFromTemplatesProviderExtensions(project: Project,
|
||||||
errorsHandler: ((ScriptTemplatesProvider, Exception) -> Unit) = { ep, ex -> throw ex }
|
errorsHandler: ((ScriptTemplatesProvider, Exception) -> Unit) = { _, ex -> throw ex }
|
||||||
): List<KotlinScriptDefinitionFromAnnotatedTemplate> =
|
): List<KotlinScriptDefinitionFromAnnotatedTemplate> =
|
||||||
makeScriptDefsFromTemplatesProviders(Extensions.getArea(project).getExtensionPoint(ScriptTemplatesProvider.EP_NAME).extensions.asIterable(),
|
makeScriptDefsFromTemplatesProviders(Extensions.getArea(project).getExtensionPoint(ScriptTemplatesProvider.EP_NAME).extensions.asIterable(),
|
||||||
errorsHandler)
|
errorsHandler)
|
||||||
|
|
||||||
fun makeScriptDefsFromTemplatesProviders(providers: Iterable<ScriptTemplatesProvider>,
|
fun makeScriptDefsFromTemplatesProviders(providers: Iterable<ScriptTemplatesProvider>,
|
||||||
errorsHandler: ((ScriptTemplatesProvider, Exception) -> Unit) = { ep, ex -> throw ex }
|
errorsHandler: ((ScriptTemplatesProvider, Exception) -> Unit) = { _, ex -> throw ex }
|
||||||
): List<KotlinScriptDefinitionFromAnnotatedTemplate> {
|
): List<KotlinScriptDefinitionFromAnnotatedTemplate> {
|
||||||
return providers.filter { it.isValid }.flatMap { provider ->
|
return providers.filter { it.isValid }.flatMap { provider ->
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.serialization.deserialization.findNonGenericClassAcr
|
|||||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
||||||
import org.jetbrains.kotlin.types.*
|
import org.jetbrains.kotlin.types.*
|
||||||
import kotlin.reflect.*
|
import kotlin.reflect.*
|
||||||
|
import kotlin.reflect.full.primaryConstructor
|
||||||
|
|
||||||
data class ScriptParameter(val name: Name, val type: KotlinType)
|
data class ScriptParameter(val name: Name, val type: KotlinType)
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,6 @@ open class ExceptionTracker : ModificationTracker, LockBasedStorageManager.Excep
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return javaClass.name + ": " + modificationCount
|
return this::class.java.name + ": " + modificationCount
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class FakeCallResolver(
|
|||||||
|
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
fakeTrace.commit(
|
fakeTrace.commit(
|
||||||
{ slice, key ->
|
{ _, key ->
|
||||||
// excluding all entries related to fake expression
|
// excluding all entries related to fake expression
|
||||||
// convert all errors on this expression to ITERATOR_MISSING on callElement
|
// convert all errors on this expression to ITERATOR_MISSING on callElement
|
||||||
key != fake
|
key != fake
|
||||||
@@ -106,7 +106,7 @@ class FakeCallResolver(
|
|||||||
valueArguments: List<KtExpression>,
|
valueArguments: List<KtExpression>,
|
||||||
name: Name,
|
name: Name,
|
||||||
callElement: KtExpression,
|
callElement: KtExpression,
|
||||||
onComplete: (KtSimpleNameExpression, Boolean) -> Unit = { x, y -> }
|
onComplete: (KtSimpleNameExpression, Boolean) -> Unit = { _, _ -> }
|
||||||
): Pair<Call, OverloadResolutionResults<FunctionDescriptor>> {
|
): Pair<Call, OverloadResolutionResults<FunctionDescriptor>> {
|
||||||
val fakeCalleeExpression = KtPsiFactory(project).createSimpleName(name.asString())
|
val fakeCalleeExpression = KtPsiFactory(project).createSimpleName(name.asString())
|
||||||
val call = CallMaker.makeCallWithExpressions(
|
val call = CallMaker.makeCallWithExpressions(
|
||||||
|
|||||||
+1
-1
@@ -373,7 +373,7 @@ class PatternMatchingTypingVisitor internal constructor(facade: ExpressionTyping
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun visitKtElement(element: KtElement) {
|
override fun visitKtElement(element: KtElement) {
|
||||||
context.trace.report(UNSUPPORTED.on(element, javaClass.canonicalName))
|
context.trace.report(UNSUPPORTED.on(element, this::class.java.canonicalName))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return newDataFlowInfo
|
return newDataFlowInfo
|
||||||
|
|||||||
+1
-2
@@ -32,7 +32,6 @@ import org.jetbrains.kotlin.psi.KtSuperExpression
|
|||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.kotlin.types.TypeUtils
|
import org.jetbrains.kotlin.types.TypeUtils
|
||||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.singletonList
|
|
||||||
|
|
||||||
|
|
||||||
fun resolveUnqualifiedSuperFromExpressionContext(
|
fun resolveUnqualifiedSuperFromExpressionContext(
|
||||||
@@ -106,7 +105,7 @@ private fun resolveSupertypesForMethodOfAny(supertypes: Collection<KotlinType>,
|
|||||||
return if (typesWithConcreteOverride.isNotEmpty())
|
return if (typesWithConcreteOverride.isNotEmpty())
|
||||||
typesWithConcreteOverride
|
typesWithConcreteOverride
|
||||||
else
|
else
|
||||||
anyType.singletonList()
|
listOf(anyType)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun resolveSupertypesByCalleeName(supertypes: Collection<KotlinType>, calleeName: Name): Collection<KotlinType> =
|
private fun resolveSupertypesByCalleeName(supertypes: Collection<KotlinType>, calleeName: Name): Collection<KotlinType> =
|
||||||
|
|||||||
+2
-6
@@ -274,12 +274,9 @@ class IncrementalJvmCompilerRunner(
|
|||||||
// there is no point in updating annotation file since all files will be compiled anyway
|
// there is no point in updating annotation file since all files will be compiled anyway
|
||||||
kaptAnnotationsFileUpdater = null
|
kaptAnnotationsFileUpdater = null
|
||||||
}
|
}
|
||||||
else -> throw IllegalStateException("Unknown CompilationMode ${compilationMode.javaClass}")
|
else -> throw IllegalStateException("Unknown CompilationMode ${compilationMode::class.java}")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("NAME_SHADOWING")
|
|
||||||
var compilationMode = compilationMode
|
|
||||||
|
|
||||||
val currentBuildInfo = BuildInfo(startTS = System.currentTimeMillis())
|
val currentBuildInfo = BuildInfo(startTS = System.currentTimeMillis())
|
||||||
BuildInfo.write(currentBuildInfo, lastBuildInfoFile)
|
BuildInfo.write(currentBuildInfo, lastBuildInfoFile)
|
||||||
val buildDirtyLookupSymbols = HashSet<LookupSymbol>()
|
val buildDirtyLookupSymbols = HashSet<LookupSymbol>()
|
||||||
@@ -356,7 +353,7 @@ class IncrementalJvmCompilerRunner(
|
|||||||
changesRegistry.registerChanges(currentBuildInfo.startTS, dirtyData)
|
changesRegistry.registerChanges(currentBuildInfo.startTS, dirtyData)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert(compilationMode is CompilationMode.Rebuild) { "Unexpected compilation mode: ${compilationMode.javaClass}" }
|
assert(compilationMode is CompilationMode.Rebuild) { "Unexpected compilation mode: ${compilationMode::class.java}" }
|
||||||
changesRegistry.unknownChanges(currentBuildInfo.startTS)
|
changesRegistry.unknownChanges(currentBuildInfo.startTS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -400,7 +397,6 @@ class IncrementalJvmCompilerRunner(
|
|||||||
KotlinClassHeader.Kind.MULTIFILE_CLASS_PART -> {
|
KotlinClassHeader.Kind.MULTIFILE_CLASS_PART -> {
|
||||||
result.addAll(partsByFacadeName(outputClass.classHeader.multifileClassName!!))
|
result.addAll(partsByFacadeName(outputClass.classHeader.multifileClassName!!))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ class FileSnapshot(
|
|||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
if (other?.javaClass != javaClass) return false
|
if (other == null || other::class.java != this::class.java) return false
|
||||||
|
|
||||||
other as FileSnapshot
|
other as FileSnapshot
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ abstract class TestWithWorkingDir {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
open fun setUp() {
|
open fun setUp() {
|
||||||
workingDir = FileUtil.createTempDirectory(this.javaClass.simpleName, null)
|
workingDir = FileUtil.createTempDirectory(this::class.java.simpleName, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
|||||||
+1
-1
@@ -81,7 +81,7 @@ class KotlinStandaloneIncrementalCompilationTest : TestWithWorkingDir() {
|
|||||||
var step = 1
|
var step = 1
|
||||||
for ((modificationStep, buildLogStep) in modifications.zip(buildLogSteps)) {
|
for ((modificationStep, buildLogStep) in modifications.zip(buildLogSteps)) {
|
||||||
modificationStep.forEach { it.perform(workingDir, mapWorkingToOriginalFile) }
|
modificationStep.forEach { it.perform(workingDir, mapWorkingToOriginalFile) }
|
||||||
val (exitCode, compiledSources, compileErrors) = make(cacheDir, sourceRoots, args)
|
val (_, compiledSources, compileErrors) = make(cacheDir, sourceRoots, args)
|
||||||
|
|
||||||
expectedSB.appendLine(stepLogAsString(step, buildLogStep.compiledKotlinFiles, buildLogStep.compileErrors))
|
expectedSB.appendLine(stepLogAsString(step, buildLogStep.compiledKotlinFiles, buildLogStep.compileErrors))
|
||||||
expectedSBWithoutErrors.appendLine(stepLogAsString(step, buildLogStep.compiledKotlinFiles, buildLogStep.compileErrors, includeErrors = false))
|
expectedSBWithoutErrors.appendLine(stepLogAsString(step, buildLogStep.compiledKotlinFiles, buildLogStep.compileErrors, includeErrors = false))
|
||||||
|
|||||||
+2
-2
@@ -120,7 +120,7 @@ class ExpressionCodegen(
|
|||||||
|
|
||||||
override fun visitBlockBody(body: IrBlockBody, data: BlockInfo): StackValue {
|
override fun visitBlockBody(body: IrBlockBody, data: BlockInfo): StackValue {
|
||||||
return body.statements.fold(none()) {
|
return body.statements.fold(none()) {
|
||||||
r, exp ->
|
_, exp ->
|
||||||
exp.accept(this, data)
|
exp.accept(this, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ class ExpressionCodegen(
|
|||||||
|
|
||||||
override fun visitContainerExpression(expression: IrContainerExpression, data: BlockInfo): StackValue {
|
override fun visitContainerExpression(expression: IrContainerExpression, data: BlockInfo): StackValue {
|
||||||
val result = expression.statements.fold(none()) {
|
val result = expression.statements.fold(none()) {
|
||||||
r, exp ->
|
_, exp ->
|
||||||
//coerceNotToUnit(r.type, Type.VOID_TYPE)
|
//coerceNotToUnit(r.type, Type.VOID_TYPE)
|
||||||
exp.accept(this, data)
|
exp.accept(this, data)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@ open class KnownClassDescriptor(
|
|||||||
override val annotations: Annotations
|
override val annotations: Annotations
|
||||||
) : ClassDescriptor {
|
) : ClassDescriptor {
|
||||||
init {
|
init {
|
||||||
assert(modality != Modality.SEALED) { "Implement getSealedSubclasses() for this class: $javaClass" }
|
assert(modality != Modality.SEALED) { "Implement getSealedSubclasses() for this class: ${this::class.java}" }
|
||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var typeConstructor: TypeConstructor
|
private lateinit var typeConstructor: TypeConstructor
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user