mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-27 00:21:29 +00:00
Compare commits
120 Commits
ssa/native
...
native_com
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c81b1760f | ||
|
|
dc4e06c6af | ||
|
|
38f6303702 | ||
|
|
b6353524a0 | ||
|
|
2e8d524b19 | ||
|
|
75afa63a79 | ||
|
|
3cd89c71cd | ||
|
|
7e376ff3c6 | ||
|
|
8cc11279d7 | ||
|
|
9a01d323aa | ||
|
|
a84470c124 | ||
|
|
87944cd866 | ||
|
|
ff97e1cea9 | ||
|
|
ff38226b01 | ||
|
|
e934478581 | ||
|
|
39616479ba | ||
|
|
38c5f58be7 | ||
|
|
0fe065ba77 | ||
|
|
4d601d34d0 | ||
|
|
39e22851cd | ||
|
|
d2cf140965 | ||
|
|
b1e2afccb5 | ||
|
|
a1d586cfc5 | ||
|
|
056f99228f | ||
|
|
88bdb7a8b9 | ||
|
|
9e61c7db7d | ||
|
|
572ac40df0 | ||
|
|
276aa903db | ||
|
|
8df4c48be2 | ||
|
|
a62d3812f6 | ||
|
|
2bd835f008 | ||
|
|
e7cf4fd3f2 | ||
|
|
320b0f907b | ||
|
|
7650f63921 | ||
|
|
419195e608 | ||
|
|
a616b79cba | ||
|
|
183eca867e | ||
|
|
7dbd79304d | ||
|
|
6e20d4deec | ||
|
|
068afcacae | ||
|
|
d2d73b5043 | ||
|
|
3391530809 | ||
|
|
4d96bfe089 | ||
|
|
9d37feab72 | ||
|
|
feb8b91075 | ||
|
|
fbe6c72c46 | ||
|
|
04a898dd44 | ||
|
|
8a05e00960 | ||
|
|
a690dbefe5 | ||
|
|
c366433034 | ||
|
|
8be1487429 | ||
|
|
7c62ffa9cd | ||
|
|
10c71ea2f2 | ||
|
|
bb98d95186 | ||
|
|
5098171326 | ||
|
|
e9c071aabc | ||
|
|
ed7b530513 | ||
|
|
65feaf9a4a | ||
|
|
558d1edd39 | ||
|
|
492dd24897 | ||
|
|
710134b4a6 | ||
|
|
c253404622 | ||
|
|
94a88c5c19 | ||
|
|
8ac926d3e2 | ||
|
|
1dcad35f21 | ||
|
|
6df81c5fc7 | ||
|
|
6c0cec151e | ||
|
|
22b2fc0c9f | ||
|
|
48596fe2c7 | ||
|
|
7fcc915fc4 | ||
|
|
7c4e5dbb09 | ||
|
|
4b12826e99 | ||
|
|
fab11884cc | ||
|
|
800ccdcc1d | ||
|
|
0d16f0de42 | ||
|
|
d191510b42 | ||
|
|
536ab732cd | ||
|
|
e100e3ec58 | ||
|
|
e6a560c49c | ||
|
|
f1636cab67 | ||
|
|
15a60b8640 | ||
|
|
86395bc6dc | ||
|
|
a8345c25f0 | ||
|
|
017d99de4c | ||
|
|
bb020202aa | ||
|
|
e111863ee2 | ||
|
|
d940851bdf | ||
|
|
868c22b4cf | ||
|
|
a8755cef36 | ||
|
|
1629c46177 | ||
|
|
3dfd560470 | ||
|
|
f745c84574 | ||
|
|
502a6086d6 | ||
|
|
1050b9d19b | ||
|
|
7954c1fced | ||
|
|
5454bed997 | ||
|
|
c361b184d9 | ||
|
|
4b1c847863 | ||
|
|
1162c1be5f | ||
|
|
b55d69c36b | ||
|
|
0af1dc35a4 | ||
|
|
ef27fe4e0e | ||
|
|
614c68280f | ||
|
|
bfbdd3f2fb | ||
|
|
157ad173ec | ||
|
|
dfbe43fe16 | ||
|
|
3dc42d2525 | ||
|
|
919d527aa7 | ||
|
|
45991a69ff | ||
|
|
a134e568f2 | ||
|
|
3af23f2d3f | ||
|
|
7572ee4122 | ||
|
|
41f3415b4a | ||
|
|
9dbd7269cb | ||
|
|
dd3d2311a8 | ||
|
|
b28e71730b | ||
|
|
5e91bc5697 | ||
|
|
ef209999f7 | ||
|
|
d364505652 | ||
|
|
30d2a1ae2a |
7659
ChangeLog.md
7659
ChangeLog.md
File diff suppressed because it is too large
Load Diff
@@ -32,6 +32,8 @@ sourceSets {
|
||||
"test" { projectDefault() }
|
||||
}
|
||||
|
||||
publish()
|
||||
|
||||
runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
@@ -39,5 +41,3 @@ javadocJar()
|
||||
testsJar()
|
||||
|
||||
projectTest()
|
||||
|
||||
publish()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@ import org.gradle.kotlin.dsl.*
|
||||
buildscript {
|
||||
extra["defaultSnapshotVersion"] = "1.3-SNAPSHOT"
|
||||
|
||||
kotlinBootstrapFrom(BootstrapOption.TeamCity("1.3.30-dev-1945", onlySuccessBootstrap = false))
|
||||
kotlinBootstrapFrom(BootstrapOption.TeamCity("1.3.30-eap-28", projectExtId = "Kotlin_1330_Compiler", onlySuccessBootstrap = false))
|
||||
|
||||
repositories.withRedirector(project) {
|
||||
bootstrapKotlinRepo?.let(::maven)
|
||||
|
||||
@@ -35,14 +35,26 @@ fun Project.testsJar(body: Jar.() -> Unit = {}): Jar {
|
||||
}
|
||||
}
|
||||
|
||||
var Project.artifactsRemovedDiagnosticFlag: Boolean
|
||||
get() = extra.has("artifactsRemovedDiagnosticFlag") && extra["artifactsRemovedDiagnosticFlag"] == true
|
||||
set(value) {
|
||||
extra["artifactsRemovedDiagnosticFlag"] = value
|
||||
}
|
||||
|
||||
fun Project.removeArtifacts(configuration: Configuration, task: Task) {
|
||||
configuration.artifacts.removeAll { artifact ->
|
||||
artifact.file in task.outputs.files
|
||||
}
|
||||
|
||||
artifactsRemovedDiagnosticFlag = true
|
||||
}
|
||||
|
||||
fun Project.noDefaultJar() {
|
||||
tasks.findByName("jar")?.let { defaultJarTask ->
|
||||
defaultJarTask.enabled = false
|
||||
defaultJarTask.actions = emptyList()
|
||||
configurations.forEach { cfg ->
|
||||
cfg.artifacts.removeAll { artifact ->
|
||||
artifact.file in defaultJarTask.outputs.files
|
||||
}
|
||||
removeArtifacts(cfg, defaultJarTask)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,8 +70,7 @@ fun Project.runtimeJarArtifactBy(task: Task, artifactRef: Any, body: Configurabl
|
||||
fun <T : Jar> Project.runtimeJar(task: T, body: T.() -> Unit = {}): T {
|
||||
extra["runtimeJarTask"] = task
|
||||
tasks.findByName("jar")?.let { defaultJarTask ->
|
||||
configurations.getOrCreate("archives")
|
||||
.artifacts.removeAll { (it as? ArchivePublishArtifact)?.archiveTask?.let { it == defaultJarTask } ?: false }
|
||||
removeArtifacts(configurations.getOrCreate("archives"), defaultJarTask)
|
||||
}
|
||||
return task.apply {
|
||||
setupPublicJar(project.the<BasePluginConvention>().archivesBaseName)
|
||||
@@ -109,6 +120,10 @@ fun Project.standardPublicJars() {
|
||||
fun Project.publish(body: Upload.() -> Unit = {}): Upload {
|
||||
apply<plugins.PublishedKotlinModule>()
|
||||
|
||||
if (artifactsRemovedDiagnosticFlag) {
|
||||
error("`publish()` should be called before removing artifacts typically done in `noDefaultJar()` of `runtimeJar()` calls")
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
if (configurations.findByName("classes-dirs") != null)
|
||||
throw GradleException("classesDirsArtifact() is incompatible with publish(), see sources comments for details")
|
||||
|
||||
@@ -244,6 +244,10 @@ public abstract class AnnotationCodegen {
|
||||
|
||||
annotationTargetMaps.put(JvmTarget.JVM_1_6, jvm6);
|
||||
annotationTargetMaps.put(JvmTarget.JVM_1_8, jvm8);
|
||||
annotationTargetMaps.put(JvmTarget.JVM_9, jvm8);
|
||||
annotationTargetMaps.put(JvmTarget.JVM_10, jvm8);
|
||||
annotationTargetMaps.put(JvmTarget.JVM_11, jvm8);
|
||||
annotationTargetMaps.put(JvmTarget.JVM_12, jvm8);
|
||||
}
|
||||
|
||||
private void generateTargetAnnotation(
|
||||
|
||||
@@ -100,7 +100,8 @@ import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.*;
|
||||
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.*;
|
||||
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.*;
|
||||
import static org.jetbrains.kotlin.resolve.BindingContext.*;
|
||||
import static org.jetbrains.kotlin.resolve.BindingContextUtils.*;
|
||||
import static org.jetbrains.kotlin.resolve.BindingContextUtils.getDelegationConstructorCall;
|
||||
import static org.jetbrains.kotlin.resolve.BindingContextUtils.isBoxedLocalCapturedInClosure;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
|
||||
import static org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils.isFunctionExpression;
|
||||
@@ -2900,7 +2901,9 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
while (cur != null) {
|
||||
ClassDescriptor thisDescriptor = cur.getThisDescriptor();
|
||||
|
||||
if (!isSuper && thisDescriptor == thisOrOuterClass) {
|
||||
// We use equals on type constructors (instead of reference equality on classes) to support the case where default parameter
|
||||
// values of actual functions loaded from the expected function refer to the expected class.
|
||||
if (!isSuper && thisDescriptor.getTypeConstructor().equals(thisOrOuterClass.getTypeConstructor())) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,9 @@ import com.intellij.openapi.util.Trinity
|
||||
import gnu.trove.TObjectIntHashMap
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import java.util.*
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
class FrameMap : FrameMapBase<DeclarationDescriptor>()
|
||||
open class FrameMap : FrameMapBase<DeclarationDescriptor>()
|
||||
|
||||
open class FrameMapBase<T : Any> {
|
||||
private val myVarIndex = TObjectIntHashMap<T>()
|
||||
@@ -61,7 +60,7 @@ open class FrameMapBase<T : Any> {
|
||||
currentSize -= type.size
|
||||
}
|
||||
|
||||
fun getIndex(descriptor: T): Int {
|
||||
open fun getIndex(descriptor: T): Int {
|
||||
return if (myVarIndex.contains(descriptor)) myVarIndex.get(descriptor) else -1
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.resolve.multiplatform.ExpectedActualResolver
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ExtensionReceiver
|
||||
|
||||
/**
|
||||
* This [FrameMap] subclass substitutes values declared in the expected declaration with the corresponding value in the actual declaration,
|
||||
* which is needed for the case when expected function declares parameters with default values, which refer to other parameters.
|
||||
*/
|
||||
class FrameMapWithExpectActualSupport(private val module: ModuleDescriptor) : FrameMap() {
|
||||
override fun getIndex(descriptor: DeclarationDescriptor): Int {
|
||||
val tmp = if (descriptor is ParameterDescriptor) findActualParameter(descriptor) ?: descriptor else descriptor
|
||||
return super.getIndex(tmp)
|
||||
}
|
||||
|
||||
private fun findActualParameter(parameter: ParameterDescriptor): ParameterDescriptor? {
|
||||
val container = parameter.containingDeclaration
|
||||
if (container !is CallableMemberDescriptor || !container.isExpect) return null
|
||||
|
||||
// Generation of value parameters is supported by the fact that FunctionCodegen.generateDefaultImplBody substitutes value parameters
|
||||
// of the generated actual function with the parameters of the expected declaration in the first place.
|
||||
// Generation of dispatch receiver parameters (this and outer receiver values) is supported
|
||||
// in ExpressionCodegen.generateThisOrOuterFromContext by comparing classes by type constructor equality.
|
||||
if (parameter !is ReceiverParameterDescriptor || parameter.value !is ExtensionReceiver) return null
|
||||
|
||||
val actual = with(ExpectedActualResolver) {
|
||||
container.findCompatibleActualForExpected(module).firstOrNull()
|
||||
}
|
||||
|
||||
return (actual as? CallableDescriptor)?.extensionReceiverParameter
|
||||
}
|
||||
}
|
||||
@@ -1360,7 +1360,7 @@ public class FunctionCodegen {
|
||||
@NotNull List<ValueParameterDescriptor> valueParameters,
|
||||
boolean isStatic
|
||||
) {
|
||||
FrameMap frameMap = new FrameMap();
|
||||
FrameMap frameMap = new FrameMapWithExpectActualSupport(state.getModule());
|
||||
if (!isStatic) {
|
||||
frameMap.enterTemp(OBJECT_TYPE);
|
||||
}
|
||||
|
||||
@@ -18,8 +18,6 @@ package org.jetbrains.kotlin.codegen
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.progress.ProcessCanceledException
|
||||
import com.intellij.util.ArrayUtil
|
||||
import com.intellij.util.SmartList
|
||||
import org.jetbrains.kotlin.backend.common.CodegenUtil
|
||||
import org.jetbrains.kotlin.codegen.context.FieldOwnerContext
|
||||
import org.jetbrains.kotlin.codegen.context.MethodContext
|
||||
@@ -41,6 +39,7 @@ import org.jetbrains.kotlin.psi.KtTypeAlias
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.MemberComparator
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClass
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClassPart
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin
|
||||
@@ -67,20 +66,20 @@ class MultifileClassCodegenImpl(
|
||||
) : MultifileClassCodegen {
|
||||
private val facadeClassType = AsmUtil.asmTypeByFqNameWithoutInnerClasses(facadeFqName)
|
||||
|
||||
private val packageFragment = getOnlyPackageFragment(facadeFqName.parent(), files, state.module)
|
||||
private val packageFragment = getOnlyPackageFragment(files, state.module)
|
||||
|
||||
private val compiledPackageFragment = getCompiledPackageFragment(facadeFqName, state)
|
||||
|
||||
private val previouslyCompiledCallables =
|
||||
if (compiledPackageFragment == null)
|
||||
emptyList<DeserializedCallableMemberDescriptor>()
|
||||
else
|
||||
getDeserializedCallables(compiledPackageFragment)
|
||||
if (compiledPackageFragment == null)
|
||||
emptyList()
|
||||
else
|
||||
getDeserializedCallables(compiledPackageFragment)
|
||||
|
||||
private fun getDeserializedCallables(compiledPackageFragment: PackageFragmentDescriptor) =
|
||||
compiledPackageFragment.getMemberScope()
|
||||
.getContributedDescriptors(DescriptorKindFilter.CALLABLES, MemberScope.ALL_NAME_FILTER)
|
||||
.filterIsInstance<DeserializedCallableMemberDescriptor>()
|
||||
compiledPackageFragment.getMemberScope()
|
||||
.getContributedDescriptors(DescriptorKindFilter.CALLABLES, MemberScope.ALL_NAME_FILTER)
|
||||
.filterIsInstance<DeserializedCallableMemberDescriptor>()
|
||||
|
||||
private val shouldGeneratePartHierarchy =
|
||||
state.languageVersionSettings.getFlag(JvmAnalysisFlags.inheritMultifileParts)
|
||||
@@ -100,7 +99,7 @@ class MultifileClassCodegenImpl(
|
||||
|
||||
private val superClassForInheritedPart = run {
|
||||
val result = hashMapOf<String, String>()
|
||||
for (i in 1 ..partInternalNamesSorted.size - 1) {
|
||||
for (i in 1 until partInternalNamesSorted.size) {
|
||||
result[partInternalNamesSorted[i]] = partInternalNamesSorted[i - 1]
|
||||
}
|
||||
result
|
||||
@@ -115,29 +114,23 @@ class MultifileClassCodegenImpl(
|
||||
J_L_OBJECT
|
||||
|
||||
private val classBuilder = ClassBuilderOnDemand {
|
||||
val originFile = files.firstOrNull()
|
||||
|
||||
val actualPackageFragment = packageFragment
|
||||
?: compiledPackageFragment
|
||||
?: throw AssertionError("No package fragment for multifile facade $facadeFqName; files: $files")
|
||||
|
||||
val declarationOrigin = MultifileClass(originFile, actualPackageFragment)
|
||||
?: compiledPackageFragment
|
||||
?: throw AssertionError("No package fragment for multifile facade $facadeFqName; files: $files")
|
||||
|
||||
val singleSourceFile =
|
||||
if (previouslyCompiledCallables.isEmpty())
|
||||
files.singleOrNull { it.hasDeclarationsForPartClass() }
|
||||
else
|
||||
null
|
||||
if (previouslyCompiledCallables.isEmpty())
|
||||
files.singleOrNull { it.hasDeclarationsForPartClass() }
|
||||
else
|
||||
null
|
||||
|
||||
val superClassForFacade =
|
||||
if (shouldGeneratePartHierarchy)
|
||||
partInternalNamesSorted.last()
|
||||
else
|
||||
J_L_OBJECT
|
||||
val superClassForFacade = if (shouldGeneratePartHierarchy) partInternalNamesSorted.last() else J_L_OBJECT
|
||||
|
||||
state.factory.newVisitor(declarationOrigin, facadeClassType, files).apply {
|
||||
defineClass(singleSourceFile, state.classFileVersion, FACADE_CLASS_ATTRIBUTES,
|
||||
facadeClassType.internalName, null, superClassForFacade, ArrayUtil.EMPTY_STRING_ARRAY)
|
||||
state.factory.newVisitor(MultifileClass(files.firstOrNull(), actualPackageFragment), facadeClassType, files).apply {
|
||||
defineClass(
|
||||
singleSourceFile, state.classFileVersion, FACADE_CLASS_ATTRIBUTES,
|
||||
facadeClassType.internalName, null, superClassForFacade, emptyArray()
|
||||
)
|
||||
if (singleSourceFile != null) {
|
||||
visitSource(singleSourceFile.name, null)
|
||||
}
|
||||
@@ -162,7 +155,7 @@ class MultifileClassCodegenImpl(
|
||||
|
||||
generateDelegatesToPreviouslyCompiledParts()
|
||||
|
||||
if (!partInternalNamesSorted.isEmpty()) {
|
||||
if (partInternalNamesSorted.isNotEmpty()) {
|
||||
generateMultifileFacadeClass()
|
||||
}
|
||||
|
||||
@@ -175,16 +168,12 @@ class MultifileClassCodegenImpl(
|
||||
try {
|
||||
generatePart(file)
|
||||
state.afterIndependentPart()
|
||||
}
|
||||
catch (e: ProcessCanceledException) {
|
||||
} catch (e: ProcessCanceledException) {
|
||||
throw e
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
val vFile = file.virtualFile
|
||||
errorHandler.reportException(e, if (vFile == null) "no file" else vFile.url)
|
||||
} catch (e: Throwable) {
|
||||
errorHandler.reportException(e, file.virtualFile?.url ?: "no file")
|
||||
DiagnosticUtils.throwIfRunningOnServer(e)
|
||||
if (ApplicationManager.getApplication().isInternal) {
|
||||
//noinspection CallToPrintStackTrace
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
@@ -205,7 +194,7 @@ class MultifileClassCodegenImpl(
|
||||
|
||||
private fun generatePart(file: KtFile) {
|
||||
val packageFragment = this.packageFragment
|
||||
?: throw AssertionError("File part $file of $facadeFqName: no package fragment")
|
||||
?: throw AssertionError("File part $file of $facadeFqName: no package fragment")
|
||||
|
||||
val partType = Type.getObjectType(JvmFileClassUtil.getFileClassInternalName(file))
|
||||
val partContext = state.rootContext.intoMultifileClassPart(packageFragment, facadeClassType, partType, file)
|
||||
@@ -219,10 +208,7 @@ class MultifileClassCodegenImpl(
|
||||
val builder = state.factory.newVisitor(MultifileClassPart(file, packageFragment), partType, file)
|
||||
|
||||
MultifileClassPartCodegen(
|
||||
builder, file, packageFragment,
|
||||
getSuperClassForPart(partType.internalName),
|
||||
shouldGeneratePartHierarchy,
|
||||
partContext, state
|
||||
builder, file, packageFragment, getSuperClassForPart(partType.internalName), shouldGeneratePartHierarchy, partContext, state
|
||||
).generate()
|
||||
|
||||
addDelegateGenerationTasksForDeclarationsInFile(file, packageFragment, partType)
|
||||
@@ -284,14 +270,14 @@ class MultifileClassCodegenImpl(
|
||||
val partFqName = JvmFileClassUtil.getPartFqNameForDeserialized(callable)
|
||||
val partType = AsmUtil.asmTypeByFqNameWithoutInnerClasses(partFqName)
|
||||
|
||||
addDelegateGenerationTaskIfNeeded(callable, { generateDelegateToCompiledMember(callable, compiledPackageFragment, partType) })
|
||||
addDelegateGenerationTaskIfNeeded(callable) { generateDelegateToCompiledMember(callable, compiledPackageFragment, partType) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun generateDelegateToCompiledMember(
|
||||
member: CallableMemberDescriptor,
|
||||
compiledPackageFragment: PackageFragmentDescriptor,
|
||||
partType: Type
|
||||
member: CallableMemberDescriptor,
|
||||
compiledPackageFragment: PackageFragmentDescriptor,
|
||||
partType: Type
|
||||
) {
|
||||
val context = state.rootContext.intoMultifileClass(compiledPackageFragment, facadeClassType, partType)
|
||||
|
||||
@@ -302,7 +288,8 @@ class MultifileClassCodegenImpl(
|
||||
memberCodegen.functionCodegen.generateMethod(OtherOrigin(member), member, DelegateToCompiledMemberGenerationStrategy)
|
||||
|
||||
memberCodegen.functionCodegen.generateDefaultIfNeeded(
|
||||
context.intoFunction(member), member, OwnerKind.PACKAGE, DefaultParameterValueLoader.DEFAULT, null)
|
||||
context.intoFunction(member), member, OwnerKind.PACKAGE, DefaultParameterValueLoader.DEFAULT, null
|
||||
)
|
||||
|
||||
memberCodegen.functionCodegen.generateOverloadsWithDefaultValues(null, member, member)
|
||||
}
|
||||
@@ -310,7 +297,7 @@ class MultifileClassCodegenImpl(
|
||||
memberCodegen.propertyCodegen.generateInPackageFacade(member)
|
||||
}
|
||||
else -> {
|
||||
throw IllegalStateException("Unexpected member: " + member)
|
||||
throw IllegalStateException("Unexpected member: $member")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -320,7 +307,9 @@ class MultifileClassCodegenImpl(
|
||||
throw IllegalStateException("shouldn't be called")
|
||||
}
|
||||
|
||||
override fun generateBody(mv: MethodVisitor, frameMap: FrameMap, signature: JvmMethodSignature, context: MethodContext, parentCodegen: MemberCodegen<*>) {
|
||||
override fun generateBody(
|
||||
mv: MethodVisitor, frameMap: FrameMap, signature: JvmMethodSignature, context: MethodContext, parentCodegen: MemberCodegen<*>
|
||||
) {
|
||||
throw IllegalStateException("shouldn't be called")
|
||||
}
|
||||
}
|
||||
@@ -340,15 +329,29 @@ class MultifileClassCodegenImpl(
|
||||
arv.visit(null, internalName)
|
||||
}
|
||||
arv.visitEnd()
|
||||
|
||||
val kotlinPackageFqName =
|
||||
packageFragment?.fqName ?: compiledPackageFragment?.fqName
|
||||
?: error("Either source package or compiled package should not be null: $facadeClassType ($files)")
|
||||
|
||||
if (files.any { it.packageFqName != kotlinPackageFqName })
|
||||
throw UnsupportedOperationException(
|
||||
"Multi-file parts of a facade with JvmPackageName should all lie in the same Kotlin package:\n " +
|
||||
files.joinToString("\n ") { file -> "$file: package ${file.packageFqName}" }
|
||||
)
|
||||
|
||||
if (kotlinPackageFqName != JvmClassName.byInternalName(facadeClassType.internalName).packageFqName) {
|
||||
av.visit(JvmAnnotationNames.METADATA_PACKAGE_NAME_FIELD_NAME, kotlinPackageFqName.asString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun createCodegenForDelegatesInMultifileFacade(facadeContext: FieldOwnerContext<*>): MemberCodegen<KtFile> =
|
||||
object : MemberCodegen<KtFile>(state, null, facadeContext, null, classBuilder) {
|
||||
override fun generateDeclaration() = throw UnsupportedOperationException()
|
||||
override fun generateBody() = throw UnsupportedOperationException()
|
||||
override fun generateKotlinMetadataAnnotation() = throw UnsupportedOperationException()
|
||||
}
|
||||
object : MemberCodegen<KtFile>(state, null, facadeContext, null, classBuilder) {
|
||||
override fun generateDeclaration() = throw UnsupportedOperationException()
|
||||
override fun generateBody() = throw UnsupportedOperationException()
|
||||
override fun generateKotlinMetadataAnnotation() = throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
private fun done() {
|
||||
classBuilder.done()
|
||||
@@ -359,19 +362,12 @@ class MultifileClassCodegenImpl(
|
||||
|
||||
companion object {
|
||||
private val J_L_OBJECT = AsmTypes.OBJECT_TYPE.internalName
|
||||
private val FACADE_CLASS_ATTRIBUTES = Opcodes.ACC_PUBLIC or Opcodes.ACC_FINAL or Opcodes.ACC_SUPER
|
||||
private const val FACADE_CLASS_ATTRIBUTES = Opcodes.ACC_PUBLIC or Opcodes.ACC_FINAL or Opcodes.ACC_SUPER
|
||||
|
||||
private fun getOnlyPackageFragment(packageFqName: FqName, files: Collection<KtFile>, moduleDescriptor: ModuleDescriptor): PackageFragmentDescriptor? {
|
||||
val fragments = SmartList<PackageFragmentDescriptor>()
|
||||
for (file in files) {
|
||||
val fragment = moduleDescriptor.findPackageFragmentForFile(file)
|
||||
?: throw AssertionError("package fragment is null for " + file + "\n" + file.text)
|
||||
|
||||
assert(packageFqName == fragment.fqName) { "expected package fq name: " + packageFqName + ", actual: " + fragment.fqName }
|
||||
|
||||
if (!fragments.contains(fragment)) {
|
||||
fragments.add(fragment)
|
||||
}
|
||||
private fun getOnlyPackageFragment(files: Collection<KtFile>, moduleDescriptor: ModuleDescriptor): PackageFragmentDescriptor? {
|
||||
val fragments = files.mapTo(linkedSetOf()) { file ->
|
||||
moduleDescriptor.findPackageFragmentForFile(file)
|
||||
?: throw AssertionError("package fragment is null for " + file + "\n" + file.text)
|
||||
}
|
||||
if (fragments.size > 1) {
|
||||
throw IllegalStateException("More than one package fragment, files: $files | fragments: $fragments")
|
||||
@@ -383,16 +379,15 @@ class MultifileClassCodegenImpl(
|
||||
CodegenUtil.getMemberDeclarationsToGenerate(this).isNotEmpty()
|
||||
|
||||
private fun getCompiledPackageFragment(
|
||||
facadeFqName: FqName, state: GenerationState
|
||||
facadeFqName: FqName, state: GenerationState
|
||||
): IncrementalPackageFragmentProvider.IncrementalMultifileClassPackageFragment? {
|
||||
if (!IncrementalCompilation.isEnabledForJvm()) return null
|
||||
|
||||
val packageFqName = facadeFqName.parent()
|
||||
|
||||
val incrementalPackageFragment = state.module.getPackage(packageFqName).fragments.firstOrNull { fragment ->
|
||||
fragment is IncrementalPackageFragmentProvider.IncrementalPackageFragment &&
|
||||
fragment.target == state.targetId
|
||||
} as IncrementalPackageFragmentProvider.IncrementalPackageFragment?
|
||||
fragment is IncrementalPackageFragmentProvider.IncrementalPackageFragment && fragment.target == state.targetId
|
||||
} as IncrementalPackageFragmentProvider.IncrementalPackageFragment?
|
||||
|
||||
return incrementalPackageFragment?.getPackageFragmentForMultifileClass(facadeFqName)
|
||||
}
|
||||
|
||||
@@ -22,20 +22,22 @@ import org.jetbrains.kotlin.codegen.context.MultifileClassPartContext
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames.METADATA_PACKAGE_NAME_FIELD_NAME
|
||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.KtProperty
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
|
||||
class MultifileClassPartCodegen(
|
||||
v: ClassBuilder,
|
||||
file: KtFile,
|
||||
private val packageFragment: PackageFragmentDescriptor,
|
||||
private val superClassInternalName: String,
|
||||
private val shouldGeneratePartHierarchy: Boolean,
|
||||
partContext: MultifileClassPartContext,
|
||||
state: GenerationState
|
||||
v: ClassBuilder,
|
||||
file: KtFile,
|
||||
private val packageFragment: PackageFragmentDescriptor,
|
||||
private val superClassInternalName: String,
|
||||
private val shouldGeneratePartHierarchy: Boolean,
|
||||
partContext: MultifileClassPartContext,
|
||||
state: GenerationState
|
||||
) : MemberCodegen<KtFile>(state, null, partContext, file, v) {
|
||||
private val partType = partContext.filePartType
|
||||
private val facadeClassType = partContext.multifileClassType
|
||||
@@ -97,6 +99,11 @@ class MultifileClassPartCodegen(
|
||||
writeKotlinMetadata(v, state, KotlinClassHeader.Kind.MULTIFILE_CLASS_PART, extraFlags) { av ->
|
||||
AsmUtil.writeAnnotationData(av, serializer, packageProto)
|
||||
av.visit(JvmAnnotationNames.METADATA_MULTIFILE_CLASS_NAME_FIELD_NAME, facadeClassType.internalName)
|
||||
|
||||
val kotlinPackageFqName = element.packageFqName
|
||||
if (kotlinPackageFqName != JvmClassName.byInternalName(partType.internalName).packageFqName) {
|
||||
av.visit(METADATA_PACKAGE_NAME_FIELD_NAME, kotlinPackageFqName.asString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
package org.jetbrains.kotlin.codegen.state
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.load.kotlin.getRepresentativeUpperBound
|
||||
import org.jetbrains.kotlin.resolve.InlineClassDescriptorResolver
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
|
||||
import org.jetbrains.kotlin.resolve.jvm.*
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.typeUtil.representativeUpperBound
|
||||
import java.security.MessageDigest
|
||||
import java.util.*
|
||||
|
||||
@@ -44,7 +44,7 @@ private fun getSignatureElementForMangling(type: KotlinType): String = buildStri
|
||||
}
|
||||
|
||||
is TypeParameterDescriptor -> {
|
||||
append(getSignatureElementForMangling(getRepresentativeUpperBound(descriptor)))
|
||||
append(getSignatureElementForMangling(descriptor.representativeUpperBound))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
@Argument(
|
||||
value = "-jvm-target",
|
||||
valueDescription = "<version>",
|
||||
description = "Target version of the generated JVM bytecode (1.6 or 1.8), default is 1.6"
|
||||
description = "Target version of the generated JVM bytecode (1.6, 1.8, 9, 10, 11 or 12), default is 1.6"
|
||||
)
|
||||
var jvmTarget: String? by NullableStringFreezableVar(JvmTarget.DEFAULT.description)
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ object TopDownAnalyzerFacadeForJVM {
|
||||
val sourceScope = if (separateModules) sourceModuleSearchScope else GlobalSearchScope.allScope(project)
|
||||
val moduleClassResolver = SourceOrBinaryModuleClassResolver(sourceScope)
|
||||
|
||||
val jvmTarget = configuration.get(JVMConfigurationKeys.JVM_TARGET) ?: JvmTarget.JVM_1_6
|
||||
val jvmTarget = configuration.get(JVMConfigurationKeys.JVM_TARGET, JvmTarget.DEFAULT)
|
||||
val languageVersionSettings = configuration.languageVersionSettings
|
||||
|
||||
val optionalBuiltInsModule =
|
||||
|
||||
@@ -56,7 +56,8 @@ open class GenericReplChecker(
|
||||
if (get(JVMConfigurationKeys.JVM_TARGET) == null) {
|
||||
put(JVMConfigurationKeys.JVM_TARGET,
|
||||
System.getProperty(KOTLIN_REPL_JVM_TARGET_PROPERTY)?.let { JvmTarget.fromString(it) }
|
||||
?: if (getJavaVersion() >= 0x10008) JvmTarget.JVM_1_8 else JvmTarget.JVM_1_6)
|
||||
?: System.getProperty("java.specification.version")?.let { JvmTarget.fromString(it) }
|
||||
?: JvmTarget.DEFAULT)
|
||||
}
|
||||
}
|
||||
KotlinCoreEnvironment.createForProduction(disposable, compilerConfiguration, EnvironmentConfigFiles.JVM_CONFIG_FILES)
|
||||
@@ -97,21 +98,3 @@ open class GenericReplChecker(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// initially taken from libraries/stdlib/src/kotlin/internal/PlatformImplementations.kt
|
||||
// fixed according to JEP 223 - http://openjdk.java.net/jeps/223
|
||||
// TODO: consider to place it to some common place
|
||||
private fun getJavaVersion(): Int {
|
||||
val default = 0x10006
|
||||
val version = System.getProperty("java.specification.version") ?: return default
|
||||
val components = version.split('.')
|
||||
return try {
|
||||
when (components.size) {
|
||||
0 -> default
|
||||
1 -> components[0].toInt() * 0x10000
|
||||
else -> components[0].toInt() * 0x10000 + components[1].toInt()
|
||||
}
|
||||
} catch (e: NumberFormatException) {
|
||||
default
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@ sourceSets {
|
||||
"test" {}
|
||||
}
|
||||
|
||||
publish()
|
||||
|
||||
val jar: Jar by tasks
|
||||
|
||||
runtimeJar(rewriteDepsToShadedCompiler(jar))
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
publish()
|
||||
|
||||
@@ -41,6 +41,8 @@ sourceSets {
|
||||
"test" {}
|
||||
}
|
||||
|
||||
publish()
|
||||
|
||||
noDefaultJar()
|
||||
|
||||
runtimeJar(task<ShadowJar>("shadowJar")) {
|
||||
@@ -55,5 +57,3 @@ javadocJar()
|
||||
dist()
|
||||
|
||||
ideaPlugin()
|
||||
|
||||
publish()
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.jetbrains.kotlin.config
|
||||
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
@@ -21,10 +22,13 @@ import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
enum class JvmTarget(override val description: String) : TargetPlatformVersion {
|
||||
JVM_1_6("1.6"),
|
||||
JVM_1_8("1.8"),
|
||||
JVM_9("9"),
|
||||
JVM_10("10"),
|
||||
JVM_11("11"),
|
||||
JVM_12("12"),
|
||||
;
|
||||
|
||||
val bytecodeVersion: Int by lazy {
|
||||
@Suppress("DEPRECATION")
|
||||
when (this) {
|
||||
JVM_1_6 -> Opcodes.V1_6
|
||||
JVM_1_8 ->
|
||||
@@ -33,6 +37,10 @@ enum class JvmTarget(override val description: String) : TargetPlatformVersion {
|
||||
java.lang.Boolean.valueOf(System.getProperty("kotlin.test.substitute.bytecode.1.8.to.1.9")) -> Opcodes.V9
|
||||
else -> Opcodes.V1_8
|
||||
}
|
||||
JVM_9 -> Opcodes.V9
|
||||
JVM_10 -> Opcodes.V9 + 1
|
||||
JVM_11 -> Opcodes.V9 + 2
|
||||
JVM_12 -> Opcodes.V9 + 3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,16 +52,13 @@ enum class JvmTarget(override val description: String) : TargetPlatformVersion {
|
||||
fun fromString(string: String) = values().find { it.description == string }
|
||||
|
||||
fun getDescription(bytecodeVersion: Int): String {
|
||||
@Suppress("DEPRECATION")
|
||||
val platformDescription = values().find { it.bytecodeVersion == bytecodeVersion }?.description ?:
|
||||
when (bytecodeVersion) {
|
||||
Opcodes.V1_7 -> "1.7"
|
||||
Opcodes.V9 -> "1.9"
|
||||
else -> null
|
||||
}
|
||||
val platformDescription = values().find { it.bytecodeVersion == bytecodeVersion }?.description ?: when (bytecodeVersion) {
|
||||
Opcodes.V1_7 -> "1.7"
|
||||
else -> null
|
||||
}
|
||||
|
||||
return if (platformDescription != null) "JVM target $platformDescription"
|
||||
else "JVM bytecode version $bytecodeVersion"
|
||||
else "JVM bytecode version $bytecodeVersion"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ object JvmAnalyzerFacade : ResolverForModuleFactory() {
|
||||
resolverForModule.componentProvider.get<JavaDescriptorResolver>()
|
||||
}
|
||||
|
||||
val jvmTarget = targetPlatformVersion as? JvmTarget ?: JvmTarget.JVM_1_6
|
||||
val jvmTarget = targetPlatformVersion as? JvmTarget ?: JvmTarget.DEFAULT
|
||||
val trace = CodeAnalyzerInitializer.getInstance(project).createTrace()
|
||||
|
||||
val lookupTracker = LookupTracker.DO_NOTHING
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.*
|
||||
class InterfaceDefaultMethodCallChecker(val jvmTarget: JvmTarget) : CallChecker {
|
||||
|
||||
override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) {
|
||||
val supportDefaults = jvmTarget == JvmTarget.JVM_1_8
|
||||
val supportDefaults = jvmTarget >= JvmTarget.JVM_1_8
|
||||
|
||||
val descriptor = resolvedCall.resultingDescriptor as? CallableMemberDescriptor ?: return
|
||||
if (descriptor is JavaPropertyDescriptor) return
|
||||
|
||||
@@ -28,7 +28,10 @@ import org.jetbrains.kotlin.resolve.AdditionalAnnotationChecker
|
||||
import org.jetbrains.kotlin.resolve.AnnotationChecker
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.*
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.getAnnotationRetention
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.isRepeatableAnnotation
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
|
||||
|
||||
object RepeatableAnnotationChecker: AdditionalAnnotationChecker {
|
||||
@@ -81,12 +84,8 @@ object FileClassAnnotationsChecker: AdditionalAnnotationChecker {
|
||||
if (classDescriptor.getAnnotationRetention() != KotlinRetention.SOURCE) {
|
||||
trace.report(ErrorsJvm.ANNOTATION_IS_NOT_APPLICABLE_TO_MULTIFILE_CLASSES.on(entry, classFqName))
|
||||
}
|
||||
if (classFqName == JvmFileClassUtil.JVM_PACKAGE_NAME) {
|
||||
trace.report(ErrorsJvm.JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_MULTIFILE_CLASSES.on(entry))
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for ((entry, classDescriptor) in fileAnnotationsToCheck) {
|
||||
if (classDescriptor.fqNameSafe != JvmFileClassUtil.JVM_PACKAGE_NAME) continue
|
||||
|
||||
@@ -97,13 +96,11 @@ object FileClassAnnotationsChecker: AdditionalAnnotationChecker {
|
||||
val value = (stringTemplateEntries.singleOrNull() as? KtLiteralStringTemplateEntry)?.text
|
||||
if (value == null) {
|
||||
trace.report(ErrorsJvm.JVM_PACKAGE_NAME_CANNOT_BE_EMPTY.on(entry))
|
||||
}
|
||||
else if (!isValidJavaFqName(value)) {
|
||||
} else if (!isValidJavaFqName(value)) {
|
||||
trace.report(ErrorsJvm.JVM_PACKAGE_NAME_MUST_BE_VALID_NAME.on(entry))
|
||||
}
|
||||
else if (entry.containingKtFile.declarations.any {
|
||||
it !is KtFunction && it !is KtProperty && it !is KtTypeAlias
|
||||
}) {
|
||||
} else if (entry.containingKtFile.declarations.any {
|
||||
it !is KtFunction && it !is KtProperty && it !is KtTypeAlias
|
||||
}) {
|
||||
trace.report(ErrorsJvm.JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_FILES_WITH_CLASSES.on(entry))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,6 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
|
||||
MAP.put(NON_SOURCE_REPEATED_ANNOTATION, "Repeatable annotations with non-SOURCE retention are not yet supported");
|
||||
MAP.put(ANNOTATION_IS_NOT_APPLICABLE_TO_MULTIFILE_CLASSES, "Annotation ''@{0}'' is not applicable to the multi-file classes", TO_STRING);
|
||||
|
||||
MAP.put(JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_MULTIFILE_CLASSES, "''@JvmPackageName'' annotation is not supported in multi-file classes");
|
||||
MAP.put(JVM_PACKAGE_NAME_CANNOT_BE_EMPTY, "''@JvmPackageName'' annotation value cannot be empty");
|
||||
MAP.put(JVM_PACKAGE_NAME_MUST_BE_VALID_NAME, "''@JvmPackageName'' annotation value must be a valid dot-qualified name of a package");
|
||||
MAP.put(JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_FILES_WITH_CLASSES, "''@JvmPackageName'' annotation is not supported for files with class declarations");
|
||||
|
||||
@@ -68,7 +68,6 @@ public interface ErrorsJvm {
|
||||
DiagnosticFactory0<KtAnnotationEntry> NON_SOURCE_REPEATED_ANNOTATION = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory1<KtAnnotationEntry, FqName> ANNOTATION_IS_NOT_APPLICABLE_TO_MULTIFILE_CLASSES = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
DiagnosticFactory0<KtAnnotationEntry> JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_MULTIFILE_CLASSES = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtAnnotationEntry> JVM_PACKAGE_NAME_CANNOT_BE_EMPTY = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtAnnotationEntry> JVM_PACKAGE_NAME_MUST_BE_VALID_NAME = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtAnnotationEntry> JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_FILES_WITH_CLASSES = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.diagnostics.Errors.*
|
||||
import org.jetbrains.kotlin.idea.MainFunctionDetector
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.BindingContext.*
|
||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsExpression
|
||||
@@ -736,7 +737,9 @@ class ControlFlowInformationProvider private constructor(
|
||||
return
|
||||
}
|
||||
!languageVersionSettings.supportsFeature(LanguageFeature.WarningOnMainUnusedParameter) -> {
|
||||
trace.record(UNUSED_MAIN_PARAMETER, element)
|
||||
if (owner.containingClassOrObject == null) {
|
||||
trace.record(UNUSED_MAIN_PARAMETER, element)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,6 +231,8 @@ public interface Errors {
|
||||
DiagnosticFactory0<KtExpression> ANNOTATION_ARGUMENT_MUST_BE_CONST = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtExpression> ANNOTATION_ARGUMENT_MUST_BE_KCLASS_LITERAL = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtExpression> ANNOTATION_ARGUMENT_MUST_BE_ENUM_CONST = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtExpression> ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER = DiagnosticFactory0.create(WARNING);
|
||||
DiagnosticFactory0<KtExpression> ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtExpression> ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtAnnotatedExpression> ANNOTATIONS_ON_BLOCK_LEVEL_EXPRESSION_ON_THE_SAME_LINE = DiagnosticFactory0.create(WARNING);
|
||||
DiagnosticFactory0<KtAnnotationEntry> ANNOTATION_USED_AS_ANNOTATION_ARGUMENT = DiagnosticFactory0.create(ERROR);
|
||||
@@ -798,6 +800,8 @@ public interface Errors {
|
||||
|
||||
DiagnosticFactory2<KtElement, KotlinType, KotlinType> INCOMPATIBLE_ENUM_COMPARISON =
|
||||
DiagnosticFactory2.create(WARNING);
|
||||
DiagnosticFactory2<KtElement, KotlinType, KotlinType> INCOMPATIBLE_ENUM_COMPARISON_ERROR =
|
||||
DiagnosticFactory2.create(ERROR);
|
||||
|
||||
DiagnosticFactory1<KtExpression, KotlinType> HAS_NEXT_MISSING = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory1<KtExpression, KotlinType> HAS_NEXT_FUNCTION_AMBIGUITY = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
@@ -741,6 +741,7 @@ public class DefaultErrorMessages {
|
||||
}, RENDER_TYPE, RENDER_TYPE);
|
||||
|
||||
MAP.put(INCOMPATIBLE_ENUM_COMPARISON, "Comparison of incompatible enums ''{0}'' and ''{1}'' is always unsuccessful", RENDER_TYPE, RENDER_TYPE);
|
||||
MAP.put(INCOMPATIBLE_ENUM_COMPARISON_ERROR, "Comparison of incompatible enums ''{0}'' and ''{1}'' is always unsuccessful", RENDER_TYPE, RENDER_TYPE);
|
||||
|
||||
MAP.put(SENSELESS_COMPARISON, "Condition ''{0}'' is always ''{1}''", ELEMENT_TEXT, TO_STRING);
|
||||
MAP.put(SENSELESS_NULL_IN_WHEN, "Expression under 'when' is never equal to null");
|
||||
@@ -866,6 +867,8 @@ public class DefaultErrorMessages {
|
||||
MAP.put(ANNOTATION_ARGUMENT_MUST_BE_CONST, "An annotation argument must be a compile-time constant");
|
||||
MAP.put(ANNOTATION_ARGUMENT_MUST_BE_ENUM_CONST, "An enum annotation argument must be a enum constant");
|
||||
MAP.put(ANNOTATION_ARGUMENT_MUST_BE_KCLASS_LITERAL, "An annotation argument must be a class literal (T::class)");
|
||||
MAP.put(ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER, "Type parameter in a class literal is not allowed in an annotation argument");
|
||||
MAP.put(ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR, "Type parameter in a class literal is deprecated in an annotation argument");
|
||||
MAP.put(ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT, "Default value of annotation parameter must be a compile-time constant");
|
||||
|
||||
MAP.put(ANNOTATIONS_ON_BLOCK_LEVEL_EXPRESSION_ON_THE_SAME_LINE,
|
||||
|
||||
@@ -127,7 +127,13 @@ class ConstantExpressionEvaluator(
|
||||
val descriptor = expressionType.constructor.declarationDescriptor
|
||||
val diagnosticFactory = when {
|
||||
DescriptorUtils.isEnumClass(descriptor) -> Errors.ANNOTATION_ARGUMENT_MUST_BE_ENUM_CONST
|
||||
descriptor is ClassDescriptor && KotlinBuiltIns.isKClass(descriptor) -> Errors.ANNOTATION_ARGUMENT_MUST_BE_KCLASS_LITERAL
|
||||
descriptor is ClassDescriptor && KotlinBuiltIns.isKClass(descriptor) -> {
|
||||
if (isTypeParameterOrArrayOfTypeParameter(expressionType.arguments.singleOrNull()?.type)) {
|
||||
Errors.ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR
|
||||
} else {
|
||||
Errors.ANNOTATION_ARGUMENT_MUST_BE_KCLASS_LITERAL
|
||||
}
|
||||
}
|
||||
else -> Errors.ANNOTATION_ARGUMENT_MUST_BE_CONST
|
||||
}
|
||||
|
||||
@@ -177,6 +183,8 @@ class ConstantExpressionEvaluator(
|
||||
} else {
|
||||
trace.report(Errors.ANNOTATION_ARGUMENT_MUST_BE_KCLASS_LITERAL.on(argumentExpression))
|
||||
}
|
||||
} else if (doubleColonLhs is DoubleColonLHS.Type && isTypeParameterOrArrayOfTypeParameter(doubleColonLhs.type)) {
|
||||
trace.report(Errors.ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER.on(argumentExpression))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -324,6 +332,13 @@ class ConstantExpressionEvaluator(
|
||||
fun getPossiblyErrorConstant(expression: KtExpression, bindingContext: BindingContext): CompileTimeConstant<*>? {
|
||||
return bindingContext.get(BindingContext.COMPILE_TIME_VALUE, expression)
|
||||
}
|
||||
|
||||
internal fun isTypeParameterOrArrayOfTypeParameter(type: KotlinType?): Boolean =
|
||||
when {
|
||||
type == null -> false
|
||||
KotlinBuiltIns.isArray(type) -> isTypeParameterOrArrayOfTypeParameter(type.arguments.singleOrNull()?.type)
|
||||
else -> type.constructor.declarationDescriptor is TypeParameterDescriptor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,6 +351,7 @@ private class ConstantExpressionEvaluatorVisitor(
|
||||
private val constantExpressionEvaluator: ConstantExpressionEvaluator,
|
||||
private val trace: BindingTrace
|
||||
) : KtVisitor<CompileTimeConstant<*>?, KotlinType>() {
|
||||
private val languageVersionSettings = constantExpressionEvaluator.languageVersionSettings
|
||||
private val builtIns = constantExpressionEvaluator.module.builtIns
|
||||
|
||||
fun evaluate(expression: KtExpression, expectedType: KotlinType?): CompileTimeConstant<*>? {
|
||||
@@ -613,7 +629,8 @@ private class ConstantExpressionEvaluatorVisitor(
|
||||
trace.report(Errors.DIVISION_BY_ZERO.on(parentExpression))
|
||||
|
||||
if ((isIntegerType(argumentForReceiver.value) && isIntegerType(argumentForParameter.value)) ||
|
||||
!constantExpressionEvaluator.languageVersionSettings.supportsFeature(LanguageFeature.DivisionByZeroInConstantExpressions)) {
|
||||
!languageVersionSettings.supportsFeature(LanguageFeature.DivisionByZeroInConstantExpressions)
|
||||
) {
|
||||
return ErrorValue.create("Division by zero").wrap()
|
||||
}
|
||||
}
|
||||
@@ -883,11 +900,19 @@ private class ConstantExpressionEvaluatorVisitor(
|
||||
}
|
||||
|
||||
override fun visitClassLiteralExpression(expression: KtClassLiteralExpression, expectedType: KotlinType?): CompileTimeConstant<*>? {
|
||||
val type = trace.getType(expression)!!
|
||||
if (type.isError) return null
|
||||
val descriptor = type.constructor.declarationDescriptor
|
||||
val kClassType = trace.getType(expression)!!
|
||||
if (kClassType.isError) return null
|
||||
val descriptor = kClassType.constructor.declarationDescriptor
|
||||
if (descriptor !is ClassDescriptor || !KotlinBuiltIns.isKClass(descriptor)) return null
|
||||
return KClassValue.create(type.arguments.first().type)?.wrap()
|
||||
|
||||
val type = kClassType.arguments.singleOrNull()?.type ?: return null
|
||||
if (languageVersionSettings.supportsFeature(LanguageFeature.ProhibitTypeParametersInClassLiteralsInAnnotationArguments) &&
|
||||
ConstantExpressionEvaluator.isTypeParameterOrArrayOfTypeParameter(type)
|
||||
) {
|
||||
return null
|
||||
}
|
||||
|
||||
return KClassValue.create(type)?.wrap()
|
||||
}
|
||||
|
||||
private fun resolveArguments(valueArguments: List<ValueArgument>, expectedType: KotlinType): List<CompileTimeConstant<*>?> {
|
||||
@@ -983,12 +1008,7 @@ private class ConstantExpressionEvaluatorVisitor(
|
||||
parameters: CompileTimeConstant.Parameters,
|
||||
expectedType: KotlinType
|
||||
): CompileTimeConstant<*>? {
|
||||
if (parameters.isUnsignedNumberLiteral &&
|
||||
!checkAccessibilityOfUnsignedTypes(
|
||||
constantExpressionEvaluator.module,
|
||||
constantExpressionEvaluator.languageVersionSettings
|
||||
)
|
||||
) {
|
||||
if (parameters.isUnsignedNumberLiteral && !checkAccessibilityOfUnsignedTypes()) {
|
||||
return UnsignedErrorValueTypeConstant(value, parameters)
|
||||
}
|
||||
|
||||
@@ -1019,8 +1039,8 @@ private class ConstantExpressionEvaluatorVisitor(
|
||||
}.wrap(parameters)
|
||||
}
|
||||
|
||||
private fun checkAccessibilityOfUnsignedTypes(module: ModuleDescriptor, languageVersionSettings: LanguageVersionSettings): Boolean {
|
||||
val uInt = module.findClassAcrossModuleDependencies(KotlinBuiltIns.FQ_NAMES.uInt) ?: return false
|
||||
private fun checkAccessibilityOfUnsignedTypes(): Boolean {
|
||||
val uInt = constantExpressionEvaluator.module.findClassAcrossModuleDependencies(KotlinBuiltIns.FQ_NAMES.uInt) ?: return false
|
||||
val accessibility = uInt.checkSinceKotlinVersionAccessibility(languageVersionSettings)
|
||||
// Case `NotAccessibleButWasExperimental` will be checked later in `checkExperimentalityOfConstantLiteral`
|
||||
return accessibility is SinceKotlinAccessibility.Accessible
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.jetbrains.kotlin.resolve.calls.inference.CallHandle;
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystem;
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilderImpl;
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker;
|
||||
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -41,11 +40,6 @@ public class TypeIntersector {
|
||||
return intersectTypes(new LinkedHashSet<>(Arrays.asList(typeA, typeB))) == null;
|
||||
}
|
||||
|
||||
public static boolean isIncompatibleEnums(@NotNull KotlinType typeA, @NotNull KotlinType typeB) {
|
||||
if (!TypeUtilsKt.isEnum(typeA) || !TypeUtilsKt.isEnum(typeB)) return false;
|
||||
return !typeA.getConstructor().equals(typeB.getConstructor());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static KotlinType intersectTypes(@NotNull Collection<KotlinType> types) {
|
||||
assert !types.isEmpty() : "Attempting to intersect empty collection of types, this case should be dealt with on the call site.";
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.types
|
||||
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext
|
||||
import org.jetbrains.kotlin.types.typeUtil.*
|
||||
|
||||
fun checkEnumsForCompatibility(context: ExpressionTypingContext, reportOn: KtElement, typeA: KotlinType, typeB: KotlinType) {
|
||||
if (isIncompatibleEnums(typeA, typeB)) {
|
||||
val diagnostic = if (context.languageVersionSettings.supportsFeature(LanguageFeature.ProhibitComparisonOfIncompatibleEnums)) {
|
||||
Errors.INCOMPATIBLE_ENUM_COMPARISON_ERROR
|
||||
} else {
|
||||
Errors.INCOMPATIBLE_ENUM_COMPARISON
|
||||
}
|
||||
|
||||
context.trace.report(diagnostic.on(reportOn, typeA, typeB))
|
||||
}
|
||||
}
|
||||
|
||||
private fun isIncompatibleEnums(typeA: KotlinType, typeB: KotlinType): Boolean {
|
||||
if (!typeA.isEnum() && !typeB.isEnum()) return false
|
||||
if (TypeUtils.isNullableType(typeA) && TypeUtils.isNullableType(typeB)) return false
|
||||
|
||||
// TODO: remove this line once KT-30266 will be fixed
|
||||
// For now, this check is needed as isSubClass contains bug wrt Nothing
|
||||
if (typeA.isNothingOrNullableNothing() || typeB.isNothingOrNullableNothing()) return false
|
||||
|
||||
val representativeTypeA = typeA.representativeTypeForTypeParameter()
|
||||
val representativeTypeB = typeB.representativeTypeForTypeParameter()
|
||||
|
||||
val classA = representativeTypeA.constructor.declarationDescriptor as? ClassDescriptor ?: return false
|
||||
val classB = representativeTypeB.constructor.declarationDescriptor as? ClassDescriptor ?: return false
|
||||
|
||||
return !DescriptorUtils.isSubclass(classA, classB) && !DescriptorUtils.isSubclass(classB, classA)
|
||||
}
|
||||
|
||||
private fun KotlinType.representativeTypeForTypeParameter(): KotlinType {
|
||||
val descriptor = constructor.declarationDescriptor
|
||||
return if (descriptor is TypeParameterDescriptor) descriptor.representativeUpperBound else this
|
||||
}
|
||||
@@ -1430,10 +1430,10 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
if (rightType != null) {
|
||||
if (TypeIntersector.isIntersectionEmpty(leftType, rightType)) {
|
||||
context.trace.report(EQUALITY_NOT_APPLICABLE.on(expression, expression.getOperationReference(), leftType, rightType));
|
||||
} else {
|
||||
EnumCompatibilityCheckerKt.checkEnumsForCompatibility(context, expression, leftType, rightType);
|
||||
}
|
||||
else if (TypeIntersector.isIncompatibleEnums(leftType, rightType)) {
|
||||
context.trace.report(INCOMPATIBLE_ENUM_COMPARISON.on(expression, leftType, rightType));
|
||||
}
|
||||
|
||||
|
||||
SenselessComparisonChecker.checkSenselessComparisonWithNull(
|
||||
expression, left, right, context,
|
||||
|
||||
@@ -684,9 +684,7 @@ class PatternMatchingTypingVisitor internal constructor(facade: ExpressionTyping
|
||||
return
|
||||
}
|
||||
|
||||
if (TypeIntersector.isIncompatibleEnums(type, subjectType)) {
|
||||
context.trace.report(INCOMPATIBLE_ENUM_COMPARISON.on(reportErrorOn, subjectType, type))
|
||||
}
|
||||
checkEnumsForCompatibility(context, reportErrorOn, subjectType, type)
|
||||
|
||||
// check if the pattern is essentially a 'null' expression
|
||||
if (KotlinBuiltIns.isNullableNothing(type) && !TypeUtils.isNullableType(subjectType)) {
|
||||
|
||||
@@ -6,18 +6,18 @@
|
||||
package org.jetbrains.kotlin.backend.common.descriptors
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.impl.ReceiverParameterDescriptorImpl
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrClassSymbolImpl
|
||||
import org.jetbrains.kotlin.ir.types.classifierOrFail
|
||||
import org.jetbrains.kotlin.ir.types.toKotlinType
|
||||
import org.jetbrains.kotlin.ir.util.defaultType
|
||||
import org.jetbrains.kotlin.ir.util.dump
|
||||
import org.jetbrains.kotlin.ir.util.isAnnotationClass
|
||||
import org.jetbrains.kotlin.ir.util.parentAsClass
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.constants.*
|
||||
@@ -41,13 +41,20 @@ abstract class WrappedDeclarationDescriptor<T : IrDeclaration>(annotations: Anno
|
||||
|
||||
private val annotationsFromOwner by lazy {
|
||||
val ownerAnnotations = (owner as? IrAnnotationContainer)?.annotations ?: return@lazy Annotations.EMPTY
|
||||
Annotations.create(ownerAnnotations.map { call ->
|
||||
AnnotationDescriptorImpl(
|
||||
call.symbol.owner.parentAsClass.defaultType.toKotlinType(),
|
||||
call.symbol.owner.valueParameters.associate { it.name to call.getValueArgument(it.index)!!.toConstantValue() },
|
||||
/*TODO*/ SourceElement.NO_SOURCE
|
||||
)
|
||||
})
|
||||
Annotations.create(ownerAnnotations.map { it.toAnnotationDescriptor() })
|
||||
}
|
||||
|
||||
private fun IrCall.toAnnotationDescriptor(): AnnotationDescriptor {
|
||||
assert(symbol.owner is IrConstructor && symbol.owner.parentAsClass.isAnnotationClass) {
|
||||
"Expected call to constructor of annotation class but was: ${this.dump()}"
|
||||
}
|
||||
return AnnotationDescriptorImpl(
|
||||
symbol.owner.parentAsClass.defaultType.toKotlinType(),
|
||||
symbol.owner.valueParameters.map { it.name to getValueArgument(it.index) }
|
||||
.filter { it.second != null }
|
||||
.associate { it.first to it.second!!.toConstantValue() },
|
||||
/*TODO*/ SourceElement.NO_SOURCE
|
||||
)
|
||||
}
|
||||
|
||||
private fun IrElement.toConstantValue(): ConstantValue<*> {
|
||||
@@ -77,7 +84,9 @@ abstract class WrappedDeclarationDescriptor<T : IrDeclaration>(annotations: Anno
|
||||
|
||||
this is IrClassReference -> KClassValue(classType.classifierOrFail.descriptor.classId!!, /*TODO*/0)
|
||||
|
||||
else -> error("$this is not expected")
|
||||
this is IrCall -> AnnotationValue(this.toAnnotationDescriptor())
|
||||
|
||||
else -> error("$this is not expected: ${this.dump()}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -583,7 +592,7 @@ open class WrappedClassDescriptor(
|
||||
private val _typeConstructor: TypeConstructor by lazy {
|
||||
LazyTypeConstructor(
|
||||
this,
|
||||
{ emptyList() },
|
||||
{ owner.typeParameters.map { it.descriptor } },
|
||||
{ owner.superTypes.map { it.toKotlinType() } },
|
||||
LockBasedStorageManager.NO_LOCKS
|
||||
)
|
||||
|
||||
@@ -271,3 +271,42 @@ fun IrBuilderWithScope.irSetField(receiver: IrExpression, irField: IrField, valu
|
||||
value = value,
|
||||
type = context.irBuiltIns.unitType
|
||||
)
|
||||
|
||||
inline fun IrBuilderWithScope.irBlock(
|
||||
startOffset: Int = this.startOffset,
|
||||
endOffset: Int = this.endOffset,
|
||||
origin: IrStatementOrigin? = null,
|
||||
resultType: IrType? = null,
|
||||
body: IrBlockBuilder.() -> Unit
|
||||
): IrExpression =
|
||||
IrBlockBuilder(
|
||||
context, scope,
|
||||
startOffset,
|
||||
endOffset,
|
||||
origin, resultType
|
||||
).block(body)
|
||||
|
||||
inline fun IrBuilderWithScope.irComposite(
|
||||
startOffset: Int = this.startOffset,
|
||||
endOffset: Int = this.endOffset,
|
||||
origin: IrStatementOrigin? = null,
|
||||
resultType: IrType? = null,
|
||||
body: IrBlockBuilder.() -> Unit
|
||||
): IrExpression =
|
||||
IrBlockBuilder(
|
||||
context, scope,
|
||||
startOffset,
|
||||
endOffset,
|
||||
origin, resultType, true
|
||||
).block(body)
|
||||
|
||||
inline fun IrBuilderWithScope.irBlockBody(
|
||||
startOffset: Int = this.startOffset,
|
||||
endOffset: Int = this.endOffset,
|
||||
body: IrBlockBodyBuilder.() -> Unit
|
||||
): IrBlockBody =
|
||||
IrBlockBodyBuilder(
|
||||
context, scope,
|
||||
startOffset,
|
||||
endOffset
|
||||
).blockBody(body)
|
||||
|
||||
@@ -143,8 +143,7 @@ fun <T : IrBuilder> T.at(startOffset: Int, endOffset: Int) = apply {
|
||||
}
|
||||
|
||||
inline fun IrGeneratorWithScope.irBlock(
|
||||
startOffset: Int = UNDEFINED_OFFSET,
|
||||
endOffset: Int = UNDEFINED_OFFSET,
|
||||
startOffset: Int, endOffset: Int,
|
||||
origin: IrStatementOrigin? = null,
|
||||
resultType: IrType? = null,
|
||||
body: IrBlockBuilder.() -> Unit
|
||||
@@ -157,8 +156,7 @@ inline fun IrGeneratorWithScope.irBlock(
|
||||
).block(body)
|
||||
|
||||
inline fun IrGeneratorWithScope.irComposite(
|
||||
startOffset: Int = UNDEFINED_OFFSET,
|
||||
endOffset: Int = UNDEFINED_OFFSET,
|
||||
startOffset: Int, endOffset: Int,
|
||||
origin: IrStatementOrigin? = null,
|
||||
resultType: IrType? = null,
|
||||
body: IrBlockBuilder.() -> Unit
|
||||
@@ -171,7 +169,7 @@ inline fun IrGeneratorWithScope.irComposite(
|
||||
).block(body)
|
||||
|
||||
inline fun IrGeneratorWithScope.irBlockBody(
|
||||
startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET,
|
||||
startOffset: Int, endOffset: Int,
|
||||
body: IrBlockBodyBuilder.() -> Unit
|
||||
): IrBlockBody =
|
||||
IrBlockBodyBuilder(
|
||||
|
||||
@@ -431,6 +431,9 @@ fun PsiElement.before(element: PsiElement) = textRange.endOffset <= element.text
|
||||
|
||||
inline fun <reified T : PsiElement> PsiElement.getLastParentOfTypeInRow() = parents.takeWhile { it is T }.lastOrNull() as? T
|
||||
|
||||
inline fun <reified T : PsiElement> PsiElement.getLastParentOfTypeInRowWithSelf() = parentsWithSelf
|
||||
.takeWhile { it is T }.lastOrNull() as? T
|
||||
|
||||
fun KtModifierListOwner.hasExpectModifier() = hasModifier(KtTokens.HEADER_KEYWORD) || hasModifier(KtTokens.EXPECT_KEYWORD)
|
||||
fun KtModifierList.hasExpectModifier() = hasModifier(KtTokens.HEADER_KEYWORD) || hasModifier(KtTokens.EXPECT_KEYWORD)
|
||||
|
||||
|
||||
2
compiler/testData/cli/jvm/help.out
vendored
2
compiler/testData/cli/jvm/help.out
vendored
@@ -5,7 +5,7 @@ where possible options include:
|
||||
-include-runtime Include Kotlin runtime in to resulting .jar
|
||||
-java-parameters Generate metadata for Java 1.8 reflection on method parameters
|
||||
-jdk-home <path> Path to JDK home directory to include into classpath, if differs from default JAVA_HOME
|
||||
-jvm-target <version> Target version of the generated JVM bytecode (1.6 or 1.8), default is 1.6
|
||||
-jvm-target <version> Target version of the generated JVM bytecode (1.6, 1.8, 9, 10, 11 or 12), default is 1.6
|
||||
-module-name <name> Name of the generated .kotlin_module file
|
||||
-no-jdk Don't include Java runtime into classpath
|
||||
-no-reflect Don't include kotlin-reflect.jar into classpath
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
error: unknown JVM target version: 1.5
|
||||
Supported versions: 1.6, 1.8
|
||||
Supported versions: 1.6, 1.8, 9, 10, 11, 12
|
||||
COMPILATION_ERROR
|
||||
|
||||
41
compiler/testData/codegen/box/jvmPackageName/multifileClass.kt
vendored
Normal file
41
compiler/testData/codegen/box/jvmPackageName/multifileClass.kt
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: A1.kt
|
||||
|
||||
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
@file:JvmPackageName("baz.foo.quux.bar")
|
||||
@file:JvmName("Facade")
|
||||
@file:JvmMultifileClass
|
||||
package foo.bar
|
||||
|
||||
val g: S? get() = f().substring(0, 0) + "K"
|
||||
|
||||
// FILE: A2.kt
|
||||
|
||||
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
@file:JvmPackageName("baz.foo.quux.bar")
|
||||
@file:JvmName("Facade")
|
||||
@file:JvmMultifileClass
|
||||
package foo.bar
|
||||
|
||||
inline fun <T> i(block: () -> T): T = block()
|
||||
|
||||
// FILE: A3.kt
|
||||
|
||||
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
@file:JvmPackageName("baz.foo.quux.bar")
|
||||
@file:JvmName("Facade")
|
||||
@file:JvmMultifileClass
|
||||
package foo.bar
|
||||
|
||||
typealias S = String
|
||||
|
||||
fun f(): String = "O"
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
import foo.bar.*
|
||||
|
||||
fun box(): S = i { f() + g }
|
||||
18
compiler/testData/codegen/box/multiplatform/defaultArguments/dispatchReceiverValue.kt
vendored
Normal file
18
compiler/testData/codegen/box/multiplatform/defaultArguments/dispatchReceiverValue.kt
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
// FILE: common.kt
|
||||
|
||||
expect class C {
|
||||
val value: String
|
||||
|
||||
fun test(result: String = value): String
|
||||
}
|
||||
|
||||
// FILE: platform.kt
|
||||
|
||||
actual class C(actual val value: String) {
|
||||
actual fun test(result: String): String = result
|
||||
}
|
||||
|
||||
fun box() = C("Fail").test("OK")
|
||||
16
compiler/testData/codegen/box/multiplatform/defaultArguments/extensionReceiverValue.kt
vendored
Normal file
16
compiler/testData/codegen/box/multiplatform/defaultArguments/extensionReceiverValue.kt
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
// FILE: common.kt
|
||||
|
||||
class Receiver(val value: String)
|
||||
|
||||
expect fun Receiver.test(result: String = value): String
|
||||
|
||||
// FILE: platform.kt
|
||||
|
||||
actual fun Receiver.test(result: String): String {
|
||||
return result
|
||||
}
|
||||
|
||||
fun box() = Receiver("Fail").test("OK")
|
||||
17
compiler/testData/codegen/box/multiplatform/defaultArguments/parametersInArgumentValues.kt
vendored
Normal file
17
compiler/testData/codegen/box/multiplatform/defaultArguments/parametersInArgumentValues.kt
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
// FILE: common.kt
|
||||
|
||||
class B(val value: Int)
|
||||
|
||||
expect fun test(a: Int = 2, b: Int = B(a * 2).value, c: String = "${b}$a"): String
|
||||
|
||||
// FILE: platform.kt
|
||||
|
||||
actual fun test(a: Int, b: Int, c: String): String = c
|
||||
|
||||
fun box(): String {
|
||||
val result = test()
|
||||
return if (result == "42") "OK" else "Fail: $result"
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
// FILE: 1.kt
|
||||
|
||||
class C(val s1: String, val s2: String)
|
||||
|
||||
expect fun C.test(r1: () -> String = { s1 }, r2: () -> String = this::s2): String
|
||||
|
||||
actual inline fun C.test(r1: () -> String, r2: () -> String): String = r1() + r2()
|
||||
|
||||
|
||||
expect class D {
|
||||
val s1: String
|
||||
val s2: String
|
||||
|
||||
fun test(r1: () -> String = { s1 }, r2: () -> String = this::s2): String
|
||||
}
|
||||
|
||||
actual class D(actual val s1: String, actual val s2: String) {
|
||||
actual inline fun test(r1: () -> String, r2: () -> String): String = r1() + r2()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
fun box(): String {
|
||||
if (C("O", "K").test() != "OK") return "Fail extension receiver"
|
||||
if (D("O", "K").test() != "OK") return "Fail dispatch receiver"
|
||||
return "OK"
|
||||
}
|
||||
25
compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameMultifileClass.kt
vendored
Normal file
25
compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameMultifileClass.kt
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: A.kt
|
||||
|
||||
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
@file:JvmPackageName("baz.foo.quux.bar")
|
||||
@file:JvmName("Facade")
|
||||
@file:JvmMultifileClass
|
||||
package foo.bar
|
||||
|
||||
typealias S = String
|
||||
|
||||
fun f(): String = "O"
|
||||
|
||||
val g: S? get() = f().substring(0, 0) + "K"
|
||||
|
||||
inline fun <T> i(block: () -> T): T = block()
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
import foo.bar.*
|
||||
|
||||
fun box(): S = i { f() + g }
|
||||
@@ -1,4 +1,4 @@
|
||||
// WITH_REFLECT
|
||||
// !LANGUAGE: +ProhibitTypeParametersInClassLiteralsInAnnotationArguments
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
@@ -35,4 +35,11 @@ fun test7() {}
|
||||
fun test8() {}
|
||||
|
||||
inline val <reified T> T.test9
|
||||
get() = @Ann(T::class) object {}
|
||||
get() = @AnnArray(<!NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION!>arrayOf(
|
||||
<!ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR!>T::class<!>,
|
||||
<!ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR!>Array<T>::class<!>,
|
||||
<!ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR!>Array<Array<Array<T>>>::class<!>
|
||||
)<!>) object {}
|
||||
|
||||
inline val <reified T> T.test10
|
||||
get() = @AnnArray(<!NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION!>[<!ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR!>T::class<!>]<!>) object {}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package
|
||||
|
||||
public val </*0*/ reified T> T.test10: kotlin.Any
|
||||
public val </*0*/ reified T> T.test9: kotlin.Any
|
||||
public fun foo(): kotlin.String
|
||||
@Ann(k = kotlin.String::class) public fun test1(): kotlin.Unit
|
||||
|
||||
12
compiler/testData/diagnostics/tests/classLiteral/inAnnotationArguments_noTypeParams.kt
vendored
Normal file
12
compiler/testData/diagnostics/tests/classLiteral/inAnnotationArguments_noTypeParams.kt
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// !LANGUAGE: -ProhibitTypeParametersInClassLiteralsInAnnotationArguments
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
annotation class Ann(vararg val k: KClass<*>)
|
||||
|
||||
inline val <reified T> T.test
|
||||
get() = @Ann(
|
||||
<!ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER!>T::class<!>,
|
||||
<!ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER!>Array<T>::class<!>,
|
||||
<!ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER!>Array<Array<Array<T>>>::class<!>
|
||||
) object {}
|
||||
11
compiler/testData/diagnostics/tests/classLiteral/inAnnotationArguments_noTypeParams.txt
vendored
Normal file
11
compiler/testData/diagnostics/tests/classLiteral/inAnnotationArguments_noTypeParams.txt
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
package
|
||||
|
||||
public val </*0*/ reified T> T.test: kotlin.Any
|
||||
|
||||
public final annotation class Ann : kotlin.Annotation {
|
||||
public constructor Ann(/*0*/ vararg k: kotlin.reflect.KClass<*> /*kotlin.Array<out kotlin.reflect.KClass<*>>*/)
|
||||
public final val k: kotlin.Array<out kotlin.reflect.KClass<*>>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
// !LANGUAGE: -ProhibitComparisonOfIncompatibleEnums
|
||||
|
||||
enum class E1 {
|
||||
A, B
|
||||
}
|
||||
@@ -56,3 +58,88 @@ fun foo3(e1: Enum<E1>, e2: Enum<E2>, e: Enum<*>) {
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
interface MyInterface
|
||||
open class MyOpenClass
|
||||
|
||||
fun foo4(e1: E1, i: MyInterface, c: MyOpenClass) {
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON!>e1 == i<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON!>i == e1<!>
|
||||
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON!>e1 == c<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON!>c == e1<!>
|
||||
|
||||
when (e1) {
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON!>i<!> -> {}
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON!>c<!> -> {}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
enum class E3 : MyInterface { X, Y }
|
||||
|
||||
fun foo5(i: MyInterface, a: Any) {
|
||||
E3.X == E3.Y
|
||||
E3.X == i
|
||||
E3.X == a
|
||||
}
|
||||
|
||||
fun foo6(e1: E1?, e2: E2) {
|
||||
<!SENSELESS_COMPARISON!>E1.A == null<!>
|
||||
<!SENSELESS_COMPARISON!>null == E1.A<!>
|
||||
e1 == null
|
||||
null == e1
|
||||
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON!>e1 == E2.A<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON!>E2.A == e1<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON!>e1 == e2<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON!>e2 == e1<!>
|
||||
|
||||
<!SENSELESS_COMPARISON!>e2 == null<!>
|
||||
<!SENSELESS_COMPARISON!>null == e2<!>
|
||||
<!SENSELESS_COMPARISON!>E1.A == null<!>
|
||||
<!SENSELESS_COMPARISON!>null == E1.A<!>
|
||||
}
|
||||
|
||||
fun foo7(e1: E1?, e2: E2?) {
|
||||
e1 == e2 // There should be an IDE-inspection for such cases
|
||||
}
|
||||
|
||||
fun <T> foo8(e1: E1?, e2: E2, t: T) {
|
||||
e1 == t
|
||||
t == e1
|
||||
|
||||
e2 == t
|
||||
t == e2
|
||||
|
||||
E1.A == t
|
||||
t == E1.A
|
||||
}
|
||||
|
||||
fun <T, K> foo9(e1: E1?, e2: E2, t: T, k: K) where T : MyInterface, T : MyOpenClass, K : MyInterface {
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON!>e1 == t<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON!>t == e1<!>
|
||||
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON!>e2 == t<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON!>t == e2<!>
|
||||
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON!>E1.A == t<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON!>t == E1.A<!>
|
||||
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON!>E3.X == t<!>
|
||||
|
||||
E3.X == k
|
||||
k == E3.X
|
||||
}
|
||||
|
||||
interface Inv<T>
|
||||
|
||||
enum class E4 : Inv<Int> { A }
|
||||
|
||||
fun foo10(e4: E4, invString: Inv<String>) {
|
||||
e4 == invString
|
||||
invString == e4
|
||||
|
||||
E4.A == invString
|
||||
invString == E4.A
|
||||
}
|
||||
@@ -1,8 +1,15 @@
|
||||
package
|
||||
|
||||
public fun foo1(/*0*/ e1: E1, /*1*/ e2: E2): kotlin.Unit
|
||||
public fun foo10(/*0*/ e4: E4, /*1*/ invString: Inv<kotlin.String>): kotlin.Unit
|
||||
public fun foo2(/*0*/ e1: E1, /*1*/ e2: E2): kotlin.Unit
|
||||
public fun foo3(/*0*/ e1: kotlin.Enum<E1>, /*1*/ e2: kotlin.Enum<E2>, /*2*/ e: kotlin.Enum<*>): kotlin.Unit
|
||||
public fun foo4(/*0*/ e1: E1, /*1*/ i: MyInterface, /*2*/ c: MyOpenClass): kotlin.Unit
|
||||
public fun foo5(/*0*/ i: MyInterface, /*1*/ a: kotlin.Any): kotlin.Unit
|
||||
public fun foo6(/*0*/ e1: E1?, /*1*/ e2: E2): kotlin.Unit
|
||||
public fun foo7(/*0*/ e1: E1?, /*1*/ e2: E2?): kotlin.Unit
|
||||
public fun </*0*/ T> foo8(/*0*/ e1: E1?, /*1*/ e2: E2, /*2*/ t: T): kotlin.Unit
|
||||
public fun </*0*/ T : MyInterface, /*1*/ K : MyInterface> foo9(/*0*/ e1: E1?, /*1*/ e2: E2, /*2*/ t: T, /*3*/ k: K): kotlin.Unit where T : MyOpenClass
|
||||
|
||||
public final enum class E1 : kotlin.Enum<E1> {
|
||||
enum entry A
|
||||
@@ -45,3 +52,62 @@ public final enum class E2 : kotlin.Enum<E2> {
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): E2
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<E2>
|
||||
}
|
||||
|
||||
public final enum class E3 : kotlin.Enum<E3>, MyInterface {
|
||||
enum entry X
|
||||
|
||||
enum entry Y
|
||||
|
||||
private constructor E3()
|
||||
public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: E3): kotlin.Int
|
||||
public final override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<E3!>!
|
||||
public final override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): E3
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<E3>
|
||||
}
|
||||
|
||||
public final enum class E4 : kotlin.Enum<E4>, Inv<kotlin.Int> {
|
||||
enum entry A
|
||||
|
||||
private constructor E4()
|
||||
public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: E4): kotlin.Int
|
||||
public final override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<E4!>!
|
||||
public final override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): E4
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<E4>
|
||||
}
|
||||
|
||||
public interface Inv</*0*/ T> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface MyInterface {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class MyOpenClass {
|
||||
public constructor MyOpenClass()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
145
compiler/testData/diagnostics/tests/enum/incompatibleEnums_1_4.kt
vendored
Normal file
145
compiler/testData/diagnostics/tests/enum/incompatibleEnums_1_4.kt
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
// !LANGUAGE: +ProhibitComparisonOfIncompatibleEnums
|
||||
|
||||
enum class E1 {
|
||||
A, B
|
||||
}
|
||||
|
||||
enum class E2 {
|
||||
A, B
|
||||
}
|
||||
|
||||
fun foo1(e1: E1, e2: E2) {
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>e1 == e2<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>e1 != e2<!>
|
||||
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>e1 == E2.A<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>E1.B == e2<!>
|
||||
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>E1.A == E2.B<!>
|
||||
|
||||
e1 == E1.A
|
||||
E1.A == e1
|
||||
e2 == E2.B
|
||||
E2.B == e2
|
||||
}
|
||||
|
||||
fun foo2(e1: E1, e2: E2) {
|
||||
when (e1) {
|
||||
E1.A -> {}
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>E2.A<!> -> {}
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>E2.B<!> -> {}
|
||||
e1 -> {}
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>e2<!> -> {}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
fun foo3(e1: Enum<E1>, e2: Enum<E2>, e: Enum<*>) {
|
||||
e1 == e
|
||||
e1 == e2
|
||||
|
||||
e1 == E1.A
|
||||
e1 == E2.A
|
||||
|
||||
when (e1) {
|
||||
e1 -> {}
|
||||
e2 -> {}
|
||||
e -> {}
|
||||
E1.A -> {}
|
||||
E2.A -> {}
|
||||
else -> {}
|
||||
}
|
||||
|
||||
when (e) {
|
||||
e -> {}
|
||||
e2 -> {}
|
||||
E1.A -> {}
|
||||
E2.A -> {}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
interface MyInterface
|
||||
open class MyOpenClass
|
||||
|
||||
fun foo4(e1: E1, i: MyInterface, c: MyOpenClass) {
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>e1 == i<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>i == e1<!>
|
||||
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>e1 == c<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>c == e1<!>
|
||||
|
||||
when (e1) {
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>i<!> -> {}
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>c<!> -> {}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
enum class E3 : MyInterface { X, Y }
|
||||
|
||||
fun foo5(i: MyInterface, a: Any) {
|
||||
E3.X == E3.Y
|
||||
E3.X == i
|
||||
E3.X == a
|
||||
}
|
||||
|
||||
fun foo6(e1: E1?, e2: E2) {
|
||||
<!SENSELESS_COMPARISON!>E1.A == null<!>
|
||||
<!SENSELESS_COMPARISON!>null == E1.A<!>
|
||||
e1 == null
|
||||
null == e1
|
||||
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>e1 == E2.A<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>E2.A == e1<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>e1 == e2<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>e2 == e1<!>
|
||||
|
||||
<!SENSELESS_COMPARISON!>e2 == null<!>
|
||||
<!SENSELESS_COMPARISON!>null == e2<!>
|
||||
<!SENSELESS_COMPARISON!>E1.A == null<!>
|
||||
<!SENSELESS_COMPARISON!>null == E1.A<!>
|
||||
}
|
||||
|
||||
fun foo7(e1: E1?, e2: E2?) {
|
||||
e1 == e2 // There should be an IDE-inspection for such cases
|
||||
}
|
||||
|
||||
fun <T> foo8(e1: E1?, e2: E2, t: T) {
|
||||
e1 == t
|
||||
t == e1
|
||||
|
||||
e2 == t
|
||||
t == e2
|
||||
|
||||
E1.A == t
|
||||
t == E1.A
|
||||
}
|
||||
|
||||
fun <T, K> foo9(e1: E1?, e2: E2, t: T, k: K) where T : MyInterface, T : MyOpenClass, K : MyInterface {
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>e1 == t<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>t == e1<!>
|
||||
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>e2 == t<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>t == e2<!>
|
||||
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>E1.A == t<!>
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>t == E1.A<!>
|
||||
|
||||
<!INCOMPATIBLE_ENUM_COMPARISON_ERROR!>E3.X == t<!>
|
||||
|
||||
E3.X == k
|
||||
k == E3.X
|
||||
}
|
||||
|
||||
interface Inv<T>
|
||||
|
||||
enum class E4 : Inv<Int> { A }
|
||||
|
||||
fun foo10(e4: E4, invString: Inv<String>) {
|
||||
e4 == invString
|
||||
invString == e4
|
||||
|
||||
E4.A == invString
|
||||
invString == E4.A
|
||||
}
|
||||
113
compiler/testData/diagnostics/tests/enum/incompatibleEnums_1_4.txt
vendored
Normal file
113
compiler/testData/diagnostics/tests/enum/incompatibleEnums_1_4.txt
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
package
|
||||
|
||||
public fun foo1(/*0*/ e1: E1, /*1*/ e2: E2): kotlin.Unit
|
||||
public fun foo10(/*0*/ e4: E4, /*1*/ invString: Inv<kotlin.String>): kotlin.Unit
|
||||
public fun foo2(/*0*/ e1: E1, /*1*/ e2: E2): kotlin.Unit
|
||||
public fun foo3(/*0*/ e1: kotlin.Enum<E1>, /*1*/ e2: kotlin.Enum<E2>, /*2*/ e: kotlin.Enum<*>): kotlin.Unit
|
||||
public fun foo4(/*0*/ e1: E1, /*1*/ i: MyInterface, /*2*/ c: MyOpenClass): kotlin.Unit
|
||||
public fun foo5(/*0*/ i: MyInterface, /*1*/ a: kotlin.Any): kotlin.Unit
|
||||
public fun foo6(/*0*/ e1: E1?, /*1*/ e2: E2): kotlin.Unit
|
||||
public fun foo7(/*0*/ e1: E1?, /*1*/ e2: E2?): kotlin.Unit
|
||||
public fun </*0*/ T> foo8(/*0*/ e1: E1?, /*1*/ e2: E2, /*2*/ t: T): kotlin.Unit
|
||||
public fun </*0*/ T : MyInterface, /*1*/ K : MyInterface> foo9(/*0*/ e1: E1?, /*1*/ e2: E2, /*2*/ t: T, /*3*/ k: K): kotlin.Unit where T : MyOpenClass
|
||||
|
||||
public final enum class E1 : kotlin.Enum<E1> {
|
||||
enum entry A
|
||||
|
||||
enum entry B
|
||||
|
||||
private constructor E1()
|
||||
public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: E1): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<E1!>!
|
||||
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): E1
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<E1>
|
||||
}
|
||||
|
||||
public final enum class E2 : kotlin.Enum<E2> {
|
||||
enum entry A
|
||||
|
||||
enum entry B
|
||||
|
||||
private constructor E2()
|
||||
public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: E2): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<E2!>!
|
||||
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): E2
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<E2>
|
||||
}
|
||||
|
||||
public final enum class E3 : kotlin.Enum<E3>, MyInterface {
|
||||
enum entry X
|
||||
|
||||
enum entry Y
|
||||
|
||||
private constructor E3()
|
||||
public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: E3): kotlin.Int
|
||||
public final override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<E3!>!
|
||||
public final override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): E3
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<E3>
|
||||
}
|
||||
|
||||
public final enum class E4 : kotlin.Enum<E4>, Inv<kotlin.Int> {
|
||||
enum entry A
|
||||
|
||||
private constructor E4()
|
||||
public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: E4): kotlin.Int
|
||||
public final override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<E4!>!
|
||||
public final override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): E4
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<E4>
|
||||
}
|
||||
|
||||
public interface Inv</*0*/ T> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface MyInterface {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class MyOpenClass {
|
||||
public constructor MyOpenClass()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -1,11 +1,5 @@
|
||||
// !DIAGNOSTICS: -INVISIBLE_MEMBER -INVISIBLE_REFERENCE
|
||||
|
||||
// FILE: a.kt
|
||||
<!JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_MULTIFILE_CLASSES!>@file:JvmPackageName("a")<!>
|
||||
@file:JvmMultifileClass
|
||||
package a
|
||||
fun a() {}
|
||||
|
||||
// FILE: b.kt
|
||||
<!JVM_PACKAGE_NAME_CANNOT_BE_EMPTY!>@file:JvmPackageName("")<!>
|
||||
package b
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package
|
||||
|
||||
package a {
|
||||
public fun a(): kotlin.Unit
|
||||
}
|
||||
|
||||
package b {
|
||||
public fun b(): kotlin.Unit
|
||||
}
|
||||
|
||||
7
compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K1_A.kt
vendored
Normal file
7
compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K1_A.kt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@file:JvmPackageName("j1")
|
||||
@file:JvmName("K1")
|
||||
@file:JvmMultifileClass
|
||||
package k1
|
||||
|
||||
fun f1() {}
|
||||
7
compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K1_B.kt
vendored
Normal file
7
compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K1_B.kt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@file:JvmPackageName("j1")
|
||||
@file:JvmName("K1")
|
||||
@file:JvmMultifileClass
|
||||
package k1
|
||||
|
||||
val v2 = Unit
|
||||
7
compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K1_C.kt
vendored
Normal file
7
compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K1_C.kt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@file:JvmPackageName("j1")
|
||||
@file:JvmName("K1")
|
||||
@file:JvmMultifileClass
|
||||
package k1
|
||||
|
||||
typealias T3 = List<String>
|
||||
7
compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K2_A.kt
vendored
Normal file
7
compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K2_A.kt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@file:JvmPackageName("j2")
|
||||
@file:JvmName("K2")
|
||||
@file:JvmMultifileClass
|
||||
package k2
|
||||
|
||||
fun f1() {}
|
||||
7
compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K2_B.kt
vendored
Normal file
7
compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K2_B.kt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@file:JvmPackageName("j3")
|
||||
@file:JvmName("K2")
|
||||
@file:JvmMultifileClass
|
||||
package k2
|
||||
|
||||
val v2 = Unit
|
||||
5
compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K2_C.kt
vendored
Normal file
5
compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K2_C.kt
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
@file:JvmName("K2")
|
||||
@file:JvmMultifileClass
|
||||
package k2
|
||||
|
||||
typealias T3 = List<String>
|
||||
8
compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/module-proto.txt
vendored
Normal file
8
compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/module-proto.txt
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
k1
|
||||
j1/K1__K1_AKt (j1/K1)
|
||||
j1/K1__K1_BKt (j1/K1)
|
||||
j1/K1__K1_CKt (j1/K1)
|
||||
k2
|
||||
k2/K2__K2_CKt (k2/K2)
|
||||
j2/K2__K2_AKt (j2/K2)
|
||||
j3/K2__K2_BKt (j3/K2)
|
||||
@@ -286,7 +286,7 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() {
|
||||
}
|
||||
}
|
||||
|
||||
return result ?: JvmTarget.JVM_1_6
|
||||
return result ?: JvmTarget.DEFAULT
|
||||
}
|
||||
|
||||
private fun checkDynamicCallDescriptors(expectedFile: File, testFiles: List<TestFile>) {
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.jetbrains.kotlin.types.expressions.FakeCallResolver
|
||||
|
||||
fun createContainerForTests(project: Project, module: ModuleDescriptor): ContainerForTests {
|
||||
return ContainerForTests(createContainer("Tests", JvmPlatform) {
|
||||
configureModule(ModuleContext(module, project), JvmPlatform, JvmTarget.JVM_1_6)
|
||||
configureModule(ModuleContext(module, project), JvmPlatform, JvmTarget.DEFAULT)
|
||||
useInstance(LanguageVersionSettingsImpl.DEFAULT)
|
||||
useImpl<AnnotationResolverImpl>()
|
||||
useImpl<ExpressionTypingServices>()
|
||||
|
||||
@@ -2991,6 +2991,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
runTest("compiler/testData/diagnostics/tests/classLiteral/inAnnotationArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inAnnotationArguments_noTypeParams.kt")
|
||||
public void testInAnnotationArguments_noTypeParams() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/classLiteral/inAnnotationArguments_noTypeParams.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("integerValueType.kt")
|
||||
public void testIntegerValueType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/classLiteral/integerValueType.kt");
|
||||
@@ -6928,6 +6933,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/incompatibleEnums.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incompatibleEnums_1_4.kt")
|
||||
public void testIncompatibleEnums_1_4() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/incompatibleEnums_1_4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inheritFromEnumEntry.kt")
|
||||
public void testInheritFromEnumEntry() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/inheritFromEnumEntry.kt");
|
||||
|
||||
@@ -2986,6 +2986,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/classLiteral/inAnnotationArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inAnnotationArguments_noTypeParams.kt")
|
||||
public void testInAnnotationArguments_noTypeParams() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/classLiteral/inAnnotationArguments_noTypeParams.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("integerValueType.kt")
|
||||
public void testIntegerValueType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/classLiteral/integerValueType.kt");
|
||||
@@ -6923,6 +6928,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/enum/incompatibleEnums.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incompatibleEnums_1_4.kt")
|
||||
public void testIncompatibleEnums_1_4() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/incompatibleEnums_1_4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inheritFromEnumEntry.kt")
|
||||
public void testInheritFromEnumEntry() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/enum/inheritFromEnumEntry.kt");
|
||||
|
||||
@@ -14655,6 +14655,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/jvmPackageName/metadataField.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multifileClass.kt")
|
||||
public void testMultifileClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvmPackageName/multifileClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("rootPackage.kt")
|
||||
public void testRootPackage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvmPackageName/rootPackage.kt");
|
||||
@@ -15875,6 +15880,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/delegatedExpectedInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("dispatchReceiverValue.kt")
|
||||
public void testDispatchReceiverValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/dispatchReceiverValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionReceiverValue.kt")
|
||||
public void testExtensionReceiverValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/extensionReceiverValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("function.kt")
|
||||
public void testFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/function.kt");
|
||||
@@ -15930,6 +15945,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/kt23739.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("parametersInArgumentValues.kt")
|
||||
public void testParametersInArgumentValues() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/parametersInArgumentValues.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("superCall.kt")
|
||||
public void testSuperCall() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/superCall.kt");
|
||||
|
||||
@@ -1890,6 +1890,37 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/multiplatform")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Multiplatform extends AbstractBlackBoxInlineCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInMultiplatform() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/multiplatform"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/multiplatform/defaultArguments")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class DefaultArguments extends AbstractBlackBoxInlineCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInDefaultArguments() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/multiplatform/defaultArguments"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("receiversAndParametersInLambda.kt")
|
||||
public void testReceiversAndParametersInLambda() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/multiplatform/defaultArguments/receiversAndParametersInLambda.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/noInline")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -1890,6 +1890,37 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/multiplatform")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Multiplatform extends AbstractCompileKotlinAgainstInlineKotlinTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInMultiplatform() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/multiplatform"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/multiplatform/defaultArguments")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class DefaultArguments extends AbstractCompileKotlinAgainstInlineKotlinTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInDefaultArguments() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/multiplatform/defaultArguments"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("receiversAndParametersInLambda.kt")
|
||||
public void testReceiversAndParametersInLambda() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/multiplatform/defaultArguments/receiversAndParametersInLambda.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/noInline")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -188,6 +188,11 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameInRootPackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("jvmPackageNameMultifileClass.kt")
|
||||
public void testJvmPackageNameMultifileClass() throws Exception {
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameMultifileClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("jvmPackageNameWithJvmName.kt")
|
||||
public void testJvmPackageNameWithJvmName() throws Exception {
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameWithJvmName.kt");
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
import org.jetbrains.kotlin.config.ApiVersion
|
||||
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
||||
import org.jetbrains.kotlin.config.LanguageVersion
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl
|
||||
import org.jetbrains.kotlin.load.kotlin.loadModuleMapping
|
||||
@@ -31,28 +30,28 @@ import java.io.File
|
||||
|
||||
class JvmModuleProtoBufTest : KtUsefulTestCase() {
|
||||
private fun doTest(
|
||||
relativeDirectory: String,
|
||||
compileWith: LanguageVersion = LanguageVersion.LATEST_STABLE,
|
||||
loadWith: LanguageVersion = LanguageVersion.LATEST_STABLE,
|
||||
extraOptions: List<String> = emptyList()
|
||||
relativeDirectory: String,
|
||||
compileWith: LanguageVersion = LanguageVersion.LATEST_STABLE,
|
||||
loadWith: LanguageVersion = LanguageVersion.LATEST_STABLE,
|
||||
extraOptions: List<String> = emptyList()
|
||||
) {
|
||||
val directory = KotlinTestUtils.getTestDataPathBase() + relativeDirectory
|
||||
val tmpdir = KotlinTestUtils.tmpDir(this::class.simpleName)
|
||||
|
||||
val moduleName = "main"
|
||||
CompilerTestUtil.executeCompilerAssertSuccessful(K2JVMCompiler(), listOf(
|
||||
CompilerTestUtil.executeCompilerAssertSuccessful(
|
||||
K2JVMCompiler(), listOf(
|
||||
directory,
|
||||
"-d", tmpdir.path,
|
||||
"-module-name", moduleName,
|
||||
"-language-version", compileWith.versionString
|
||||
) + extraOptions)
|
||||
) + extraOptions
|
||||
)
|
||||
|
||||
val mapping = ModuleMapping.loadModuleMapping(
|
||||
File(tmpdir, "META-INF/$moduleName.${ModuleMapping.MAPPING_FILE_EXT}").readBytes(), "test",
|
||||
CompilerDeserializationConfiguration(
|
||||
LanguageVersionSettingsImpl(loadWith, ApiVersion.createByLanguageVersion(loadWith))
|
||||
),
|
||||
::error
|
||||
File(tmpdir, "META-INF/$moduleName.${ModuleMapping.MAPPING_FILE_EXT}").readBytes(), "test",
|
||||
CompilerDeserializationConfiguration(LanguageVersionSettingsImpl(loadWith, ApiVersion.createByLanguageVersion(loadWith))),
|
||||
::error
|
||||
)
|
||||
val result = buildString {
|
||||
for (annotationClassId in mapping.moduleData.annotations) {
|
||||
@@ -82,18 +81,19 @@ class JvmModuleProtoBufTest : KtUsefulTestCase() {
|
||||
}
|
||||
|
||||
fun testJvmPackageName() {
|
||||
doTest("/moduleProtoBuf/jvmPackageName",
|
||||
compileWith = LanguageVersion.KOTLIN_1_2, loadWith = LanguageVersion.KOTLIN_1_2)
|
||||
doTest("/moduleProtoBuf/jvmPackageName")
|
||||
}
|
||||
|
||||
fun testJvmPackageNameManyParts() {
|
||||
doTest("/moduleProtoBuf/jvmPackageNameManyParts",
|
||||
compileWith = LanguageVersion.KOTLIN_1_2, loadWith = LanguageVersion.KOTLIN_1_2)
|
||||
doTest("/moduleProtoBuf/jvmPackageNameManyParts")
|
||||
}
|
||||
|
||||
fun testJvmPackageNameLanguageVersion11() {
|
||||
doTest("/moduleProtoBuf/jvmPackageNameLanguageVersion11",
|
||||
compileWith = LanguageVersion.KOTLIN_1_2, loadWith = LanguageVersion.KOTLIN_1_1)
|
||||
doTest("/moduleProtoBuf/jvmPackageNameLanguageVersion11", loadWith = LanguageVersion.KOTLIN_1_1)
|
||||
}
|
||||
|
||||
fun testJvmPackageNameMultifileClass() {
|
||||
doTest("/moduleProtoBuf/jvmPackageNameMultifileClass")
|
||||
}
|
||||
|
||||
fun testExperimental() {
|
||||
|
||||
@@ -14655,6 +14655,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/jvmPackageName/metadataField.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multifileClass.kt")
|
||||
public void testMultifileClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvmPackageName/multifileClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("rootPackage.kt")
|
||||
public void testRootPackage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvmPackageName/rootPackage.kt");
|
||||
@@ -15880,6 +15885,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/constructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("dispatchReceiverValue.kt")
|
||||
public void testDispatchReceiverValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/dispatchReceiverValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionReceiverValue.kt")
|
||||
public void testExtensionReceiverValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/extensionReceiverValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("function.kt")
|
||||
public void testFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/function.kt");
|
||||
@@ -15934,6 +15949,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
public void testKt23739() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/kt23739.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("parametersInArgumentValues.kt")
|
||||
public void testParametersInArgumentValues() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/parametersInArgumentValues.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14660,6 +14660,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/jvmPackageName/metadataField.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multifileClass.kt")
|
||||
public void testMultifileClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvmPackageName/multifileClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("rootPackage.kt")
|
||||
public void testRootPackage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/jvmPackageName/rootPackage.kt");
|
||||
@@ -15880,6 +15885,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/delegatedExpectedInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("dispatchReceiverValue.kt")
|
||||
public void testDispatchReceiverValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/dispatchReceiverValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionReceiverValue.kt")
|
||||
public void testExtensionReceiverValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/extensionReceiverValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("function.kt")
|
||||
public void testFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/function.kt");
|
||||
@@ -15935,6 +15950,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/kt23739.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("parametersInArgumentValues.kt")
|
||||
public void testParametersInArgumentValues() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/parametersInArgumentValues.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("superCall.kt")
|
||||
public void testSuperCall() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/defaultArguments/superCall.kt");
|
||||
|
||||
@@ -1890,6 +1890,37 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/multiplatform")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Multiplatform extends AbstractIrBlackBoxInlineCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInMultiplatform() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/multiplatform"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/multiplatform/defaultArguments")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class DefaultArguments extends AbstractIrBlackBoxInlineCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInDefaultArguments() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/multiplatform/defaultArguments"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("receiversAndParametersInLambda.kt")
|
||||
public void testReceiversAndParametersInLambda() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/multiplatform/defaultArguments/receiversAndParametersInLambda.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/noInline")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -100,6 +100,8 @@ enum class LanguageFeature(
|
||||
ProperInlineFromHigherPlatformDiagnostic(KOTLIN_1_4, kind = BUG_FIX),
|
||||
ProhibitRepeatedUseSiteTargetAnnotations(KOTLIN_1_4, kind = BUG_FIX),
|
||||
ProhibitUseSiteTargetAnnotationsOnSuperTypes(KOTLIN_1_4, kind = BUG_FIX),
|
||||
ProhibitTypeParametersInClassLiteralsInAnnotationArguments(KOTLIN_1_4, kind = BUG_FIX),
|
||||
ProhibitComparisonOfIncompatibleEnums(KOTLIN_1_4, kind = BUG_FIX),
|
||||
|
||||
ProperVisibilityForCompanionObjectInstanceField(sinceVersion = null, kind = BUG_FIX),
|
||||
// Temporarily disabled, see KT-27084/KT-22379
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.resolve.unsubstitutedUnderlyingType
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.typeUtil.makeNullable
|
||||
import org.jetbrains.kotlin.types.typeUtil.replaceArgumentsWithStarProjections
|
||||
import org.jetbrains.kotlin.types.typeUtil.representativeUpperBound
|
||||
import org.jetbrains.kotlin.utils.DO_NOTHING_3
|
||||
|
||||
interface JvmTypeFactory<T : Any> {
|
||||
@@ -181,7 +182,7 @@ fun <T : Any> mapType(
|
||||
|
||||
descriptor is TypeParameterDescriptor -> {
|
||||
val type = mapType(
|
||||
getRepresentativeUpperBound(descriptor),
|
||||
descriptor.representativeUpperBound,
|
||||
factory,
|
||||
mode,
|
||||
typeMappingConfiguration,
|
||||
@@ -255,7 +256,7 @@ internal fun computeUnderlyingType(inlineClassType: KotlinType): KotlinType? {
|
||||
|
||||
val descriptor = inlineClassType.unsubstitutedUnderlyingType()?.constructor?.declarationDescriptor ?: return null
|
||||
return if (descriptor is TypeParameterDescriptor)
|
||||
getRepresentativeUpperBound(descriptor)
|
||||
descriptor.representativeUpperBound
|
||||
else
|
||||
inlineClassType.substitutedUnderlyingType()
|
||||
}
|
||||
@@ -270,7 +271,7 @@ internal fun computeExpandedTypeInner(kotlinType: KotlinType, visitedClassifiers
|
||||
|
||||
return when {
|
||||
classifier is TypeParameterDescriptor ->
|
||||
computeExpandedTypeInner(getRepresentativeUpperBound(classifier), visitedClassifiers)
|
||||
computeExpandedTypeInner(classifier.representativeUpperBound, visitedClassifiers)
|
||||
?.let { expandedUpperBound ->
|
||||
if (expandedUpperBound.isNullable() || !kotlinType.isMarkedNullable)
|
||||
expandedUpperBound
|
||||
@@ -338,16 +339,6 @@ fun computeInternalName(
|
||||
private fun getContainer(container: DeclarationDescriptor?): DeclarationDescriptor? =
|
||||
container as? ClassDescriptor ?: container as? PackageFragmentDescriptor ?: container?.let { getContainer(it.containingDeclaration) }
|
||||
|
||||
fun getRepresentativeUpperBound(descriptor: TypeParameterDescriptor): KotlinType {
|
||||
val upperBounds = descriptor.upperBounds
|
||||
assert(!upperBounds.isEmpty()) { "Upper bounds should not be empty: $descriptor" }
|
||||
|
||||
return upperBounds.firstOrNull {
|
||||
val classDescriptor = it.constructor.declarationDescriptor as? ClassDescriptor ?: return@firstOrNull false
|
||||
classDescriptor.kind != ClassKind.INTERFACE && classDescriptor.kind != ClassKind.ANNOTATION_CLASS
|
||||
} ?: upperBounds.first()
|
||||
}
|
||||
|
||||
open class JvmDescriptorTypeWriter<T : Any>(private val jvmTypeFactory: JvmTypeFactory<T>) {
|
||||
private var jvmCurrentTypeArrayLevel: Int = 0
|
||||
protected var jvmCurrentType: T? = null
|
||||
|
||||
@@ -6,15 +6,11 @@
|
||||
package org.jetbrains.kotlin.resolve.jvm
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.load.kotlin.getRepresentativeUpperBound
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
|
||||
import org.jetbrains.kotlin.resolve.isInlineClass
|
||||
import org.jetbrains.kotlin.resolve.isInlineClassType
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import java.security.MessageDigest
|
||||
import java.util.*
|
||||
import org.jetbrains.kotlin.types.typeUtil.representativeUpperBound
|
||||
|
||||
fun shouldHideConstructorDueToInlineClassTypeValueParameters(descriptor: CallableMemberDescriptor): Boolean {
|
||||
val constructorDescriptor = descriptor as? ClassConstructorDescriptor ?: return false
|
||||
@@ -45,5 +41,5 @@ private fun isDontMangleClass(classDescriptor: ClassDescriptor) =
|
||||
|
||||
private fun KotlinType.isTypeParameterWithUpperBoundThatRequiresMangling(): Boolean {
|
||||
val descriptor = constructor.declarationDescriptor as? TypeParameterDescriptor ?: return false
|
||||
return getRepresentativeUpperBound(descriptor).requiresFunctionNameMangling()
|
||||
return descriptor.representativeUpperBound.requiresFunctionNameMangling()
|
||||
}
|
||||
|
||||
@@ -214,10 +214,10 @@ class KClassValue(value: Value) : ConstantValue<KClassValue.Value>(value) {
|
||||
KClassValue(classId, arrayDimensions)
|
||||
}
|
||||
is TypeParameterDescriptor -> {
|
||||
// This is possible if a reified type parameter is used in annotation on a local class / anonymous object.
|
||||
// This is possible before 1.4 if a reified type parameter is used in annotation on a local class / anonymous object.
|
||||
// In JVM class file, we can't represent such literal properly, so we're writing java.lang.Object instead.
|
||||
// This has no effect on the compiler front-end or other back-ends, so we use kotlin.Any for simplicity here.
|
||||
// Overall, it looks like such code should be disallowed: https://youtrack.jetbrains.com/issue/KT-27799
|
||||
// See LanguageFeature.ProhibitTypeParametersInClassLiteralsInAnnotationArguments
|
||||
KClassValue(ClassId.topLevel(KotlinBuiltIns.FQ_NAMES.any.toSafe()), 0)
|
||||
}
|
||||
else -> null
|
||||
|
||||
@@ -384,20 +384,30 @@ public class TypeUtils {
|
||||
public static boolean contains(
|
||||
@Nullable KotlinType type,
|
||||
@NotNull Function1<UnwrappedType, Boolean> isSpecialType
|
||||
) {
|
||||
return contains(type, isSpecialType, new HashSet<KotlinType>());
|
||||
}
|
||||
|
||||
private static boolean contains(
|
||||
@Nullable KotlinType type,
|
||||
@NotNull Function1<UnwrappedType, Boolean> isSpecialType,
|
||||
HashSet<KotlinType> visited
|
||||
) {
|
||||
if (type == null) return false;
|
||||
if (visited.contains(type)) return false;
|
||||
visited.add(type);
|
||||
|
||||
UnwrappedType unwrappedType = type.unwrap();
|
||||
if (isSpecialType.invoke(unwrappedType)) return true;
|
||||
|
||||
FlexibleType flexibleType = unwrappedType instanceof FlexibleType ? (FlexibleType) unwrappedType : null;
|
||||
if (flexibleType != null
|
||||
&& (contains(flexibleType.getLowerBound(), isSpecialType) || contains(flexibleType.getUpperBound(), isSpecialType))) {
|
||||
&& (contains(flexibleType.getLowerBound(), isSpecialType, visited) || contains(flexibleType.getUpperBound(), isSpecialType, visited))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (unwrappedType instanceof DefinitelyNotNullType &&
|
||||
contains(((DefinitelyNotNullType) unwrappedType).getOriginal(), isSpecialType)) {
|
||||
contains(((DefinitelyNotNullType) unwrappedType).getOriginal(), isSpecialType, visited)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -405,13 +415,13 @@ public class TypeUtils {
|
||||
if (typeConstructor instanceof IntersectionTypeConstructor) {
|
||||
IntersectionTypeConstructor intersectionTypeConstructor = (IntersectionTypeConstructor) typeConstructor;
|
||||
for (KotlinType supertype : intersectionTypeConstructor.getSupertypes()) {
|
||||
if (contains(supertype, isSpecialType)) return true;
|
||||
if (contains(supertype, isSpecialType, visited)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
for (TypeProjection projection : type.getArguments()) {
|
||||
if (!projection.isStarProjection() && contains(projection.getType(), isSpecialType)) return true;
|
||||
if (!projection.isStarProjection() && contains(projection.getType(), isSpecialType, visited)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ fun KotlinType.supertypes(): Collection<KotlinType> = TypeUtils.getAllSupertypes
|
||||
|
||||
fun KotlinType.isNothing(): Boolean = KotlinBuiltIns.isNothing(this)
|
||||
fun KotlinType.isNullableNothing(): Boolean = KotlinBuiltIns.isNullableNothing(this)
|
||||
fun KotlinType.isNothingOrNullableNothing(): Boolean = KotlinBuiltIns.isNothingOrNullableNothing(this)
|
||||
fun KotlinType.isUnit(): Boolean = KotlinBuiltIns.isUnit(this)
|
||||
fun KotlinType.isAnyOrNullableAny(): Boolean = KotlinBuiltIns.isAnyOrNullableAny(this)
|
||||
fun KotlinType.isNullableAny(): Boolean = KotlinBuiltIns.isNullableAny(this)
|
||||
@@ -228,3 +229,14 @@ fun UnwrappedType.canHaveUndefinedNullability(): Boolean =
|
||||
constructor is NewTypeVariableConstructor ||
|
||||
constructor.declarationDescriptor is TypeParameterDescriptor ||
|
||||
this is NewCapturedType
|
||||
|
||||
val TypeParameterDescriptor.representativeUpperBound: KotlinType
|
||||
get() {
|
||||
assert(upperBounds.isNotEmpty()) { "Upper bounds should not be empty: $this" }
|
||||
|
||||
return upperBounds.firstOrNull {
|
||||
val classDescriptor = it.constructor.declarationDescriptor as? ClassDescriptor ?: return@firstOrNull false
|
||||
classDescriptor.kind != ClassKind.INTERFACE && classDescriptor.kind != ClassKind.ANNOTATION_CLASS
|
||||
} ?: upperBounds.first()
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ class TypeDeserializer(
|
||||
private val parent: TypeDeserializer?,
|
||||
typeParameterProtos: List<ProtoBuf.TypeParameter>,
|
||||
private val debugName: String,
|
||||
private val containerPresentableName: String,
|
||||
var experimentalSuspendFunctionTypeEncountered: Boolean = false
|
||||
) {
|
||||
private val classDescriptors: (Int) -> ClassDescriptor? = c.storageManager.createMemoizedFunctionWithNullableValues { fqNameIndex ->
|
||||
@@ -112,7 +113,9 @@ class TypeDeserializer(
|
||||
proto.hasClassName() -> (classDescriptors(proto.className) ?: notFoundClass(proto.className)).typeConstructor
|
||||
proto.hasTypeParameter() ->
|
||||
typeParameterTypeConstructor(proto.typeParameter)
|
||||
?: ErrorUtils.createErrorTypeConstructor("Unknown type parameter ${proto.typeParameter}")
|
||||
?: ErrorUtils.createErrorTypeConstructor(
|
||||
"Unknown type parameter ${proto.typeParameter}. Please try recompiling module containing \"$containerPresentableName\""
|
||||
)
|
||||
proto.hasTypeParameterName() -> {
|
||||
val container = c.containingDeclaration
|
||||
val name = c.nameResolver.getString(proto.typeParameterName)
|
||||
|
||||
@@ -80,7 +80,8 @@ class DeserializationContext(
|
||||
) {
|
||||
val typeDeserializer: TypeDeserializer = TypeDeserializer(
|
||||
this, parentTypeDeserializer, typeParameters,
|
||||
"Deserializer for ${containingDeclaration.name}"
|
||||
"Deserializer for \"${containingDeclaration.name}\"",
|
||||
containerSource?.presentableString ?: "[container not found]"
|
||||
)
|
||||
|
||||
val memberDeserializer: MemberDeserializer = MemberDeserializer(this)
|
||||
|
||||
@@ -41,11 +41,13 @@ message Module {
|
||||
}
|
||||
|
||||
message PackageParts {
|
||||
// Dot-separated Kotlin FQ name of the package.
|
||||
required string package_fq_name = 1;
|
||||
|
||||
// Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
// (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
// Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
// Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
// class_with_jvm_package_name_short_name.
|
||||
repeated string short_class_name = 2;
|
||||
|
||||
// For each name in short_class_name, index of the name of the corresponding multi-file facade class in multifile_facade_short_name + 1,
|
||||
@@ -54,12 +56,24 @@ message PackageParts {
|
||||
repeated int32 multifile_facade_short_name_id = 3 [packed = true];
|
||||
|
||||
// Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
//
|
||||
// The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
// and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
// otherwise behavior is unspecified.
|
||||
repeated string multifile_facade_short_name = 4;
|
||||
|
||||
// Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
// The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
// Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
// @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
repeated string class_with_jvm_package_name_short_name = 5;
|
||||
|
||||
// This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
|
||||
// multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
|
||||
// names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
//
|
||||
// For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
|
||||
// multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
|
||||
repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true];
|
||||
|
||||
// For each name in class_with_jvm_package_name_short_name, the index (into PackageTable#jvm_package_name) of the JVM package name.
|
||||
// This list should have at least one element, otherwise classes with JVM package names are going to be ignored completely.
|
||||
//
|
||||
|
||||
@@ -1702,14 +1702,26 @@ public final class JvmModuleProtoBuf {
|
||||
|
||||
/**
|
||||
* <code>required string package_fq_name = 1;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Dot-separated Kotlin FQ name of the package.
|
||||
* </pre>
|
||||
*/
|
||||
boolean hasPackageFqName();
|
||||
/**
|
||||
* <code>required string package_fq_name = 1;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Dot-separated Kotlin FQ name of the package.
|
||||
* </pre>
|
||||
*/
|
||||
java.lang.String getPackageFqName();
|
||||
/**
|
||||
* <code>required string package_fq_name = 1;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Dot-separated Kotlin FQ name of the package.
|
||||
* </pre>
|
||||
*/
|
||||
org.jetbrains.kotlin.protobuf.ByteString
|
||||
getPackageFqNameBytes();
|
||||
@@ -1720,7 +1732,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <pre>
|
||||
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
* (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
* class_with_jvm_package_name_short_name.
|
||||
* </pre>
|
||||
*/
|
||||
org.jetbrains.kotlin.protobuf.ProtocolStringList
|
||||
@@ -1731,7 +1744,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <pre>
|
||||
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
* (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
* class_with_jvm_package_name_short_name.
|
||||
* </pre>
|
||||
*/
|
||||
int getShortClassNameCount();
|
||||
@@ -1741,7 +1755,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <pre>
|
||||
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
* (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
* class_with_jvm_package_name_short_name.
|
||||
* </pre>
|
||||
*/
|
||||
java.lang.String getShortClassName(int index);
|
||||
@@ -1751,7 +1766,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <pre>
|
||||
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
* (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
* class_with_jvm_package_name_short_name.
|
||||
* </pre>
|
||||
*/
|
||||
org.jetbrains.kotlin.protobuf.ByteString
|
||||
@@ -1793,6 +1809,9 @@ public final class JvmModuleProtoBuf {
|
||||
*
|
||||
* <pre>
|
||||
* Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
* The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
* and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
* otherwise behavior is unspecified.
|
||||
* </pre>
|
||||
*/
|
||||
org.jetbrains.kotlin.protobuf.ProtocolStringList
|
||||
@@ -1802,6 +1821,9 @@ public final class JvmModuleProtoBuf {
|
||||
*
|
||||
* <pre>
|
||||
* Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
* The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
* and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
* otherwise behavior is unspecified.
|
||||
* </pre>
|
||||
*/
|
||||
int getMultifileFacadeShortNameCount();
|
||||
@@ -1810,6 +1832,9 @@ public final class JvmModuleProtoBuf {
|
||||
*
|
||||
* <pre>
|
||||
* Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
* The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
* and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
* otherwise behavior is unspecified.
|
||||
* </pre>
|
||||
*/
|
||||
java.lang.String getMultifileFacadeShortName(int index);
|
||||
@@ -1818,6 +1843,9 @@ public final class JvmModuleProtoBuf {
|
||||
*
|
||||
* <pre>
|
||||
* Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
* The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
* and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
* otherwise behavior is unspecified.
|
||||
* </pre>
|
||||
*/
|
||||
org.jetbrains.kotlin.protobuf.ByteString
|
||||
@@ -1827,8 +1855,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <code>repeated string class_with_jvm_package_name_short_name = 5;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
* @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* </pre>
|
||||
*/
|
||||
org.jetbrains.kotlin.protobuf.ProtocolStringList
|
||||
@@ -1837,8 +1865,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <code>repeated string class_with_jvm_package_name_short_name = 5;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
* @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* </pre>
|
||||
*/
|
||||
int getClassWithJvmPackageNameShortNameCount();
|
||||
@@ -1846,8 +1874,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <code>repeated string class_with_jvm_package_name_short_name = 5;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
* @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* </pre>
|
||||
*/
|
||||
java.lang.String getClassWithJvmPackageNameShortName(int index);
|
||||
@@ -1855,13 +1883,50 @@ public final class JvmModuleProtoBuf {
|
||||
* <code>repeated string class_with_jvm_package_name_short_name = 5;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
* @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* </pre>
|
||||
*/
|
||||
org.jetbrains.kotlin.protobuf.ByteString
|
||||
getClassWithJvmPackageNameShortNameBytes(int index);
|
||||
|
||||
/**
|
||||
* <code>repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true];</code>
|
||||
*
|
||||
* <pre>
|
||||
* This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
|
||||
* multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
|
||||
* names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
|
||||
* multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
|
||||
* </pre>
|
||||
*/
|
||||
java.util.List<java.lang.Integer> getClassWithJvmPackageNameMultifileFacadeShortNameIdList();
|
||||
/**
|
||||
* <code>repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true];</code>
|
||||
*
|
||||
* <pre>
|
||||
* This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
|
||||
* multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
|
||||
* names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
|
||||
* multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
|
||||
* </pre>
|
||||
*/
|
||||
int getClassWithJvmPackageNameMultifileFacadeShortNameIdCount();
|
||||
/**
|
||||
* <code>repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true];</code>
|
||||
*
|
||||
* <pre>
|
||||
* This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
|
||||
* multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
|
||||
* names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
|
||||
* multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
|
||||
* </pre>
|
||||
*/
|
||||
int getClassWithJvmPackageNameMultifileFacadeShortNameId(int index);
|
||||
|
||||
/**
|
||||
* <code>repeated int32 class_with_jvm_package_name_package_id = 6 [packed = true];</code>
|
||||
*
|
||||
@@ -2004,9 +2069,9 @@ public final class JvmModuleProtoBuf {
|
||||
break;
|
||||
}
|
||||
case 48: {
|
||||
if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) {
|
||||
classWithJvmPackageNamePackageId_ = new java.util.ArrayList<java.lang.Integer>();
|
||||
mutable_bitField0_ |= 0x00000020;
|
||||
mutable_bitField0_ |= 0x00000040;
|
||||
}
|
||||
classWithJvmPackageNamePackageId_.add(input.readInt32());
|
||||
break;
|
||||
@@ -2014,9 +2079,9 @@ public final class JvmModuleProtoBuf {
|
||||
case 50: {
|
||||
int length = input.readRawVarint32();
|
||||
int limit = input.pushLimit(length);
|
||||
if (!((mutable_bitField0_ & 0x00000020) == 0x00000020) && input.getBytesUntilLimit() > 0) {
|
||||
if (!((mutable_bitField0_ & 0x00000040) == 0x00000040) && input.getBytesUntilLimit() > 0) {
|
||||
classWithJvmPackageNamePackageId_ = new java.util.ArrayList<java.lang.Integer>();
|
||||
mutable_bitField0_ |= 0x00000020;
|
||||
mutable_bitField0_ |= 0x00000040;
|
||||
}
|
||||
while (input.getBytesUntilLimit() > 0) {
|
||||
classWithJvmPackageNamePackageId_.add(input.readInt32());
|
||||
@@ -2024,6 +2089,27 @@ public final class JvmModuleProtoBuf {
|
||||
input.popLimit(limit);
|
||||
break;
|
||||
}
|
||||
case 56: {
|
||||
if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
classWithJvmPackageNameMultifileFacadeShortNameId_ = new java.util.ArrayList<java.lang.Integer>();
|
||||
mutable_bitField0_ |= 0x00000020;
|
||||
}
|
||||
classWithJvmPackageNameMultifileFacadeShortNameId_.add(input.readInt32());
|
||||
break;
|
||||
}
|
||||
case 58: {
|
||||
int length = input.readRawVarint32();
|
||||
int limit = input.pushLimit(length);
|
||||
if (!((mutable_bitField0_ & 0x00000020) == 0x00000020) && input.getBytesUntilLimit() > 0) {
|
||||
classWithJvmPackageNameMultifileFacadeShortNameId_ = new java.util.ArrayList<java.lang.Integer>();
|
||||
mutable_bitField0_ |= 0x00000020;
|
||||
}
|
||||
while (input.getBytesUntilLimit() > 0) {
|
||||
classWithJvmPackageNameMultifileFacadeShortNameId_.add(input.readInt32());
|
||||
}
|
||||
input.popLimit(limit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
|
||||
@@ -2044,9 +2130,12 @@ public final class JvmModuleProtoBuf {
|
||||
if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
classWithJvmPackageNameShortName_ = classWithJvmPackageNameShortName_.getUnmodifiableView();
|
||||
}
|
||||
if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) {
|
||||
classWithJvmPackageNamePackageId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNamePackageId_);
|
||||
}
|
||||
if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNameMultifileFacadeShortNameId_);
|
||||
}
|
||||
try {
|
||||
unknownFieldsCodedOutput.flush();
|
||||
} catch (java.io.IOException e) {
|
||||
@@ -2077,12 +2166,20 @@ public final class JvmModuleProtoBuf {
|
||||
private java.lang.Object packageFqName_;
|
||||
/**
|
||||
* <code>required string package_fq_name = 1;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Dot-separated Kotlin FQ name of the package.
|
||||
* </pre>
|
||||
*/
|
||||
public boolean hasPackageFqName() {
|
||||
return ((bitField0_ & 0x00000001) == 0x00000001);
|
||||
}
|
||||
/**
|
||||
* <code>required string package_fq_name = 1;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Dot-separated Kotlin FQ name of the package.
|
||||
* </pre>
|
||||
*/
|
||||
public java.lang.String getPackageFqName() {
|
||||
java.lang.Object ref = packageFqName_;
|
||||
@@ -2100,6 +2197,10 @@ public final class JvmModuleProtoBuf {
|
||||
}
|
||||
/**
|
||||
* <code>required string package_fq_name = 1;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Dot-separated Kotlin FQ name of the package.
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ByteString
|
||||
getPackageFqNameBytes() {
|
||||
@@ -2123,7 +2224,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <pre>
|
||||
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
* (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
* class_with_jvm_package_name_short_name.
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ProtocolStringList
|
||||
@@ -2136,7 +2238,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <pre>
|
||||
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
* (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
* class_with_jvm_package_name_short_name.
|
||||
* </pre>
|
||||
*/
|
||||
public int getShortClassNameCount() {
|
||||
@@ -2148,7 +2251,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <pre>
|
||||
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
* (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
* class_with_jvm_package_name_short_name.
|
||||
* </pre>
|
||||
*/
|
||||
public java.lang.String getShortClassName(int index) {
|
||||
@@ -2160,7 +2264,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <pre>
|
||||
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
* (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
* class_with_jvm_package_name_short_name.
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ByteString
|
||||
@@ -2216,6 +2321,9 @@ public final class JvmModuleProtoBuf {
|
||||
*
|
||||
* <pre>
|
||||
* Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
* The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
* and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
* otherwise behavior is unspecified.
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ProtocolStringList
|
||||
@@ -2227,6 +2335,9 @@ public final class JvmModuleProtoBuf {
|
||||
*
|
||||
* <pre>
|
||||
* Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
* The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
* and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
* otherwise behavior is unspecified.
|
||||
* </pre>
|
||||
*/
|
||||
public int getMultifileFacadeShortNameCount() {
|
||||
@@ -2237,6 +2348,9 @@ public final class JvmModuleProtoBuf {
|
||||
*
|
||||
* <pre>
|
||||
* Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
* The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
* and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
* otherwise behavior is unspecified.
|
||||
* </pre>
|
||||
*/
|
||||
public java.lang.String getMultifileFacadeShortName(int index) {
|
||||
@@ -2247,6 +2361,9 @@ public final class JvmModuleProtoBuf {
|
||||
*
|
||||
* <pre>
|
||||
* Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
* The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
* and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
* otherwise behavior is unspecified.
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ByteString
|
||||
@@ -2260,8 +2377,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <code>repeated string class_with_jvm_package_name_short_name = 5;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
* @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ProtocolStringList
|
||||
@@ -2272,8 +2389,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <code>repeated string class_with_jvm_package_name_short_name = 5;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
* @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* </pre>
|
||||
*/
|
||||
public int getClassWithJvmPackageNameShortNameCount() {
|
||||
@@ -2283,8 +2400,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <code>repeated string class_with_jvm_package_name_short_name = 5;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
* @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* </pre>
|
||||
*/
|
||||
public java.lang.String getClassWithJvmPackageNameShortName(int index) {
|
||||
@@ -2294,8 +2411,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <code>repeated string class_with_jvm_package_name_short_name = 5;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
* @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ByteString
|
||||
@@ -2303,6 +2420,53 @@ public final class JvmModuleProtoBuf {
|
||||
return classWithJvmPackageNameShortName_.getByteString(index);
|
||||
}
|
||||
|
||||
public static final int CLASS_WITH_JVM_PACKAGE_NAME_MULTIFILE_FACADE_SHORT_NAME_ID_FIELD_NUMBER = 7;
|
||||
private java.util.List<java.lang.Integer> classWithJvmPackageNameMultifileFacadeShortNameId_;
|
||||
/**
|
||||
* <code>repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true];</code>
|
||||
*
|
||||
* <pre>
|
||||
* This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
|
||||
* multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
|
||||
* names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
|
||||
* multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
|
||||
* </pre>
|
||||
*/
|
||||
public java.util.List<java.lang.Integer>
|
||||
getClassWithJvmPackageNameMultifileFacadeShortNameIdList() {
|
||||
return classWithJvmPackageNameMultifileFacadeShortNameId_;
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true];</code>
|
||||
*
|
||||
* <pre>
|
||||
* This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
|
||||
* multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
|
||||
* names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
|
||||
* multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
|
||||
* </pre>
|
||||
*/
|
||||
public int getClassWithJvmPackageNameMultifileFacadeShortNameIdCount() {
|
||||
return classWithJvmPackageNameMultifileFacadeShortNameId_.size();
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true];</code>
|
||||
*
|
||||
* <pre>
|
||||
* This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
|
||||
* multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
|
||||
* names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
|
||||
* multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
|
||||
* </pre>
|
||||
*/
|
||||
public int getClassWithJvmPackageNameMultifileFacadeShortNameId(int index) {
|
||||
return classWithJvmPackageNameMultifileFacadeShortNameId_.get(index);
|
||||
}
|
||||
private int classWithJvmPackageNameMultifileFacadeShortNameIdMemoizedSerializedSize = -1;
|
||||
|
||||
public static final int CLASS_WITH_JVM_PACKAGE_NAME_PACKAGE_ID_FIELD_NUMBER = 6;
|
||||
private java.util.List<java.lang.Integer> classWithJvmPackageNamePackageId_;
|
||||
/**
|
||||
@@ -2356,6 +2520,7 @@ public final class JvmModuleProtoBuf {
|
||||
multifileFacadeShortNameId_ = java.util.Collections.emptyList();
|
||||
multifileFacadeShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
|
||||
classWithJvmPackageNameShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
|
||||
classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.emptyList();
|
||||
classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList();
|
||||
}
|
||||
private byte memoizedIsInitialized = -1;
|
||||
@@ -2401,6 +2566,13 @@ public final class JvmModuleProtoBuf {
|
||||
for (int i = 0; i < classWithJvmPackageNamePackageId_.size(); i++) {
|
||||
output.writeInt32NoTag(classWithJvmPackageNamePackageId_.get(i));
|
||||
}
|
||||
if (getClassWithJvmPackageNameMultifileFacadeShortNameIdList().size() > 0) {
|
||||
output.writeRawVarint32(58);
|
||||
output.writeRawVarint32(classWithJvmPackageNameMultifileFacadeShortNameIdMemoizedSerializedSize);
|
||||
}
|
||||
for (int i = 0; i < classWithJvmPackageNameMultifileFacadeShortNameId_.size(); i++) {
|
||||
output.writeInt32NoTag(classWithJvmPackageNameMultifileFacadeShortNameId_.get(i));
|
||||
}
|
||||
output.writeRawBytes(unknownFields);
|
||||
}
|
||||
|
||||
@@ -2469,6 +2641,20 @@ public final class JvmModuleProtoBuf {
|
||||
}
|
||||
classWithJvmPackageNamePackageIdMemoizedSerializedSize = dataSize;
|
||||
}
|
||||
{
|
||||
int dataSize = 0;
|
||||
for (int i = 0; i < classWithJvmPackageNameMultifileFacadeShortNameId_.size(); i++) {
|
||||
dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeInt32SizeNoTag(classWithJvmPackageNameMultifileFacadeShortNameId_.get(i));
|
||||
}
|
||||
size += dataSize;
|
||||
if (!getClassWithJvmPackageNameMultifileFacadeShortNameIdList().isEmpty()) {
|
||||
size += 1;
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeInt32SizeNoTag(dataSize);
|
||||
}
|
||||
classWithJvmPackageNameMultifileFacadeShortNameIdMemoizedSerializedSize = dataSize;
|
||||
}
|
||||
size += unknownFields.size();
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
@@ -2573,8 +2759,10 @@ public final class JvmModuleProtoBuf {
|
||||
bitField0_ = (bitField0_ & ~0x00000008);
|
||||
classWithJvmPackageNameShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
|
||||
bitField0_ = (bitField0_ & ~0x00000010);
|
||||
classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList();
|
||||
classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00000020);
|
||||
classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00000040);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -2623,9 +2811,14 @@ public final class JvmModuleProtoBuf {
|
||||
}
|
||||
result.classWithJvmPackageNameShortName_ = classWithJvmPackageNameShortName_;
|
||||
if (((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
classWithJvmPackageNamePackageId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNamePackageId_);
|
||||
classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNameMultifileFacadeShortNameId_);
|
||||
bitField0_ = (bitField0_ & ~0x00000020);
|
||||
}
|
||||
result.classWithJvmPackageNameMultifileFacadeShortNameId_ = classWithJvmPackageNameMultifileFacadeShortNameId_;
|
||||
if (((bitField0_ & 0x00000040) == 0x00000040)) {
|
||||
classWithJvmPackageNamePackageId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNamePackageId_);
|
||||
bitField0_ = (bitField0_ & ~0x00000040);
|
||||
}
|
||||
result.classWithJvmPackageNamePackageId_ = classWithJvmPackageNamePackageId_;
|
||||
result.bitField0_ = to_bitField0_;
|
||||
return result;
|
||||
@@ -2677,11 +2870,21 @@ public final class JvmModuleProtoBuf {
|
||||
classWithJvmPackageNameShortName_.addAll(other.classWithJvmPackageNameShortName_);
|
||||
}
|
||||
|
||||
}
|
||||
if (!other.classWithJvmPackageNameMultifileFacadeShortNameId_.isEmpty()) {
|
||||
if (classWithJvmPackageNameMultifileFacadeShortNameId_.isEmpty()) {
|
||||
classWithJvmPackageNameMultifileFacadeShortNameId_ = other.classWithJvmPackageNameMultifileFacadeShortNameId_;
|
||||
bitField0_ = (bitField0_ & ~0x00000020);
|
||||
} else {
|
||||
ensureClassWithJvmPackageNameMultifileFacadeShortNameIdIsMutable();
|
||||
classWithJvmPackageNameMultifileFacadeShortNameId_.addAll(other.classWithJvmPackageNameMultifileFacadeShortNameId_);
|
||||
}
|
||||
|
||||
}
|
||||
if (!other.classWithJvmPackageNamePackageId_.isEmpty()) {
|
||||
if (classWithJvmPackageNamePackageId_.isEmpty()) {
|
||||
classWithJvmPackageNamePackageId_ = other.classWithJvmPackageNamePackageId_;
|
||||
bitField0_ = (bitField0_ & ~0x00000020);
|
||||
bitField0_ = (bitField0_ & ~0x00000040);
|
||||
} else {
|
||||
ensureClassWithJvmPackageNamePackageIdIsMutable();
|
||||
classWithJvmPackageNamePackageId_.addAll(other.classWithJvmPackageNamePackageId_);
|
||||
@@ -2723,12 +2926,20 @@ public final class JvmModuleProtoBuf {
|
||||
private java.lang.Object packageFqName_ = "";
|
||||
/**
|
||||
* <code>required string package_fq_name = 1;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Dot-separated Kotlin FQ name of the package.
|
||||
* </pre>
|
||||
*/
|
||||
public boolean hasPackageFqName() {
|
||||
return ((bitField0_ & 0x00000001) == 0x00000001);
|
||||
}
|
||||
/**
|
||||
* <code>required string package_fq_name = 1;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Dot-separated Kotlin FQ name of the package.
|
||||
* </pre>
|
||||
*/
|
||||
public java.lang.String getPackageFqName() {
|
||||
java.lang.Object ref = packageFqName_;
|
||||
@@ -2746,6 +2957,10 @@ public final class JvmModuleProtoBuf {
|
||||
}
|
||||
/**
|
||||
* <code>required string package_fq_name = 1;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Dot-separated Kotlin FQ name of the package.
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ByteString
|
||||
getPackageFqNameBytes() {
|
||||
@@ -2762,6 +2977,10 @@ public final class JvmModuleProtoBuf {
|
||||
}
|
||||
/**
|
||||
* <code>required string package_fq_name = 1;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Dot-separated Kotlin FQ name of the package.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder setPackageFqName(
|
||||
java.lang.String value) {
|
||||
@@ -2775,6 +2994,10 @@ public final class JvmModuleProtoBuf {
|
||||
}
|
||||
/**
|
||||
* <code>required string package_fq_name = 1;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Dot-separated Kotlin FQ name of the package.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder clearPackageFqName() {
|
||||
bitField0_ = (bitField0_ & ~0x00000001);
|
||||
@@ -2784,6 +3007,10 @@ public final class JvmModuleProtoBuf {
|
||||
}
|
||||
/**
|
||||
* <code>required string package_fq_name = 1;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Dot-separated Kotlin FQ name of the package.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder setPackageFqNameBytes(
|
||||
org.jetbrains.kotlin.protobuf.ByteString value) {
|
||||
@@ -2809,7 +3036,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <pre>
|
||||
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
* (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
* class_with_jvm_package_name_short_name.
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ProtocolStringList
|
||||
@@ -2822,7 +3050,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <pre>
|
||||
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
* (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
* class_with_jvm_package_name_short_name.
|
||||
* </pre>
|
||||
*/
|
||||
public int getShortClassNameCount() {
|
||||
@@ -2834,7 +3063,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <pre>
|
||||
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
* (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
* class_with_jvm_package_name_short_name.
|
||||
* </pre>
|
||||
*/
|
||||
public java.lang.String getShortClassName(int index) {
|
||||
@@ -2846,7 +3076,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <pre>
|
||||
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
* (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
* class_with_jvm_package_name_short_name.
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ByteString
|
||||
@@ -2859,7 +3090,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <pre>
|
||||
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
* (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
* class_with_jvm_package_name_short_name.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder setShortClassName(
|
||||
@@ -2878,7 +3110,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <pre>
|
||||
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
* (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
* class_with_jvm_package_name_short_name.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder addShortClassName(
|
||||
@@ -2897,7 +3130,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <pre>
|
||||
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
* (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
* class_with_jvm_package_name_short_name.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder addAllShortClassName(
|
||||
@@ -2914,7 +3148,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <pre>
|
||||
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
* (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
* class_with_jvm_package_name_short_name.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder clearShortClassName() {
|
||||
@@ -2929,7 +3164,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <pre>
|
||||
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
|
||||
* (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
|
||||
* Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
|
||||
* class_with_jvm_package_name_short_name.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder addShortClassNameBytes(
|
||||
@@ -3063,6 +3299,9 @@ public final class JvmModuleProtoBuf {
|
||||
*
|
||||
* <pre>
|
||||
* Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
* The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
* and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
* otherwise behavior is unspecified.
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ProtocolStringList
|
||||
@@ -3074,6 +3313,9 @@ public final class JvmModuleProtoBuf {
|
||||
*
|
||||
* <pre>
|
||||
* Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
* The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
* and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
* otherwise behavior is unspecified.
|
||||
* </pre>
|
||||
*/
|
||||
public int getMultifileFacadeShortNameCount() {
|
||||
@@ -3084,6 +3326,9 @@ public final class JvmModuleProtoBuf {
|
||||
*
|
||||
* <pre>
|
||||
* Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
* The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
* and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
* otherwise behavior is unspecified.
|
||||
* </pre>
|
||||
*/
|
||||
public java.lang.String getMultifileFacadeShortName(int index) {
|
||||
@@ -3094,6 +3339,9 @@ public final class JvmModuleProtoBuf {
|
||||
*
|
||||
* <pre>
|
||||
* Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
* The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
* and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
* otherwise behavior is unspecified.
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ByteString
|
||||
@@ -3105,6 +3353,9 @@ public final class JvmModuleProtoBuf {
|
||||
*
|
||||
* <pre>
|
||||
* Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
* The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
* and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
* otherwise behavior is unspecified.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder setMultifileFacadeShortName(
|
||||
@@ -3122,6 +3373,9 @@ public final class JvmModuleProtoBuf {
|
||||
*
|
||||
* <pre>
|
||||
* Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
* The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
* and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
* otherwise behavior is unspecified.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder addMultifileFacadeShortName(
|
||||
@@ -3139,6 +3393,9 @@ public final class JvmModuleProtoBuf {
|
||||
*
|
||||
* <pre>
|
||||
* Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
* The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
* and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
* otherwise behavior is unspecified.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder addAllMultifileFacadeShortName(
|
||||
@@ -3154,6 +3411,9 @@ public final class JvmModuleProtoBuf {
|
||||
*
|
||||
* <pre>
|
||||
* Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
* The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
* and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
* otherwise behavior is unspecified.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder clearMultifileFacadeShortName() {
|
||||
@@ -3167,6 +3427,9 @@ public final class JvmModuleProtoBuf {
|
||||
*
|
||||
* <pre>
|
||||
* Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
|
||||
* The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
|
||||
* and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
|
||||
* otherwise behavior is unspecified.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder addMultifileFacadeShortNameBytes(
|
||||
@@ -3191,8 +3454,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <code>repeated string class_with_jvm_package_name_short_name = 5;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
* @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ProtocolStringList
|
||||
@@ -3203,8 +3466,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <code>repeated string class_with_jvm_package_name_short_name = 5;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
* @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* </pre>
|
||||
*/
|
||||
public int getClassWithJvmPackageNameShortNameCount() {
|
||||
@@ -3214,8 +3477,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <code>repeated string class_with_jvm_package_name_short_name = 5;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
* @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* </pre>
|
||||
*/
|
||||
public java.lang.String getClassWithJvmPackageNameShortName(int index) {
|
||||
@@ -3225,8 +3488,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <code>repeated string class_with_jvm_package_name_short_name = 5;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
* @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ByteString
|
||||
@@ -3237,8 +3500,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <code>repeated string class_with_jvm_package_name_short_name = 5;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
* @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder setClassWithJvmPackageNameShortName(
|
||||
@@ -3255,8 +3518,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <code>repeated string class_with_jvm_package_name_short_name = 5;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
* @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder addClassWithJvmPackageNameShortName(
|
||||
@@ -3273,8 +3536,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <code>repeated string class_with_jvm_package_name_short_name = 5;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
* @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder addAllClassWithJvmPackageNameShortName(
|
||||
@@ -3289,8 +3552,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <code>repeated string class_with_jvm_package_name_short_name = 5;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
* @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder clearClassWithJvmPackageNameShortName() {
|
||||
@@ -3303,8 +3566,8 @@ public final class JvmModuleProtoBuf {
|
||||
* <code>repeated string class_with_jvm_package_name_short_name = 5;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
|
||||
* @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder addClassWithJvmPackageNameShortNameBytes(
|
||||
@@ -3318,11 +3581,133 @@ public final class JvmModuleProtoBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
private java.util.List<java.lang.Integer> classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.emptyList();
|
||||
private void ensureClassWithJvmPackageNameMultifileFacadeShortNameIdIsMutable() {
|
||||
if (!((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
classWithJvmPackageNameMultifileFacadeShortNameId_ = new java.util.ArrayList<java.lang.Integer>(classWithJvmPackageNameMultifileFacadeShortNameId_);
|
||||
bitField0_ |= 0x00000020;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true];</code>
|
||||
*
|
||||
* <pre>
|
||||
* This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
|
||||
* multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
|
||||
* names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
|
||||
* multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
|
||||
* </pre>
|
||||
*/
|
||||
public java.util.List<java.lang.Integer>
|
||||
getClassWithJvmPackageNameMultifileFacadeShortNameIdList() {
|
||||
return java.util.Collections.unmodifiableList(classWithJvmPackageNameMultifileFacadeShortNameId_);
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true];</code>
|
||||
*
|
||||
* <pre>
|
||||
* This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
|
||||
* multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
|
||||
* names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
|
||||
* multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
|
||||
* </pre>
|
||||
*/
|
||||
public int getClassWithJvmPackageNameMultifileFacadeShortNameIdCount() {
|
||||
return classWithJvmPackageNameMultifileFacadeShortNameId_.size();
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true];</code>
|
||||
*
|
||||
* <pre>
|
||||
* This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
|
||||
* multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
|
||||
* names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
|
||||
* multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
|
||||
* </pre>
|
||||
*/
|
||||
public int getClassWithJvmPackageNameMultifileFacadeShortNameId(int index) {
|
||||
return classWithJvmPackageNameMultifileFacadeShortNameId_.get(index);
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true];</code>
|
||||
*
|
||||
* <pre>
|
||||
* This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
|
||||
* multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
|
||||
* names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
|
||||
* multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder setClassWithJvmPackageNameMultifileFacadeShortNameId(
|
||||
int index, int value) {
|
||||
ensureClassWithJvmPackageNameMultifileFacadeShortNameIdIsMutable();
|
||||
classWithJvmPackageNameMultifileFacadeShortNameId_.set(index, value);
|
||||
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true];</code>
|
||||
*
|
||||
* <pre>
|
||||
* This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
|
||||
* multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
|
||||
* names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
|
||||
* multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder addClassWithJvmPackageNameMultifileFacadeShortNameId(int value) {
|
||||
ensureClassWithJvmPackageNameMultifileFacadeShortNameIdIsMutable();
|
||||
classWithJvmPackageNameMultifileFacadeShortNameId_.add(value);
|
||||
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true];</code>
|
||||
*
|
||||
* <pre>
|
||||
* This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
|
||||
* multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
|
||||
* names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
|
||||
* multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder addAllClassWithJvmPackageNameMultifileFacadeShortNameId(
|
||||
java.lang.Iterable<? extends java.lang.Integer> values) {
|
||||
ensureClassWithJvmPackageNameMultifileFacadeShortNameIdIsMutable();
|
||||
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
|
||||
values, classWithJvmPackageNameMultifileFacadeShortNameId_);
|
||||
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true];</code>
|
||||
*
|
||||
* <pre>
|
||||
* This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
|
||||
* multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
|
||||
* names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
|
||||
* For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
|
||||
* multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
|
||||
* </pre>
|
||||
*/
|
||||
public Builder clearClassWithJvmPackageNameMultifileFacadeShortNameId() {
|
||||
classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00000020);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private java.util.List<java.lang.Integer> classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList();
|
||||
private void ensureClassWithJvmPackageNamePackageIdIsMutable() {
|
||||
if (!((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
if (!((bitField0_ & 0x00000040) == 0x00000040)) {
|
||||
classWithJvmPackageNamePackageId_ = new java.util.ArrayList<java.lang.Integer>(classWithJvmPackageNamePackageId_);
|
||||
bitField0_ |= 0x00000020;
|
||||
bitField0_ |= 0x00000040;
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -3435,7 +3820,7 @@ public final class JvmModuleProtoBuf {
|
||||
*/
|
||||
public Builder clearClassWithJvmPackageNamePackageId() {
|
||||
classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00000020);
|
||||
bitField0_ = (bitField0_ & ~0x00000040);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class JvmMetadataVersion(versionArray: IntArray, val isStrictSemantics: Boolean)
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val INSTANCE = JvmMetadataVersion(1, 1, 13)
|
||||
val INSTANCE = JvmMetadataVersion(1, 1, 15)
|
||||
|
||||
@JvmField
|
||||
val INVALID_VERSION = JvmMetadataVersion()
|
||||
|
||||
@@ -75,10 +75,12 @@ class ModuleMapping private constructor(
|
||||
val packageParts = result.getOrPut(packageFqName) { PackageParts(packageFqName) }
|
||||
|
||||
for ((index, partShortName) in proto.shortClassNameList.withIndex()) {
|
||||
val multifileFacadeId = proto.multifileFacadeShortNameIdList.getOrNull(index)?.minus(1)
|
||||
val facadeShortName = multifileFacadeId?.let(proto.multifileFacadeShortNameList::getOrNull)
|
||||
val facadeInternalName = facadeShortName?.let { internalNameOf(packageFqName, it) }
|
||||
packageParts.addPart(internalNameOf(packageFqName, partShortName), facadeInternalName)
|
||||
packageParts.addPart(
|
||||
internalNameOf(packageFqName, partShortName),
|
||||
loadMultiFileFacadeInternalName(
|
||||
proto.multifileFacadeShortNameIdList, proto.multifileFacadeShortNameList, index, packageFqName
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
if (isJvmPackageNameSupported) {
|
||||
@@ -87,7 +89,16 @@ class ModuleMapping private constructor(
|
||||
?: proto.classWithJvmPackageNamePackageIdList.lastOrNull()
|
||||
?: continue
|
||||
val jvmPackageName = moduleProto.jvmPackageNameList.getOrNull(packageId) ?: continue
|
||||
packageParts.addPart(internalNameOf(jvmPackageName, partShortName), null)
|
||||
|
||||
packageParts.addPart(
|
||||
internalNameOf(jvmPackageName, partShortName),
|
||||
loadMultiFileFacadeInternalName(
|
||||
proto.classWithJvmPackageNameMultifileFacadeShortNameIdList,
|
||||
proto.multifileFacadeShortNameList,
|
||||
index,
|
||||
jvmPackageName
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,6 +114,17 @@ class ModuleMapping private constructor(
|
||||
|
||||
return ModuleMapping(result, BinaryModuleData(annotations), debugName)
|
||||
}
|
||||
|
||||
private fun loadMultiFileFacadeInternalName(
|
||||
multifileFacadeIds: List<Int>,
|
||||
multifileFacadeShortNames: List<String>,
|
||||
index: Int,
|
||||
packageFqName: String
|
||||
): String? {
|
||||
val multifileFacadeId = multifileFacadeIds.getOrNull(index)?.minus(1)
|
||||
val facadeShortName = multifileFacadeId?.let(multifileFacadeShortNames::getOrNull)
|
||||
return facadeShortName?.let { internalNameOf(packageFqName, it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,9 +162,10 @@ class PackageParts(val packageFqName: String) {
|
||||
partInternalName.packageName == packageInternalName
|
||||
}
|
||||
|
||||
writePartsWithinPackage(partsWithinPackage)
|
||||
|
||||
writePartsOutsidePackage(partsOutsidePackage, builder)
|
||||
val facadeNameToId = mutableMapOf<String, Int>()
|
||||
writePartsWithinPackage(partsWithinPackage, facadeNameToId)
|
||||
writePartsOutsidePackage(partsOutsidePackage, facadeNameToId, builder)
|
||||
writeMultifileFacadeNames(facadeNameToId)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -154,26 +177,24 @@ class PackageParts(val packageFqName: String) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun JvmModuleProtoBuf.PackageParts.Builder.writePartsWithinPackage(parts: List<String>) {
|
||||
val facadeNameToId = mutableMapOf<String, Int>()
|
||||
private fun JvmModuleProtoBuf.PackageParts.Builder.writePartsWithinPackage(
|
||||
parts: List<String>,
|
||||
facadeNameToId: MutableMap<String, Int>
|
||||
) {
|
||||
for ((facadeInternalName, partInternalNames) in parts.groupBy { getMultifileFacadeName(it) }.toSortedMap(nullsLast())) {
|
||||
for (partInternalName in partInternalNames.sorted()) {
|
||||
addShortClassName(partInternalName.className)
|
||||
if (facadeInternalName != null) {
|
||||
addMultifileFacadeShortNameId(1 + facadeNameToId.getOrPut(facadeInternalName.className) { facadeNameToId.size })
|
||||
addMultifileFacadeShortNameId(getMultifileFacadeShortNameId(facadeInternalName, facadeNameToId))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ((facadeId, facadeName) in facadeNameToId.values.zip(facadeNameToId.keys).sortedBy(Pair<Int, String>::first)) {
|
||||
assert(facadeId == multifileFacadeShortNameCount) { "Multifile facades are loaded incorrectly: $facadeNameToId" }
|
||||
addMultifileFacadeShortName(facadeName)
|
||||
}
|
||||
}
|
||||
|
||||
// Writes information about package parts which have a different JVM package from the Kotlin package (with the help of @JvmPackageName)
|
||||
private fun JvmModuleProtoBuf.PackageParts.Builder.writePartsOutsidePackage(
|
||||
parts: List<String>,
|
||||
facadeNameToId: MutableMap<String, Int>,
|
||||
packageTableBuilder: JvmModuleProtoBuf.Module.Builder
|
||||
) {
|
||||
val packageIds = mutableListOf<Int>()
|
||||
@@ -183,9 +204,16 @@ class PackageParts(val packageFqName: String) {
|
||||
packageTableBuilder.addJvmPackageName(packageFqName)
|
||||
}
|
||||
val packageId = packageTableBuilder.jvmPackageNameList.indexOf(packageFqName)
|
||||
for (part in partsInPackage.map { it.className }.sorted()) {
|
||||
addClassWithJvmPackageNameShortName(part)
|
||||
packageIds.add(packageId)
|
||||
for ((facadeInternalName, partInternalNames) in partsInPackage.groupBy { getMultifileFacadeName(it) }.toSortedMap(nullsLast())) {
|
||||
for (partInternalName in partInternalNames.sorted()) {
|
||||
addClassWithJvmPackageNameShortName(partInternalName.className)
|
||||
if (facadeInternalName != null) {
|
||||
addClassWithJvmPackageNameMultifileFacadeShortNameId(
|
||||
getMultifileFacadeShortNameId(facadeInternalName, facadeNameToId)
|
||||
)
|
||||
}
|
||||
packageIds.add(packageId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,6 +225,17 @@ class PackageParts(val packageFqName: String) {
|
||||
addAllClassWithJvmPackageNamePackageId(packageIds)
|
||||
}
|
||||
|
||||
private fun getMultifileFacadeShortNameId(facadeInternalName: String, facadeNameToId: MutableMap<String, Int>): Int {
|
||||
return 1 + facadeNameToId.getOrPut(facadeInternalName.className) { facadeNameToId.size }
|
||||
}
|
||||
|
||||
private fun JvmModuleProtoBuf.PackageParts.Builder.writeMultifileFacadeNames(facadeNameToId: Map<String, Int>) {
|
||||
for ((facadeId, facadeName) in facadeNameToId.values.zip(facadeNameToId.keys).sortedBy(Pair<Int, String>::first)) {
|
||||
assert(facadeId == multifileFacadeShortNameCount) { "Multifile facades are loaded incorrectly: $facadeNameToId" }
|
||||
addMultifileFacadeShortName(facadeName)
|
||||
}
|
||||
}
|
||||
|
||||
private val String.packageName: String get() = substringBeforeLast('/', "")
|
||||
private val String.className: String get() = substringAfterLast('/')
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ enum class UnsignedType {
|
||||
val asSigned: PrimitiveType = PrimitiveType.valueOf(name.substring(1))
|
||||
|
||||
val byteSize = (1 shl ordinal)
|
||||
val bitSize = byteSize * 8
|
||||
val mask = "0x${List(byteSize) { "FF" }.chunked(2).joinToString("_") { it.joinToString("") }}"
|
||||
}
|
||||
|
||||
|
||||
@@ -199,9 +199,37 @@ class UnsignedTypeGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIns
|
||||
out.println()
|
||||
}
|
||||
|
||||
private fun lsb(count: Int) = "least significant $count bits"
|
||||
private fun msb(count: Int) = "most significant $count bits"
|
||||
|
||||
private fun generateMemberConversions() {
|
||||
for (otherType in UnsignedType.values()) {
|
||||
val signed = otherType.asSigned.capitalized
|
||||
|
||||
out.println(" /**\n * Converts this [$className] value to [$signed].\n *")
|
||||
when {
|
||||
otherType < type -> {
|
||||
out.println(" * If this value is less than or equals to [$signed.MAX_VALUE], the resulting `$signed` value represents")
|
||||
out.println(" * the same numerical value as this `$className`.")
|
||||
out.println(" *")
|
||||
out.println(" * The resulting `$signed` value is represented by the ${lsb(otherType.bitSize)} of this `$className` value.")
|
||||
out.println(" * Note that the resulting `$signed` value may be negative.")
|
||||
}
|
||||
otherType == type -> {
|
||||
out.println(" * If this value is less than or equals to [$signed.MAX_VALUE], the resulting `$signed` value represents")
|
||||
out.println(" * the same numerical value as this `$className`. Otherwise the result is negative.")
|
||||
out.println(" *")
|
||||
out.println(" * The resulting `$signed` value has the same binary representation as this `$className` value.")
|
||||
}
|
||||
else -> {
|
||||
out.println(" * The resulting `$signed` value represents the same numerical value as this `$className`.")
|
||||
out.println(" *")
|
||||
out.println(" * The ${lsb(type.bitSize)} of the resulting `$signed` value are the same as the binary representation of this `$className` value,")
|
||||
out.println(" * whereas the ${msb(otherType.bitSize - type.bitSize)} are filled with zeros.")
|
||||
}
|
||||
}
|
||||
out.println(" */")
|
||||
|
||||
out.println(" @kotlin.internal.InlineOnly")
|
||||
out.print(" public inline fun to$signed(): $signed = ")
|
||||
out.println(when {
|
||||
@@ -214,6 +242,28 @@ class UnsignedTypeGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIns
|
||||
|
||||
for (otherType in UnsignedType.values()) {
|
||||
val name = otherType.capitalized
|
||||
|
||||
if (type == otherType)
|
||||
out.println(" /** Returns this value. */")
|
||||
else {
|
||||
out.println(" /**\n * Converts this [$className] value to [$name].\n *")
|
||||
when {
|
||||
otherType < type -> {
|
||||
out.println(" * If this value is less than or equals to [$name.MAX_VALUE], the resulting `$name` value represents")
|
||||
out.println(" * the same numerical value as this `$className`.")
|
||||
out.println(" *")
|
||||
out.println(" * The resulting `$name` value is represented by the ${lsb(otherType.bitSize)} of this `$className` value.")
|
||||
}
|
||||
else -> {
|
||||
out.println(" * The resulting `$name` value represents the same numerical value as this `$className`.")
|
||||
out.println(" *")
|
||||
out.println(" * The ${lsb(type.bitSize)} of the resulting `$name` value are the same as the binary representation of this `$className` value,")
|
||||
out.println(" * whereas the ${msb(otherType.bitSize - type.bitSize)} are filled with zeros.")
|
||||
}
|
||||
}
|
||||
out.println(" */")
|
||||
}
|
||||
|
||||
out.println(" @kotlin.internal.InlineOnly")
|
||||
out.print(" public inline fun to$name(): $name = ")
|
||||
out.println(when {
|
||||
@@ -228,6 +278,17 @@ class UnsignedTypeGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIns
|
||||
private fun generateFloatingConversions() {
|
||||
for (otherType in PrimitiveType.floatingPoint) {
|
||||
val otherName = otherType.capitalized
|
||||
|
||||
out.println(" /**\n * Converts this [$className] value to [$otherName].\n *")
|
||||
if (type == UnsignedType.ULONG || type == UnsignedType.UINT && otherType == PrimitiveType.FLOAT) {
|
||||
out.println(" * The resulting value is the closest `$otherName` to this `$className` value.")
|
||||
out.println(" * In case when this `$className` value is exactly between two `$otherName`s,")
|
||||
out.println(" * the one with zero at least significant bit of mantissa is selected.")
|
||||
} else {
|
||||
out.println(" * The resulting `$otherName` value represents the same numerical value as this `$className`.")
|
||||
}
|
||||
out.println(" */")
|
||||
|
||||
out.println(" @kotlin.internal.InlineOnly")
|
||||
out.print(" public inline fun to$otherName(): $otherName = ")
|
||||
when (type) {
|
||||
@@ -244,6 +305,28 @@ class UnsignedTypeGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIns
|
||||
for (otherType in UnsignedType.values()) {
|
||||
val otherSigned = otherType.asSigned.capitalized
|
||||
val thisSigned = type.asSigned.capitalized
|
||||
|
||||
out.println("/**\n * Converts this [$otherSigned] value to [$className].\n *")
|
||||
when {
|
||||
otherType < type -> {
|
||||
out.println(" * If this value is positive, the resulting `$className` value represents the same numerical value as this `$otherSigned`.")
|
||||
out.println(" *")
|
||||
out.println(" * The ${lsb(otherType.bitSize)} of the resulting `$className` value are the same as the binary representation of this `$otherSigned` value,")
|
||||
out.println(" * whereas the ${msb(type.bitSize - otherType.bitSize)} are filled with the sign bit of this value.")
|
||||
}
|
||||
otherType == type -> {
|
||||
out.println(" * If this value is positive, the resulting `$className` value represents the same numerical value as this `$otherSigned`.")
|
||||
out.println(" *")
|
||||
out.println(" * The resulting `$className` value has the same binary representation as this `$otherSigned` value.")
|
||||
}
|
||||
else -> {
|
||||
out.println(" * If this value is positive and less than or equals to [$className.MAX_VALUE], the resulting `$className` value represents")
|
||||
out.println(" * the same numerical value as this `$otherSigned`.")
|
||||
out.println(" *")
|
||||
out.println(" * The resulting `$className` value is represented by the ${lsb(type.bitSize)} of this `$otherSigned` value.")
|
||||
}
|
||||
}
|
||||
out.println(" */")
|
||||
out.println("@SinceKotlin(\"1.3\")")
|
||||
out.println("@ExperimentalUnsignedTypes")
|
||||
out.println("@kotlin.internal.InlineOnly")
|
||||
@@ -257,6 +340,17 @@ class UnsignedTypeGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIns
|
||||
|
||||
for (otherType in PrimitiveType.floatingPoint) {
|
||||
val otherName = otherType.capitalized
|
||||
|
||||
out.println(
|
||||
"""
|
||||
/**
|
||||
* Converts this [$otherName] value to [$className].
|
||||
*
|
||||
* The fractional part, if any, is rounded down.
|
||||
* Returns zero if this `$otherName` value is negative or `NaN`, [$className.MAX_VALUE] if it's bigger than `$className.MAX_VALUE`.
|
||||
*/
|
||||
""".trimIndent()
|
||||
)
|
||||
out.println("@SinceKotlin(\"1.3\")")
|
||||
out.println("@ExperimentalUnsignedTypes")
|
||||
out.println("@kotlin.internal.InlineOnly")
|
||||
@@ -360,8 +454,7 @@ class UnsignedArrayGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIn
|
||||
}
|
||||
|
||||
override fun containsAll(elements: Collection<$elementType>): Boolean {
|
||||
if ((elements as Collection<Any?>).any { it as? $elementType == null }) return false
|
||||
return elements.all { storage.contains(it.to$storageElementType()) }
|
||||
return (elements as Collection<*>).all { it is $elementType && storage.contains(it.to$storageElementType()) }
|
||||
}
|
||||
|
||||
override fun isEmpty(): Boolean = this.storage.size == 0"""
|
||||
|
||||
@@ -527,7 +527,7 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
|
||||
testClass<AbstractOutOfBlockModificationTest> {
|
||||
model("codeInsight/outOfBlock")
|
||||
model("codeInsight/outOfBlock", pattern = KT_OR_KTS)
|
||||
}
|
||||
|
||||
testClass<AbstractDataFlowValueRenderingTest> {
|
||||
|
||||
@@ -518,7 +518,7 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
|
||||
testClass<AbstractOutOfBlockModificationTest> {
|
||||
model("codeInsight/outOfBlock")
|
||||
model("codeInsight/outOfBlock", pattern = KT_OR_KTS)
|
||||
}
|
||||
|
||||
testClass<AbstractDataFlowValueRenderingTest> {
|
||||
@@ -627,10 +627,6 @@ fun main(args: Array<String>) {
|
||||
model("debugger/smartStepInto")
|
||||
}
|
||||
|
||||
testClass<AbstractBeforeExtractFunctionInsertionTest> {
|
||||
model("debugger/insertBeforeExtractFunction", extension = "kt")
|
||||
}
|
||||
|
||||
testClass<AbstractKotlinSteppingTest> {
|
||||
model("debugger/tinyApp/src/stepping/stepIntoAndSmartStepInto", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepIntoTest", testClassName = "StepInto")
|
||||
model("debugger/tinyApp/src/stepping/stepIntoAndSmartStepInto", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doSmartStepIntoTest", testClassName = "SmartStepInto")
|
||||
|
||||
@@ -515,7 +515,7 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
|
||||
testClass<AbstractOutOfBlockModificationTest> {
|
||||
model("codeInsight/outOfBlock")
|
||||
model("codeInsight/outOfBlock", pattern = KT_OR_KTS)
|
||||
}
|
||||
|
||||
testClass<AbstractDataFlowValueRenderingTest> {
|
||||
|
||||
@@ -507,7 +507,7 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
|
||||
testClass<AbstractOutOfBlockModificationTest> {
|
||||
model("codeInsight/outOfBlock")
|
||||
model("codeInsight/outOfBlock", pattern = KT_OR_KTS)
|
||||
}
|
||||
|
||||
testClass<AbstractDataFlowValueRenderingTest> {
|
||||
|
||||
@@ -507,7 +507,7 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
|
||||
testClass<AbstractOutOfBlockModificationTest> {
|
||||
model("codeInsight/outOfBlock")
|
||||
model("codeInsight/outOfBlock", pattern = KT_OR_KTS)
|
||||
}
|
||||
|
||||
testClass<AbstractDataFlowValueRenderingTest> {
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.analyzer.ModuleInfo
|
||||
import org.jetbrains.kotlin.analyzer.TrackableModuleInfo
|
||||
import org.jetbrains.kotlin.caches.project.LibraryModuleInfo
|
||||
import org.jetbrains.kotlin.caches.resolve.resolution
|
||||
import org.jetbrains.kotlin.config.KotlinSourceRootType
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.util.enlargedSearchScope
|
||||
import org.jetbrains.kotlin.idea.configuration.BuildSystemType
|
||||
@@ -210,8 +210,8 @@ fun Module.testSourceInfo(): ModuleTestSourceInfo? = if (hasTestRoots()) ModuleT
|
||||
|
||||
internal fun Module.correspondingModuleInfos(): List<ModuleSourceInfo> = listOf(testSourceInfo(), productionSourceInfo()).filterNotNull()
|
||||
|
||||
private fun Module.hasProductionRoots() = hasRootsOfType(JavaSourceRootType.SOURCE) || hasRootsOfType(KotlinSourceRootType.Source) || (isNewMPPModule && sourceType == SourceType.PRODUCTION)
|
||||
private fun Module.hasTestRoots() = hasRootsOfType(JavaSourceRootType.TEST_SOURCE) || hasRootsOfType(KotlinSourceRootType.TestSource) || (isNewMPPModule && sourceType == SourceType.TEST)
|
||||
private fun Module.hasProductionRoots() = hasRootsOfType(JavaSourceRootType.SOURCE) || hasRootsOfType(SourceKotlinRootType) || (isNewMPPModule && sourceType == SourceType.PRODUCTION)
|
||||
private fun Module.hasTestRoots() = hasRootsOfType(JavaSourceRootType.TEST_SOURCE) || hasRootsOfType(TestSourceKotlinRootType) || (isNewMPPModule && sourceType == SourceType.TEST)
|
||||
|
||||
private fun Module.hasRootsOfType(sourceRootType: JpsModuleSourceRootType<*>): Boolean =
|
||||
rootManager.contentEntries.any { it.getSourceFolders(sourceRootType).isNotEmpty() }
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.idea.caches.project.NotUnderContentRootModuleInfo
|
||||
import org.jetbrains.kotlin.idea.caches.project.getModuleInfo
|
||||
import org.jetbrains.kotlin.idea.core.script.IdeScriptReportSink
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDefinitionsManager
|
||||
import org.jetbrains.kotlin.idea.core.script.scriptDependencies
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDependenciesUpdater
|
||||
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil
|
||||
import org.jetbrains.kotlin.idea.util.isRunningInCidrIde
|
||||
import org.jetbrains.kotlin.psi.KtCodeFragment
|
||||
@@ -67,7 +67,7 @@ object KotlinHighlightingUtil {
|
||||
@Suppress("DEPRECATION")
|
||||
private fun shouldHighlightScript(ktFile: KtFile): Boolean {
|
||||
if (isRunningInCidrIde) return false // There is no Java support in CIDR. So do not highlight errors in KTS if running in CIDR.
|
||||
if (ktFile.virtualFile.scriptDependencies == null) return false
|
||||
if (!ScriptDependenciesUpdater.areDependenciesCached(ktFile)) return false
|
||||
if (ktFile.virtualFile.getUserData(IdeScriptReportSink.Reports)?.any { it.severity == ScriptReport.Severity.FATAL } == true) {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.intellij.psi.PsiFile
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import org.jetbrains.kotlin.idea.core.script.IdeScriptReportSink
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDefinitionsManager
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDependenciesUpdater
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import kotlin.script.experimental.dependencies.ScriptReport
|
||||
|
||||
@@ -53,18 +54,17 @@ class ScriptExternalHighlightingPass(
|
||||
if (!file.isScript()) return
|
||||
|
||||
if (!ScriptDefinitionsManager.getInstance(file.project).isReady()) {
|
||||
UIUtil.invokeLaterIfNeeded {
|
||||
val ideFrame = WindowManager.getInstance().getIdeFrame(file.project)
|
||||
if (ideFrame != null) {
|
||||
val statusBar = ideFrame.statusBar as StatusBarEx
|
||||
statusBar.notifyProgressByBalloon(
|
||||
MessageType.WARNING,
|
||||
"Highlighting in scripts is not available until all Script Definitions are loaded",
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
}
|
||||
showNotification(
|
||||
file,
|
||||
"Highlighting in scripts is not available until all Script Definitions are loaded"
|
||||
)
|
||||
}
|
||||
|
||||
if (!ScriptDependenciesUpdater.areDependenciesCached(file)) {
|
||||
showNotification(
|
||||
file,
|
||||
"Highlighting in scripts is not available until all Script Dependencies are loaded"
|
||||
)
|
||||
}
|
||||
|
||||
val reports = file.virtualFile.getUserData(IdeScriptReportSink.Reports) ?: return
|
||||
@@ -118,6 +118,21 @@ class ScriptExternalHighlightingPass(
|
||||
}
|
||||
}
|
||||
|
||||
private fun showNotification(file: KtFile, message: String) {
|
||||
UIUtil.invokeLaterIfNeeded {
|
||||
val ideFrame = WindowManager.getInstance().getIdeFrame(file.project)
|
||||
if (ideFrame != null) {
|
||||
val statusBar = ideFrame.statusBar as StatusBarEx
|
||||
statusBar.notifyProgressByBalloon(
|
||||
MessageType.WARNING,
|
||||
message,
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Factory(registrar: TextEditorHighlightingPassRegistrar) : ProjectComponent,
|
||||
TextEditorHighlightingPassFactory {
|
||||
init {
|
||||
|
||||
@@ -39,7 +39,6 @@ import org.jetbrains.kotlin.idea.caches.project.cached
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getTopmostParentOfType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.isAncestor
|
||||
import org.jetbrains.kotlin.psi.psiUtil.parents
|
||||
|
||||
val KOTLIN_CONSOLE_KEY = Key.create<Boolean>("kotlin.console")
|
||||
|
||||
@@ -128,8 +127,8 @@ class KotlinCodeBlockModificationListener(
|
||||
?.let { return it }
|
||||
}
|
||||
|
||||
val blockDeclaration = KtPsiUtil.getTopmostParentOfTypes(element, *BLOCK_DECLARATION_TYPES) ?: return null
|
||||
if (blockDeclaration.parents.any { it !is KtClassBody && it !is KtClassOrObject && it !is KtFile }) return null // should not be local declaration
|
||||
val blockDeclaration = KtPsiUtil.getTopmostParentOfTypes(element, *BLOCK_DECLARATION_TYPES) as? KtDeclaration ?: return null
|
||||
if (KtPsiUtil.isLocal(blockDeclaration)) return null // should not be local declaration
|
||||
|
||||
when (blockDeclaration) {
|
||||
is KtNamedFunction -> {
|
||||
@@ -151,6 +150,13 @@ class KotlinCodeBlockModificationListener(
|
||||
}
|
||||
}
|
||||
|
||||
is KtScriptInitializer -> {
|
||||
return (blockDeclaration.body as? KtCallExpression)
|
||||
?.lambdaArguments?.last()
|
||||
?.getLambdaExpression()
|
||||
?.takeIf { it.isAncestor(element) }
|
||||
}
|
||||
|
||||
else -> throw IllegalStateException()
|
||||
}
|
||||
|
||||
@@ -163,7 +169,8 @@ class KotlinCodeBlockModificationListener(
|
||||
|
||||
private val BLOCK_DECLARATION_TYPES = arrayOf<Class<out KtDeclaration>>(
|
||||
KtProperty::class.java,
|
||||
KtNamedFunction::class.java
|
||||
KtNamedFunction::class.java,
|
||||
KtScriptInitializer::class.java
|
||||
)
|
||||
|
||||
fun getInstance(project: Project) = project.getComponent(KotlinCodeBlockModificationListener::class.java)
|
||||
|
||||
@@ -19,9 +19,7 @@ package org.jetbrains.kotlin.idea.search
|
||||
import com.intellij.openapi.fileTypes.FileType
|
||||
import com.intellij.openapi.fileTypes.FileTypeRegistry
|
||||
import com.intellij.openapi.progress.ProgressIndicator
|
||||
import com.intellij.openapi.progress.ProgressManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.roots.FileIndexFacade
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiFile
|
||||
@@ -32,15 +30,17 @@ import com.intellij.psi.search.LocalSearchScope
|
||||
import com.intellij.psi.search.PsiSearchHelper
|
||||
import com.intellij.psi.search.SearchScope
|
||||
import com.intellij.psi.search.searches.ReferencesSearch
|
||||
import com.intellij.util.Processor
|
||||
import com.intellij.util.CommonProcessors
|
||||
import com.intellij.util.indexing.FileBasedIndex
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
import org.jetbrains.kotlin.idea.util.compat.psiSearchHelperInstance
|
||||
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
||||
import org.jetbrains.kotlin.idea.util.compat.psiSearchHelperInstance
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.script.findScriptDefinition
|
||||
import org.jetbrains.kotlin.psi.KtNamedDeclaration
|
||||
import org.jetbrains.kotlin.types.expressions.OperatorConventions
|
||||
import java.util.*
|
||||
|
||||
infix fun SearchScope.and(otherScope: SearchScope): SearchScope = intersectWith(otherScope)
|
||||
infix fun SearchScope.or(otherScope: SearchScope): SearchScope = union(otherScope)
|
||||
@@ -121,32 +121,23 @@ fun PsiSearchHelper.isCheapEnoughToSearchConsideringOperators(
|
||||
return PsiSearchHelper.SearchCostResult.TOO_MANY_OCCURRENCES
|
||||
}
|
||||
|
||||
if (!isCheapToSearchUsagesInScripts(scope.restrictToKotlinSources(), name)) {
|
||||
return PsiSearchHelper.SearchCostResult.TOO_MANY_OCCURRENCES
|
||||
}
|
||||
|
||||
return isCheapEnoughToSearch(name, scope, fileToIgnoreOccurrencesIn, progress)
|
||||
}
|
||||
|
||||
private fun isCheapToSearchUsagesInScripts(scope: GlobalSearchScope, name: String): Boolean {
|
||||
val project = scope.project ?: return true
|
||||
fun findScriptsWithUsages(declaration: KtNamedDeclaration): List<VirtualFile> {
|
||||
val project = declaration.project
|
||||
val scope = psiSearchHelperInstance(project).getUseScope(declaration) as? GlobalSearchScope
|
||||
?: return emptyList()
|
||||
|
||||
var scriptsCount = 0
|
||||
val processor = object : Processor<VirtualFile> {
|
||||
override fun process(file: VirtualFile): Boolean {
|
||||
ProgressManager.checkCanceled()
|
||||
if (findScriptDefinition(file, project) == null) return true
|
||||
return scriptsCount++ < 3
|
||||
}
|
||||
}
|
||||
|
||||
val index = FileIndexFacade.getInstance(project)
|
||||
return runReadAction {
|
||||
FileBasedIndex.getInstance().processFilesContainingAllKeys(
|
||||
val name = declaration.name.takeIf { it?.isNotBlank() == true } ?: return emptyList()
|
||||
val collector = CommonProcessors.CollectProcessor(ArrayList<VirtualFile>())
|
||||
runReadAction {
|
||||
FileBasedIndex.getInstance().getFilesWithKey(
|
||||
IdIndex.NAME,
|
||||
listOf(IdIndexEntry(name, true)),
|
||||
scope,
|
||||
null,
|
||||
{ file -> !index.shouldBeFound(scope, file) || processor.process(file) })
|
||||
setOf(IdIndexEntry(name, true)),
|
||||
collector,
|
||||
scope
|
||||
)
|
||||
}
|
||||
return collector.results.filter { findScriptDefinition(it, project) != null }.toList()
|
||||
}
|
||||
|
||||
@@ -22,7 +22,10 @@ import org.jetbrains.kotlin.idea.util.ShadowedDeclarationsFilter
|
||||
import org.jetbrains.kotlin.idea.util.getResolutionScope
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.createSmartPointer
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getQualifiedExpressionForReceiver
|
||||
import org.jetbrains.kotlin.psi.psiUtil.parents
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getCall
|
||||
@@ -36,7 +39,6 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
|
||||
import org.jetbrains.kotlin.resolve.scopes.utils.findFirstClassifierWithDeprecationStatus
|
||||
import org.jetbrains.kotlin.resolve.scopes.utils.findPackage
|
||||
import org.jetbrains.kotlin.resolve.source.getPsi
|
||||
import java.lang.IllegalStateException
|
||||
import java.util.*
|
||||
|
||||
class ShortenReferences(val options: (KtElement) -> Options = { Options.DEFAULT }) {
|
||||
@@ -49,7 +51,7 @@ class ShortenReferences(val options: (KtElement) -> Options = { Options.DEFAULT
|
||||
) {
|
||||
companion object {
|
||||
val DEFAULT = Options()
|
||||
val ALL_ENABLED = Options(true, true)
|
||||
val ALL_ENABLED = Options(removeThisLabels = true, removeThis = true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +61,30 @@ class ShortenReferences(val options: (KtElement) -> Options = { Options.DEFAULT
|
||||
|
||||
val RETAIN_COMPANION = ShortenReferences { Options(removeExplicitCompanion = false) }
|
||||
|
||||
fun canBePossibleToDropReceiver(element: KtDotQualifiedExpression, bindingContext: BindingContext): Boolean {
|
||||
val receiver = element.receiverExpression
|
||||
val nameRef = when (receiver) {
|
||||
is KtThisExpression -> return true
|
||||
is KtNameReferenceExpression -> receiver
|
||||
is KtDotQualifiedExpression -> receiver.selectorExpression as? KtNameReferenceExpression ?: return false
|
||||
else -> return false
|
||||
}
|
||||
val targetDescriptor = bindingContext[BindingContext.REFERENCE_TARGET, nameRef]
|
||||
when (targetDescriptor) {
|
||||
is ClassDescriptor -> {
|
||||
if (targetDescriptor.kind != ClassKind.OBJECT) return true
|
||||
// for object receiver we should additionally check that it's dispatch receiver (that is the member is inside the object) or not a receiver at all
|
||||
val resolvedCall = element.getResolvedCall(bindingContext) ?: return false
|
||||
val receiverKind = resolvedCall.explicitReceiverKind
|
||||
return receiverKind == ExplicitReceiverKind.DISPATCH_RECEIVER || receiverKind == ExplicitReceiverKind.NO_EXPLICIT_RECEIVER
|
||||
}
|
||||
|
||||
is PackageViewDescriptor -> return true
|
||||
|
||||
else -> return false
|
||||
}
|
||||
}
|
||||
|
||||
private fun DeclarationDescriptor.asString() = DescriptorRenderer.FQ_NAMES_IN_TYPES.render(this)
|
||||
|
||||
private fun KtReferenceExpression.targets(context: BindingContext) = getImportableTargets(context)
|
||||
@@ -85,7 +111,7 @@ class ShortenReferences(val options: (KtElement) -> Options = { Options.DEFAULT
|
||||
rangeMarker.isGreedyToLeft = true
|
||||
rangeMarker.isGreedyToRight = true
|
||||
try {
|
||||
process(listOf(file), { element ->
|
||||
process(listOf(file)) { element ->
|
||||
if (rangeMarker.isValid) {
|
||||
val range = TextRange(rangeMarker.startOffset, rangeMarker.endOffset)
|
||||
|
||||
@@ -111,7 +137,7 @@ class ShortenReferences(val options: (KtElement) -> Options = { Options.DEFAULT
|
||||
} else {
|
||||
FilterResult.SKIP
|
||||
}
|
||||
})
|
||||
}
|
||||
} finally {
|
||||
rangeMarker.dispose()
|
||||
}
|
||||
@@ -172,7 +198,7 @@ class ShortenReferences(val options: (KtElement) -> Options = { Options.DEFAULT
|
||||
}
|
||||
|
||||
// step 2: analyze collected elements with resolve and decide which can be shortened now and which need descriptors to be imported before shortening
|
||||
val allElementsToAnalyze = visitors.flatMap { it.getElementsToAnalyze().map { it.element } }
|
||||
val allElementsToAnalyze = visitors.flatMap { visitor -> visitor.getElementsToAnalyze().map { it.element } }
|
||||
val bindingContext = file.getResolutionFacade().analyze(allElementsToAnalyze, BodyResolveMode.PARTIAL_WITH_CFA)
|
||||
processors.forEach { it.analyzeCollectedElements(bindingContext) }
|
||||
|
||||
@@ -363,7 +389,7 @@ class ShortenReferences(val options: (KtElement) -> Options = { Options.DEFAULT
|
||||
val referenceExpression = element.referenceExpression ?: return AnalyzeQualifiedElementResult.Skip
|
||||
|
||||
val target = referenceExpression.targets(bindingContext).singleOrNull()
|
||||
?: return AnalyzeQualifiedElementResult.Skip
|
||||
?: return AnalyzeQualifiedElementResult.Skip
|
||||
|
||||
val scope = element.getResolutionScope(bindingContext, resolutionFacade)
|
||||
val name = target.name
|
||||
@@ -449,7 +475,8 @@ class ShortenReferences(val options: (KtElement) -> Options = { Options.DEFAULT
|
||||
if (PsiTreeUtil.getParentOfType(
|
||||
element,
|
||||
KtImportDirective::class.java, KtPackageDirective::class.java
|
||||
) != null) return AnalyzeQualifiedElementResult.Skip
|
||||
) != null
|
||||
) return AnalyzeQualifiedElementResult.Skip
|
||||
|
||||
val selector = element.selectorExpression ?: return AnalyzeQualifiedElementResult.Skip
|
||||
val callee = selector.getCalleeExpressionIfAny() as? KtReferenceExpression ?: return AnalyzeQualifiedElementResult.Skip
|
||||
@@ -536,30 +563,6 @@ class ShortenReferences(val options: (KtElement) -> Options = { Options.DEFAULT
|
||||
}
|
||||
}
|
||||
|
||||
private fun canBePossibleToDropReceiver(element: KtDotQualifiedExpression, bindingContext: BindingContext): Boolean {
|
||||
val receiver = element.receiverExpression
|
||||
val nameRef = when (receiver) {
|
||||
is KtThisExpression -> return true
|
||||
is KtNameReferenceExpression -> receiver
|
||||
is KtDotQualifiedExpression -> receiver.selectorExpression as? KtNameReferenceExpression ?: return false
|
||||
else -> return false
|
||||
}
|
||||
val targetDescriptor = bindingContext[BindingContext.REFERENCE_TARGET, nameRef]
|
||||
when (targetDescriptor) {
|
||||
is ClassDescriptor -> {
|
||||
if (targetDescriptor.kind != ClassKind.OBJECT) return true
|
||||
// for object receiver we should additionally check that it's dispatch receiver (that is the member is inside the object) or not a receiver at all
|
||||
val resolvedCall = element.getResolvedCall(bindingContext) ?: return false
|
||||
val receiverKind = resolvedCall.explicitReceiverKind
|
||||
return receiverKind == ExplicitReceiverKind.DISPATCH_RECEIVER || receiverKind == ExplicitReceiverKind.NO_EXPLICIT_RECEIVER
|
||||
}
|
||||
|
||||
is PackageViewDescriptor -> return true
|
||||
|
||||
else -> return false
|
||||
}
|
||||
}
|
||||
|
||||
private fun copyShortenAndAnalyze(
|
||||
element: KtDotQualifiedExpression,
|
||||
bindingContext: BindingContext
|
||||
@@ -673,7 +676,8 @@ class ShortenReferences(val options: (KtElement) -> Options = { Options.DEFAULT
|
||||
if (PsiTreeUtil.getParentOfType(
|
||||
element,
|
||||
KtImportDirective::class.java, KtPackageDirective::class.java
|
||||
) != null) return AnalyzeQualifiedElementResult.Skip
|
||||
) != null
|
||||
) return AnalyzeQualifiedElementResult.Skip
|
||||
|
||||
val receiverTarget = receiver.singleTarget(bindingContext) as? ClassDescriptor ?: return AnalyzeQualifiedElementResult.Skip
|
||||
|
||||
@@ -683,7 +687,7 @@ class ShortenReferences(val options: (KtElement) -> Options = { Options.DEFAULT
|
||||
if (receiverTarget.companionObjectDescriptor != selectorTarget) return AnalyzeQualifiedElementResult.Skip
|
||||
|
||||
val selectorsSelector = (parent as? KtDotQualifiedExpression)?.selectorExpression
|
||||
?: return AnalyzeQualifiedElementResult.ShortenNow
|
||||
?: return AnalyzeQualifiedElementResult.ShortenNow
|
||||
|
||||
val selectorsSelectorTarget = selectorsSelector.singleTarget(bindingContext) ?: return AnalyzeQualifiedElementResult.Skip
|
||||
if (selectorsSelectorTarget is ClassDescriptor) return AnalyzeQualifiedElementResult.Skip
|
||||
@@ -693,7 +697,8 @@ class ShortenReferences(val options: (KtElement) -> Options = { Options.DEFAULT
|
||||
if (source != null && isEnumCompanionPropertyWithEntryConflict(
|
||||
source,
|
||||
source.name ?: ""
|
||||
)) return AnalyzeQualifiedElementResult.Skip
|
||||
)
|
||||
) return AnalyzeQualifiedElementResult.Skip
|
||||
}
|
||||
|
||||
return AnalyzeQualifiedElementResult.ShortenNow
|
||||
|
||||
@@ -10,23 +10,22 @@ import com.intellij.openapi.vfs.VirtualFile
|
||||
import org.jetbrains.jps.model.java.JavaResourceRootType
|
||||
import org.jetbrains.jps.model.java.JavaSourceRootType
|
||||
import org.jetbrains.jps.model.module.JpsModuleSourceRootType
|
||||
import org.jetbrains.kotlin.config.KotlinResourceRootType
|
||||
import org.jetbrains.kotlin.config.KotlinSourceRootType
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.idea.caches.project.SourceType
|
||||
import org.jetbrains.kotlin.idea.util.isInSourceContentWithoutInjected
|
||||
|
||||
private val testRootTypes: Set<JpsModuleSourceRootType<*>> = setOf(
|
||||
JavaSourceRootType.TEST_SOURCE,
|
||||
JavaResourceRootType.TEST_RESOURCE,
|
||||
KotlinSourceRootType.TestSource,
|
||||
KotlinResourceRootType.TestResource
|
||||
TestSourceKotlinRootType,
|
||||
TestResourceKotlinRootType
|
||||
)
|
||||
|
||||
private val sourceRootTypes = setOf<JpsModuleSourceRootType<*>>(
|
||||
JavaSourceRootType.SOURCE,
|
||||
JavaResourceRootType.RESOURCE,
|
||||
KotlinSourceRootType.Source,
|
||||
KotlinResourceRootType.Resource
|
||||
SourceKotlinRootType,
|
||||
ResourceKotlinRootType
|
||||
)
|
||||
|
||||
fun JpsModuleSourceRootType<*>.getSourceType(): SourceType? = when(this) {
|
||||
|
||||
@@ -19,7 +19,8 @@ import com.intellij.util.Query
|
||||
import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes
|
||||
import org.jetbrains.jps.model.java.JavaSourceRootProperties
|
||||
import org.jetbrains.jps.model.module.JpsModuleSourceRootType
|
||||
import org.jetbrains.kotlin.config.KotlinSourceRootType
|
||||
import org.jetbrains.kotlin.config.SourceKotlinRootType
|
||||
import org.jetbrains.kotlin.config.TestSourceKotlinRootType
|
||||
import org.jetbrains.kotlin.idea.caches.PerModulePackageCacheService
|
||||
import org.jetbrains.kotlin.idea.roots.invalidateProjectRoots
|
||||
import org.jetbrains.kotlin.idea.util.rootManager
|
||||
@@ -79,7 +80,7 @@ private fun findLongestExistingPackage(module: Module, packageName: String): Psi
|
||||
}
|
||||
|
||||
private val kotlinSourceRootTypes: Set<JpsModuleSourceRootType<JavaSourceRootProperties>> =
|
||||
setOf(KotlinSourceRootType.Source, KotlinSourceRootType.TestSource) + JavaModuleSourceRootTypes.SOURCES
|
||||
setOf(SourceKotlinRootType, TestSourceKotlinRootType) + JavaModuleSourceRootTypes.SOURCES
|
||||
|
||||
private fun Module.getNonGeneratedKotlinSourceRoots(): List<VirtualFile> {
|
||||
val result = mutableListOf<VirtualFile>()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user