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 {
|
||||
// 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 jarConnection = javaClass.getResource(resourcePath).openConnection() as? JarURLConnection
|
||||
val resourcePath = "/" + this::class.java.name.replace('.', '/') + ".class"
|
||||
val jarConnection = this::class.java.getResource(resourcePath).openConnection() as? JarURLConnection
|
||||
?: throw UnsupportedOperationException("Kotlin compiler Ant task should be loaded from the JAR file")
|
||||
val antTaskJarPath = File(jarConnection.jarFileURL.toURI())
|
||||
|
||||
@@ -54,7 +54,7 @@ internal object KotlinAntTaskUtil {
|
||||
val cached = classLoaderRef.get()
|
||||
if (cached != null) return cached
|
||||
|
||||
val myLoader = javaClass.classLoader
|
||||
val myLoader = this::class.java.classLoader
|
||||
if (myLoader !is AntClassLoader) return myLoader
|
||||
|
||||
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.jvm.BitEncoding
|
||||
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
|
||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
||||
import org.jetbrains.org.objectweb.asm.*
|
||||
import java.io.File
|
||||
import java.security.MessageDigest
|
||||
@@ -272,7 +271,7 @@ open class IncrementalCacheImpl<Target>(
|
||||
ProtoBuf.Class::getPropertyList
|
||||
) + 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)
|
||||
|
||||
listOf(companionObjectMembersChanged, companionObjectChanged)
|
||||
@@ -780,7 +779,7 @@ sealed class ChangeInfo(val fqName: FqName) {
|
||||
protected open fun toStringProperties(): String = "fqName = $fqName"
|
||||
|
||||
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 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>,
|
||||
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())
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ abstract class BasicMap<K : Comparable<K>, V>(
|
||||
fun dump(): String {
|
||||
return with(StringBuilder()) {
|
||||
with(Printer(this)) {
|
||||
println(this@BasicMap.javaClass.simpleName)
|
||||
println(this@BasicMap::class.java.simpleName)
|
||||
pushIndent()
|
||||
|
||||
for (key in storage.keys.sorted()) {
|
||||
|
||||
@@ -131,7 +131,7 @@ object ConstantsMapExternalizer : DataExternalizer<Map<String, Any>> {
|
||||
output.writeByte(Kind.STRING.ordinal)
|
||||
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)}")
|
||||
|
||||
if (!classHeader!!.metadataVersion.isCompatible()) {
|
||||
if (!classHeader.metadataVersion.isCompatible()) {
|
||||
error("Incompatible class ($classHeader): $classFile")
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -81,8 +81,8 @@ fun getModificationsToPerform(
|
||||
|
||||
val rules = mapOf<String, (String, File) -> Modification>(
|
||||
newSuffix to { path, file -> ModifyContent(path, file) },
|
||||
touchSuffix to { path, file -> TouchFile(path, touchPolicy) },
|
||||
deleteSuffix to { path, file -> DeleteFile(path) }
|
||||
touchSuffix to { path, _ -> TouchFile(path, touchPolicy) },
|
||||
deleteSuffix to { path, _ -> DeleteFile(path) }
|
||||
)
|
||||
|
||||
val modifications = ArrayList<Modification>()
|
||||
@@ -130,7 +130,7 @@ fun getModificationsToPerform(
|
||||
abstract class Modification(val path: String) {
|
||||
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) {
|
||||
|
||||
@@ -91,7 +91,7 @@ object CodegenUtil {
|
||||
else if (traitMember is PropertyDescriptor) {
|
||||
for (traitAccessor in traitMember.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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.descriptorUtil.overriddenTreeAsSequence
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
||||
import java.util.*
|
||||
|
||||
class BridgeForBuiltinSpecial<out Signature : Any>(
|
||||
@@ -76,7 +75,7 @@ object BuiltinSpecialBridgesUtil {
|
||||
else null
|
||||
|
||||
val commonBridges = reachableDeclarations.mapTo(LinkedHashSet<Signature>(), signatureByDescriptor)
|
||||
commonBridges.removeAll(specialBridgesSignaturesInSuperClass + specialBridge?.from.singletonOrEmptyList())
|
||||
commonBridges.removeAll(specialBridgesSignaturesInSuperClass + listOfNotNull(specialBridge?.from))
|
||||
|
||||
if (fake) {
|
||||
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.typeUtil.makeNullable
|
||||
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.MethodVisitor
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
@@ -289,8 +288,8 @@ class CoroutineCodegen private constructor(
|
||||
}
|
||||
|
||||
private fun allFunctionParameters() =
|
||||
originalSuspendFunctionDescriptor.extensionReceiverParameter.singletonOrEmptyList() +
|
||||
originalSuspendFunctionDescriptor.valueParameters.orEmpty()
|
||||
listOfNotNull(originalSuspendFunctionDescriptor.extensionReceiverParameter) +
|
||||
originalSuspendFunctionDescriptor.valueParameters.orEmpty()
|
||||
|
||||
private fun ParameterDescriptor.getFieldInfoForCoroutineLambdaParameter() =
|
||||
createHiddenFieldInfo(type, COROUTINE_LAMBDA_PARAMETER_PREFIX + (this.safeAs<ValueParameterDescriptor>()?.index ?: ""))
|
||||
|
||||
+1
-1
@@ -294,7 +294,7 @@ class CoroutineTransformerMethodVisitor(
|
||||
get() {
|
||||
assert(suspensionCallEnd.next is LabelNode) {
|
||||
"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
|
||||
|
||||
+1
-1
@@ -217,7 +217,7 @@ private class VarExpectedTypeFrame(maxLocals: Int) : VarFrame<VarExpectedTypeFra
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
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
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class SMAPBuilder(
|
||||
private fun generateDebugStrata(realMappings: List<FileMapping>): String {
|
||||
val combinedMapping = FileMapping(source, path)
|
||||
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(
|
||||
callSiteMarker!!.lineNumber, dest, range
|
||||
))
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ internal val classId: ClassId =
|
||||
ClassId.topLevel(FqName("org.jetbrains.kotlin.codegen.intrinsics.IntrinsicArrayConstructorsKt"))
|
||||
|
||||
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.close()
|
||||
}
|
||||
|
||||
-1
@@ -20,7 +20,6 @@ import com.intellij.openapi.util.Pair
|
||||
import org.jetbrains.kotlin.codegen.AsmUtil
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.StrictBasicValue
|
||||
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.tree.AbstractInsnNode
|
||||
import java.util.*
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ open class StrictBasicValue(type: Type?) : BasicValue(type) {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
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
|
||||
|
||||
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?.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 =
|
||||
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 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 {
|
||||
// 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) =
|
||||
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 {
|
||||
if (from == to) return to
|
||||
|
||||
for (fromField in fieldsToCopy) {
|
||||
val toField = to.javaClass.getField(fromField.name)
|
||||
val toField = to::class.java.getField(fromField.name)
|
||||
val fromValue = fromField.get(from)
|
||||
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 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@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) {
|
||||
put(k?.copyValueIfNeeded(), v?.copyValueIfNeeded())
|
||||
}
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ interface KotlinJsr223JvmInvocableScriptEngine : Invocable {
|
||||
val evalState = state.asState(GenericReplEvaluatorState::class.java)
|
||||
return evalState.history.map { it.item }.filter { it.instance != null }.reversed().ensureNotEmpty("no script ").let { history ->
|
||||
if (receiverInstance != null) {
|
||||
val receiverKlass = receiverClass ?: receiverInstance.javaClass.kotlin
|
||||
val receiverKlass = receiverClass ?: receiverInstance::class.java.kotlin
|
||||
val receiverInHistory = history.find { it.instance == receiverInstance } ?:
|
||||
EvalClassWithInstanceAndLoader(receiverKlass, receiverInstance, receiverKlass.java.classLoader, history.first().invokeWrapper)
|
||||
listOf(receiverInHistory) + history.filterNot { it == receiverInHistory }
|
||||
@@ -54,7 +54,7 @@ interface KotlinJsr223JvmInvocableScriptEngine : Invocable {
|
||||
override fun invokeMethod(thiz: Any?, name: String?, vararg args: Any?): Any? {
|
||||
if (name == null) throw java.lang.NullPointerException("method name cannot be null")
|
||||
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? {
|
||||
|
||||
@@ -26,7 +26,7 @@ fun makeScriptBaseName(codeLine: ReplCodeLine) =
|
||||
fun renderReplStackTrace(cause: Throwable, startFromMethodName: String): String {
|
||||
val newTrace = arrayListOf<StackTraceElement>()
|
||||
var skip = true
|
||||
for ((_, element) in cause.stackTrace.withIndex().reversed()) {
|
||||
for (element in cause.stackTrace.reversed()) {
|
||||
if ("${element.className}.${element.methodName}" == startFromMethodName) {
|
||||
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) {
|
||||
writeAll(outputDir, REPORT_NOTHING)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ object PluginCliParser {
|
||||
?.map { File(it).toURI().toURL() }
|
||||
?.toTypedArray()
|
||||
?: arrayOf<URL>(),
|
||||
javaClass.classLoader
|
||||
this::class.java.classLoader
|
||||
)
|
||||
|
||||
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.util.slicedMap.ReadOnlySlice
|
||||
import org.jetbrains.kotlin.util.slicedMap.WritableSlice
|
||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
/**
|
||||
@@ -147,7 +146,7 @@ class CliLightClassGenerationSupport(project: Project) : LightClassGenerationSup
|
||||
val filesForFacade = findFilesForFacade(facadeFqName, scope)
|
||||
if (filesForFacade.isEmpty()) return emptyList()
|
||||
|
||||
return emptyOrSingletonList<PsiClass>(
|
||||
return listOfNotNull<PsiClass>(
|
||||
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.Name
|
||||
import org.jetbrains.kotlin.serialization.deserialization.MetadataPackageFragment
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
import java.io.InputStream
|
||||
|
||||
class CliVirtualFileFinder(
|
||||
@@ -61,6 +60,6 @@ class CliVirtualFileFinder(
|
||||
|
||||
private fun findBinaryClass(classId: ClassId, fileName: String): VirtualFile? =
|
||||
index.findClass(classId, acceptedRootTypes = JavaRoot.OnlyBinary) { dir, _ ->
|
||||
dir.findChild(fileName)?.check(VirtualFile::isValid)
|
||||
}?.check { it in scope }
|
||||
dir.findChild(fileName)?.takeIf(VirtualFile::isValid)
|
||||
}?.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.resolve.jvm.KotlinCliJavaFileManager
|
||||
import org.jetbrains.kotlin.util.PerformanceCounter
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
import java.util.*
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
@@ -50,7 +49,7 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ
|
||||
val classNameWithInnerClasses = classId.relativeClassName.asString()
|
||||
index.findClass(classId) { dir, 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? {
|
||||
var found = false
|
||||
val packageFqName = packageName.toSafeFqName() ?: return null
|
||||
index.traverseDirectoriesInPackage(packageFqName) { dir, rootType ->
|
||||
index.traverseDirectoriesInPackage(packageFqName) { _, _ ->
|
||||
found = true
|
||||
//abort on first found
|
||||
false
|
||||
@@ -149,10 +148,7 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ
|
||||
var curClass = topLevelClass
|
||||
while (segments.hasNext()) {
|
||||
val innerClassName = segments.next()
|
||||
val innerClass = curClass.findInnerClassByName(innerClassName, false)
|
||||
if (innerClass == null) {
|
||||
return null
|
||||
}
|
||||
val innerClass = curClass.findInnerClassByName(innerClassName, false) ?: return null
|
||||
curClass = innerClass
|
||||
}
|
||||
return curClass
|
||||
|
||||
@@ -93,7 +93,7 @@ class JvmDependenciesIndexImpl(_roots: List<JavaRoot>): JvmDependenciesIndex {
|
||||
): Set<String> {
|
||||
val result = hashSetOf<String>()
|
||||
traverseDirectoriesInPackage(packageFqName, continueSearch = {
|
||||
dir, rootType ->
|
||||
dir, _ ->
|
||||
|
||||
for (child in dir.children) {
|
||||
if (child.extension != "class" && child.extension != "java") continue
|
||||
|
||||
@@ -73,7 +73,7 @@ open class GenericReplCompiler(disposable: Disposable,
|
||||
val scriptDescriptor = when (analysisResult) {
|
||||
is ReplCodeAnalyzer.ReplLineAnalysisResult.WithErrors -> return ReplCompileResult.Error(errorHolder.renderedDiagnostics)
|
||||
is ReplCodeAnalyzer.ReplLineAnalysisResult.Successful -> analysisResult.scriptDescriptor
|
||||
else -> error("Unexpected result ${analysisResult.javaClass}")
|
||||
else -> error("Unexpected result ${analysisResult::class.java}")
|
||||
}
|
||||
|
||||
val generationState = GenerationState(
|
||||
|
||||
@@ -103,7 +103,7 @@ class ReplInterpreter(
|
||||
val scriptDescriptor = when (analysisResult) {
|
||||
is ReplCodeAnalyzer.ReplLineAnalysisResult.WithErrors -> return LineResult.Error.CompileTime(errorHolder.renderedDiagnostics)
|
||||
is ReplCodeAnalyzer.ReplLineAnalysisResult.Successful -> analysisResult.scriptDescriptor
|
||||
else -> error("Unexpected result ${analysisResult.javaClass}")
|
||||
else -> error("Unexpected result ${analysisResult::class.java}")
|
||||
}
|
||||
|
||||
val state = GenerationState(
|
||||
@@ -185,7 +185,7 @@ class ReplInterpreter(
|
||||
private fun renderStackTrace(cause: Throwable, startFromMethodName: String): String {
|
||||
val newTrace = arrayListOf<StackTraceElement>()
|
||||
var skip = true
|
||||
for ((_, element) in cause.stackTrace.withIndex().reversed()) {
|
||||
for (element in cause.stackTrace.reversed()) {
|
||||
if ("${element.className}.${element.methodName}" == startFromMethodName) {
|
||||
skip = false
|
||||
}
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ class Preprocessor(val logger: Logger = SystemOutLogger) {
|
||||
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) {
|
||||
|
||||
@@ -21,11 +21,11 @@ import java.lang.reflect.*
|
||||
class InstanceComponentDescriptor(val instance: Any) : ComponentDescriptor {
|
||||
|
||||
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 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) {
|
||||
val classInfo = instance.javaClass.getInfo()
|
||||
val classInfo = instance::class.java.getInfo()
|
||||
|
||||
classInfo.setterInfos.forEach { (method) ->
|
||||
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.load.kotlin.incremental.components.IncrementalCompilationComponents
|
||||
import org.jetbrains.kotlin.progress.CompilationCanceledStatus
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
import java.io.File
|
||||
import java.io.OutputStream
|
||||
import java.io.PrintStream
|
||||
@@ -60,11 +59,11 @@ object KotlinCompilerClient {
|
||||
checkId: Boolean = true
|
||||
): CompileService? {
|
||||
val flagFile = System.getProperty(COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY)
|
||||
?.let(String::trimQuotes)
|
||||
?.check { !it.isBlank() }
|
||||
?.let(::File)
|
||||
?.check(File::exists)
|
||||
?: makeAutodeletingFlagFile(baseDir = File(daemonOptions.runFilesPathOrDefault))
|
||||
?.let(String::trimQuotes)
|
||||
?.takeIf { !it.isBlank() }
|
||||
?.let(::File)
|
||||
?.takeIf(File::exists)
|
||||
?: makeAutodeletingFlagFile(baseDir = File(daemonOptions.runFilesPathOrDefault))
|
||||
return connectToCompileService(compilerId, flagFile, daemonJVMOptions, daemonOptions, reportingTargets, autostart)
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ private inline fun tryConnectToDaemon(port: Int, report: (DaemonReportCategory,
|
||||
when (daemon) {
|
||||
null -> report(DaemonReportCategory.EXCEPTION, "daemon not found")
|
||||
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) {
|
||||
|
||||
+4
-4
@@ -44,22 +44,22 @@ interface CompileService : Remote {
|
||||
class Good<out R>(val result: R) : CallResult<R>() {
|
||||
override fun get(): R = 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>() {
|
||||
override fun get(): Nothing = throw IllegalStateException("Get is inapplicable to Ok call result")
|
||||
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>() {
|
||||
override fun get(): Nothing = throw IllegalStateException("Service 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>() {
|
||||
override fun get(): Nothing = throw Exception(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<*>
|
||||
|
||||
@@ -47,7 +47,6 @@ import org.jetbrains.kotlin.incremental.*
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
|
||||
import org.jetbrains.kotlin.modules.Module
|
||||
import org.jetbrains.kotlin.progress.CompilationCanceledStatus
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
import org.jetbrains.kotlin.utils.stackTraceStr
|
||||
import java.io.BufferedOutputStream
|
||||
import java.io.ByteArrayOutputStream
|
||||
@@ -352,7 +351,7 @@ class CompileServiceImpl(
|
||||
}
|
||||
}
|
||||
CompilerMode.NON_INCREMENTAL_COMPILER -> {
|
||||
doCompile(sessionId, daemonReporter, tracer = null) { eventManger, profiler ->
|
||||
doCompile(sessionId, daemonReporter, tracer = null) { _, _ ->
|
||||
execCompiler(targetPlatform, Services.EMPTY, k2PlatformArgs, messageCollector)
|
||||
}
|
||||
}
|
||||
@@ -366,7 +365,7 @@ class CompileServiceImpl(
|
||||
val gradleIncrementalServicesFacade = servicesFacade as IncrementalCompilerServicesFacade
|
||||
|
||||
withIC {
|
||||
doCompile(sessionId, daemonReporter, tracer = null) { eventManger, profiler ->
|
||||
doCompile(sessionId, daemonReporter, tracer = null) { _, _ ->
|
||||
execIncrementalCompiler(k2jvmArgs, gradleIncrementalArgs, gradleIncrementalServicesFacade, compilationResults!!,
|
||||
messageCollector, daemonReporter)
|
||||
}
|
||||
@@ -647,7 +646,7 @@ class CompileServiceImpl(
|
||||
|
||||
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 })
|
||||
.thenBy(FileAgeComparator()) { it.runFile }
|
||||
aliveWithOpts.maxWith(comparator)?.let { bestDaemonWithMetadata ->
|
||||
@@ -745,7 +744,7 @@ class CompileServiceImpl(
|
||||
operationsTracer: RemoteOperationsTracer?,
|
||||
body: (PrintStream, EventManager, Profiler) -> ExitCode): CompileService.CallResult<Int> =
|
||||
ifAlive {
|
||||
withValidClientOrSessionProxy(sessionId) { _ ->
|
||||
withValidClientOrSessionProxy(sessionId) {
|
||||
operationsTracer?.before("compile")
|
||||
val rpcProfiler = if (daemonOptions.reportPerf) WallAndThreadTotalProfiler() else DummyProfiler()
|
||||
val eventManger = EventManagerImpl()
|
||||
@@ -775,7 +774,7 @@ class CompileServiceImpl(
|
||||
tracer: RemoteOperationsTracer?,
|
||||
body: (EventManager, Profiler) -> ExitCode): CompileService.CallResult<Int> =
|
||||
ifAlive {
|
||||
withValidClientOrSessionProxy(sessionId) { _ ->
|
||||
withValidClientOrSessionProxy(sessionId) {
|
||||
tracer?.before("compile")
|
||||
val rpcProfiler = if (daemonOptions.reportPerf) WallAndThreadTotalProfiler() else DummyProfiler()
|
||||
val eventManger = EventManagerImpl()
|
||||
@@ -907,8 +906,6 @@ class CompileServiceImpl(
|
||||
@JvmName("withValidRepl1")
|
||||
private inline fun<R> withValidRepl(sessionId: Int, body: KotlinJvmReplService.() -> CompileService.CallResult<R>): CompileService.CallResult<R> =
|
||||
withValidClientOrSessionProxy(sessionId) { session ->
|
||||
(session?.data as? KotlinJvmReplService?)?.let {
|
||||
it.body()
|
||||
} ?: CompileService.CallResult.Error("Not a REPL session $sessionId")
|
||||
(session?.data as? KotlinJvmReplService?)?.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? {
|
||||
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 {
|
||||
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.typeUtil.asTypeProjection
|
||||
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
|
||||
// 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.isStarProjection ->
|
||||
parameter.upperBounds.first().check {
|
||||
parameter.upperBounds.first().takeIf {
|
||||
t -> !t.contains { it.constructor.declarationDescriptor in parametersSet }
|
||||
}?.asTypeProjection() ?: return@nonProjectionParametrization null
|
||||
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ class JavaClassImpl(psiClass: PsiClass) : JavaClassifierImpl<PsiClass>(psiClass)
|
||||
val psiClass = psi
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ class VirtualFileKotlinClass private constructor(
|
||||
|
||||
override fun equals(other: Any?) = other is VirtualFileKotlinClass && other.file == file
|
||||
override fun hashCode() = file.hashCode()
|
||||
override fun toString() = "${javaClass.simpleName}: $file"
|
||||
override fun toString() = "${this::class.java.simpleName}: $file"
|
||||
|
||||
companion object Factory {
|
||||
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.jvm.JvmProtoBufUtil
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.singletonOrEmptyList
|
||||
import org.jetbrains.kotlin.utils.keysToMap
|
||||
|
||||
class IncrementalPackageFragmentProvider(
|
||||
@@ -53,7 +52,7 @@ class IncrementalPackageFragmentProvider(
|
||||
override fun getSubPackagesOf(fqName: FqName, nameFilter: (Name) -> Boolean): Collection<FqName> = emptySet()
|
||||
|
||||
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.TargetEnvironment
|
||||
import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
||||
import java.util.*
|
||||
|
||||
class ResolverForModule(
|
||||
@@ -179,7 +178,7 @@ abstract class AnalyzerFacade<in P : PlatformAnalysisParameters> {
|
||||
val resolverForProject = createResolverForProject()
|
||||
|
||||
fun computeDependencyDescriptors(module: M): List<ModuleDescriptorImpl> {
|
||||
val orderedDependencies = firstDependency.singletonOrEmptyList() + module.dependencies()
|
||||
val orderedDependencies = listOfNotNull(firstDependency) + module.dependencies()
|
||||
val dependenciesDescriptors = orderedDependencies.mapTo(ArrayList<ModuleDescriptorImpl>()) {
|
||||
dependencyInfo ->
|
||||
resolverForProject.descriptorForModule(dependencyInfo as M)
|
||||
|
||||
@@ -113,7 +113,7 @@ class ConstructorConsistencyChecker private constructor(
|
||||
.filterIsInstance<PropertyDescriptor>()
|
||||
.filter { trace.get(BindingContext.BACKING_FIELD_REQUIRED, it) == true }
|
||||
pseudocode.traverse(
|
||||
TraversalOrder.FORWARD, variablesData.variableInitializers, { instruction, enterData, exitData ->
|
||||
TraversalOrder.FORWARD, variablesData.variableInitializers, { instruction, enterData, _ ->
|
||||
|
||||
fun firstUninitializedNotNullProperty() = propertyDescriptors.firstOrNull {
|
||||
!it.type.isMarkedNullable && !KotlinBuiltIns.isPrimitiveType(it.type) &&
|
||||
|
||||
@@ -549,7 +549,7 @@ class ControlFlowInformationProvider private constructor(
|
||||
pseudocode.traverse(TraversalOrder.BACKWARD, variableStatusData) {
|
||||
instruction: Instruction,
|
||||
enterData: Map<VariableDescriptor, VariableUseState>,
|
||||
exitData: Map<VariableDescriptor, VariableUseState> ->
|
||||
_: Map<VariableDescriptor, VariableUseState> ->
|
||||
|
||||
val ctxt = VariableUseContext(instruction, reportedDiagnosticMap)
|
||||
val declaredVariables = pseudocodeVariablesData.getDeclaredVariables(instruction.owner, false)
|
||||
|
||||
@@ -1026,7 +1026,7 @@ class ControlFlowProcessor(private val trace: BindingTrace) {
|
||||
}
|
||||
|
||||
private fun isBlockInDoWhile(expression: KtBlockExpression): Boolean {
|
||||
val parent = expression.parent ?: return false
|
||||
val parent = expression.parent
|
||||
return parent.parent is KtDoWhileExpression
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -17,17 +17,16 @@
|
||||
package org.jetbrains.kotlin.cfg.pseudocode.instructions
|
||||
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
||||
|
||||
abstract class InstructionWithNext(
|
||||
element: KtElement,
|
||||
blockScope: BlockScope
|
||||
) : KtElementInstructionImpl(element, blockScope) {
|
||||
var next: Instruction? = null
|
||||
set(value: Instruction?) {
|
||||
set(value) {
|
||||
field = outgoingEdgeTo(value)
|
||||
}
|
||||
|
||||
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.InstructionImpl
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.Instruction
|
||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
||||
|
||||
abstract class AbstractJumpInstruction(
|
||||
element: KtElement,
|
||||
@@ -30,7 +29,7 @@ abstract class AbstractJumpInstruction(
|
||||
blockScope: BlockScope
|
||||
) : KtElementInstructionImpl(element, blockScope), JumpInstruction {
|
||||
var resolvedTarget: Instruction? = null
|
||||
set(value: Instruction?) {
|
||||
set(value) {
|
||||
field = outgoingEdgeTo(value)
|
||||
}
|
||||
|
||||
@@ -45,5 +44,5 @@ abstract class AbstractJumpInstruction(
|
||||
}
|
||||
|
||||
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.InstructionVisitorWithResult
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionVisitor
|
||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
||||
|
||||
class ConditionalJumpInstruction(
|
||||
element: KtElement,
|
||||
@@ -37,13 +36,13 @@ class ConditionalJumpInstruction(
|
||||
|
||||
var nextOnTrue: Instruction
|
||||
get() = _nextOnTrue!!
|
||||
set(value: Instruction) {
|
||||
set(value) {
|
||||
_nextOnTrue = outgoingEdgeTo(value)
|
||||
}
|
||||
|
||||
var nextOnFalse: Instruction
|
||||
get() = _nextOnFalse!!
|
||||
set(value: Instruction) {
|
||||
set(value) {
|
||||
_nextOnFalse = outgoingEdgeTo(value)
|
||||
}
|
||||
|
||||
@@ -51,7 +50,7 @@ class ConditionalJumpInstruction(
|
||||
get() = Arrays.asList(nextOnFalse, nextOnTrue)
|
||||
|
||||
override val inputValues: List<PseudoValue>
|
||||
get() = emptyOrSingletonList(conditionValue)
|
||||
get() = listOfNotNull(conditionValue)
|
||||
|
||||
override fun accept(visitor: InstructionVisitor) {
|
||||
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.InstructionVisitorWithResult
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionImpl
|
||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
||||
|
||||
class NondeterministicJumpInstruction(
|
||||
element: KtElement,
|
||||
@@ -48,7 +47,7 @@ class NondeterministicJumpInstruction(
|
||||
|
||||
var next: Instruction
|
||||
get() = _next!!
|
||||
set(value: Instruction) {
|
||||
set(value) {
|
||||
_next = outgoingEdgeTo(value)
|
||||
}
|
||||
|
||||
@@ -60,7 +59,7 @@ class NondeterministicJumpInstruction(
|
||||
}
|
||||
|
||||
override val inputValues: List<PseudoValue>
|
||||
get() = emptyOrSingletonList(inputValue)
|
||||
get() = listOfNotNull(inputValue)
|
||||
|
||||
override fun accept(visitor: InstructionVisitor) {
|
||||
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.name.Name
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.singletonList
|
||||
|
||||
sealed class LocalVariableAccessorDescriptor(
|
||||
final override val correspondingVariable: LocalVariableDescriptor,
|
||||
@@ -38,7 +37,7 @@ sealed class LocalVariableAccessorDescriptor(
|
||||
|
||||
init {
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ object PositioningStrategies {
|
||||
is KtPropertyAccessor -> element.namePlaceholder
|
||||
is KtAnonymousInitializer -> element
|
||||
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)
|
||||
}
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ sealed class RenderingContext {
|
||||
is DiagnosticWithParameters1<*, *> -> listOf(d.a)
|
||||
is DiagnosticWithParameters2<*, *, *> -> listOf(d.a, d.b)
|
||||
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()
|
||||
}
|
||||
return Impl(parameters)
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ private class AdaptiveClassifierNamePolicy(private val ambiguousNames: List<Name
|
||||
val index = typeParametersWithSameName.indexOf(classifier)
|
||||
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 val LOG = Logger.getInstance(this.javaClass)
|
||||
private val LOG = Logger.getInstance(this::class.java)
|
||||
|
||||
override fun visitKtFile(file: KtFile, data: Unit?): String? {
|
||||
return "STUB file: ${file.name}"
|
||||
@@ -48,7 +48,7 @@ private object DebugTextBuildingVisitor : KtVisitor<String, Unit>() {
|
||||
|
||||
override fun visitKtElement(element: KtElement, data: Unit?): String? {
|
||||
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
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ abstract class KtClassOrObject :
|
||||
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)
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.intellij.testFramework.LightVirtualFile
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
import java.util.*
|
||||
|
||||
abstract class KtCodeFragment(
|
||||
@@ -175,7 +174,7 @@ abstract class KtCodeFragment(
|
||||
private fun initImports(imports: String?) {
|
||||
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 {
|
||||
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 {
|
||||
val argumentTypes = args.map { 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
|
||||
@@ -105,7 +105,7 @@ fun <TElement : KtElement> createByPattern(pattern: String, vararg args: Any, fa
|
||||
val args = args.zip(argumentTypes).map {
|
||||
val (arg, type) = it
|
||||
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
|
||||
arg
|
||||
}
|
||||
@@ -127,7 +127,7 @@ fun <TElement : KtElement> createByPattern(pattern: String, vararg args: Any, fa
|
||||
if (arg is String) continue // already in the text
|
||||
val expectedElementType = (argumentTypes[n] as PsiElementPlaceholderArgumentType<*, *>).placeholderClass
|
||||
|
||||
for ((range, text) in placeholders) {
|
||||
for ((range, _) in placeholders) {
|
||||
val token = resultElement.findElementAt(range.startOffset)!!
|
||||
for (element in token.parentsWithSelf) {
|
||||
val elementRange = element.textRange.shiftRight(-start)
|
||||
|
||||
@@ -28,5 +28,5 @@ internal fun KtElement.deleteSemicolon() {
|
||||
if (sibling == null || sibling.node.elementType != KtTokens.SEMICOLON) return
|
||||
|
||||
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
|
||||
if (stub != null) {
|
||||
@@ -339,12 +339,12 @@ fun KtModifierListOwner.isProtected(): Boolean = hasModifier(KtTokens.PROTECTED_
|
||||
|
||||
fun KtSimpleNameExpression.isImportDirectiveExpression(): Boolean {
|
||||
val parent = parent
|
||||
return parent is KtImportDirective || parent?.parent is KtImportDirective
|
||||
return parent is KtImportDirective || parent.parent is KtImportDirective
|
||||
}
|
||||
|
||||
fun KtSimpleNameExpression.isPackageDirectiveExpression(): Boolean {
|
||||
val parent = parent
|
||||
return parent is KtPackageDirective || parent?.parent is KtPackageDirective
|
||||
return parent is KtPackageDirective || parent.parent is KtPackageDirective
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
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)
|
||||
if (propertiesValues.isEmpty()) {
|
||||
return "$STUB_TO_STRING_PREFIX$stubType"
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ class SyntheticClassOrObjectDescriptor(
|
||||
override fun getSealedSubclasses() = emptyList<ClassDescriptor>()
|
||||
|
||||
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> =
|
||||
|
||||
@@ -79,7 +79,7 @@ class AllUnderImportScope(
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
interface BodyResolveCache {
|
||||
open fun resolveFunctionBody(function: KtNamedFunction): BindingContext
|
||||
fun resolveFunctionBody(function: KtNamedFunction): BindingContext
|
||||
|
||||
object ThrowException : BodyResolveCache {
|
||||
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.classCanHaveOpenMembers
|
||||
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.source.KotlinSourceElement
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
||||
import org.jetbrains.kotlin.types.typeUtil.*
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
import java.util.*
|
||||
|
||||
internal class DeclarationsCheckerBuilder(
|
||||
@@ -189,7 +187,7 @@ class DeclarationsChecker(
|
||||
private fun getUsedTypeAliasParameters(type: KotlinType, typeAlias: TypeAliasDescriptor): Set<TypeParameterDescriptor> =
|
||||
type.constituentTypes().mapNotNullTo(HashSet()) {
|
||||
val descriptor = it.constructor.declarationDescriptor as? TypeParameterDescriptor
|
||||
descriptor?.check { it.containingDeclaration == typeAlias }
|
||||
descriptor?.takeIf { it.containingDeclaration == typeAlias }
|
||||
}
|
||||
|
||||
private class TypeAliasDeclarationCheckingReportStrategy(
|
||||
@@ -271,10 +269,10 @@ class DeclarationsChecker(
|
||||
if (visibilityModifier != null && visibilityModifier.node?.elementType != KtTokens.PRIVATE_KEYWORD) {
|
||||
val classDescriptor = constructorDescriptor.containingDeclaration
|
||||
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) {
|
||||
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.utils.Printer
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
|
||||
class LazyExplicitImportScope(
|
||||
private val packageOrClassDescriptor: DeclarationDescriptor,
|
||||
@@ -68,7 +67,7 @@ class LazyExplicitImportScope(
|
||||
}
|
||||
|
||||
override fun printStructure(p: Printer) {
|
||||
p.println(javaClass.simpleName, ": ", aliasName)
|
||||
p.println(this::class.java.simpleName, ": ", aliasName)
|
||||
}
|
||||
|
||||
// should be called only once
|
||||
@@ -113,5 +112,5 @@ class LazyExplicitImportScope(
|
||||
|
||||
private fun <D : CallableMemberDescriptor> Collection<D>.choseOnlyVisibleOrAll() =
|
||||
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.resolve.calls.tower.getTypeAliasConstructors
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
||||
import java.util.*
|
||||
|
||||
class OverloadResolver(
|
||||
@@ -38,7 +37,7 @@ class OverloadResolver(
|
||||
fun checkOverloads(c: BodiesResolveContext) {
|
||||
val inClasses = findConstructorsInNestedClassesAndTypeAliases(c)
|
||||
|
||||
for ((key, value) in c.declaredClasses) {
|
||||
for (value in c.declaredClasses.values) {
|
||||
checkOverloadsInClass(value, inClasses.get(value))
|
||||
}
|
||||
checkOverloadsInPackages(c)
|
||||
@@ -115,7 +114,7 @@ class OverloadResolver(
|
||||
scope, name ->
|
||||
val variables = scope.getContributedVariables(name, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
||||
val classifier = scope.getContributedClassifier(name, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
||||
variables + classifier.singletonOrEmptyList()
|
||||
variables + listOfNotNull(classifier)
|
||||
}
|
||||
|
||||
return packageMembersByName
|
||||
@@ -215,7 +214,7 @@ class OverloadResolver(
|
||||
val bySourceFile = members.groupBy { DescriptorUtils.getContainingSourceFile(it) }
|
||||
|
||||
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.
|
||||
if (membersInFile.any { it.isPrivate() }) {
|
||||
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.types.expressions.ExpressionTypingContext
|
||||
import org.jetbrains.kotlin.types.expressions.isWithoutValueArguments
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
|
||||
class QualifiedExpressionResolver {
|
||||
fun resolvePackageHeader(
|
||||
@@ -418,12 +417,12 @@ class QualifiedExpressionResolver {
|
||||
val qualifierDescriptor = when (receiver) {
|
||||
is PackageQualifier -> {
|
||||
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)
|
||||
}
|
||||
is ClassQualifier -> receiver.staticScope.getContributedClassifier(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)
|
||||
else -> null
|
||||
}
|
||||
@@ -549,7 +548,7 @@ class QualifiedExpressionResolver {
|
||||
trace: BindingTrace,
|
||||
position: QualifierPosition
|
||||
) {
|
||||
path.foldRight(packageView) { (name, expression), currentView ->
|
||||
path.foldRight(packageView) { (_, expression), currentView ->
|
||||
storeResult(trace, expression, currentView, shouldBeVisibleFrom = null, position = position)
|
||||
currentView.containingDeclaration
|
||||
?: 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)
|
||||
|
||||
val platformSpecificContainer = composeContainer(this.javaClass.simpleName) {
|
||||
val platformSpecificContainer = composeContainer(this::class.java.simpleName) {
|
||||
useInstance(dynamicTypesSettings)
|
||||
declarationCheckers.forEach { useInstance(it) }
|
||||
callCheckers.forEach { useInstance(it) }
|
||||
|
||||
@@ -281,7 +281,7 @@ class TypeResolver(
|
||||
override fun getVisibility() = Visibilities.LOCAL
|
||||
|
||||
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
|
||||
@@ -415,7 +415,7 @@ class TypeResolver(
|
||||
}
|
||||
is ClassDescriptor -> resolveTypeForClass(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),
|
||||
reversedQualifierParts.size)
|
||||
|
||||
for ((name, expression, typeArguments) in nonClassQualifierParts) {
|
||||
for ((_, _, typeArguments) in nonClassQualifierParts) {
|
||||
if (typeArguments != null) {
|
||||
c.trace.report(TYPE_ARGUMENTS_NOT_ALLOWED.on(typeArguments, "here"))
|
||||
return null
|
||||
|
||||
@@ -189,7 +189,7 @@ class VarianceCheckerCore(
|
||||
(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))
|
||||
}
|
||||
|
||||
for ((typeVariable, typeBounds) in allTypeParameterBounds) {
|
||||
for ((typeVariable, _) in allTypeParameterBounds) {
|
||||
for (declaredUpperBound in typeVariable.freshTypeParameter.upperBounds) {
|
||||
if (declaredUpperBound.isDefaultBound()) continue //todo remove this line (?)
|
||||
val context = ConstraintContext(TYPE_BOUND_POSITION.position(typeVariable.originalTypeParameter.index))
|
||||
|
||||
@@ -48,7 +48,7 @@ interface TypeBounds {
|
||||
) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
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
|
||||
|
||||
|
||||
+2
-2
@@ -123,7 +123,7 @@ object DataFlowValueFactory {
|
||||
receiverValue.getType(),
|
||||
bindingContext,
|
||||
containingDeclarationOrModule)
|
||||
else -> throw UnsupportedOperationException("Unsupported receiver value: " + receiverValue.javaClass.name)
|
||||
else -> throw UnsupportedOperationException("Unsupported receiver value: " + receiverValue::class.java.name)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -242,7 +242,7 @@ object DataFlowValueFactory {
|
||||
}
|
||||
else {
|
||||
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() {
|
||||
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> {
|
||||
|
||||
+1
-2
@@ -56,7 +56,6 @@ import org.jetbrains.kotlin.types.ErrorUtils
|
||||
import org.jetbrains.kotlin.types.expressions.OperatorConventions
|
||||
import org.jetbrains.kotlin.types.isDynamic
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
import org.jetbrains.kotlin.utils.sure
|
||||
import java.lang.IllegalStateException
|
||||
import java.util.*
|
||||
@@ -449,7 +448,7 @@ class NewResolutionOldInference(
|
||||
functionContext.tracing.bindReference(variable.resolvedCall.trace, variable.resolvedCall)
|
||||
// todo hacks
|
||||
val functionCall = CallTransformer.CallForImplicitInvoke(
|
||||
basicCallContext.call.explicitReceiver?.check { useExplicitReceiver },
|
||||
basicCallContext.call.explicitReceiver?.takeIf { useExplicitReceiver },
|
||||
variableReceiver, basicCallContext.call, true)
|
||||
val tracingForInvoke = TracingStrategyForInvoke(calleeExpression, functionCall, variableReceiver.type)
|
||||
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
|
||||
|
||||
val parent = element.parent
|
||||
val reference: KtExpression? = when {
|
||||
parent is KtInstanceExpressionWithLabel -> parent
|
||||
parent is KtUserType -> parent.parent?.parent as? KtConstructorCalleeExpression
|
||||
val reference: KtExpression? = when (parent) {
|
||||
is KtInstanceExpressionWithLabel -> parent
|
||||
is KtUserType -> parent.parent.parent as? KtConstructorCalleeExpression
|
||||
else -> element.getCalleeExpressionIfAny()
|
||||
}
|
||||
if (reference != null) {
|
||||
|
||||
+1
-1
@@ -401,7 +401,7 @@ private class ConstantExpressionEvaluatorVisitor(
|
||||
is IntegerValueTypeConstant ->
|
||||
compileTimeConstant.getType(expectedType)
|
||||
else ->
|
||||
throw IllegalStateException("Unexpected compileTimeConstant class: ${compileTimeConstant.javaClass.canonicalName}")
|
||||
throw IllegalStateException("Unexpected compileTimeConstant class: ${compileTimeConstant::class.java.canonicalName}")
|
||||
|
||||
}
|
||||
if (!constantType.isSubtypeOf(expectedType)) return null
|
||||
|
||||
@@ -24,7 +24,7 @@ interface Diagnostics : Iterable<Diagnostic> {
|
||||
//should not be called on readonly views
|
||||
//any Diagnostics object returned by BindingContext#getDiagnostics() should implement this property
|
||||
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>
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class FunctionImportedFromObject(
|
||||
newOwner: DeclarationDescriptor?, modality: Modality?, visibility: Visibility?,
|
||||
kind: CallableMemberDescriptor.Kind?, copyOverrides: Boolean
|
||||
): 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?,
|
||||
kind: CallableMemberDescriptor.Kind?, copyOverrides: Boolean
|
||||
): 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.storage.StorageManager
|
||||
import org.jetbrains.kotlin.storage.getValue
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
|
||||
class DefaultImportProvider(
|
||||
storageManager: StorageManager,
|
||||
@@ -56,7 +55,7 @@ class DefaultImportProvider(
|
||||
defaultImports
|
||||
.filter { it.isAllUnder }
|
||||
.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 =
|
||||
builtinTypeAliases
|
||||
|
||||
@@ -40,7 +40,6 @@ import org.jetbrains.kotlin.storage.StorageManager
|
||||
import org.jetbrains.kotlin.storage.getValue
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||
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)
|
||||
|
||||
@@ -176,7 +175,7 @@ class FileScopeFactory(
|
||||
if (name in excludedNames) return null
|
||||
val classifier = scope.getContributedClassifier(name, location) ?: return null
|
||||
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> {
|
||||
|
||||
@@ -254,7 +254,7 @@ class LazyImportScope(
|
||||
override fun toString() = "LazyImportScope: " + debugName
|
||||
|
||||
override fun printStructure(p: Printer) {
|
||||
p.println(javaClass.simpleName, ": ", debugName, " {")
|
||||
p.println(this::class.java.simpleName, ": ", debugName, " {")
|
||||
p.pushIndent()
|
||||
|
||||
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.StorageManager
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import org.jetbrains.kotlin.utils.toReadOnlyList
|
||||
import java.util.*
|
||||
|
||||
abstract class AbstractLazyMemberScope<out D : DeclarationDescriptor, out DP : DeclarationProvider>
|
||||
@@ -61,7 +60,7 @@ protected constructor(
|
||||
}
|
||||
}
|
||||
getNonDeclaredClasses(name, result)
|
||||
return result.toReadOnlyList()
|
||||
return result.toList()
|
||||
}
|
||||
|
||||
override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
|
||||
@@ -92,7 +91,7 @@ protected constructor(
|
||||
|
||||
getNonDeclaredFunctions(name, result)
|
||||
|
||||
return result.toReadOnlyList()
|
||||
return result.toList()
|
||||
}
|
||||
|
||||
protected abstract fun getScopeForMemberDeclarationResolution(declaration: KtDeclaration): LexicalScope
|
||||
@@ -125,7 +124,7 @@ protected constructor(
|
||||
|
||||
getNonDeclaredProperties(name, result)
|
||||
|
||||
return result.toReadOnlyList()
|
||||
return result.toList()
|
||||
}
|
||||
|
||||
protected abstract fun getNonDeclaredProperties(name: Name, result: MutableSet<PropertyDescriptor>)
|
||||
@@ -142,7 +141,7 @@ protected constructor(
|
||||
getScopeForMemberDeclarationResolution(ktTypeAlias),
|
||||
ktTypeAlias,
|
||||
trace)
|
||||
}.toReadOnlyList()
|
||||
}.toList()
|
||||
|
||||
protected fun computeDescriptorsFromDeclaredElements(
|
||||
kindFilter: DescriptorKindFilter,
|
||||
@@ -193,7 +192,7 @@ protected constructor(
|
||||
}
|
||||
else throw IllegalArgumentException("Unsupported declaration kind: " + declaration)
|
||||
}
|
||||
return result.toReadOnlyList()
|
||||
return result.toList()
|
||||
}
|
||||
|
||||
abstract fun recordLookup(name: Name, from: LookupLocation)
|
||||
@@ -204,7 +203,7 @@ protected constructor(
|
||||
abstract override fun toString(): String
|
||||
|
||||
override fun printScopeStructure(p: Printer) {
|
||||
p.println(javaClass.simpleName, " {")
|
||||
p.println(this::class.java.simpleName, " {")
|
||||
p.pushIndent()
|
||||
|
||||
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) }
|
||||
|
||||
override fun printScopeStructure(p: Printer) {
|
||||
p.println(javaClass.simpleName, " {")
|
||||
p.println(this::class.java.simpleName, " {")
|
||||
p.pushIndent()
|
||||
p.println("descriptor = ", descriptor)
|
||||
p.popIndent()
|
||||
|
||||
+3
-3
@@ -30,8 +30,8 @@ import org.jetbrains.kotlin.psi.KtScript
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||
import java.io.File
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.memberFunctions
|
||||
import kotlin.reflect.primaryConstructor
|
||||
import kotlin.reflect.full.memberFunctions
|
||||
import kotlin.reflect.full.primaryConstructor
|
||||
|
||||
open class KotlinScriptDefinitionFromAnnotatedTemplate(
|
||||
template: KClass<out Any>,
|
||||
@@ -95,7 +95,7 @@ open class KotlinScriptDefinitionFromAnnotatedTemplate(
|
||||
}
|
||||
|
||||
fun makeScriptContents() = BasicScriptContents(file, getAnnotations = {
|
||||
val classLoader = (template as Any).javaClass.classLoader
|
||||
val classLoader = (template as Any)::class.java.classLoader
|
||||
try {
|
||||
getAnnotationEntries(file, project)
|
||||
.mapNotNull { psiAnn ->
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.types.TypeUtils
|
||||
import org.jetbrains.kotlin.utils.tryCreateCallableMappingFromNamedArgs
|
||||
import kotlin.reflect.KClass
|
||||
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()
|
||||
|
||||
|
||||
+2
-2
@@ -52,13 +52,13 @@ interface ScriptTemplatesProvider {
|
||||
}
|
||||
|
||||
fun makeScriptDefsFromTemplatesProviderExtensions(project: Project,
|
||||
errorsHandler: ((ScriptTemplatesProvider, Exception) -> Unit) = { ep, ex -> throw ex }
|
||||
errorsHandler: ((ScriptTemplatesProvider, Exception) -> Unit) = { _, ex -> throw ex }
|
||||
): List<KotlinScriptDefinitionFromAnnotatedTemplate> =
|
||||
makeScriptDefsFromTemplatesProviders(Extensions.getArea(project).getExtensionPoint(ScriptTemplatesProvider.EP_NAME).extensions.asIterable(),
|
||||
errorsHandler)
|
||||
|
||||
fun makeScriptDefsFromTemplatesProviders(providers: Iterable<ScriptTemplatesProvider>,
|
||||
errorsHandler: ((ScriptTemplatesProvider, Exception) -> Unit) = { ep, ex -> throw ex }
|
||||
errorsHandler: ((ScriptTemplatesProvider, Exception) -> Unit) = { _, ex -> throw ex }
|
||||
): List<KotlinScriptDefinitionFromAnnotatedTemplate> {
|
||||
return providers.filter { it.isValid }.flatMap { provider ->
|
||||
try {
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.serialization.deserialization.findNonGenericClassAcr
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import kotlin.reflect.*
|
||||
import kotlin.reflect.full.primaryConstructor
|
||||
|
||||
data class ScriptParameter(val name: Name, val type: KotlinType)
|
||||
|
||||
|
||||
@@ -41,6 +41,6 @@ open class ExceptionTracker : ModificationTracker, LockBasedStorageManager.Excep
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return javaClass.name + ": " + modificationCount
|
||||
return this::class.java.name + ": " + modificationCount
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ class FakeCallResolver(
|
||||
|
||||
if (isSuccess) {
|
||||
fakeTrace.commit(
|
||||
{ slice, key ->
|
||||
{ _, key ->
|
||||
// excluding all entries related to fake expression
|
||||
// convert all errors on this expression to ITERATOR_MISSING on callElement
|
||||
key != fake
|
||||
@@ -106,7 +106,7 @@ class FakeCallResolver(
|
||||
valueArguments: List<KtExpression>,
|
||||
name: Name,
|
||||
callElement: KtExpression,
|
||||
onComplete: (KtSimpleNameExpression, Boolean) -> Unit = { x, y -> }
|
||||
onComplete: (KtSimpleNameExpression, Boolean) -> Unit = { _, _ -> }
|
||||
): Pair<Call, OverloadResolutionResults<FunctionDescriptor>> {
|
||||
val fakeCalleeExpression = KtPsiFactory(project).createSimpleName(name.asString())
|
||||
val call = CallMaker.makeCallWithExpressions(
|
||||
|
||||
+1
-1
@@ -373,7 +373,7 @@ class PatternMatchingTypingVisitor internal constructor(facade: ExpressionTyping
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
+1
-2
@@ -32,7 +32,6 @@ import org.jetbrains.kotlin.psi.KtSuperExpression
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.TypeUtils
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.singletonList
|
||||
|
||||
|
||||
fun resolveUnqualifiedSuperFromExpressionContext(
|
||||
@@ -106,7 +105,7 @@ private fun resolveSupertypesForMethodOfAny(supertypes: Collection<KotlinType>,
|
||||
return if (typesWithConcreteOverride.isNotEmpty())
|
||||
typesWithConcreteOverride
|
||||
else
|
||||
anyType.singletonList()
|
||||
listOf(anyType)
|
||||
}
|
||||
|
||||
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
|
||||
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())
|
||||
BuildInfo.write(currentBuildInfo, lastBuildInfoFile)
|
||||
val buildDirtyLookupSymbols = HashSet<LookupSymbol>()
|
||||
@@ -356,7 +353,7 @@ class IncrementalJvmCompilerRunner(
|
||||
changesRegistry.registerChanges(currentBuildInfo.startTS, dirtyData)
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -400,7 +397,6 @@ class IncrementalJvmCompilerRunner(
|
||||
KotlinClassHeader.Kind.MULTIFILE_CLASS_PART -> {
|
||||
result.addAll(partsByFacadeName(outputClass.classHeader.multifileClassName!!))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ class FileSnapshot(
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
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
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ abstract class TestWithWorkingDir {
|
||||
|
||||
@Before
|
||||
open fun setUp() {
|
||||
workingDir = FileUtil.createTempDirectory(this.javaClass.simpleName, null)
|
||||
workingDir = FileUtil.createTempDirectory(this::class.java.simpleName, null)
|
||||
}
|
||||
|
||||
@After
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ class KotlinStandaloneIncrementalCompilationTest : TestWithWorkingDir() {
|
||||
var step = 1
|
||||
for ((modificationStep, buildLogStep) in modifications.zip(buildLogSteps)) {
|
||||
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))
|
||||
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 {
|
||||
return body.statements.fold(none()) {
|
||||
r, exp ->
|
||||
_, exp ->
|
||||
exp.accept(this, data)
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@ class ExpressionCodegen(
|
||||
|
||||
override fun visitContainerExpression(expression: IrContainerExpression, data: BlockInfo): StackValue {
|
||||
val result = expression.statements.fold(none()) {
|
||||
r, exp ->
|
||||
_, exp ->
|
||||
//coerceNotToUnit(r.type, Type.VOID_TYPE)
|
||||
exp.accept(this, data)
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ open class KnownClassDescriptor(
|
||||
override val annotations: Annotations
|
||||
) : ClassDescriptor {
|
||||
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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user