Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.platform
import org.jetbrains.kotlin.builtins.CompanionObjectMapping
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltIns.FQ_NAMES
import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.name.*
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeUtils
import java.util.*
object JavaToKotlinClassMap : PlatformToKotlinClassMap {
private val javaToKotlin = HashMap()
private val kotlinToJava = HashMap()
private val mutableToReadOnly = HashMap()
private val readOnlyToMutable = HashMap()
// describes mapping for a java class that has separate readOnly and mutable equivalents in Kotlin
data class PlatformMutabilityMapping(
val javaClass: ClassId,
val kotlinReadOnly: ClassId,
val kotlinMutable: ClassId
)
private inline fun mutabilityMapping(kotlinReadOnly: ClassId, kotlinMutable: FqName): PlatformMutabilityMapping {
val mutableClassId = ClassId(kotlinReadOnly.packageFqName, kotlinMutable.tail(kotlinReadOnly.packageFqName), false)
return PlatformMutabilityMapping(classId(T::class.java), kotlinReadOnly, mutableClassId)
}
val mutabilityMappings = listOf(
mutabilityMapping>(ClassId.topLevel(FQ_NAMES.iterable), FQ_NAMES.mutableIterable),
mutabilityMapping>(ClassId.topLevel(FQ_NAMES.iterator), FQ_NAMES.mutableIterator),
mutabilityMapping>(ClassId.topLevel(FQ_NAMES.collection), FQ_NAMES.mutableCollection),
mutabilityMapping>(ClassId.topLevel(FQ_NAMES.list), FQ_NAMES.mutableList),
mutabilityMapping>(ClassId.topLevel(FQ_NAMES.set), FQ_NAMES.mutableSet),
mutabilityMapping>(ClassId.topLevel(FQ_NAMES.listIterator), FQ_NAMES.mutableListIterator),
mutabilityMapping