mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-20 08:31:28 +00:00
Compare commits
2 Commits
rr/pdn_byt
...
rr/ilmir/i
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ccaa4a1cf1 | ||
|
|
f025a357f7 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -32,8 +32,6 @@ build/
|
||||
.idea/modules
|
||||
.idea/runConfigurations/JPS_*.xml
|
||||
.idea/runConfigurations/PILL_*.xml
|
||||
.idea/runConfigurations/_FP_*.xml
|
||||
.idea/runConfigurations/_MT_*.xml
|
||||
.idea/libraries
|
||||
.idea/modules.xml
|
||||
.idea/gradle.xml
|
||||
@@ -56,7 +54,6 @@ build/
|
||||
.idea/artifacts/kotlin_test_js_ir_*
|
||||
.idea/artifacts/kotlin_stdlib_wasm_*
|
||||
.idea/jarRepositories.xml
|
||||
.idea/csv-plugin.xml
|
||||
kotlin-ultimate/
|
||||
node_modules/
|
||||
.rpt2_cache/
|
||||
@@ -65,5 +62,3 @@ local.properties
|
||||
buildSrcTmp/
|
||||
distTmp/
|
||||
outTmp/
|
||||
/test.output
|
||||
/kotlin-native/dist
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="kotlinx.cli-jvm-1.5.255-SNAPSHOT">
|
||||
<output-path>$PROJECT_DIR$/kotlin-native/endorsedLibraries/kotlinx.cli/build/libs</output-path>
|
||||
<root id="archive" name="kotlinx.cli-jvm-1.5.255-SNAPSHOT.jar">
|
||||
<element id="module-output" name="kotlin.kotlin-native.endorsedLibraries.kotlinx.cli.jvmMain" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
23
.idea/codeStyles/Project.xml
generated
23
.idea/codeStyles/Project.xml
generated
@@ -63,6 +63,27 @@
|
||||
<option name="FOR_BRACE_FORCE" value="1" />
|
||||
<option name="FIELD_ANNOTATION_WRAP" value="0" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JavaScript">
|
||||
<option name="ELSE_ON_NEW_LINE" value="true" />
|
||||
<option name="WHILE_ON_NEW_LINE" value="true" />
|
||||
<option name="CATCH_ON_NEW_LINE" value="true" />
|
||||
<option name="FINALLY_ON_NEW_LINE" value="true" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
||||
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
|
||||
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="5" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="5" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||
<option name="ASSIGNMENT_WRAP" value="1" />
|
||||
<option name="IF_BRACE_FORCE" value="1" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="1" />
|
||||
<option name="WHILE_BRACE_FORCE" value="1" />
|
||||
<option name="FOR_BRACE_FORCE" value="1" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="PROTO">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
@@ -80,4 +101,4 @@
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
||||
</component>
|
||||
|
||||
9
.idea/dictionaries/sebastiansellmair.xml
generated
9
.idea/dictionaries/sebastiansellmair.xml
generated
@@ -1,9 +0,0 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="sebastiansellmair">
|
||||
<words>
|
||||
<w>cinterops</w>
|
||||
<w>interops</w>
|
||||
<w>klibrary</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
||||
4
.idea/misc.xml
generated
4
.idea/misc.xml
generated
@@ -12,14 +12,10 @@
|
||||
<item index="2" class="java.lang.String" itemvalue="org.gradle.api.tasks.options.Option" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<file type="web" url="file://$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="IdProvider" IDEtalkID="71A301FF1940049D6D82F12C40F1E1D5" />
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
<component name="JavadocGenerationManager">
|
||||
<option name="OTHER_OPTIONS" value="" />
|
||||
</component>
|
||||
|
||||
4
.idea/runConfigurations/Generate_All_Tests.xml
generated
4
.idea/runConfigurations/Generate_All_Tests.xml
generated
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Generate All Tests" type="GradleRunConfiguration" factoryName="Gradle" folderName="Generators">
|
||||
<configuration default="false" name="Generate All Tests" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -17,4 +17,4 @@
|
||||
</ExternalSystemSettings>
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
@@ -1,24 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Generate FIR Checker Components and FIR/IDE Diagnostics" type="GradleRunConfiguration" factoryName="Gradle" folderName="Generators">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value=":compiler:fir:checkers:generateCheckersComponents" />
|
||||
<option value=":idea:idea-frontend-fir:generateCode" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" value="" />
|
||||
</ExternalSystemSettings>
|
||||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
|
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
21
.idea/runConfigurations/Generate_FIR_tree.xml
generated
21
.idea/runConfigurations/Generate_FIR_tree.xml
generated
@@ -1,21 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Generate FIR tree" type="GradleRunConfiguration" factoryName="Gradle" folderName="Generators">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/compiler/fir/tree" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value="generateTree" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" value="" />
|
||||
</ExternalSystemSettings>
|
||||
<GradleScriptDebugEnabled>true</GradleScriptDebugEnabled>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Generate standard library sources" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
|
||||
<configuration default="false" name="Generate standard library sources" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/libraries/tools/kotlin-stdlib-gen" />
|
||||
@@ -17,4 +17,4 @@
|
||||
</ExternalSystemSettings>
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
4
.idea/runConfigurations/IDEA.xml
generated
4
.idea/runConfigurations/IDEA.xml
generated
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="IDEA" type="GradleRunConfiguration" factoryName="Gradle" singleton="true" folderName="IDEA">
|
||||
<configuration default="false" name="IDEA" type="GradleRunConfiguration" factoryName="Gradle" singleton="true">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -17,4 +17,4 @@
|
||||
</ExternalSystemSettings>
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
4
.idea/runConfigurations/IDEA_Ultimate.xml
generated
4
.idea/runConfigurations/IDEA_Ultimate.xml
generated
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="IDEA Ultimate" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
|
||||
<configuration default="false" name="IDEA Ultimate" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -17,4 +17,4 @@
|
||||
</ExternalSystemSettings>
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="IDEA Ultimate (No ProcessCanceledException) " type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
|
||||
<configuration default="false" name="IDEA Ultimate (No ProcessCanceledException) " type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -17,4 +17,4 @@
|
||||
</ExternalSystemSettings>
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
|
||||
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -17,4 +17,4 @@
|
||||
</ExternalSystemSettings>
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
4
.idea/runConfigurations/IDEA__Not_Internal_.xml
generated
4
.idea/runConfigurations/IDEA__Not_Internal_.xml
generated
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="IDEA (Not Internal)" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
|
||||
<configuration default="false" name="IDEA (Not Internal)" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -16,4 +16,4 @@
|
||||
<option name="vmOptions" value="" />
|
||||
</ExternalSystemSettings>
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
25
.idea/runConfigurations/Test__Commonizer.xml
generated
25
.idea/runConfigurations/Test__Commonizer.xml
generated
@@ -1,25 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Test: Commonizer" type="GradleRunConfiguration" factoryName="Gradle" folderName="Tests">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="--tests "org.jetbrains.kotlin.gradle.CommonizerHierarchicalIT" --tests "org.jetbrains.kotlin.gradle.CommonizerIT" --tests "org.jetbrains.kotlin.commonizer.**"" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value=":native:kotlin-klib-commonizer-api:test" />
|
||||
<option value=":native:kotlin-klib-commonizer:test" />
|
||||
<option value=":kotlin-gradle-plugin-integration-tests:test" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" value="" />
|
||||
</ExternalSystemSettings>
|
||||
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
|
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
4
.idea/runConfigurations/Test__KMM.xml
generated
4
.idea/runConfigurations/Test__KMM.xml
generated
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Test: KMM" type="GradleRunConfiguration" factoryName="Gradle" folderName="Tests">
|
||||
<configuration default="false" name="Test: KMM" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -17,4 +17,4 @@
|
||||
</ExternalSystemSettings>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Test: public API binary compatibility validator, overwrite results" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
|
||||
<configuration default="false" name="Test: public API binary compatibility validator, overwrite results" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/libraries/tools/binary-compatibility-validator" />
|
||||
@@ -18,4 +18,4 @@
|
||||
</ExternalSystemSettings>
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Test: stdlib-js public kotlin api test, overwrite results" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
|
||||
<configuration default="false" name="Test: stdlib-js public kotlin api test, overwrite results" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -19,4 +19,4 @@
|
||||
<GradleScriptDebugEnabled>false</GradleScriptDebugEnabled>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
37
ReadMe.md
37
ReadMe.md
@@ -106,8 +106,6 @@ To reproduce TeamCity build use `-Pteamcity=true` flag. Local builds don't run p
|
||||
**OPTIONAL:** Some artifacts, mainly Maven plugin ones, are built separately with Maven.
|
||||
Refer to [libraries/ReadMe.md](libraries/ReadMe.md) for details.
|
||||
|
||||
To build Kotlin/Native, see
|
||||
[kotlin-native/README.md](kotlin-native/README.md#building-from-source).
|
||||
|
||||
### Building for different versions of IntelliJ IDEA and Android Studio
|
||||
|
||||
@@ -147,27 +145,28 @@ From this root project there are Run/Debug Configurations for running `IDEA` or
|
||||
* Run the `IDEA` run configuration in the project
|
||||
* A child IntelliJ IDEA with the Kotlin plugin will then startup
|
||||
|
||||
### Dependency verification
|
||||
### Including into composite build
|
||||
|
||||
We have a [dependencies verification](https://docs.gradle.org/current/userguide/dependency_verification.html) feature enabled in the
|
||||
repository for all Gradle builds. Gradle will check hashes (md5 and sha256) of used dependencies and will fail builds with
|
||||
`Dependency verification failed` errors when local artifacts are absent or have different hashes listed in the
|
||||
[verification-metadata.xml](https://github.com/JetBrains/kotlin/blob/master/gradle/verification-metadata.xml) file.
|
||||
To include kotlin compiler into [composite build](https://docs.gradle.org/current/userguide/composite_builds.html) you need to define `dependencySubstitution` for `kotlin-compiler` module in `settings.gradle.kts`
|
||||
|
||||
It's expected that `verification-metadata.xml` should only be updated with the commits that modify the build. There are some tips how
|
||||
to perform such updates:
|
||||
```Kotlin
|
||||
includeBuild("/path/to/kotlin") {
|
||||
dependencySubstitution {
|
||||
substitute(module("org.jetbrains.kotlin:kotlin-compiler"))
|
||||
.with(project(":include:kotlin-compiler"))
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- Use auto-generation for getting an initial list of new hashes (verify updates relate to you changes).
|
||||
or in `settings.gradle`
|
||||
|
||||
`./gradlew -M sha256,md5 help`
|
||||
|
||||
*(any other task may be used instead of `help`)*
|
||||
|
||||
- Consider removing old versions from the file if you are updating dependencies.
|
||||
- Leave meaningful `origin` attribute (instead of `Generated by Gradle`) if you did some manual verification of the artifact.
|
||||
- Always do manual verification if several hashes are needed and a new `also-trust` tag has to be added.
|
||||
- If you’re adding a dependency with OS mentioning in an artifact name (`darwin`, `mac`, `osx`, `linux`, `windows`), remember to add
|
||||
counterparts for other platforms.
|
||||
```Groovy
|
||||
includeBuild('/path/to/kotlin') {
|
||||
dependencySubstitution {
|
||||
substitute module('org.jetbrains.kotlin:kotlin-compiler') with project(':include:kotlin-compiler')
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
# License
|
||||
Kotlin is distributed under the terms of the Apache License (Version 2.0). See [license folder](license/README.md) for details.
|
||||
|
||||
@@ -1,11 +1,36 @@
|
||||
import kotlinx.benchmark.gradle.benchmark
|
||||
|
||||
val benchmarks_version = "0.3.0"
|
||||
val benchmarks_version = "0.2.0-dev-7"
|
||||
buildscript {
|
||||
val benchmarks_version = "0.2.0-dev-7"
|
||||
|
||||
repositories {
|
||||
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
|
||||
if (cacheRedirectorEnabled) {
|
||||
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
|
||||
} else {
|
||||
maven("https://dl.bintray.com/kotlin/kotlinx")
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlinx:kotlinx.benchmark.gradle:$benchmarks_version")
|
||||
}
|
||||
}
|
||||
|
||||
apply(plugin = "kotlinx.benchmark")
|
||||
|
||||
plugins {
|
||||
java
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.kotlinx.benchmark") version "0.3.0"
|
||||
}
|
||||
|
||||
repositories {
|
||||
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
|
||||
if (cacheRedirectorEnabled) {
|
||||
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
|
||||
} else {
|
||||
maven("https://dl.bintray.com/kotlin/kotlinx")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -17,7 +42,7 @@ dependencies {
|
||||
compile(jpsStandalone()) { includeJars("jps-model") }
|
||||
compile(intellijPluginDep("java"))
|
||||
compile(intellijDep()) { includeIntellijCoreJarDependencies(project) }
|
||||
compile("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:$benchmarks_version")
|
||||
compile("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:$benchmarks_version")
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -67,16 +92,18 @@ benchmark {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.matching { it is Zip && it.name == "mainBenchmarkJar" }.configureEach {
|
||||
this as Zip
|
||||
isZip64 = true
|
||||
archiveFileName.set("benchmarks.jar")
|
||||
}
|
||||
|
||||
val benchmarkTasks = listOf("mainBenchmark", "mainFirBenchmark", "mainNiBenchmark")
|
||||
tasks.matching { it is JavaExec && it.name in benchmarkTasks }.configureEach {
|
||||
this as JavaExec
|
||||
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
|
||||
tasks.named("classes") {
|
||||
doLast {
|
||||
tasks.named("mainBenchmarkJar", Zip::class.java) {
|
||||
isZip64 = true
|
||||
archiveName = "benchmarks.jar"
|
||||
}
|
||||
listOf("mainBenchmark", "mainFirBenchmark", "mainNiBenchmark").forEach {
|
||||
tasks.named(it, JavaExec::class.java) {
|
||||
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register<JavaExec>("runBenchmark") {
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.context.withProject
|
||||
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
||||
import org.jetbrains.kotlin.diagnostics.Severity
|
||||
import org.jetbrains.kotlin.fir.builder.RawFirBuilder
|
||||
import org.jetbrains.kotlin.fir.createSessionForTests
|
||||
import org.jetbrains.kotlin.fir.createSession
|
||||
import org.jetbrains.kotlin.fir.java.FirJavaElementFinder
|
||||
import org.jetbrains.kotlin.fir.resolve.firProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirProviderImpl
|
||||
@@ -150,7 +150,7 @@ abstract class AbstractSimpleFileBenchmark {
|
||||
private fun analyzeGreenFileIr(bh: Blackhole) {
|
||||
val scope = GlobalSearchScope.filesScope(env.project, listOf(file.virtualFile))
|
||||
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(env.project))
|
||||
val session = createSessionForTests(env, scope)
|
||||
val session = createSession(env, scope)
|
||||
val firProvider = session.firProvider as FirProviderImpl
|
||||
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.build
|
||||
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmBytecodeBinaryVersion
|
||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
|
||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,13 +26,11 @@ open class GeneratedFile(
|
||||
val outputFile: File
|
||||
) {
|
||||
val sourceFiles = sourceFiles.sortedBy { it.path }
|
||||
|
||||
override fun toString(): String = "${this::class.java.simpleName}: $outputFile"
|
||||
}
|
||||
|
||||
class GeneratedJvmClass(
|
||||
sourceFiles: Collection<File>,
|
||||
outputFile: File
|
||||
class GeneratedJvmClass (
|
||||
sourceFiles: Collection<File>,
|
||||
outputFile: File
|
||||
) : GeneratedFile(sourceFiles, outputFile) {
|
||||
val outputClass = LocalFileKotlinClass.create(outputFile).sure {
|
||||
"Couldn't load KotlinClass from $outputFile; it may happen because class doesn't have valid Kotlin annotations"
|
||||
|
||||
@@ -29,43 +29,21 @@ import org.jetbrains.kotlin.cli.common.arguments.Argument;
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments;
|
||||
import org.jetbrains.kotlin.cli.common.arguments.InternalArgument;
|
||||
import org.jetbrains.kotlin.cli.common.arguments.ParseCommandLineArgumentsKt;
|
||||
import org.jetbrains.kotlin.idea.ExplicitDefaultSubstitutor;
|
||||
import org.jetbrains.kotlin.idea.ExplicitDefaultSubstitutorsKt;
|
||||
import org.jetbrains.kotlin.utils.StringsKt;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ArgumentUtils {
|
||||
private ArgumentUtils() {
|
||||
}
|
||||
private ArgumentUtils() {}
|
||||
|
||||
@NotNull
|
||||
public static List<String> convertArgumentsToStringList(@NotNull CommonToolArguments arguments)
|
||||
throws InstantiationException, IllegalAccessException, InvocationTargetException {
|
||||
List<String> convertedArguments = convertArgumentsToStringListInternal(arguments);
|
||||
|
||||
Map<KClass<? extends CommonToolArguments>, Collection<ExplicitDefaultSubstitutor>> defaultSubstitutorsMap =
|
||||
ExplicitDefaultSubstitutorsKt.getDefaultSubstitutors();
|
||||
KClass<? extends CommonToolArguments> argumentsKClass = JvmClassMappingKt.getKotlinClass(arguments.getClass());
|
||||
Collection<ExplicitDefaultSubstitutor> defaultSubstitutors = defaultSubstitutorsMap.get(argumentsKClass);
|
||||
if (defaultSubstitutors != null) {
|
||||
for (ExplicitDefaultSubstitutor substitutor : defaultSubstitutors) {
|
||||
if (substitutor.isSubstitutable(convertedArguments)) convertedArguments.addAll(substitutor.getNewSubstitution());
|
||||
}
|
||||
}
|
||||
return convertedArguments;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<String> convertArgumentsToStringListNoDefaults(@NotNull CommonToolArguments arguments)
|
||||
throws InstantiationException, IllegalAccessException, InvocationTargetException {
|
||||
return convertArgumentsToStringListInternal(arguments);
|
||||
}
|
||||
|
||||
private static List<String> convertArgumentsToStringListInternal(@NotNull CommonToolArguments arguments)
|
||||
throws InstantiationException, IllegalAccessException, InvocationTargetException {
|
||||
List<String> result = new ArrayList<>();
|
||||
Class<? extends CommonToolArguments> argumentsClass = arguments.getClass();
|
||||
convertArgumentsToStringList(arguments, argumentsClass.newInstance(), JvmClassMappingKt.getKotlinClass(argumentsClass), result);
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.arguments.Argument
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.config.JvmTarget
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KProperty1
|
||||
import kotlin.reflect.full.findAnnotation
|
||||
|
||||
val defaultSubstitutors: Map<KClass<out CommonToolArguments>, Collection<ExplicitDefaultSubstitutor>> =
|
||||
mapOf(K2JVMCompilerArguments::class to listOf(JvmTargetDefaultSubstitutor))
|
||||
|
||||
sealed class ExplicitDefaultSubstitutor {
|
||||
abstract val substitutedProperty: KProperty1<out CommonToolArguments, String?>
|
||||
abstract val oldSubstitution: List<String>
|
||||
abstract val newSubstitution: List<String>
|
||||
abstract fun isSubstitutable(args: List<String>): Boolean
|
||||
|
||||
protected val argument: Argument by lazy {
|
||||
substitutedProperty.findAnnotation() ?: error("Property \"${substitutedProperty.name}\" has no Argument annotation")
|
||||
}
|
||||
}
|
||||
|
||||
object JvmTargetDefaultSubstitutor : ExplicitDefaultSubstitutor() {
|
||||
override val substitutedProperty
|
||||
get() = K2JVMCompilerArguments::jvmTarget
|
||||
private val oldDefault: String
|
||||
get() = JvmTarget.JVM_1_6.description
|
||||
private val newDefault: String
|
||||
get() = JvmTarget.JVM_1_8.description
|
||||
|
||||
private fun prepareSubstitution(default: String): List<String> = listOf(argument.value, default)
|
||||
|
||||
override val oldSubstitution: List<String>
|
||||
get() = prepareSubstitution(oldDefault)
|
||||
override val newSubstitution: List<String>
|
||||
get() = prepareSubstitution(newDefault)
|
||||
|
||||
override fun isSubstitutable(args: List<String>): Boolean = argument.value !in args
|
||||
}
|
||||
@@ -33,7 +33,6 @@ import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
|
||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.ModuleMapping
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.SpecialNames.DEFAULT_NAME_FOR_COMPANION_OBJECT
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||
import org.jetbrains.org.objectweb.asm.*
|
||||
@@ -95,10 +94,6 @@ open class IncrementalJvmCache(
|
||||
fun sourcesByInternalName(internalName: String): Collection<File> =
|
||||
internalNameToSource[internalName]
|
||||
|
||||
fun getAllPartsOfMultifileFacade(facade: JvmClassName): Collection<String>? {
|
||||
return multifileFacadeToParts[facade]
|
||||
}
|
||||
|
||||
fun isMultifileFacade(className: JvmClassName): Boolean =
|
||||
className in multifileFacadeToParts
|
||||
|
||||
@@ -400,9 +395,7 @@ open class IncrementalJvmCache(
|
||||
}
|
||||
|
||||
for (const in oldMap.keys + newMap.keys) {
|
||||
//Constant can be declared via companion object or via const field declaration
|
||||
changesCollector.collectMemberIfValueWasChanged(kotlinClass.scopeFqName(companion = true), const, oldMap[const], newMap[const])
|
||||
changesCollector.collectMemberIfValueWasChanged(kotlinClass.scopeFqName(companion = false), const, oldMap[const], newMap[const])
|
||||
changesCollector.collectMemberIfValueWasChanged(kotlinClass.scopeFqName(), const, oldMap[const], newMap[const])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,8 +425,6 @@ open class IncrementalJvmCache(
|
||||
|
||||
private inner class MultifileClassFacadeMap(storageFile: File) :
|
||||
BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
|
||||
|
||||
@Synchronized
|
||||
operator fun set(className: JvmClassName, partNames: Collection<String>) {
|
||||
storage[className.internalName] = partNames
|
||||
}
|
||||
@@ -444,7 +435,6 @@ open class IncrementalJvmCache(
|
||||
operator fun contains(className: JvmClassName): Boolean =
|
||||
className.internalName in storage
|
||||
|
||||
@Synchronized
|
||||
fun remove(className: JvmClassName) {
|
||||
storage.remove(className.internalName)
|
||||
}
|
||||
@@ -454,8 +444,6 @@ open class IncrementalJvmCache(
|
||||
|
||||
private inner class MultifileClassPartMap(storageFile: File) :
|
||||
BasicStringMap<String>(storageFile, EnumeratorStringDescriptor.INSTANCE) {
|
||||
|
||||
@Synchronized
|
||||
fun set(partName: String, facadeName: String) {
|
||||
storage[partName] = facadeName
|
||||
}
|
||||
@@ -463,7 +451,6 @@ open class IncrementalJvmCache(
|
||||
fun get(partName: JvmClassName): String? =
|
||||
storage[partName.internalName]
|
||||
|
||||
@Synchronized
|
||||
fun remove(className: JvmClassName) {
|
||||
storage.remove(className.internalName)
|
||||
}
|
||||
@@ -602,12 +589,11 @@ sealed class ChangeInfo(val fqName: FqName) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun LocalFileKotlinClass.scopeFqName(companion: Boolean = false) = when (classHeader.kind) {
|
||||
KotlinClassHeader.Kind.CLASS -> {
|
||||
className.fqNameForClassNameWithoutDollars.let { if (companion) it.child(DEFAULT_NAME_FOR_COMPANION_OBJECT) else it }
|
||||
private fun LocalFileKotlinClass.scopeFqName() =
|
||||
when (classHeader.kind) {
|
||||
KotlinClassHeader.Kind.CLASS -> className.fqNameForClassNameWithoutDollars
|
||||
else -> className.packageFqName
|
||||
}
|
||||
else -> className.packageFqName
|
||||
}
|
||||
|
||||
fun ByteArray.md5(): Long {
|
||||
val d = MessageDigest.getInstance("MD5").digest(this)!!
|
||||
|
||||
@@ -182,21 +182,6 @@ open class ProtoCompareGenerated(
|
||||
|
||||
if (!checkEqualsClassSealedSubclassFqName(old, new)) return false
|
||||
|
||||
if (old.hasInlineClassUnderlyingPropertyName() != new.hasInlineClassUnderlyingPropertyName()) return false
|
||||
if (old.hasInlineClassUnderlyingPropertyName()) {
|
||||
if (!checkStringEquals(old.inlineClassUnderlyingPropertyName, new.inlineClassUnderlyingPropertyName)) return false
|
||||
}
|
||||
|
||||
if (old.hasInlineClassUnderlyingType() != new.hasInlineClassUnderlyingType()) return false
|
||||
if (old.hasInlineClassUnderlyingType()) {
|
||||
if (!checkEquals(old.inlineClassUnderlyingType, new.inlineClassUnderlyingType)) return false
|
||||
}
|
||||
|
||||
if (old.hasInlineClassUnderlyingTypeId() != new.hasInlineClassUnderlyingTypeId()) return false
|
||||
if (old.hasInlineClassUnderlyingTypeId()) {
|
||||
if (!checkEquals(oldTypeTable.getType(old.inlineClassUnderlyingTypeId), newTypeTable.getType(new.inlineClassUnderlyingTypeId))) return false
|
||||
}
|
||||
|
||||
if (!checkEqualsClassVersionRequirement(old, new)) return false
|
||||
|
||||
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) return false
|
||||
@@ -281,9 +266,6 @@ open class ProtoCompareGenerated(
|
||||
TYPE_ALIAS_LIST,
|
||||
ENUM_ENTRY_LIST,
|
||||
SEALED_SUBCLASS_FQ_NAME_LIST,
|
||||
INLINE_CLASS_UNDERLYING_PROPERTY_NAME,
|
||||
INLINE_CLASS_UNDERLYING_TYPE,
|
||||
INLINE_CLASS_UNDERLYING_TYPE_ID,
|
||||
VERSION_REQUIREMENT_LIST,
|
||||
VERSION_REQUIREMENT_TABLE,
|
||||
JVM_EXT_CLASS_MODULE_NAME,
|
||||
@@ -332,21 +314,6 @@ open class ProtoCompareGenerated(
|
||||
|
||||
if (!checkEqualsClassSealedSubclassFqName(old, new)) result.add(ProtoBufClassKind.SEALED_SUBCLASS_FQ_NAME_LIST)
|
||||
|
||||
if (old.hasInlineClassUnderlyingPropertyName() != new.hasInlineClassUnderlyingPropertyName()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME)
|
||||
if (old.hasInlineClassUnderlyingPropertyName()) {
|
||||
if (!checkStringEquals(old.inlineClassUnderlyingPropertyName, new.inlineClassUnderlyingPropertyName)) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME)
|
||||
}
|
||||
|
||||
if (old.hasInlineClassUnderlyingType() != new.hasInlineClassUnderlyingType()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE)
|
||||
if (old.hasInlineClassUnderlyingType()) {
|
||||
if (!checkEquals(old.inlineClassUnderlyingType, new.inlineClassUnderlyingType)) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE)
|
||||
}
|
||||
|
||||
if (old.hasInlineClassUnderlyingTypeId() != new.hasInlineClassUnderlyingTypeId()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID)
|
||||
if (old.hasInlineClassUnderlyingTypeId()) {
|
||||
if (!checkEquals(oldTypeTable.getType(old.inlineClassUnderlyingTypeId), newTypeTable.getType(new.inlineClassUnderlyingTypeId))) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID)
|
||||
}
|
||||
|
||||
if (!checkEqualsClassVersionRequirement(old, new)) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_LIST)
|
||||
|
||||
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_TABLE)
|
||||
@@ -1761,18 +1728,6 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
|
||||
hashCode = 31 * hashCode + fqNameIndexes(getSealedSubclassFqName(i))
|
||||
}
|
||||
|
||||
if (hasInlineClassUnderlyingPropertyName()) {
|
||||
hashCode = 31 * hashCode + stringIndexes(inlineClassUnderlyingPropertyName)
|
||||
}
|
||||
|
||||
if (hasInlineClassUnderlyingType()) {
|
||||
hashCode = 31 * hashCode + inlineClassUnderlyingType.hashCode(stringIndexes, fqNameIndexes, typeById)
|
||||
}
|
||||
|
||||
if (hasInlineClassUnderlyingTypeId()) {
|
||||
hashCode = 31 * hashCode + typeById(inlineClassUnderlyingTypeId).hashCode(stringIndexes, fqNameIndexes, typeById)
|
||||
}
|
||||
|
||||
for(i in 0..versionRequirementCount - 1) {
|
||||
hashCode = 31 * hashCode + getVersionRequirement(i)
|
||||
}
|
||||
|
||||
@@ -290,11 +290,6 @@ class DifferenceCalculatorForClass(
|
||||
isClassAffected = true
|
||||
areSubclassesAffected = true
|
||||
}
|
||||
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME,
|
||||
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE,
|
||||
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID -> {
|
||||
isClassAffected = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@ data class BuildLogFinder(
|
||||
private val isGradleEnabled: Boolean = false,
|
||||
private val isJsEnabled: Boolean = false,
|
||||
private val isScopeExpansionEnabled: Boolean = false,
|
||||
private val isKlibEnabled: Boolean = false,
|
||||
private val isFirEnabled: Boolean = false
|
||||
private val isKlibEnabled: Boolean = false
|
||||
) {
|
||||
companion object {
|
||||
private const val JS_LOG = "js-build.log"
|
||||
@@ -33,8 +32,6 @@ data class BuildLogFinder(
|
||||
private const val GRADLE_LOG = "gradle-build.log"
|
||||
private const val DATA_CONTAINER_LOG = "data-container-version-build.log"
|
||||
const val JS_JPS_LOG = "js-jps-build.log"
|
||||
private const val FIR_LOG = "fir-build.log"
|
||||
private const val GRADLE_FIR_LOG = "gradle-fir-build.log"
|
||||
private const val SIMPLE_LOG = "build.log"
|
||||
|
||||
fun isJpsLogFile(file: File): Boolean =
|
||||
@@ -48,8 +45,6 @@ data class BuildLogFinder(
|
||||
isScopeExpansionEnabled && SCOPE_EXPANDING_LOG in files -> SCOPE_EXPANDING_LOG
|
||||
isKlibEnabled && KLIB_LOG in files -> KLIB_LOG
|
||||
isJsEnabled && JS_LOG in files -> JS_LOG
|
||||
isGradleEnabled && isFirEnabled && GRADLE_FIR_LOG in files -> GRADLE_FIR_LOG
|
||||
isFirEnabled && FIR_LOG in files -> FIR_LOG
|
||||
isGradleEnabled && GRADLE_LOG in files -> GRADLE_LOG
|
||||
isJsEnabled && JS_JPS_LOG in files -> JS_JPS_LOG
|
||||
isDataContainerBuildLogEnabled && DATA_CONTAINER_LOG in files -> DATA_CONTAINER_LOG
|
||||
|
||||
@@ -10,21 +10,17 @@ public final class DebugKlibMetadataProtoBuf {
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.packageFqName);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.classAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.classFile);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.classKdoc);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.classUniqId);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.constructorAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.constructorKdoc);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.constructorUniqId);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.functionAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.functionFile);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.functionKdoc);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.functionUniqId);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyGetterAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertySetterAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.compileTimeValue);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyFile);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyKdoc);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyUniqId);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.enumEntryAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.enumEntryOrdinal);
|
||||
@@ -3167,17 +3163,6 @@ public final class DebugKlibMetadataProtoBuf {
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.Integer.class,
|
||||
null);
|
||||
public static final int CLASS_KDOC_FIELD_NUMBER = 176;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Class,
|
||||
java.lang.String> classKdoc = org.jetbrains.kotlin.protobuf.GeneratedMessage
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.String.class,
|
||||
null);
|
||||
public static final int CLASS_UNIQ_ID_FIELD_NUMBER = 171;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
|
||||
@@ -3200,17 +3185,6 @@ public final class DebugKlibMetadataProtoBuf {
|
||||
.newFileScopedGeneratedExtension(
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
|
||||
public static final int CONSTRUCTOR_KDOC_FIELD_NUMBER = 173;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Constructor { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Constructor,
|
||||
java.lang.String> constructorKdoc = org.jetbrains.kotlin.protobuf.GeneratedMessage
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.String.class,
|
||||
null);
|
||||
public static final int CONSTRUCTOR_UNIQ_ID_FIELD_NUMBER = 172;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Constructor { ... }</code>
|
||||
@@ -3244,17 +3218,6 @@ public final class DebugKlibMetadataProtoBuf {
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.Integer.class,
|
||||
null);
|
||||
public static final int FUNCTION_KDOC_FIELD_NUMBER = 174;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Function,
|
||||
java.lang.String> functionKdoc = org.jetbrains.kotlin.protobuf.GeneratedMessage
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.String.class,
|
||||
null);
|
||||
public static final int FUNCTION_UNIQ_ID_FIELD_NUMBER = 173;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
|
||||
@@ -3321,17 +3284,6 @@ public final class DebugKlibMetadataProtoBuf {
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.Integer.class,
|
||||
null);
|
||||
public static final int PROPERTY_KDOC_FIELD_NUMBER = 180;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
|
||||
java.lang.String> propertyKdoc = org.jetbrains.kotlin.protobuf.GeneratedMessage
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.String.class,
|
||||
null);
|
||||
public static final int PROPERTY_UNIQ_ID_FIELD_NUMBER = 179;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
|
||||
@@ -3528,79 +3480,72 @@ public final class DebugKlibMetadataProtoBuf {
|
||||
".metadata.Class\030\252\001 \003(\0132).org.jetbrains.k" +
|
||||
"otlin.metadata.Annotation:?\n\nclass_file\022",
|
||||
"$.org.jetbrains.kotlin.metadata.Class\030\257\001" +
|
||||
" \001(\005B\004\200\265\030\001:?\n\nclass_kdoc\022$.org.jetbrains" +
|
||||
".kotlin.metadata.Class\030\260\001 \001(\tB\004\200\265\030\001:u\n\rc" +
|
||||
"lass_uniq_id\022$.org.jetbrains.kotlin.meta" +
|
||||
"data.Class\030\253\001 \001(\01327.org.jetbrains.kotlin" +
|
||||
".library.metadata.DescriptorUniqId:v\n\026co" +
|
||||
"nstructor_annotation\022*.org.jetbrains.kot" +
|
||||
"lin.metadata.Constructor\030\252\001 \003(\0132).org.je" +
|
||||
"tbrains.kotlin.metadata.Annotation:K\n\020co" +
|
||||
"nstructor_kdoc\022*.org.jetbrains.kotlin.me",
|
||||
"tadata.Constructor\030\255\001 \001(\tB\004\200\265\030\001:\201\001\n\023cons" +
|
||||
"tructor_uniq_id\022*.org.jetbrains.kotlin.m" +
|
||||
"etadata.Constructor\030\254\001 \001(\01327.org.jetbrai" +
|
||||
"ns.kotlin.library.metadata.DescriptorUni" +
|
||||
"qId:p\n\023function_annotation\022\'.org.jetbrai" +
|
||||
"ns.kotlin.metadata.Function\030\252\001 \003(\0132).org" +
|
||||
".jetbrains.kotlin.metadata.Annotation:E\n" +
|
||||
"\rfunction_file\022\'.org.jetbrains.kotlin.me" +
|
||||
"tadata.Function\030\254\001 \001(\005B\004\200\265\030\001:E\n\rfunction" +
|
||||
"_kdoc\022\'.org.jetbrains.kotlin.metadata.Fu",
|
||||
"nction\030\256\001 \001(\tB\004\200\265\030\001:{\n\020function_uniq_id\022" +
|
||||
"\'.org.jetbrains.kotlin.metadata.Function" +
|
||||
"\030\255\001 \001(\01327.org.jetbrains.kotlin.library.m" +
|
||||
"etadata.DescriptorUniqId:p\n\023property_ann" +
|
||||
"otation\022\'.org.jetbrains.kotlin.metadata." +
|
||||
"Property\030\252\001 \003(\0132).org.jetbrains.kotlin.m" +
|
||||
"etadata.Annotation:w\n\032property_getter_an" +
|
||||
"notation\022\'.org.jetbrains.kotlin.metadata" +
|
||||
".Property\030\261\001 \003(\0132).org.jetbrains.kotlin." +
|
||||
"metadata.Annotation:w\n\032property_setter_a",
|
||||
"nnotation\022\'.org.jetbrains.kotlin.metadat" +
|
||||
"a.Property\030\262\001 \003(\0132).org.jetbrains.kotlin" +
|
||||
".metadata.Annotation:~\n\022compile_time_val" +
|
||||
"ue\022\'.org.jetbrains.kotlin.metadata.Prope" +
|
||||
"rty\030\255\001 \001(\01328.org.jetbrains.kotlin.metada" +
|
||||
"ta.Annotation.Argument.Value:E\n\rproperty" +
|
||||
"_file\022\'.org.jetbrains.kotlin.metadata.Pr" +
|
||||
"operty\030\260\001 \001(\005B\004\200\265\030\001:E\n\rproperty_kdoc\022\'.o" +
|
||||
"rg.jetbrains.kotlin.metadata.Property\030\264\001" +
|
||||
" \001(\tB\004\200\265\030\001:{\n\020property_uniq_id\022\'.org.jet",
|
||||
"brains.kotlin.metadata.Property\030\263\001 \001(\01327" +
|
||||
".org.jetbrains.kotlin.library.metadata.D" +
|
||||
"escriptorUniqId:s\n\025enum_entry_annotation" +
|
||||
"\022(.org.jetbrains.kotlin.metadata.EnumEnt" +
|
||||
"ry\030\252\001 \003(\0132).org.jetbrains.kotlin.metadat" +
|
||||
"a.Annotation:E\n\022enum_entry_ordinal\022(.org" +
|
||||
".jetbrains.kotlin.metadata.EnumEntry\030\253\001 " +
|
||||
"\001(\005:~\n\022enum_entry_uniq_id\022(.org.jetbrain" +
|
||||
"s.kotlin.metadata.EnumEntry\030\254\001 \001(\01327.org" +
|
||||
".jetbrains.kotlin.library.metadata.Descr",
|
||||
"iptorUniqId:w\n\024parameter_annotation\022-.or" +
|
||||
"g.jetbrains.kotlin.metadata.ValueParamet" +
|
||||
"er\030\252\001 \003(\0132).org.jetbrains.kotlin.metadat" +
|
||||
"a.Annotation:h\n\017type_annotation\022#.org.je" +
|
||||
"tbrains.kotlin.metadata.Type\030\252\001 \003(\0132).or" +
|
||||
"g.jetbrains.kotlin.metadata.Annotation:{" +
|
||||
"\n\031type_parameter_annotation\022,.org.jetbra" +
|
||||
"ins.kotlin.metadata.TypeParameter\030\252\001 \003(\013" +
|
||||
"2).org.jetbrains.kotlin.metadata.Annotat" +
|
||||
"ion:\202\001\n\022type_param_uniq_id\022,.org.jetbrai",
|
||||
"ns.kotlin.metadata.TypeParameter\030\253\001 \001(\0132" +
|
||||
"7.org.jetbrains.kotlin.library.metadata." +
|
||||
"DescriptorUniqId:U\n\026package_fragment_fil" +
|
||||
"es\022..org.jetbrains.kotlin.metadata.Packa" +
|
||||
"geFragment\030\252\001 \003(\005B\004\200\265\030\001:A\n\010is_empty\022..or" +
|
||||
"g.jetbrains.kotlin.metadata.PackageFragm" +
|
||||
"ent\030\254\001 \001(\010:@\n\007fq_name\022..org.jetbrains.ko" +
|
||||
"tlin.metadata.PackageFragment\030\255\001 \001(\t:G\n\n" +
|
||||
"class_name\022..org.jetbrains.kotlin.metada" +
|
||||
"ta.PackageFragment\030\256\001 \003(\005B\002\020\001:~\n\022type_al",
|
||||
"ias_uniq_id\022(.org.jetbrains.kotlin.metad" +
|
||||
"ata.TypeAlias\030\203\001 \001(\01327.org.jetbrains.kot" +
|
||||
"lin.library.metadata.DescriptorUniqIdB\033B" +
|
||||
"\031DebugKlibMetadataProtoBuf"
|
||||
" \001(\005B\004\200\265\030\001:u\n\rclass_uniq_id\022$.org.jetbra" +
|
||||
"ins.kotlin.metadata.Class\030\253\001 \001(\01327.org.j" +
|
||||
"etbrains.kotlin.library.metadata.Descrip" +
|
||||
"torUniqId:v\n\026constructor_annotation\022*.or" +
|
||||
"g.jetbrains.kotlin.metadata.Constructor\030" +
|
||||
"\252\001 \003(\0132).org.jetbrains.kotlin.metadata.A" +
|
||||
"nnotation:\201\001\n\023constructor_uniq_id\022*.org." +
|
||||
"jetbrains.kotlin.metadata.Constructor\030\254\001" +
|
||||
" \001(\01327.org.jetbrains.kotlin.library.meta",
|
||||
"data.DescriptorUniqId:p\n\023function_annota" +
|
||||
"tion\022\'.org.jetbrains.kotlin.metadata.Fun" +
|
||||
"ction\030\252\001 \003(\0132).org.jetbrains.kotlin.meta" +
|
||||
"data.Annotation:E\n\rfunction_file\022\'.org.j" +
|
||||
"etbrains.kotlin.metadata.Function\030\254\001 \001(\005" +
|
||||
"B\004\200\265\030\001:{\n\020function_uniq_id\022\'.org.jetbrai" +
|
||||
"ns.kotlin.metadata.Function\030\255\001 \001(\01327.org" +
|
||||
".jetbrains.kotlin.library.metadata.Descr" +
|
||||
"iptorUniqId:p\n\023property_annotation\022\'.org" +
|
||||
".jetbrains.kotlin.metadata.Property\030\252\001 \003",
|
||||
"(\0132).org.jetbrains.kotlin.metadata.Annot" +
|
||||
"ation:w\n\032property_getter_annotation\022\'.or" +
|
||||
"g.jetbrains.kotlin.metadata.Property\030\261\001 " +
|
||||
"\003(\0132).org.jetbrains.kotlin.metadata.Anno" +
|
||||
"tation:w\n\032property_setter_annotation\022\'.o" +
|
||||
"rg.jetbrains.kotlin.metadata.Property\030\262\001" +
|
||||
" \003(\0132).org.jetbrains.kotlin.metadata.Ann" +
|
||||
"otation:~\n\022compile_time_value\022\'.org.jetb" +
|
||||
"rains.kotlin.metadata.Property\030\255\001 \001(\01328." +
|
||||
"org.jetbrains.kotlin.metadata.Annotation",
|
||||
".Argument.Value:E\n\rproperty_file\022\'.org.j" +
|
||||
"etbrains.kotlin.metadata.Property\030\260\001 \001(\005" +
|
||||
"B\004\200\265\030\001:{\n\020property_uniq_id\022\'.org.jetbrai" +
|
||||
"ns.kotlin.metadata.Property\030\263\001 \001(\01327.org" +
|
||||
".jetbrains.kotlin.library.metadata.Descr" +
|
||||
"iptorUniqId:s\n\025enum_entry_annotation\022(.o" +
|
||||
"rg.jetbrains.kotlin.metadata.EnumEntry\030\252" +
|
||||
"\001 \003(\0132).org.jetbrains.kotlin.metadata.An" +
|
||||
"notation:E\n\022enum_entry_ordinal\022(.org.jet" +
|
||||
"brains.kotlin.metadata.EnumEntry\030\253\001 \001(\005:",
|
||||
"~\n\022enum_entry_uniq_id\022(.org.jetbrains.ko" +
|
||||
"tlin.metadata.EnumEntry\030\254\001 \001(\01327.org.jet" +
|
||||
"brains.kotlin.library.metadata.Descripto" +
|
||||
"rUniqId:w\n\024parameter_annotation\022-.org.je" +
|
||||
"tbrains.kotlin.metadata.ValueParameter\030\252" +
|
||||
"\001 \003(\0132).org.jetbrains.kotlin.metadata.An" +
|
||||
"notation:h\n\017type_annotation\022#.org.jetbra" +
|
||||
"ins.kotlin.metadata.Type\030\252\001 \003(\0132).org.je" +
|
||||
"tbrains.kotlin.metadata.Annotation:{\n\031ty" +
|
||||
"pe_parameter_annotation\022,.org.jetbrains.",
|
||||
"kotlin.metadata.TypeParameter\030\252\001 \003(\0132).o" +
|
||||
"rg.jetbrains.kotlin.metadata.Annotation:" +
|
||||
"\202\001\n\022type_param_uniq_id\022,.org.jetbrains.k" +
|
||||
"otlin.metadata.TypeParameter\030\253\001 \001(\01327.or" +
|
||||
"g.jetbrains.kotlin.library.metadata.Desc" +
|
||||
"riptorUniqId:U\n\026package_fragment_files\022." +
|
||||
".org.jetbrains.kotlin.metadata.PackageFr" +
|
||||
"agment\030\252\001 \003(\005B\004\200\265\030\001:A\n\010is_empty\022..org.je" +
|
||||
"tbrains.kotlin.metadata.PackageFragment\030" +
|
||||
"\254\001 \001(\010:@\n\007fq_name\022..org.jetbrains.kotlin",
|
||||
".metadata.PackageFragment\030\255\001 \001(\t:G\n\nclas" +
|
||||
"s_name\022..org.jetbrains.kotlin.metadata.P" +
|
||||
"ackageFragment\030\256\001 \003(\005B\002\020\001:~\n\022type_alias_" +
|
||||
"uniq_id\022(.org.jetbrains.kotlin.metadata." +
|
||||
"TypeAlias\030\203\001 \001(\01327.org.jetbrains.kotlin." +
|
||||
"library.metadata.DescriptorUniqIdB\033B\031Deb" +
|
||||
"ugKlibMetadataProtoBuf"
|
||||
};
|
||||
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
|
||||
@@ -3637,34 +3582,30 @@ public final class DebugKlibMetadataProtoBuf {
|
||||
packageFqName.internalInit(descriptor.getExtensions().get(0));
|
||||
classAnnotation.internalInit(descriptor.getExtensions().get(1));
|
||||
classFile.internalInit(descriptor.getExtensions().get(2));
|
||||
classKdoc.internalInit(descriptor.getExtensions().get(3));
|
||||
classUniqId.internalInit(descriptor.getExtensions().get(4));
|
||||
constructorAnnotation.internalInit(descriptor.getExtensions().get(5));
|
||||
constructorKdoc.internalInit(descriptor.getExtensions().get(6));
|
||||
constructorUniqId.internalInit(descriptor.getExtensions().get(7));
|
||||
functionAnnotation.internalInit(descriptor.getExtensions().get(8));
|
||||
functionFile.internalInit(descriptor.getExtensions().get(9));
|
||||
functionKdoc.internalInit(descriptor.getExtensions().get(10));
|
||||
functionUniqId.internalInit(descriptor.getExtensions().get(11));
|
||||
propertyAnnotation.internalInit(descriptor.getExtensions().get(12));
|
||||
propertyGetterAnnotation.internalInit(descriptor.getExtensions().get(13));
|
||||
propertySetterAnnotation.internalInit(descriptor.getExtensions().get(14));
|
||||
compileTimeValue.internalInit(descriptor.getExtensions().get(15));
|
||||
propertyFile.internalInit(descriptor.getExtensions().get(16));
|
||||
propertyKdoc.internalInit(descriptor.getExtensions().get(17));
|
||||
propertyUniqId.internalInit(descriptor.getExtensions().get(18));
|
||||
enumEntryAnnotation.internalInit(descriptor.getExtensions().get(19));
|
||||
enumEntryOrdinal.internalInit(descriptor.getExtensions().get(20));
|
||||
enumEntryUniqId.internalInit(descriptor.getExtensions().get(21));
|
||||
parameterAnnotation.internalInit(descriptor.getExtensions().get(22));
|
||||
typeAnnotation.internalInit(descriptor.getExtensions().get(23));
|
||||
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(24));
|
||||
typeParamUniqId.internalInit(descriptor.getExtensions().get(25));
|
||||
packageFragmentFiles.internalInit(descriptor.getExtensions().get(26));
|
||||
isEmpty.internalInit(descriptor.getExtensions().get(27));
|
||||
fqName.internalInit(descriptor.getExtensions().get(28));
|
||||
className.internalInit(descriptor.getExtensions().get(29));
|
||||
typeAliasUniqId.internalInit(descriptor.getExtensions().get(30));
|
||||
classUniqId.internalInit(descriptor.getExtensions().get(3));
|
||||
constructorAnnotation.internalInit(descriptor.getExtensions().get(4));
|
||||
constructorUniqId.internalInit(descriptor.getExtensions().get(5));
|
||||
functionAnnotation.internalInit(descriptor.getExtensions().get(6));
|
||||
functionFile.internalInit(descriptor.getExtensions().get(7));
|
||||
functionUniqId.internalInit(descriptor.getExtensions().get(8));
|
||||
propertyAnnotation.internalInit(descriptor.getExtensions().get(9));
|
||||
propertyGetterAnnotation.internalInit(descriptor.getExtensions().get(10));
|
||||
propertySetterAnnotation.internalInit(descriptor.getExtensions().get(11));
|
||||
compileTimeValue.internalInit(descriptor.getExtensions().get(12));
|
||||
propertyFile.internalInit(descriptor.getExtensions().get(13));
|
||||
propertyUniqId.internalInit(descriptor.getExtensions().get(14));
|
||||
enumEntryAnnotation.internalInit(descriptor.getExtensions().get(15));
|
||||
enumEntryOrdinal.internalInit(descriptor.getExtensions().get(16));
|
||||
enumEntryUniqId.internalInit(descriptor.getExtensions().get(17));
|
||||
parameterAnnotation.internalInit(descriptor.getExtensions().get(18));
|
||||
typeAnnotation.internalInit(descriptor.getExtensions().get(19));
|
||||
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(20));
|
||||
typeParamUniqId.internalInit(descriptor.getExtensions().get(21));
|
||||
packageFragmentFiles.internalInit(descriptor.getExtensions().get(22));
|
||||
isEmpty.internalInit(descriptor.getExtensions().get(23));
|
||||
fqName.internalInit(descriptor.getExtensions().get(24));
|
||||
className.internalInit(descriptor.getExtensions().get(25));
|
||||
typeAliasUniqId.internalInit(descriptor.getExtensions().get(26));
|
||||
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry =
|
||||
org.jetbrains.kotlin.protobuf.ExtensionRegistry.newInstance();
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipMessageInComparison);
|
||||
@@ -3672,10 +3613,6 @@ public final class DebugKlibMetadataProtoBuf {
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
|
||||
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
|
||||
.internalUpdateFileDescriptor(descriptor, registry);
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor();
|
||||
|
||||
@@ -10347,37 +10347,6 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
int getSealedSubclassFqName(int index);
|
||||
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
boolean hasInlineClassUnderlyingPropertyName();
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
int getInlineClassUnderlyingPropertyName();
|
||||
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
boolean hasInlineClassUnderlyingType();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type getInlineClassUnderlyingType();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder getInlineClassUnderlyingTypeOrBuilder();
|
||||
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
boolean hasInlineClassUnderlyingTypeId();
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
int getInlineClassUnderlyingTypeId();
|
||||
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
*/
|
||||
@@ -10616,32 +10585,9 @@ public final class DebugProtoBuf {
|
||||
input.popLimit(limit);
|
||||
break;
|
||||
}
|
||||
case 136: {
|
||||
bitField0_ |= 0x00000008;
|
||||
inlineClassUnderlyingPropertyName_ = input.readInt32();
|
||||
break;
|
||||
}
|
||||
case 146: {
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder subBuilder = null;
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
subBuilder = inlineClassUnderlyingType_.toBuilder();
|
||||
}
|
||||
inlineClassUnderlyingType_ = input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.PARSER, extensionRegistry);
|
||||
if (subBuilder != null) {
|
||||
subBuilder.mergeFrom(inlineClassUnderlyingType_);
|
||||
inlineClassUnderlyingType_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000010;
|
||||
break;
|
||||
}
|
||||
case 152: {
|
||||
bitField0_ |= 0x00000020;
|
||||
inlineClassUnderlyingTypeId_ = input.readInt32();
|
||||
break;
|
||||
}
|
||||
case 242: {
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.Builder subBuilder = null;
|
||||
if (((bitField0_ & 0x00000040) == 0x00000040)) {
|
||||
if (((bitField0_ & 0x00000008) == 0x00000008)) {
|
||||
subBuilder = typeTable_.toBuilder();
|
||||
}
|
||||
typeTable_ = input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.PARSER, extensionRegistry);
|
||||
@@ -10649,13 +10595,13 @@ public final class DebugProtoBuf {
|
||||
subBuilder.mergeFrom(typeTable_);
|
||||
typeTable_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000040;
|
||||
bitField0_ |= 0x00000008;
|
||||
break;
|
||||
}
|
||||
case 248: {
|
||||
if (!((mutable_bitField0_ & 0x00020000) == 0x00020000)) {
|
||||
if (!((mutable_bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>();
|
||||
mutable_bitField0_ |= 0x00020000;
|
||||
mutable_bitField0_ |= 0x00004000;
|
||||
}
|
||||
versionRequirement_.add(input.readInt32());
|
||||
break;
|
||||
@@ -10663,9 +10609,9 @@ public final class DebugProtoBuf {
|
||||
case 250: {
|
||||
int length = input.readRawVarint32();
|
||||
int limit = input.pushLimit(length);
|
||||
if (!((mutable_bitField0_ & 0x00020000) == 0x00020000) && input.getBytesUntilLimit() > 0) {
|
||||
if (!((mutable_bitField0_ & 0x00004000) == 0x00004000) && input.getBytesUntilLimit() > 0) {
|
||||
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>();
|
||||
mutable_bitField0_ |= 0x00020000;
|
||||
mutable_bitField0_ |= 0x00004000;
|
||||
}
|
||||
while (input.getBytesUntilLimit() > 0) {
|
||||
versionRequirement_.add(input.readInt32());
|
||||
@@ -10675,7 +10621,7 @@ public final class DebugProtoBuf {
|
||||
}
|
||||
case 258: {
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.Builder subBuilder = null;
|
||||
if (((bitField0_ & 0x00000080) == 0x00000080)) {
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
subBuilder = versionRequirementTable_.toBuilder();
|
||||
}
|
||||
versionRequirementTable_ = input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.PARSER, extensionRegistry);
|
||||
@@ -10683,7 +10629,7 @@ public final class DebugProtoBuf {
|
||||
subBuilder.mergeFrom(versionRequirementTable_);
|
||||
versionRequirementTable_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000080;
|
||||
bitField0_ |= 0x00000010;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -10724,7 +10670,7 @@ public final class DebugProtoBuf {
|
||||
if (((mutable_bitField0_ & 0x00001000) == 0x00001000)) {
|
||||
sealedSubclassFqName_ = java.util.Collections.unmodifiableList(sealedSubclassFqName_);
|
||||
}
|
||||
if (((mutable_bitField0_ & 0x00020000) == 0x00020000)) {
|
||||
if (((mutable_bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
versionRequirement_ = java.util.Collections.unmodifiableList(versionRequirement_);
|
||||
}
|
||||
this.unknownFields = unknownFields.build();
|
||||
@@ -11279,64 +11225,13 @@ public final class DebugProtoBuf {
|
||||
}
|
||||
private int sealedSubclassFqNameMemoizedSerializedSize = -1;
|
||||
|
||||
public static final int INLINE_CLASS_UNDERLYING_PROPERTY_NAME_FIELD_NUMBER = 17;
|
||||
private int inlineClassUnderlyingPropertyName_;
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingPropertyName() {
|
||||
return ((bitField0_ & 0x00000008) == 0x00000008);
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public int getInlineClassUnderlyingPropertyName() {
|
||||
return inlineClassUnderlyingPropertyName_;
|
||||
}
|
||||
|
||||
public static final int INLINE_CLASS_UNDERLYING_TYPE_FIELD_NUMBER = 18;
|
||||
private org.jetbrains.kotlin.metadata.DebugProtoBuf.Type inlineClassUnderlyingType_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingType() {
|
||||
return ((bitField0_ & 0x00000010) == 0x00000010);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Type getInlineClassUnderlyingType() {
|
||||
return inlineClassUnderlyingType_;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder getInlineClassUnderlyingTypeOrBuilder() {
|
||||
return inlineClassUnderlyingType_;
|
||||
}
|
||||
|
||||
public static final int INLINE_CLASS_UNDERLYING_TYPE_ID_FIELD_NUMBER = 19;
|
||||
private int inlineClassUnderlyingTypeId_;
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingTypeId() {
|
||||
return ((bitField0_ & 0x00000020) == 0x00000020);
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public int getInlineClassUnderlyingTypeId() {
|
||||
return inlineClassUnderlyingTypeId_;
|
||||
}
|
||||
|
||||
public static final int TYPE_TABLE_FIELD_NUMBER = 30;
|
||||
private org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable typeTable_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
*/
|
||||
public boolean hasTypeTable() {
|
||||
return ((bitField0_ & 0x00000040) == 0x00000040);
|
||||
return ((bitField0_ & 0x00000008) == 0x00000008);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
@@ -11391,7 +11286,7 @@ public final class DebugProtoBuf {
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
*/
|
||||
public boolean hasVersionRequirementTable() {
|
||||
return ((bitField0_ & 0x00000080) == 0x00000080);
|
||||
return ((bitField0_ & 0x00000010) == 0x00000010);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
@@ -11420,9 +11315,6 @@ public final class DebugProtoBuf {
|
||||
typeAlias_ = java.util.Collections.emptyList();
|
||||
enumEntry_ = java.util.Collections.emptyList();
|
||||
sealedSubclassFqName_ = java.util.Collections.emptyList();
|
||||
inlineClassUnderlyingPropertyName_ = 0;
|
||||
inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
|
||||
inlineClassUnderlyingTypeId_ = 0;
|
||||
typeTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance();
|
||||
versionRequirement_ = java.util.Collections.emptyList();
|
||||
versionRequirementTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.getDefaultInstance();
|
||||
@@ -11479,12 +11371,6 @@ public final class DebugProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasInlineClassUnderlyingType()) {
|
||||
if (!getInlineClassUnderlyingType().isInitialized()) {
|
||||
memoizedIsInitialized = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasTypeTable()) {
|
||||
if (!getTypeTable().isInitialized()) {
|
||||
memoizedIsInitialized = 0;
|
||||
@@ -11557,21 +11443,12 @@ public final class DebugProtoBuf {
|
||||
output.writeInt32NoTag(sealedSubclassFqName_.get(i));
|
||||
}
|
||||
if (((bitField0_ & 0x00000008) == 0x00000008)) {
|
||||
output.writeInt32(17, inlineClassUnderlyingPropertyName_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
output.writeMessage(18, inlineClassUnderlyingType_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
output.writeInt32(19, inlineClassUnderlyingTypeId_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000040) == 0x00000040)) {
|
||||
output.writeMessage(30, typeTable_);
|
||||
}
|
||||
for (int i = 0; i < versionRequirement_.size(); i++) {
|
||||
output.writeInt32(31, versionRequirement_.get(i));
|
||||
}
|
||||
if (((bitField0_ & 0x00000080) == 0x00000080)) {
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
output.writeMessage(32, versionRequirementTable_);
|
||||
}
|
||||
extensionWriter.writeUntil(19000, output);
|
||||
@@ -11667,18 +11544,6 @@ public final class DebugProtoBuf {
|
||||
sealedSubclassFqNameMemoizedSerializedSize = dataSize;
|
||||
}
|
||||
if (((bitField0_ & 0x00000008) == 0x00000008)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeInt32Size(17, inlineClassUnderlyingPropertyName_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(18, inlineClassUnderlyingType_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeInt32Size(19, inlineClassUnderlyingTypeId_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000040) == 0x00000040)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(30, typeTable_);
|
||||
}
|
||||
@@ -11691,7 +11556,7 @@ public final class DebugProtoBuf {
|
||||
size += dataSize;
|
||||
size += 2 * getVersionRequirementList().size();
|
||||
}
|
||||
if (((bitField0_ & 0x00000080) == 0x00000080)) {
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(32, versionRequirementTable_);
|
||||
}
|
||||
@@ -11813,7 +11678,6 @@ public final class DebugProtoBuf {
|
||||
getPropertyFieldBuilder();
|
||||
getTypeAliasFieldBuilder();
|
||||
getEnumEntryFieldBuilder();
|
||||
getInlineClassUnderlyingTypeFieldBuilder();
|
||||
getTypeTableFieldBuilder();
|
||||
getVersionRequirementTableFieldBuilder();
|
||||
}
|
||||
@@ -11878,30 +11742,20 @@ public final class DebugProtoBuf {
|
||||
}
|
||||
sealedSubclassFqName_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00001000);
|
||||
inlineClassUnderlyingPropertyName_ = 0;
|
||||
bitField0_ = (bitField0_ & ~0x00002000);
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
|
||||
} else {
|
||||
inlineClassUnderlyingTypeBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
inlineClassUnderlyingTypeId_ = 0;
|
||||
bitField0_ = (bitField0_ & ~0x00008000);
|
||||
if (typeTableBuilder_ == null) {
|
||||
typeTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance();
|
||||
} else {
|
||||
typeTableBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00010000);
|
||||
bitField0_ = (bitField0_ & ~0x00002000);
|
||||
versionRequirement_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00020000);
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
if (versionRequirementTableBuilder_ == null) {
|
||||
versionRequirementTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.getDefaultInstance();
|
||||
} else {
|
||||
versionRequirementTableBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00040000);
|
||||
bitField0_ = (bitField0_ & ~0x00008000);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -12023,34 +11877,18 @@ public final class DebugProtoBuf {
|
||||
if (((from_bitField0_ & 0x00002000) == 0x00002000)) {
|
||||
to_bitField0_ |= 0x00000008;
|
||||
}
|
||||
result.inlineClassUnderlyingPropertyName_ = inlineClassUnderlyingPropertyName_;
|
||||
if (((from_bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
to_bitField0_ |= 0x00000010;
|
||||
}
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
result.inlineClassUnderlyingType_ = inlineClassUnderlyingType_;
|
||||
} else {
|
||||
result.inlineClassUnderlyingType_ = inlineClassUnderlyingTypeBuilder_.build();
|
||||
}
|
||||
if (((from_bitField0_ & 0x00008000) == 0x00008000)) {
|
||||
to_bitField0_ |= 0x00000020;
|
||||
}
|
||||
result.inlineClassUnderlyingTypeId_ = inlineClassUnderlyingTypeId_;
|
||||
if (((from_bitField0_ & 0x00010000) == 0x00010000)) {
|
||||
to_bitField0_ |= 0x00000040;
|
||||
}
|
||||
if (typeTableBuilder_ == null) {
|
||||
result.typeTable_ = typeTable_;
|
||||
} else {
|
||||
result.typeTable_ = typeTableBuilder_.build();
|
||||
}
|
||||
if (((bitField0_ & 0x00020000) == 0x00020000)) {
|
||||
if (((bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
versionRequirement_ = java.util.Collections.unmodifiableList(versionRequirement_);
|
||||
bitField0_ = (bitField0_ & ~0x00020000);
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
}
|
||||
result.versionRequirement_ = versionRequirement_;
|
||||
if (((from_bitField0_ & 0x00040000) == 0x00040000)) {
|
||||
to_bitField0_ |= 0x00000080;
|
||||
if (((from_bitField0_ & 0x00008000) == 0x00008000)) {
|
||||
to_bitField0_ |= 0x00000010;
|
||||
}
|
||||
if (versionRequirementTableBuilder_ == null) {
|
||||
result.versionRequirementTable_ = versionRequirementTable_;
|
||||
@@ -12294,22 +12132,13 @@ public final class DebugProtoBuf {
|
||||
}
|
||||
onChanged();
|
||||
}
|
||||
if (other.hasInlineClassUnderlyingPropertyName()) {
|
||||
setInlineClassUnderlyingPropertyName(other.getInlineClassUnderlyingPropertyName());
|
||||
}
|
||||
if (other.hasInlineClassUnderlyingType()) {
|
||||
mergeInlineClassUnderlyingType(other.getInlineClassUnderlyingType());
|
||||
}
|
||||
if (other.hasInlineClassUnderlyingTypeId()) {
|
||||
setInlineClassUnderlyingTypeId(other.getInlineClassUnderlyingTypeId());
|
||||
}
|
||||
if (other.hasTypeTable()) {
|
||||
mergeTypeTable(other.getTypeTable());
|
||||
}
|
||||
if (!other.versionRequirement_.isEmpty()) {
|
||||
if (versionRequirement_.isEmpty()) {
|
||||
versionRequirement_ = other.versionRequirement_;
|
||||
bitField0_ = (bitField0_ & ~0x00020000);
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
} else {
|
||||
ensureVersionRequirementIsMutable();
|
||||
versionRequirement_.addAll(other.versionRequirement_);
|
||||
@@ -12371,12 +12200,6 @@ public final class DebugProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasInlineClassUnderlyingType()) {
|
||||
if (!getInlineClassUnderlyingType().isInitialized()) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasTypeTable()) {
|
||||
if (!getTypeTable().isInitialized()) {
|
||||
|
||||
@@ -14435,186 +14258,6 @@ public final class DebugProtoBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
private int inlineClassUnderlyingPropertyName_ ;
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingPropertyName() {
|
||||
return ((bitField0_ & 0x00002000) == 0x00002000);
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public int getInlineClassUnderlyingPropertyName() {
|
||||
return inlineClassUnderlyingPropertyName_;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public Builder setInlineClassUnderlyingPropertyName(int value) {
|
||||
bitField0_ |= 0x00002000;
|
||||
inlineClassUnderlyingPropertyName_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public Builder clearInlineClassUnderlyingPropertyName() {
|
||||
bitField0_ = (bitField0_ & ~0x00002000);
|
||||
inlineClassUnderlyingPropertyName_ = 0;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private org.jetbrains.kotlin.metadata.DebugProtoBuf.Type inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
|
||||
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type, org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder> inlineClassUnderlyingTypeBuilder_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingType() {
|
||||
return ((bitField0_ & 0x00004000) == 0x00004000);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Type getInlineClassUnderlyingType() {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
return inlineClassUnderlyingType_;
|
||||
} else {
|
||||
return inlineClassUnderlyingTypeBuilder_.getMessage();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public Builder setInlineClassUnderlyingType(org.jetbrains.kotlin.metadata.DebugProtoBuf.Type value) {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
inlineClassUnderlyingType_ = value;
|
||||
onChanged();
|
||||
} else {
|
||||
inlineClassUnderlyingTypeBuilder_.setMessage(value);
|
||||
}
|
||||
bitField0_ |= 0x00004000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public Builder setInlineClassUnderlyingType(
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder builderForValue) {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
inlineClassUnderlyingType_ = builderForValue.build();
|
||||
onChanged();
|
||||
} else {
|
||||
inlineClassUnderlyingTypeBuilder_.setMessage(builderForValue.build());
|
||||
}
|
||||
bitField0_ |= 0x00004000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public Builder mergeInlineClassUnderlyingType(org.jetbrains.kotlin.metadata.DebugProtoBuf.Type value) {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
if (((bitField0_ & 0x00004000) == 0x00004000) &&
|
||||
inlineClassUnderlyingType_ != org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance()) {
|
||||
inlineClassUnderlyingType_ =
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.newBuilder(inlineClassUnderlyingType_).mergeFrom(value).buildPartial();
|
||||
} else {
|
||||
inlineClassUnderlyingType_ = value;
|
||||
}
|
||||
onChanged();
|
||||
} else {
|
||||
inlineClassUnderlyingTypeBuilder_.mergeFrom(value);
|
||||
}
|
||||
bitField0_ |= 0x00004000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public Builder clearInlineClassUnderlyingType() {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
|
||||
onChanged();
|
||||
} else {
|
||||
inlineClassUnderlyingTypeBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder getInlineClassUnderlyingTypeBuilder() {
|
||||
bitField0_ |= 0x00004000;
|
||||
onChanged();
|
||||
return getInlineClassUnderlyingTypeFieldBuilder().getBuilder();
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder getInlineClassUnderlyingTypeOrBuilder() {
|
||||
if (inlineClassUnderlyingTypeBuilder_ != null) {
|
||||
return inlineClassUnderlyingTypeBuilder_.getMessageOrBuilder();
|
||||
} else {
|
||||
return inlineClassUnderlyingType_;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type, org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder>
|
||||
getInlineClassUnderlyingTypeFieldBuilder() {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
inlineClassUnderlyingTypeBuilder_ = new org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type, org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder>(
|
||||
getInlineClassUnderlyingType(),
|
||||
getParentForChildren(),
|
||||
isClean());
|
||||
inlineClassUnderlyingType_ = null;
|
||||
}
|
||||
return inlineClassUnderlyingTypeBuilder_;
|
||||
}
|
||||
|
||||
private int inlineClassUnderlyingTypeId_ ;
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingTypeId() {
|
||||
return ((bitField0_ & 0x00008000) == 0x00008000);
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public int getInlineClassUnderlyingTypeId() {
|
||||
return inlineClassUnderlyingTypeId_;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public Builder setInlineClassUnderlyingTypeId(int value) {
|
||||
bitField0_ |= 0x00008000;
|
||||
inlineClassUnderlyingTypeId_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public Builder clearInlineClassUnderlyingTypeId() {
|
||||
bitField0_ = (bitField0_ & ~0x00008000);
|
||||
inlineClassUnderlyingTypeId_ = 0;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable typeTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance();
|
||||
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTableOrBuilder> typeTableBuilder_;
|
||||
@@ -14622,7 +14265,7 @@ public final class DebugProtoBuf {
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
*/
|
||||
public boolean hasTypeTable() {
|
||||
return ((bitField0_ & 0x00010000) == 0x00010000);
|
||||
return ((bitField0_ & 0x00002000) == 0x00002000);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
@@ -14647,7 +14290,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
typeTableBuilder_.setMessage(value);
|
||||
}
|
||||
bitField0_ |= 0x00010000;
|
||||
bitField0_ |= 0x00002000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14661,7 +14304,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
typeTableBuilder_.setMessage(builderForValue.build());
|
||||
}
|
||||
bitField0_ |= 0x00010000;
|
||||
bitField0_ |= 0x00002000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14669,7 +14312,7 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
public Builder mergeTypeTable(org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable value) {
|
||||
if (typeTableBuilder_ == null) {
|
||||
if (((bitField0_ & 0x00010000) == 0x00010000) &&
|
||||
if (((bitField0_ & 0x00002000) == 0x00002000) &&
|
||||
typeTable_ != org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance()) {
|
||||
typeTable_ =
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.newBuilder(typeTable_).mergeFrom(value).buildPartial();
|
||||
@@ -14680,7 +14323,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
typeTableBuilder_.mergeFrom(value);
|
||||
}
|
||||
bitField0_ |= 0x00010000;
|
||||
bitField0_ |= 0x00002000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14693,14 +14336,14 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
typeTableBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00010000);
|
||||
bitField0_ = (bitField0_ & ~0x00002000);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.Builder getTypeTableBuilder() {
|
||||
bitField0_ |= 0x00010000;
|
||||
bitField0_ |= 0x00002000;
|
||||
onChanged();
|
||||
return getTypeTableFieldBuilder().getBuilder();
|
||||
}
|
||||
@@ -14733,9 +14376,9 @@ public final class DebugProtoBuf {
|
||||
|
||||
private java.util.List<java.lang.Integer> versionRequirement_ = java.util.Collections.emptyList();
|
||||
private void ensureVersionRequirementIsMutable() {
|
||||
if (!((bitField0_ & 0x00020000) == 0x00020000)) {
|
||||
if (!((bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>(versionRequirement_);
|
||||
bitField0_ |= 0x00020000;
|
||||
bitField0_ |= 0x00004000;
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -14820,7 +14463,7 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
public Builder clearVersionRequirement() {
|
||||
versionRequirement_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00020000);
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
@@ -14832,7 +14475,7 @@ public final class DebugProtoBuf {
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
*/
|
||||
public boolean hasVersionRequirementTable() {
|
||||
return ((bitField0_ & 0x00040000) == 0x00040000);
|
||||
return ((bitField0_ & 0x00008000) == 0x00008000);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
@@ -14857,7 +14500,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
versionRequirementTableBuilder_.setMessage(value);
|
||||
}
|
||||
bitField0_ |= 0x00040000;
|
||||
bitField0_ |= 0x00008000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14871,7 +14514,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
versionRequirementTableBuilder_.setMessage(builderForValue.build());
|
||||
}
|
||||
bitField0_ |= 0x00040000;
|
||||
bitField0_ |= 0x00008000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14879,7 +14522,7 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
public Builder mergeVersionRequirementTable(org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable value) {
|
||||
if (versionRequirementTableBuilder_ == null) {
|
||||
if (((bitField0_ & 0x00040000) == 0x00040000) &&
|
||||
if (((bitField0_ & 0x00008000) == 0x00008000) &&
|
||||
versionRequirementTable_ != org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.getDefaultInstance()) {
|
||||
versionRequirementTable_ =
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.newBuilder(versionRequirementTable_).mergeFrom(value).buildPartial();
|
||||
@@ -14890,7 +14533,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
versionRequirementTableBuilder_.mergeFrom(value);
|
||||
}
|
||||
bitField0_ |= 0x00040000;
|
||||
bitField0_ |= 0x00008000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14903,14 +14546,14 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
versionRequirementTableBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00040000);
|
||||
bitField0_ = (bitField0_ & ~0x00008000);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.Builder getVersionRequirementTableBuilder() {
|
||||
bitField0_ |= 0x00040000;
|
||||
bitField0_ |= 0x00008000;
|
||||
onChanged();
|
||||
return getVersionRequirementTableFieldBuilder().getBuilder();
|
||||
}
|
||||
@@ -34739,7 +34382,7 @@ public final class DebugProtoBuf {
|
||||
"Variance:\003INV\0228\n\013upper_bound\030\005 \003(\0132#.org" +
|
||||
".jetbrains.kotlin.metadata.Type\022\036\n\016upper" +
|
||||
"_bound_id\030\006 \003(\005B\006\020\001\240\265\030\001\"$\n\010Variance\022\006\n\002I" +
|
||||
"N\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002*\005\010d\020\350\007\"\327\010\n\005Class\022\020" +
|
||||
"N\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002*\005\010d\020\350\007\"\250\007\n\005Class\022\020" +
|
||||
"\n\005flags\030\001 \001(\005:\0016\022\025\n\007fq_name\030\003 \002(\005B\004\220\265\030\001\022",
|
||||
"#\n\025companion_object_name\030\004 \001(\005B\004\210\265\030\001\022D\n\016" +
|
||||
"type_parameter\030\005 \003(\0132,.org.jetbrains.kot" +
|
||||
@@ -34755,127 +34398,122 @@ public final class DebugProtoBuf {
|
||||
"brains.kotlin.metadata.TypeAlias\022<\n\nenum" +
|
||||
"_entry\030\r \003(\0132(.org.jetbrains.kotlin.meta" +
|
||||
"data.EnumEntry\022\'\n\027sealed_subclass_fq_nam" +
|
||||
"e\030\020 \003(\005B\006\020\001\220\265\030\001\0223\n%inline_class_underlyi" +
|
||||
"ng_property_name\030\021 \001(\005B\004\210\265\030\001\022I\n\034inline_c" +
|
||||
"lass_underlying_type\030\022 \001(\0132#.org.jetbrai" +
|
||||
"ns.kotlin.metadata.Type\022-\n\037inline_class_" +
|
||||
"underlying_type_id\030\023 \001(\005B\004\240\265\030\001\022<\n\ntype_t" +
|
||||
"able\030\036 \001(\0132(.org.jetbrains.kotlin.metada",
|
||||
"ta.TypeTable\022\033\n\023version_requirement\030\037 \003(" +
|
||||
"\005\022Y\n\031version_requirement_table\030 \001(\01326.o" +
|
||||
"rg.jetbrains.kotlin.metadata.VersionRequ" +
|
||||
"irementTable\"x\n\004Kind\022\t\n\005CLASS\020\000\022\r\n\tINTER" +
|
||||
"FACE\020\001\022\016\n\nENUM_CLASS\020\002\022\016\n\nENUM_ENTRY\020\003\022\024" +
|
||||
"\n\020ANNOTATION_CLASS\020\004\022\n\n\006OBJECT\020\005\022\024\n\020COMP" +
|
||||
"ANION_OBJECT\020\006*\006\010d\020\270\224\001\"\335\002\n\007Package\0229\n\010fu" +
|
||||
"nction\030\003 \003(\0132\'.org.jetbrains.kotlin.meta" +
|
||||
"data.Function\0229\n\010property\030\004 \003(\0132\'.org.je" +
|
||||
"tbrains.kotlin.metadata.Property\022<\n\ntype",
|
||||
"_alias\030\005 \003(\0132(.org.jetbrains.kotlin.meta" +
|
||||
"data.TypeAlias\022<\n\ntype_table\030\036 \001(\0132(.org" +
|
||||
".jetbrains.kotlin.metadata.TypeTable\022Y\n\031" +
|
||||
"version_requirement_table\030 \001(\01326.org.je" +
|
||||
"tbrains.kotlin.metadata.VersionRequireme" +
|
||||
"ntTable*\005\010d\020\310\001\"`\n\tTypeTable\0221\n\004type\030\001 \003(" +
|
||||
"\0132#.org.jetbrains.kotlin.metadata.Type\022\032" +
|
||||
"\n\016first_nullable\030\002 \001(\005:\002-1:\004\240\273\030\001\"\214\001\n\013Con" +
|
||||
"structor\022\020\n\005flags\030\001 \001(\005:\0016\022F\n\017value_para" +
|
||||
"meter\030\002 \003(\0132-.org.jetbrains.kotlin.metad",
|
||||
"ata.ValueParameter\022\033\n\023version_requiremen" +
|
||||
"t\030\037 \003(\005*\006\010d\020\270\224\001\"\246\004\n\010Function\022\020\n\005flags\030\t " +
|
||||
"\001(\005:\0016\022\024\n\told_flags\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002" +
|
||||
"(\005B\004\210\265\030\001\0228\n\013return_type\030\003 \001(\0132#.org.jetb" +
|
||||
"rains.kotlin.metadata.Type\022\034\n\016return_typ" +
|
||||
"e_id\030\007 \001(\005B\004\240\265\030\001\022D\n\016type_parameter\030\004 \003(\013" +
|
||||
"2,.org.jetbrains.kotlin.metadata.TypePar" +
|
||||
"ameter\022:\n\rreceiver_type\030\005 \001(\0132#.org.jetb" +
|
||||
"rains.kotlin.metadata.Type\022\036\n\020receiver_t" +
|
||||
"ype_id\030\010 \001(\005B\004\240\265\030\001\022F\n\017value_parameter\030\006 ",
|
||||
"\003(\0132-.org.jetbrains.kotlin.metadata.Valu" +
|
||||
"eParameter\022<\n\ntype_table\030\036 \001(\0132(.org.jet" +
|
||||
"brains.kotlin.metadata.TypeTable\022\033\n\023vers" +
|
||||
"ion_requirement\030\037 \003(\005\0229\n\010contract\030 \001(\0132" +
|
||||
"\'.org.jetbrains.kotlin.metadata.Contract" +
|
||||
"*\006\010d\020\270\224\001\"\345\003\n\010Property\022\022\n\005flags\030\013 \001(\005:\00351" +
|
||||
"8\022\027\n\told_flags\030\001 \001(\005:\0042054\022\022\n\004name\030\002 \002(\005" +
|
||||
"B\004\210\265\030\001\0228\n\013return_type\030\003 \001(\0132#.org.jetbra" +
|
||||
"ins.kotlin.metadata.Type\022\034\n\016return_type_" +
|
||||
"id\030\t \001(\005B\004\240\265\030\001\022D\n\016type_parameter\030\004 \003(\0132,",
|
||||
".org.jetbrains.kotlin.metadata.TypeParam" +
|
||||
"eter\022:\n\rreceiver_type\030\005 \001(\0132#.org.jetbra" +
|
||||
"ins.kotlin.metadata.Type\022\036\n\020receiver_typ" +
|
||||
"e_id\030\n \001(\005B\004\240\265\030\001\022M\n\026setter_value_paramet" +
|
||||
"er\030\006 \001(\0132-.org.jetbrains.kotlin.metadata" +
|
||||
".ValueParameter\022\024\n\014getter_flags\030\007 \001(\005\022\024\n" +
|
||||
"\014setter_flags\030\010 \001(\005\022\033\n\023version_requireme" +
|
||||
"nt\030\037 \003(\005*\006\010d\020\270\224\001\"\357\001\n\016ValueParameter\022\020\n\005f" +
|
||||
"lags\030\001 \001(\005:\0010\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0221\n\004typ" +
|
||||
"e\030\003 \001(\0132#.org.jetbrains.kotlin.metadata.",
|
||||
"Type\022\025\n\007type_id\030\005 \001(\005B\004\240\265\030\001\022@\n\023vararg_el" +
|
||||
"ement_type\030\004 \001(\0132#.org.jetbrains.kotlin." +
|
||||
"metadata.Type\022$\n\026vararg_element_type_id\030" +
|
||||
"\006 \001(\005B\004\240\265\030\001*\005\010d\020\310\001\"\226\003\n\tTypeAlias\022\020\n\005flag" +
|
||||
"s\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\022D\n\016type_p" +
|
||||
"arameter\030\003 \003(\0132,.org.jetbrains.kotlin.me" +
|
||||
"tadata.TypeParameter\022<\n\017underlying_type\030" +
|
||||
"\004 \001(\0132#.org.jetbrains.kotlin.metadata.Ty" +
|
||||
"pe\022 \n\022underlying_type_id\030\005 \001(\005B\004\240\265\030\001\022:\n\r" +
|
||||
"expanded_type\030\006 \001(\0132#.org.jetbrains.kotl",
|
||||
"in.metadata.Type\022\036\n\020expanded_type_id\030\007 \001" +
|
||||
"(\005B\004\240\265\030\001\022=\n\nannotation\030\010 \003(\0132).org.jetbr" +
|
||||
"ains.kotlin.metadata.Annotation\022\033\n\023versi" +
|
||||
"on_requirement\030\037 \003(\005*\005\010d\020\310\001\"&\n\tEnumEntry" +
|
||||
"\022\022\n\004name\030\001 \001(\005B\004\210\265\030\001*\005\010d\020\310\001\"\225\003\n\022VersionR" +
|
||||
"equirement\022\017\n\007version\030\001 \001(\005\022\024\n\014version_f" +
|
||||
"ull\030\002 \001(\005\022M\n\005level\030\003 \001(\01627.org.jetbrains" +
|
||||
".kotlin.metadata.VersionRequirement.Leve" +
|
||||
"l:\005ERROR\022\022\n\nerror_code\030\004 \001(\005\022\025\n\007message\030" +
|
||||
"\005 \001(\005B\004\230\265\030\001\022e\n\014version_kind\030\006 \001(\0162=.org.",
|
||||
"jetbrains.kotlin.metadata.VersionRequire" +
|
||||
"ment.VersionKind:\020LANGUAGE_VERSION\"+\n\005Le" +
|
||||
"vel\022\013\n\007WARNING\020\000\022\t\n\005ERROR\020\001\022\n\n\006HIDDEN\020\002\"" +
|
||||
"J\n\013VersionKind\022\024\n\020LANGUAGE_VERSION\020\000\022\024\n\020" +
|
||||
"COMPILER_VERSION\020\001\022\017\n\013API_VERSION\020\002\"a\n\027V" +
|
||||
"ersionRequirementTable\022F\n\013requirement\030\001 " +
|
||||
"\003(\01321.org.jetbrains.kotlin.metadata.Vers" +
|
||||
"ionRequirement\"\217\002\n\017PackageFragment\022;\n\007st" +
|
||||
"rings\030\001 \001(\0132*.org.jetbrains.kotlin.metad" +
|
||||
"ata.StringTable\022J\n\017qualified_names\030\002 \001(\013",
|
||||
"21.org.jetbrains.kotlin.metadata.Qualifi" +
|
||||
"edNameTable\0227\n\007package\030\003 \001(\0132&.org.jetbr" +
|
||||
"ains.kotlin.metadata.Package\0223\n\005class\030\004 " +
|
||||
"\003(\0132$.org.jetbrains.kotlin.metadata.Clas" +
|
||||
"s*\005\010d\020\310\001\"A\n\010Contract\0225\n\006effect\030\001 \003(\0132%.o" +
|
||||
"rg.jetbrains.kotlin.metadata.Effect\"\306\003\n\006" +
|
||||
"Effect\022E\n\013effect_type\030\001 \001(\01620.org.jetbra" +
|
||||
"ins.kotlin.metadata.Effect.EffectType\022N\n" +
|
||||
"\033effect_constructor_argument\030\002 \003(\0132).org" +
|
||||
".jetbrains.kotlin.metadata.Expression\022S\n",
|
||||
" conclusion_of_conditional_effect\030\003 \001(\0132" +
|
||||
").org.jetbrains.kotlin.metadata.Expressi" +
|
||||
"on\022B\n\004kind\030\004 \001(\01624.org.jetbrains.kotlin." +
|
||||
"metadata.Effect.InvocationKind\"C\n\nEffect" +
|
||||
"Type\022\024\n\020RETURNS_CONSTANT\020\000\022\t\n\005CALLS\020\001\022\024\n" +
|
||||
"\020RETURNS_NOT_NULL\020\002\"G\n\016InvocationKind\022\020\n" +
|
||||
"\014AT_MOST_ONCE\020\000\022\020\n\014EXACTLY_ONCE\020\001\022\021\n\rAT_" +
|
||||
"LEAST_ONCE\020\002\"\245\003\n\nExpression\022\020\n\005flags\030\001 \001" +
|
||||
"(\005:\0010\022!\n\031value_parameter_reference\030\002 \001(\005" +
|
||||
"\022O\n\016constant_value\030\003 \001(\01627.org.jetbrains",
|
||||
".kotlin.metadata.Expression.ConstantValu" +
|
||||
"e\022=\n\020is_instance_type\030\004 \001(\0132#.org.jetbra" +
|
||||
"ins.kotlin.metadata.Type\022!\n\023is_instance_" +
|
||||
"type_id\030\005 \001(\005B\004\240\265\030\001\022?\n\014and_argument\030\006 \003(" +
|
||||
"\0132).org.jetbrains.kotlin.metadata.Expres" +
|
||||
"sion\022>\n\013or_argument\030\007 \003(\0132).org.jetbrain" +
|
||||
"s.kotlin.metadata.Expression\".\n\rConstant" +
|
||||
"Value\022\010\n\004TRUE\020\000\022\t\n\005FALSE\020\001\022\010\n\004NULL\020\002*9\n\010" +
|
||||
"Modality\022\t\n\005FINAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRAC" +
|
||||
"T\020\002\022\n\n\006SEALED\020\003*b\n\nVisibility\022\014\n\010INTERNA",
|
||||
"L\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tPROTECTED\020\002\022\n\n\006PUBLI" +
|
||||
"C\020\003\022\023\n\017PRIVATE_TO_THIS\020\004\022\t\n\005LOCAL\020\005*Q\n\nM" +
|
||||
"emberKind\022\017\n\013DECLARATION\020\000\022\021\n\rFAKE_OVERR" +
|
||||
"IDE\020\001\022\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESIZED\020\003B\017" +
|
||||
"B\rDebugProtoBuf"
|
||||
"e\030\020 \003(\005B\006\020\001\220\265\030\001\022<\n\ntype_table\030\036 \001(\0132(.or" +
|
||||
"g.jetbrains.kotlin.metadata.TypeTable\022\033\n" +
|
||||
"\023version_requirement\030\037 \003(\005\022Y\n\031version_re" +
|
||||
"quirement_table\030 \001(\01326.org.jetbrains.ko" +
|
||||
"tlin.metadata.VersionRequirementTable\"x\n" +
|
||||
"\004Kind\022\t\n\005CLASS\020\000\022\r\n\tINTERFACE\020\001\022\016\n\nENUM_",
|
||||
"CLASS\020\002\022\016\n\nENUM_ENTRY\020\003\022\024\n\020ANNOTATION_CL" +
|
||||
"ASS\020\004\022\n\n\006OBJECT\020\005\022\024\n\020COMPANION_OBJECT\020\006*" +
|
||||
"\006\010d\020\270\224\001\"\335\002\n\007Package\0229\n\010function\030\003 \003(\0132\'." +
|
||||
"org.jetbrains.kotlin.metadata.Function\0229" +
|
||||
"\n\010property\030\004 \003(\0132\'.org.jetbrains.kotlin." +
|
||||
"metadata.Property\022<\n\ntype_alias\030\005 \003(\0132(." +
|
||||
"org.jetbrains.kotlin.metadata.TypeAlias\022" +
|
||||
"<\n\ntype_table\030\036 \001(\0132(.org.jetbrains.kotl" +
|
||||
"in.metadata.TypeTable\022Y\n\031version_require" +
|
||||
"ment_table\030 \001(\01326.org.jetbrains.kotlin.",
|
||||
"metadata.VersionRequirementTable*\005\010d\020\310\001\"" +
|
||||
"`\n\tTypeTable\0221\n\004type\030\001 \003(\0132#.org.jetbrai" +
|
||||
"ns.kotlin.metadata.Type\022\032\n\016first_nullabl" +
|
||||
"e\030\002 \001(\005:\002-1:\004\240\273\030\001\"\214\001\n\013Constructor\022\020\n\005fla" +
|
||||
"gs\030\001 \001(\005:\0016\022F\n\017value_parameter\030\002 \003(\0132-.o" +
|
||||
"rg.jetbrains.kotlin.metadata.ValueParame" +
|
||||
"ter\022\033\n\023version_requirement\030\037 \003(\005*\006\010d\020\270\224\001" +
|
||||
"\"\246\004\n\010Function\022\020\n\005flags\030\t \001(\005:\0016\022\024\n\told_f" +
|
||||
"lags\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0228\n\013ret" +
|
||||
"urn_type\030\003 \001(\0132#.org.jetbrains.kotlin.me",
|
||||
"tadata.Type\022\034\n\016return_type_id\030\007 \001(\005B\004\240\265\030" +
|
||||
"\001\022D\n\016type_parameter\030\004 \003(\0132,.org.jetbrain" +
|
||||
"s.kotlin.metadata.TypeParameter\022:\n\rrecei" +
|
||||
"ver_type\030\005 \001(\0132#.org.jetbrains.kotlin.me" +
|
||||
"tadata.Type\022\036\n\020receiver_type_id\030\010 \001(\005B\004\240" +
|
||||
"\265\030\001\022F\n\017value_parameter\030\006 \003(\0132-.org.jetbr" +
|
||||
"ains.kotlin.metadata.ValueParameter\022<\n\nt" +
|
||||
"ype_table\030\036 \001(\0132(.org.jetbrains.kotlin.m" +
|
||||
"etadata.TypeTable\022\033\n\023version_requirement" +
|
||||
"\030\037 \003(\005\0229\n\010contract\030 \001(\0132\'.org.jetbrains",
|
||||
".kotlin.metadata.Contract*\006\010d\020\270\224\001\"\345\003\n\010Pr" +
|
||||
"operty\022\022\n\005flags\030\013 \001(\005:\003518\022\027\n\told_flags\030" +
|
||||
"\001 \001(\005:\0042054\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0228\n\013retur" +
|
||||
"n_type\030\003 \001(\0132#.org.jetbrains.kotlin.meta" +
|
||||
"data.Type\022\034\n\016return_type_id\030\t \001(\005B\004\240\265\030\001\022" +
|
||||
"D\n\016type_parameter\030\004 \003(\0132,.org.jetbrains." +
|
||||
"kotlin.metadata.TypeParameter\022:\n\rreceive" +
|
||||
"r_type\030\005 \001(\0132#.org.jetbrains.kotlin.meta" +
|
||||
"data.Type\022\036\n\020receiver_type_id\030\n \001(\005B\004\240\265\030" +
|
||||
"\001\022M\n\026setter_value_parameter\030\006 \001(\0132-.org.",
|
||||
"jetbrains.kotlin.metadata.ValueParameter" +
|
||||
"\022\024\n\014getter_flags\030\007 \001(\005\022\024\n\014setter_flags\030\010" +
|
||||
" \001(\005\022\033\n\023version_requirement\030\037 \003(\005*\006\010d\020\270\224" +
|
||||
"\001\"\357\001\n\016ValueParameter\022\020\n\005flags\030\001 \001(\005:\0010\022\022" +
|
||||
"\n\004name\030\002 \002(\005B\004\210\265\030\001\0221\n\004type\030\003 \001(\0132#.org.j" +
|
||||
"etbrains.kotlin.metadata.Type\022\025\n\007type_id" +
|
||||
"\030\005 \001(\005B\004\240\265\030\001\022@\n\023vararg_element_type\030\004 \001(" +
|
||||
"\0132#.org.jetbrains.kotlin.metadata.Type\022$" +
|
||||
"\n\026vararg_element_type_id\030\006 \001(\005B\004\240\265\030\001*\005\010d" +
|
||||
"\020\310\001\"\226\003\n\tTypeAlias\022\020\n\005flags\030\001 \001(\005:\0016\022\022\n\004n",
|
||||
"ame\030\002 \002(\005B\004\210\265\030\001\022D\n\016type_parameter\030\003 \003(\0132" +
|
||||
",.org.jetbrains.kotlin.metadata.TypePara" +
|
||||
"meter\022<\n\017underlying_type\030\004 \001(\0132#.org.jet" +
|
||||
"brains.kotlin.metadata.Type\022 \n\022underlyin" +
|
||||
"g_type_id\030\005 \001(\005B\004\240\265\030\001\022:\n\rexpanded_type\030\006" +
|
||||
" \001(\0132#.org.jetbrains.kotlin.metadata.Typ" +
|
||||
"e\022\036\n\020expanded_type_id\030\007 \001(\005B\004\240\265\030\001\022=\n\nann" +
|
||||
"otation\030\010 \003(\0132).org.jetbrains.kotlin.met" +
|
||||
"adata.Annotation\022\033\n\023version_requirement\030" +
|
||||
"\037 \003(\005*\005\010d\020\310\001\"&\n\tEnumEntry\022\022\n\004name\030\001 \001(\005B",
|
||||
"\004\210\265\030\001*\005\010d\020\310\001\"\225\003\n\022VersionRequirement\022\017\n\007v" +
|
||||
"ersion\030\001 \001(\005\022\024\n\014version_full\030\002 \001(\005\022M\n\005le" +
|
||||
"vel\030\003 \001(\01627.org.jetbrains.kotlin.metadat" +
|
||||
"a.VersionRequirement.Level:\005ERROR\022\022\n\nerr" +
|
||||
"or_code\030\004 \001(\005\022\025\n\007message\030\005 \001(\005B\004\230\265\030\001\022e\n\014" +
|
||||
"version_kind\030\006 \001(\0162=.org.jetbrains.kotli" +
|
||||
"n.metadata.VersionRequirement.VersionKin" +
|
||||
"d:\020LANGUAGE_VERSION\"+\n\005Level\022\013\n\007WARNING\020" +
|
||||
"\000\022\t\n\005ERROR\020\001\022\n\n\006HIDDEN\020\002\"J\n\013VersionKind\022" +
|
||||
"\024\n\020LANGUAGE_VERSION\020\000\022\024\n\020COMPILER_VERSIO",
|
||||
"N\020\001\022\017\n\013API_VERSION\020\002\"a\n\027VersionRequireme" +
|
||||
"ntTable\022F\n\013requirement\030\001 \003(\01321.org.jetbr" +
|
||||
"ains.kotlin.metadata.VersionRequirement\"" +
|
||||
"\217\002\n\017PackageFragment\022;\n\007strings\030\001 \001(\0132*.o" +
|
||||
"rg.jetbrains.kotlin.metadata.StringTable" +
|
||||
"\022J\n\017qualified_names\030\002 \001(\01321.org.jetbrain" +
|
||||
"s.kotlin.metadata.QualifiedNameTable\0227\n\007" +
|
||||
"package\030\003 \001(\0132&.org.jetbrains.kotlin.met" +
|
||||
"adata.Package\0223\n\005class\030\004 \003(\0132$.org.jetbr" +
|
||||
"ains.kotlin.metadata.Class*\005\010d\020\310\001\"A\n\010Con",
|
||||
"tract\0225\n\006effect\030\001 \003(\0132%.org.jetbrains.ko" +
|
||||
"tlin.metadata.Effect\"\306\003\n\006Effect\022E\n\013effec" +
|
||||
"t_type\030\001 \001(\01620.org.jetbrains.kotlin.meta" +
|
||||
"data.Effect.EffectType\022N\n\033effect_constru" +
|
||||
"ctor_argument\030\002 \003(\0132).org.jetbrains.kotl" +
|
||||
"in.metadata.Expression\022S\n conclusion_of_" +
|
||||
"conditional_effect\030\003 \001(\0132).org.jetbrains" +
|
||||
".kotlin.metadata.Expression\022B\n\004kind\030\004 \001(" +
|
||||
"\01624.org.jetbrains.kotlin.metadata.Effect" +
|
||||
".InvocationKind\"C\n\nEffectType\022\024\n\020RETURNS",
|
||||
"_CONSTANT\020\000\022\t\n\005CALLS\020\001\022\024\n\020RETURNS_NOT_NU" +
|
||||
"LL\020\002\"G\n\016InvocationKind\022\020\n\014AT_MOST_ONCE\020\000" +
|
||||
"\022\020\n\014EXACTLY_ONCE\020\001\022\021\n\rAT_LEAST_ONCE\020\002\"\245\003" +
|
||||
"\n\nExpression\022\020\n\005flags\030\001 \001(\005:\0010\022!\n\031value_" +
|
||||
"parameter_reference\030\002 \001(\005\022O\n\016constant_va" +
|
||||
"lue\030\003 \001(\01627.org.jetbrains.kotlin.metadat" +
|
||||
"a.Expression.ConstantValue\022=\n\020is_instanc" +
|
||||
"e_type\030\004 \001(\0132#.org.jetbrains.kotlin.meta" +
|
||||
"data.Type\022!\n\023is_instance_type_id\030\005 \001(\005B\004" +
|
||||
"\240\265\030\001\022?\n\014and_argument\030\006 \003(\0132).org.jetbrai",
|
||||
"ns.kotlin.metadata.Expression\022>\n\013or_argu" +
|
||||
"ment\030\007 \003(\0132).org.jetbrains.kotlin.metada" +
|
||||
"ta.Expression\".\n\rConstantValue\022\010\n\004TRUE\020\000" +
|
||||
"\022\t\n\005FALSE\020\001\022\010\n\004NULL\020\002*9\n\010Modality\022\t\n\005FIN" +
|
||||
"AL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRACT\020\002\022\n\n\006SEALED\020\003" +
|
||||
"*b\n\nVisibility\022\014\n\010INTERNAL\020\000\022\013\n\007PRIVATE\020" +
|
||||
"\001\022\r\n\tPROTECTED\020\002\022\n\n\006PUBLIC\020\003\022\023\n\017PRIVATE_" +
|
||||
"TO_THIS\020\004\022\t\n\005LOCAL\020\005*Q\n\nMemberKind\022\017\n\013DE" +
|
||||
"CLARATION\020\000\022\021\n\rFAKE_OVERRIDE\020\001\022\016\n\nDELEGA" +
|
||||
"TION\020\002\022\017\n\013SYNTHESIZED\020\003B\017B\rDebugProtoBuf"
|
||||
};
|
||||
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
|
||||
@@ -34949,7 +34587,7 @@ public final class DebugProtoBuf {
|
||||
internal_static_org_jetbrains_kotlin_metadata_Class_fieldAccessorTable = new
|
||||
org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_org_jetbrains_kotlin_metadata_Class_descriptor,
|
||||
new java.lang.String[] { "Flags", "FqName", "CompanionObjectName", "TypeParameter", "Supertype", "SupertypeId", "NestedClassName", "Constructor", "Function", "Property", "TypeAlias", "EnumEntry", "SealedSubclassFqName", "InlineClassUnderlyingPropertyName", "InlineClassUnderlyingType", "InlineClassUnderlyingTypeId", "TypeTable", "VersionRequirement", "VersionRequirementTable", });
|
||||
new java.lang.String[] { "Flags", "FqName", "CompanionObjectName", "TypeParameter", "Supertype", "SupertypeId", "NestedClassName", "Constructor", "Function", "Property", "TypeAlias", "EnumEntry", "SealedSubclassFqName", "TypeTable", "VersionRequirement", "VersionRequirementTable", });
|
||||
internal_static_org_jetbrains_kotlin_metadata_Package_descriptor =
|
||||
getDescriptor().getMessageTypes().get(6);
|
||||
internal_static_org_jetbrains_kotlin_metadata_Package_fieldAccessorTable = new
|
||||
@@ -35058,8 +34696,6 @@ public final class DebugProtoBuf {
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.fqNameIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipMessageInComparison);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable);
|
||||
|
||||
111
build.gradle.kts
111
build.gradle.kts
@@ -27,7 +27,7 @@ buildscript {
|
||||
dependencies {
|
||||
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
|
||||
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.26")
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
|
||||
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
|
||||
classpath(kotlin("serialization", bootstrapKotlinVersion))
|
||||
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
|
||||
@@ -115,10 +115,6 @@ extra["ideaUltimateSandboxDir"] = project.file(ideaUltimateSandboxDir)
|
||||
extra["ideaPluginDir"] = project.file(ideaPluginDir)
|
||||
extra["ideaUltimatePluginDir"] = project.file(ideaUltimatePluginDir)
|
||||
extra["isSonatypeRelease"] = false
|
||||
val kotlinNativeVersionObject = project.kotlinNativeVersionValue()
|
||||
subprojects {
|
||||
extra["kotlinNativeVersion"] = kotlinNativeVersionObject
|
||||
}
|
||||
|
||||
// Work-around necessary to avoid setting null javaHome. Will be removed after support of lazy task configuration
|
||||
val jdkNotFoundConst = "JDK NOT FOUND"
|
||||
@@ -134,7 +130,6 @@ extra["JDK_18"] = jdkPath("1.8")
|
||||
extra["JDK_9"] = jdkPath("9")
|
||||
extra["JDK_10"] = jdkPath("10")
|
||||
extra["JDK_11"] = jdkPath("11")
|
||||
extra["JDK_15"] = jdkPath("15")
|
||||
|
||||
// allow opening the project without setting up all env variables (see KT-26413)
|
||||
if (!kotlinBuildProperties.isInIdeaSync) {
|
||||
@@ -159,7 +154,6 @@ rootProject.apply {
|
||||
from(rootProject.file("gradle/checkArtifacts.gradle.kts"))
|
||||
from(rootProject.file("gradle/checkCacheability.gradle.kts"))
|
||||
from(rootProject.file("gradle/retryPublishing.gradle.kts"))
|
||||
from(rootProject.file("gradle/modularizedTestConfigurations.gradle.kts"))
|
||||
}
|
||||
|
||||
IdeVersionConfigurator.setCurrentIde(project)
|
||||
@@ -183,7 +177,7 @@ extra["versions.jflex"] = "1.7.0"
|
||||
extra["versions.markdown"] = "0.1.25"
|
||||
extra["versions.trove4j"] = "1.0.20181211"
|
||||
extra["versions.completion-ranking-kotlin"] = "0.1.3"
|
||||
extra["versions.r8"] = "2.1.96"
|
||||
extra["versions.r8"] = "2.0.88"
|
||||
val immutablesVersion = "0.3.1"
|
||||
extra["versions.kotlinx-collections-immutable"] = immutablesVersion
|
||||
extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
|
||||
@@ -192,7 +186,7 @@ extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
|
||||
extra["versions.ktor-network"] = "1.0.1"
|
||||
|
||||
if (!project.hasProperty("versions.kotlin-native")) {
|
||||
extra["versions.kotlin-native"] = "1.5.20-dev-5613"
|
||||
extra["versions.kotlin-native"] = "1.5-dev-17775"
|
||||
}
|
||||
|
||||
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
|
||||
@@ -235,7 +229,6 @@ extra["compilerModules"] = arrayOf(
|
||||
":compiler:frontend",
|
||||
":compiler:frontend.common",
|
||||
":compiler:frontend.java",
|
||||
":compiler:frontend:cfg",
|
||||
":compiler:cli-common",
|
||||
":compiler:ir.tree",
|
||||
":compiler:ir.tree.impl",
|
||||
@@ -243,7 +236,6 @@ extra["compilerModules"] = arrayOf(
|
||||
":compiler:ir.psi2ir",
|
||||
":compiler:ir.backend.common",
|
||||
":compiler:backend.jvm",
|
||||
":compiler:backend.jvm:backend.jvm.entrypoint",
|
||||
":compiler:backend.js",
|
||||
":compiler:backend.wasm",
|
||||
":compiler:ir.serialization.common",
|
||||
@@ -332,8 +324,17 @@ extra["tasksWithWarnings"] = listOf(
|
||||
":kotlin-stdlib:compileTestKotlin",
|
||||
":kotlin-stdlib-jdk7:compileTestKotlin",
|
||||
":kotlin-stdlib-jdk8:compileTestKotlin",
|
||||
":compiler:cli:compileKotlin",
|
||||
":compiler:frontend:compileKotlin",
|
||||
":compiler:fir:tree:compileKotlin",
|
||||
":compiler:fir:resolve:compileKotlin",
|
||||
":compiler:fir:checkers:compileKotlin",
|
||||
":compiler:fir:java:compileKotlin",
|
||||
":kotlin-scripting-compiler:compileKotlin",
|
||||
":kotlin-scripting-compiler:compileTestKotlin",
|
||||
":plugins:uast-kotlin:compileKotlin",
|
||||
":plugins:uast-kotlin:compileTestKotlin"
|
||||
":plugins:uast-kotlin:compileTestKotlin",
|
||||
":plugins:uast-kotlin-idea:compileKotlin"
|
||||
)
|
||||
|
||||
val tasksWithWarnings: List<String> by extra
|
||||
@@ -355,12 +356,6 @@ val coreLibProjects = listOfNotNull(
|
||||
":kotlin-reflect"
|
||||
)
|
||||
|
||||
val projectsWithDisabledFirBootstrap = coreLibProjects + listOf(
|
||||
":kotlin-gradle-plugin",
|
||||
":kotlinx-metadata",
|
||||
":kotlinx-metadata-jvm"
|
||||
)
|
||||
|
||||
val gradlePluginProjects = listOf(
|
||||
":kotlin-gradle-plugin",
|
||||
":kotlin-gradle-plugin-api",
|
||||
@@ -368,8 +363,7 @@ val gradlePluginProjects = listOf(
|
||||
":kotlin-annotation-processing-gradle",
|
||||
":kotlin-noarg",
|
||||
":kotlin-sam-with-receiver",
|
||||
":kotlin-parcelize-compiler",
|
||||
":kotlin-lombok"
|
||||
":kotlin-parcelize-compiler"
|
||||
)
|
||||
|
||||
apply {
|
||||
@@ -430,19 +424,14 @@ allprojects {
|
||||
repositories {
|
||||
kotlinBuildLocalRepo(project)
|
||||
mirrorRepo?.let(::maven)
|
||||
|
||||
internalBootstrapRepo?.let(::maven)
|
||||
bootstrapKotlinRepo?.let(::maven)
|
||||
maven(protobufRepo)
|
||||
|
||||
maven(intellijRepo)
|
||||
|
||||
mavenCentral()
|
||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||
maven("https://dl.google.com/dl/android/maven2")
|
||||
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
|
||||
|
||||
jcenter()
|
||||
maven(protobufRepo)
|
||||
maven(intellijRepo)
|
||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies")
|
||||
maven("https://dl.google.com/dl/android/maven2")
|
||||
bootstrapKotlinRepo?.let(::maven)
|
||||
internalBootstrapRepo?.let(::maven)
|
||||
}
|
||||
|
||||
configureJvmProject(javaHome!!, jvmTarget!!)
|
||||
@@ -476,7 +465,7 @@ allprojects {
|
||||
useIR = true
|
||||
}
|
||||
|
||||
if (useJvmFir && this@allprojects.name !in projectsWithDisabledFirBootstrap) {
|
||||
if (useJvmFir) {
|
||||
freeCompilerArgs += "-Xuse-fir"
|
||||
freeCompilerArgs += "-Xabi-stability=stable"
|
||||
}
|
||||
@@ -578,6 +567,22 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
gradle.buildFinished {
|
||||
val taskGraph = gradle?.taskGraph
|
||||
if (taskGraph != null) {
|
||||
taskGraph.allTasks
|
||||
.filterIsInstance<SourceTask>()
|
||||
.filter { it.didWork }
|
||||
.forEach {
|
||||
it.source.visit {
|
||||
if (file.isDirectory && file.listFiles()?.isEmpty() == true) {
|
||||
logger.warn("Empty source directories may cause build cache misses: " + file.absolutePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gradle.taskGraph.whenReady {
|
||||
fun Boolean.toOnOff(): String = if (this) "on" else "off"
|
||||
val profile = if (isTeamcityBuild) "CI" else "Local"
|
||||
@@ -618,12 +623,17 @@ val ideaPlugin by task<Task> {
|
||||
}
|
||||
|
||||
tasks {
|
||||
named<Delete>("clean") {
|
||||
delete += setOf("$buildDir/repo", distDir)
|
||||
named("clean") {
|
||||
doLast {
|
||||
delete("$buildDir/repo")
|
||||
delete(distDir)
|
||||
}
|
||||
}
|
||||
|
||||
register<Delete>("cleanupArtifacts") {
|
||||
delete = setOf(artifactsDir)
|
||||
register("cleanupArtifacts") {
|
||||
doLast {
|
||||
delete(artifactsDir)
|
||||
}
|
||||
}
|
||||
|
||||
listOf("clean", "assemble", "install").forEach { taskName ->
|
||||
@@ -722,12 +732,10 @@ tasks {
|
||||
register("scriptingTest") {
|
||||
dependsOn("dist")
|
||||
dependsOn(":kotlin-script-util:test")
|
||||
dependsOn(":kotlin-scripting-compiler:test")
|
||||
dependsOn(":kotlin-scripting-compiler:testWithIr")
|
||||
dependsOn(":kotlin-scripting-compiler-embeddable:test")
|
||||
dependsOn(":kotlin-scripting-common:test")
|
||||
dependsOn(":kotlin-scripting-jvm:test")
|
||||
dependsOn(":kotlin-scripting-jvm-host-test:test")
|
||||
dependsOn(":kotlin-scripting-jvm-host-test:testWithIr")
|
||||
dependsOn(":kotlin-scripting-dependencies:test")
|
||||
dependsOn(":kotlin-scripting-dependencies-maven:test")
|
||||
dependsOn(":kotlin-scripting-jsr223-test:test")
|
||||
@@ -735,7 +743,6 @@ tasks {
|
||||
// dependsOn(":kotlin-scripting-jvm-host-test:embeddableTest")
|
||||
dependsOn(":kotlin-scripting-jsr223-test:embeddableTest")
|
||||
dependsOn(":kotlin-main-kts-test:test")
|
||||
dependsOn(":kotlin-main-kts-test:testWithIr")
|
||||
dependsOn(":kotlin-scripting-ide-services-test:test")
|
||||
dependsOn(":kotlin-scripting-ide-services-test:embeddableTest")
|
||||
dependsOn(":kotlin-scripting-js-test:test")
|
||||
@@ -761,15 +768,11 @@ tasks {
|
||||
dependsOn("jvmCompilerIntegrationTest")
|
||||
|
||||
dependsOn(":plugins:parcelize:parcelize-compiler:test")
|
||||
|
||||
dependsOn(":kotlin-util-io:test")
|
||||
dependsOn(":kotlin-util-klib:test")
|
||||
}
|
||||
|
||||
register("toolsTest") {
|
||||
dependsOn(":tools:kotlinp:test")
|
||||
dependsOn(":native:kotlin-klib-commonizer:test")
|
||||
dependsOn(":native:kotlin-klib-commonizer-api:test")
|
||||
}
|
||||
|
||||
register("examplesTest") {
|
||||
@@ -804,6 +807,7 @@ tasks {
|
||||
dependsOn("dist")
|
||||
dependsOn(
|
||||
":idea:idea-maven:test",
|
||||
":j2k:test",
|
||||
":nj2k:test",
|
||||
":idea:jvm-debugger:jvm-debugger-core:test",
|
||||
":idea:jvm-debugger:jvm-debugger-evaluation:test",
|
||||
@@ -889,11 +893,17 @@ tasks {
|
||||
if (Ide.IJ()) {
|
||||
dependsOn(
|
||||
":libraries:tools:new-project-wizard:test",
|
||||
":libraries:tools:new-project-wizard:new-project-wizard-cli:test"
|
||||
":libraries:tools:new-project-wizard:new-project-wizard-cli:test",
|
||||
":idea:idea-new-project-wizard:test" // Temporary here. Remove after enabling builds for ideaIntegrationsTests
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
register("ideaIntegrationsTests") {
|
||||
if (Ide.IJ()) {
|
||||
dependsOn(":idea:idea-new-project-wizard:test")
|
||||
}
|
||||
}
|
||||
|
||||
register("kaptIdeTest") {
|
||||
dependsOn(":kotlin-annotation-processing:test")
|
||||
@@ -942,12 +952,6 @@ tasks {
|
||||
}
|
||||
}
|
||||
|
||||
register("publishGradlePluginArtifacts") {
|
||||
idePluginDependency {
|
||||
dependsOnKotlinGradlePluginPublish()
|
||||
}
|
||||
}
|
||||
|
||||
register("publishIdeArtifacts") {
|
||||
idePluginDependency {
|
||||
dependsOn(
|
||||
@@ -1200,8 +1204,7 @@ val Jar.outputFile: File
|
||||
val Project.sourceSetsOrNull: SourceSetContainer?
|
||||
get() = convention.findPlugin(JavaPluginConvention::class.java)?.sourceSets
|
||||
|
||||
val disableVerificationTasks = providers.systemProperty("disable.verification.tasks")
|
||||
.forUseAtConfigurationTime().orNull?.toBoolean() ?: false
|
||||
val disableVerificationTasks = System.getProperty("disable.verification.tasks") == "true"
|
||||
if (disableVerificationTasks) {
|
||||
gradle.taskGraph.whenReady {
|
||||
allTasks.forEach {
|
||||
|
||||
@@ -11,8 +11,10 @@ buildscript {
|
||||
|
||||
repositories {
|
||||
if (cacheRedirectorEnabled) {
|
||||
maven("https://cache-redirector.jetbrains.com/jcenter.bintray.com")
|
||||
maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||
} else {
|
||||
jcenter()
|
||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||
}
|
||||
|
||||
@@ -22,12 +24,14 @@ buildscript {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.26")
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
|
||||
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:${project.bootstrapKotlinVersion}")
|
||||
}
|
||||
}
|
||||
|
||||
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
|
||||
|
||||
logger.info("buildSrcKotlinVersion: " + extra["bootstrapKotlinVersion"])
|
||||
logger.info("buildSrc kotlin compiler version: " + org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION)
|
||||
logger.info("buildSrc stdlib version: " + KotlinVersion.CURRENT)
|
||||
@@ -35,7 +39,6 @@ logger.info("buildSrc stdlib version: " + KotlinVersion.CURRENT)
|
||||
apply {
|
||||
plugin("kotlin")
|
||||
plugin("kotlin-sam-with-receiver")
|
||||
plugin("groovy")
|
||||
|
||||
from("../gradle/checkCacheability.gradle.kts")
|
||||
}
|
||||
@@ -78,12 +81,11 @@ extra["intellijReleaseType"] = when {
|
||||
else -> "releases"
|
||||
}
|
||||
|
||||
extra["versions.androidDxSources"] = "5.0.0_r2"
|
||||
extra["customDepsOrg"] = "kotlin.build"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
|
||||
jcenter()
|
||||
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
|
||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||
gradlePluginPortal()
|
||||
|
||||
@@ -92,60 +94,11 @@ repositories {
|
||||
}
|
||||
}
|
||||
|
||||
val generateCompilerVersion by tasks.registering(VersionGenerator::class) {
|
||||
kotlinNativeVersionInResources=true
|
||||
defaultVersionFileLocation()
|
||||
}
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||
dependsOn(generateCompilerVersion)
|
||||
}
|
||||
|
||||
tasks.clean {
|
||||
doFirst {
|
||||
val versionSourceDirectory = project.konanVersionGeneratedSrc()
|
||||
if (versionSourceDirectory.exists()) {
|
||||
versionSourceDirectory.delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets["main"].withConvention(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet::class) {
|
||||
kotlin.srcDir("src/main/kotlin")
|
||||
if (!kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
kotlin.srcDir("../kotlin-native/shared/src/library/kotlin")
|
||||
kotlin.srcDir("../kotlin-native/shared/src/main/kotlin")
|
||||
kotlin.srcDir("../kotlin-native/build-tools/src/main/kotlin")
|
||||
kotlin.srcDir("../kotlin-native/tools/kotlin-native-gradle-plugin/src/main/kotlin")
|
||||
kotlin.srcDir("../compiler/util-klib/src")
|
||||
kotlin.srcDir("../native/utils/src")
|
||||
}
|
||||
kotlin.srcDir(project.kotlinNativeVersionSrc())
|
||||
/**
|
||||
* TODO: mentioned bellow and Co it'd be better to move to :kotlin-native:performance:buildSrc,
|
||||
* because all this relates to benchmarking.
|
||||
*/
|
||||
kotlin.exclude("**/benchmark/*.kt")
|
||||
kotlin.exclude("**/kotlin/MPPTools.kt")
|
||||
kotlin.exclude("**/kotlin/RegressionsReporter.kt")
|
||||
kotlin.exclude("**/kotlin/RunJvmTask.kt")
|
||||
kotlin.exclude("**/kotlin/RunKotlinNativeTask.kt")
|
||||
kotlin.exclude("**/kotlin/BuildRegister.kt")
|
||||
kotlin.exclude("**/kotlin/benchmarkUtils.kt")
|
||||
}
|
||||
|
||||
tasks.validatePlugins.configure {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
java {
|
||||
disableAutoTargetJvm()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(kotlin("stdlib", embeddedKotlinVersion))
|
||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
|
||||
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.26")
|
||||
implementation("com.gradle.publish:plugin-publish-plugin:0.14.0")
|
||||
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
|
||||
implementation("com.gradle.publish:plugin-publish-plugin:0.12.0")
|
||||
|
||||
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
|
||||
implementation("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")
|
||||
@@ -158,29 +111,8 @@ dependencies {
|
||||
|
||||
implementation("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.5")
|
||||
|
||||
implementation("org.gradle:test-retry-gradle-plugin:1.2.0")
|
||||
implementation("org.gradle:test-retry-gradle-plugin:1.1.9")
|
||||
implementation("com.gradle.enterprise:test-distribution-gradle-plugin:1.2.1")
|
||||
|
||||
compileOnly(gradleApi())
|
||||
|
||||
val kotlinVersion = project.bootstrapKotlinVersion
|
||||
val ktorVersion = "1.2.1"
|
||||
val slackApiVersion = "1.2.0"
|
||||
val metadataVersion = "0.0.1-dev-10"
|
||||
|
||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
|
||||
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
|
||||
implementation("com.ullink.slack:simpleslackapi:$slackApiVersion")
|
||||
|
||||
implementation("io.ktor:ktor-client-auth:$ktorVersion")
|
||||
implementation("io.ktor:ktor-client-core:$ktorVersion")
|
||||
implementation("io.ktor:ktor-client-cio:$ktorVersion")
|
||||
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-metadata-klib:$metadataVersion")
|
||||
if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
implementation("org.jetbrains.kotlin:kotlin-native-utils:${project.bootstrapKotlinVersion}")
|
||||
}
|
||||
}
|
||||
|
||||
samWithReceiver {
|
||||
@@ -196,26 +128,11 @@ java {
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile>().configureEach {
|
||||
kotlinOptions.allWarningsAsErrors = true
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
"-Xopt-in=kotlin.RequiresOptIn",
|
||||
"-Xskip-runtime-version-check",
|
||||
"-Xsuppress-version-warnings",
|
||||
"-Xopt-in=kotlin.ExperimentalStdlibApi"
|
||||
)
|
||||
kotlinOptions.freeCompilerArgs +=
|
||||
listOf("-Xopt-in=kotlin.RequiresOptIn", "-Xskip-runtime-version-check")
|
||||
}
|
||||
|
||||
tasks["build"].dependsOn(":prepare-deps:build")
|
||||
sourceSets["main"].withConvention(org.gradle.api.tasks.GroovySourceSet::class) {
|
||||
if (!kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
groovy.srcDir("../kotlin-native/build-tools/src/main/groovy")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("compileGroovy", GroovyCompile::class.java) {
|
||||
classpath += project.files(tasks.named("compileKotlin", org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class.java))
|
||||
dependsOn(tasks.named("compileKotlin"))
|
||||
}
|
||||
|
||||
allprojects {
|
||||
tasks.register("checkBuild")
|
||||
@@ -224,40 +141,3 @@ allprojects {
|
||||
apply(from = "$rootDir/../gradle/cacheRedirector.gradle.kts")
|
||||
}
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
plugins {
|
||||
create("compileToBitcode") {
|
||||
id = "compile-to-bitcode"
|
||||
implementationClass = "org.jetbrains.kotlin.bitcode.CompileToBitcodePlugin"
|
||||
}
|
||||
create("runtimeTesting") {
|
||||
id = "runtime-testing"
|
||||
implementationClass = "org.jetbrains.kotlin.testing.native.RuntimeTestingPlugin"
|
||||
}
|
||||
create("konan") {
|
||||
id = "konan"
|
||||
implementationClass = "org.jetbrains.kotlin.gradle.plugin.konan.KonanPlugin"
|
||||
}
|
||||
// We bundle a shaded version of kotlinx-serialization plugin
|
||||
create("kotlinx-serialization-native") {
|
||||
id = "kotlinx-serialization-native"
|
||||
implementationClass = "shadow.org.jetbrains.kotlinx.serialization.gradle.SerializationGradleSubplugin"
|
||||
}
|
||||
|
||||
create("org.jetbrains.kotlin.konan") {
|
||||
id = "org.jetbrains.kotlin.konan"
|
||||
implementationClass = "org.jetbrains.kotlin.gradle.plugin.konan.KonanPlugin"
|
||||
}
|
||||
|
||||
create("native") {
|
||||
id = "native"
|
||||
implementationClass = "org.jetbrains.gradle.plugins.tools.NativePlugin"
|
||||
}
|
||||
|
||||
create("native-interop-plugin") {
|
||||
id = "native-interop-plugin"
|
||||
implementationClass = "org.jetbrains.kotlin.NativeInteropPlugin"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,11 +65,28 @@ repositories {
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
|
||||
ivy {
|
||||
url = URI("https://dl.bintray.com/kotlin/as/")
|
||||
|
||||
patternLayout {
|
||||
artifact("[artifact]-[revision]-$androidStudioOs.[ext]")
|
||||
}
|
||||
|
||||
credentials {
|
||||
username = System.getenv("AS_BINTRAY_USER_NAME") ?: findProperty("bintray.user") as String?
|
||||
password = System.getenv("AS_BINTRAY_API_KEY") ?: findProperty("bintray.apikey") as String?
|
||||
}
|
||||
|
||||
metadataSources {
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
maven("https://www.jetbrains.com/intellij-repository/$intellijReleaseType")
|
||||
maven("https://plugins.jetbrains.com/maven")
|
||||
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
|
||||
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
|
||||
}
|
||||
|
||||
val intellij by configurations.creating
|
||||
|
||||
@@ -20,7 +20,7 @@ buildscript {
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.26")
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.konan
|
||||
import java.io.*
|
||||
|
||||
val VERSION_PATH = "/META-INF/kotlin-native.compiler.version"
|
||||
val CompilerVersion.Companion.CURRENT: CompilerVersion
|
||||
get() {
|
||||
return InputStreamReader(this::class.java.getResourceAsStream(VERSION_PATH)).use {
|
||||
it.readLines().single().parseCompilerVersion()
|
||||
}
|
||||
}
|
||||
|
||||
val currentCompilerVersion = CompilerVersion.CURRENT
|
||||
@@ -1,51 +0,0 @@
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.artifacts.Configuration
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.tasks.SourceSet
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.kotlin.dsl.provideDelegate
|
||||
import org.gradle.kotlin.dsl.withGroovyBuilder
|
||||
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
class InstrumentJava(@Transient val javaInstrumentator: Configuration, @Transient val sourceSet: SourceSet) : Action<Task> {
|
||||
private val instrumentatorClasspath: String by lazy {
|
||||
javaInstrumentator.asPath
|
||||
}
|
||||
|
||||
private val srcDirs: FileCollection by lazy {
|
||||
sourceSet.allJava.sourceDirectories
|
||||
}
|
||||
|
||||
override fun execute(task: Task) {
|
||||
require(task is JavaCompile) { "$task is not of type JavaCompile!" }
|
||||
task.doLast {
|
||||
task.ant.withGroovyBuilder {
|
||||
"taskdef"(
|
||||
"name" to "instrumentIdeaExtensions",
|
||||
"classpath" to instrumentatorClasspath,
|
||||
"loaderref" to "java2.loader",
|
||||
"classname" to "com.intellij.ant.InstrumentIdeaExtensions"
|
||||
)
|
||||
}
|
||||
|
||||
val javaSourceDirectories = srcDirs.filter { it.exists() }
|
||||
|
||||
task.ant.withGroovyBuilder {
|
||||
javaSourceDirectories.forEach { directory ->
|
||||
"instrumentIdeaExtensions"(
|
||||
"srcdir" to directory,
|
||||
"destdir" to task.destinationDir,
|
||||
"classpath" to task.classpath.asPath,
|
||||
"includeantruntime" to false,
|
||||
"instrumentNotNull" to true
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import org.gradle.api.tasks.TaskProvider
|
||||
import org.gradle.api.tasks.Upload
|
||||
import org.gradle.api.tasks.javadoc.Javadoc
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
import org.gradle.api.artifacts.dsl.DependencyHandler
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer
|
||||
import plugins.KotlinBuildPublishingPlugin
|
||||
|
||||
@@ -8,37 +8,48 @@ package tasks
|
||||
import groovy.util.Node
|
||||
import groovy.util.XmlParser
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
abstract class WriteCopyrightToFile : DefaultTask() {
|
||||
|
||||
|
||||
|
||||
open class WriteCopyrightToFile : DefaultTask() {
|
||||
|
||||
@InputFile
|
||||
val path = project.file("${project.rootDir}/.idea/copyright/apache.xml")
|
||||
var path = project.file("${project.rootDir}/.idea/copyright/apache.xml")
|
||||
|
||||
@get:OutputFile
|
||||
abstract val outputFile: RegularFileProperty
|
||||
@OutputFile
|
||||
var outputFile: File? = null
|
||||
|
||||
@get:Input
|
||||
val commented: Property<Boolean> = project.objects.property(Boolean::class.java).convention(true)
|
||||
@Input
|
||||
var commented: Boolean = true
|
||||
|
||||
@TaskAction
|
||||
fun write() {
|
||||
val file = outputFile.asFile.get()
|
||||
file.writeText(if (commented.get()) readCopyrightCommented() else readCopyright())
|
||||
if (commented) {
|
||||
outputFile!!.writeText(project.readCopyrightCommented())
|
||||
} else {
|
||||
outputFile!!.writeText(project.readCopyright())
|
||||
}
|
||||
}
|
||||
|
||||
private fun readCopyright(): String {
|
||||
assert(path.exists()) {
|
||||
"File $path with copyright not found"
|
||||
|
||||
fun Project.readCopyright(): String {
|
||||
val file = rootDir.resolve(".idea/copyright/apache.xml")
|
||||
|
||||
assert(file.exists()) {
|
||||
"File $file with copyright not found"
|
||||
}
|
||||
|
||||
|
||||
val xmlParser = XmlParser()
|
||||
val node = xmlParser.parse(path)
|
||||
val node = xmlParser.parse(file)
|
||||
assert(node.attribute("name") == "CopyrightManager") {
|
||||
"Format changed occasionally?"
|
||||
}
|
||||
@@ -48,7 +59,7 @@ abstract class WriteCopyrightToFile : DefaultTask() {
|
||||
return noticeNode.attribute("value").toString().replace("$today.year", GregorianCalendar()[Calendar.YEAR].toString())
|
||||
}
|
||||
|
||||
private fun readCopyrightCommented(): String {
|
||||
fun Project.readCopyrightCommented(): String {
|
||||
return "/*\n" + readCopyright().prependIndent(" * ") + "\n */"
|
||||
}
|
||||
}
|
||||
@@ -118,8 +118,7 @@ fun DependencyHandler.projectArchives(name: String): ProjectDependency = project
|
||||
fun Project.testApiJUnit5(
|
||||
vintageEngine: Boolean = false,
|
||||
runner: Boolean = false,
|
||||
suiteApi: Boolean = false,
|
||||
jupiterParams: Boolean = false
|
||||
suiteApi: Boolean = false
|
||||
) {
|
||||
with(dependencies) {
|
||||
val platformVersion = commonVer("org.junit", "junit-bom")
|
||||
@@ -128,11 +127,6 @@ fun Project.testApiJUnit5(
|
||||
if (vintageEngine) {
|
||||
testApi("org.junit.vintage:junit-vintage-engine:$platformVersion")
|
||||
}
|
||||
|
||||
if (jupiterParams) {
|
||||
testApi("org.junit.jupiter:junit-jupiter-params:$platformVersion")
|
||||
}
|
||||
|
||||
val componentsVersion = commonVer("org.junit.platform", "")
|
||||
|
||||
val components = mutableListOf(
|
||||
|
||||
@@ -25,7 +25,6 @@ val packagesToRelocate =
|
||||
"org.fusesource",
|
||||
"net.jpountz",
|
||||
"one.util.streamex",
|
||||
"it.unimi.dsi.fastutil",
|
||||
"kotlinx.collections.immutable"
|
||||
)
|
||||
|
||||
@@ -128,6 +127,7 @@ fun Project.rewriteDepsToShadedJar(
|
||||
archiveClassifier.set("original")
|
||||
}
|
||||
|
||||
val compilerDummyJarFile by lazy { configurations.getAt("compilerDummyJar").singleFile }
|
||||
|
||||
shadowJarTask.configure {
|
||||
dependsOn(originalJarTask)
|
||||
@@ -135,8 +135,7 @@ fun Project.rewriteDepsToShadedJar(
|
||||
|
||||
// When Gradle traverses the inputs, reject the shaded compiler JAR,
|
||||
// which leads to the content of that JAR being excluded as well:
|
||||
val compilerDummyJarFile = project.provider { configurations.getByName("compilerDummyJar").singleFile }
|
||||
exclude { it.file == compilerDummyJarFile.get() }
|
||||
exclude { it.file == compilerDummyJarFile }
|
||||
|
||||
archiveClassifier.set("original")
|
||||
body()
|
||||
|
||||
@@ -21,18 +21,15 @@ import org.gradle.api.artifacts.Configuration
|
||||
import org.gradle.api.artifacts.ProjectDependency
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.file.FileSystemOperations
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.internal.ConventionTask
|
||||
import org.gradle.api.plugins.ExtensionAware
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.api.tasks.compile.AbstractCompile
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
|
||||
fun Project.configureFormInstrumentation() {
|
||||
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.configureEach {
|
||||
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.all {
|
||||
// When we change the output classes directory, Gradle will automatically configure
|
||||
// the test compile tasks to use the instrumented classes. Normally this is fine,
|
||||
// however, it causes problems for Kotlin projects:
|
||||
@@ -45,36 +42,31 @@ fun Project.configureFormInstrumentation() {
|
||||
|
||||
// This fails when we change the classes dir. The easiest fix is to prepend the
|
||||
// classes from the "friendly directory" to the compile classpath.
|
||||
if (!tasks.names.contains("compileTestKotlin")) return@configureEach
|
||||
val testCompile = tasks.findByName("compileTestKotlin") as AbstractCompile?
|
||||
testCompile?.doFirst {
|
||||
val originalClassesDirs = files((mainSourceSet as ExtensionAware).extra.get("classesDirsCopy"))
|
||||
|
||||
tasks.named<AbstractCompile>("compileTestKotlin") {
|
||||
val objects = project.objects
|
||||
val classesDirs = project.mainSourceSet.output.classesDirs
|
||||
val classesDirsCopy = project.provider { (mainSourceSet as ExtensionAware).extra.get("classesDirsCopy") }
|
||||
doFirst {
|
||||
val originalClassesDirs = objects.fileCollection().from(classesDirsCopy)
|
||||
testCompile.classpath = (testCompile.classpath
|
||||
- mainSourceSet.output.classesDirs
|
||||
+ originalClassesDirs)
|
||||
|
||||
classpath = (classpath
|
||||
- classesDirs
|
||||
+ originalClassesDirs)
|
||||
// Since Kotlin 1.3.60, the friend paths available to the test compile task are calculated as the main source set's
|
||||
// output.classesDirs. Since the classesDirs are excluded from the classpath (replaced by the originalClassesDirs),
|
||||
// in order to be able to access the internals of 'main', tests need to receive the original classes dirs as a
|
||||
// -Xfriend-paths compiler argument as well.
|
||||
fun addFreeCompilerArgs(kotlinCompileTask: AbstractCompile, vararg args: String) {
|
||||
val getKotlinOptions = kotlinCompileTask::class.java.getMethod("getKotlinOptions")
|
||||
val kotlinOptions = getKotlinOptions(kotlinCompileTask)
|
||||
|
||||
// Since Kotlin 1.3.60, the friend paths available to the test compile task are calculated as the main source set's
|
||||
// output.classesDirs. Since the classesDirs are excluded from the classpath (replaced by the originalClassesDirs),
|
||||
// in order to be able to access the internals of 'main', tests need to receive the original classes dirs as a
|
||||
// -Xfriend-paths compiler argument as well.
|
||||
fun addFreeCompilerArgs(kotlinCompileTask: AbstractCompile, vararg args: String) {
|
||||
val getKotlinOptions = kotlinCompileTask::class.java.getMethod("getKotlinOptions")
|
||||
val kotlinOptions = getKotlinOptions(kotlinCompileTask)
|
||||
val getFreeCompilerArgs = kotlinOptions::class.java.getMethod("getFreeCompilerArgs")
|
||||
val freeCompilerArgs = getFreeCompilerArgs(kotlinOptions) as List<*>
|
||||
|
||||
val getFreeCompilerArgs = kotlinOptions::class.java.getMethod("getFreeCompilerArgs")
|
||||
val freeCompilerArgs = getFreeCompilerArgs(kotlinOptions) as List<*>
|
||||
|
||||
val setFreeCompilerArgs = kotlinOptions::class.java.getMethod("setFreeCompilerArgs", List::class.java)
|
||||
setFreeCompilerArgs(kotlinOptions, freeCompilerArgs + args)
|
||||
}
|
||||
addFreeCompilerArgs(this as AbstractCompile, "-Xfriend-paths=" + originalClassesDirs.joinToString(",") { it.absolutePath })
|
||||
val setFreeCompilerArgs = kotlinOptions::class.java.getMethod("setFreeCompilerArgs", List::class.java)
|
||||
setFreeCompilerArgs(kotlinOptions, freeCompilerArgs + args)
|
||||
}
|
||||
addFreeCompilerArgs(testCompile, "-Xfriend-paths=" + originalClassesDirs.joinToString(",") { it.absolutePath })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
val instrumentationClasspathCfg = configurations.create("instrumentationClasspath")
|
||||
@@ -84,7 +76,7 @@ fun Project.configureFormInstrumentation() {
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
sourceSets.forEach { sourceSetParam ->
|
||||
sourceSets.all { sourceSetParam ->
|
||||
// This copy will ignore filters, but they are unlikely to be used.
|
||||
val classesDirs = (sourceSetParam.output.classesDirs as ConfigurableFileCollection).from as Collection<Any>
|
||||
|
||||
@@ -96,82 +88,66 @@ fun Project.configureFormInstrumentation() {
|
||||
(sourceSetParam.output.classesDirs as ConfigurableFileCollection).setFrom(instrumentedClassesDir)
|
||||
val instrumentTask =
|
||||
project.tasks.register(sourceSetParam.getTaskName("instrument", "classes"), IntelliJInstrumentCodeTask::class.java) {
|
||||
dependsOn(sourceSetParam.classesTaskName)
|
||||
compileClasspath.from(sourceSetParam.compileClasspath)
|
||||
sourceDirs.from(project.files({ sourceSetParam.allSource.srcDirs.filter { !sourceSetParam.resources.contains(it) && it.exists() } }))
|
||||
instrumentationClasspathConfiguration = instrumentationClasspathCfg
|
||||
originalClassesDirs.from(classesDirsCopy)
|
||||
output.set(instrumentedClassesDir)
|
||||
dependsOn(sourceSetParam.classesTaskName).onlyIf { !classesDirsCopy.isEmpty }
|
||||
sourceSet = sourceSetParam
|
||||
instrumentationClasspath = instrumentationClasspathCfg
|
||||
originalClassesDirs = classesDirsCopy
|
||||
output = instrumentedClassesDir
|
||||
outputs.dir(instrumentedClassesDir)
|
||||
}
|
||||
|
||||
// Ensure that our task is invoked when the source set is built
|
||||
sourceSetParam.compiledBy(instrumentTask)
|
||||
@Suppress("UNUSED_EXPRESSION")
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@CacheableTask
|
||||
abstract class IntelliJInstrumentCodeTask : ConventionTask() {
|
||||
open class IntelliJInstrumentCodeTask : ConventionTask() {
|
||||
companion object {
|
||||
private const val FILTER_ANNOTATION_REGEXP_CLASS = "com.intellij.ant.ClassFilterAnnotationRegexp"
|
||||
private const val LOADER_REF = "java2.loader"
|
||||
}
|
||||
|
||||
@Transient
|
||||
@Internal
|
||||
lateinit var instrumentationClasspathConfiguration: Configuration
|
||||
@Classpath
|
||||
var instrumentationClasspath: Configuration? = null
|
||||
|
||||
@get:Classpath
|
||||
val instrumentationClasspath: String by lazy {
|
||||
instrumentationClasspathConfiguration.asPath
|
||||
}
|
||||
|
||||
@get:InputFiles
|
||||
@get:PathSensitive(PathSensitivity.RELATIVE)
|
||||
@get:SkipWhenEmpty
|
||||
abstract val originalClassesDirs: ConfigurableFileCollection
|
||||
@InputFiles
|
||||
@PathSensitive(PathSensitivity.RELATIVE)
|
||||
var originalClassesDirs: FileCollection? = null
|
||||
|
||||
@get:Input
|
||||
var instrumentNotNull: Boolean = false
|
||||
|
||||
@get:InputFiles
|
||||
@get:Classpath
|
||||
abstract val compileClasspath: ConfigurableFileCollection
|
||||
|
||||
// Instrumentation needs to have access to sources of forms for inclusion
|
||||
private val depSourceDirectorySets by lazy {
|
||||
project.configurations["compile"].dependencies.withType(ProjectDependency::class.java)
|
||||
.map { p -> p.dependencyProject.mainSourceSet.allSource.sourceDirectories }
|
||||
}
|
||||
@Internal
|
||||
var sourceSet: SourceSet? = null
|
||||
|
||||
@get:InputFiles
|
||||
@get:PathSensitive(PathSensitivity.RELATIVE)
|
||||
abstract val sourceDirs: ConfigurableFileCollection
|
||||
val sourceDirs: FileCollection
|
||||
get() = project.files(sourceSet!!.allSource.srcDirs.filter { !sourceSet!!.resources.contains(it) && it.exists() })
|
||||
|
||||
@get:OutputDirectory
|
||||
abstract val output: RegularFileProperty
|
||||
|
||||
@get:Inject
|
||||
abstract val fs: FileSystemOperations
|
||||
lateinit var output: File
|
||||
|
||||
@TaskAction
|
||||
fun instrumentClasses() {
|
||||
logger.info(
|
||||
"input files are: ${
|
||||
originalClassesDirs.joinToString(
|
||||
"; ",
|
||||
transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)"}" })
|
||||
}"
|
||||
"input files are: ${originalClassesDirs?.joinToString(
|
||||
"; ",
|
||||
transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)"}" })}"
|
||||
)
|
||||
output.asFile.get().deleteRecursively()
|
||||
output.deleteRecursively()
|
||||
copyOriginalClasses()
|
||||
|
||||
val classpath = instrumentationClasspath
|
||||
val classpath = instrumentationClasspath!!
|
||||
|
||||
ant.withGroovyBuilder {
|
||||
"taskdef"(
|
||||
"name" to "instrumentIdeaExtensions",
|
||||
"classpath" to classpath,
|
||||
"classpath" to classpath.asPath,
|
||||
"loaderref" to LOADER_REF,
|
||||
"classname" to "com.intellij.ant.InstrumentIdeaExtensions"
|
||||
)
|
||||
@@ -179,14 +155,14 @@ abstract class IntelliJInstrumentCodeTask : ConventionTask() {
|
||||
|
||||
logger.info("Compiling forms and instrumenting code with nullability preconditions")
|
||||
if (instrumentNotNull) {
|
||||
prepareNotNullInstrumenting(classpath)
|
||||
prepareNotNullInstrumenting(classpath.asPath)
|
||||
}
|
||||
|
||||
instrumentCode(sourceDirs, instrumentNotNull)
|
||||
}
|
||||
|
||||
private fun copyOriginalClasses() {
|
||||
fs.copy {
|
||||
project.copy {
|
||||
from(originalClassesDirs)
|
||||
into(output)
|
||||
}
|
||||
@@ -205,10 +181,12 @@ abstract class IntelliJInstrumentCodeTask : ConventionTask() {
|
||||
|
||||
private fun instrumentCode(srcDirs: FileCollection, instrumentNotNull: Boolean) {
|
||||
val headlessOldValue = System.setProperty("java.awt.headless", "true")
|
||||
val output = output.get().asFile
|
||||
|
||||
// Instrumentation needs to have access to sources of forms for inclusion
|
||||
val depSourceDirectorySets = project.configurations["compile"].dependencies.withType(ProjectDependency::class.java)
|
||||
.map { p -> p.dependencyProject.mainSourceSet.allSource.sourceDirectories }
|
||||
val instrumentationClasspath =
|
||||
depSourceDirectorySets.fold(compileClasspath as FileCollection) { acc, v -> acc + v }.asPath.also {
|
||||
depSourceDirectorySets.fold(sourceSet!!.compileClasspath) { acc, v -> acc + v }.asPath.also {
|
||||
logger.info("Using following dependency source dirs: $it")
|
||||
}
|
||||
|
||||
|
||||
@@ -10,12 +10,12 @@ import net.rubygrapefruit.platform.WindowsRegistry.Key.HKEY_LOCAL_MACHINE
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
|
||||
enum class JdkMajorVersion(private val mandatory: Boolean = true) {
|
||||
JDK_16, JDK_17, JDK_18, JDK_9, JDK_10(false), JDK_11(false), /*15.0*/JDK_15(false);
|
||||
JDK_16, JDK_17, JDK_18, JDK_9, JDK_10(false), JDK_11(false);
|
||||
|
||||
fun isMandatory(): Boolean = mandatory
|
||||
}
|
||||
|
||||
val jdkAlternativeVarNames = mapOf(JdkMajorVersion.JDK_9 to listOf("JDK_19"), JdkMajorVersion.JDK_15 to listOf("JDK_15_0"))
|
||||
val jdkAlternativeVarNames = mapOf(JdkMajorVersion.JDK_9 to listOf("JDK_19"))
|
||||
|
||||
data class JdkId(val explicit: Boolean, val majorVersion: JdkMajorVersion, var version: String, var homeDir: File)
|
||||
|
||||
@@ -105,8 +105,8 @@ private val macOsJavaHomeOutRegexes =
|
||||
listOf(
|
||||
Regex("""\s+(\S+),\s+(\S+):\s+".*?"\s+(.+)"""),
|
||||
Regex("""\s+(\S+)\s+\((.*?)\):\s+(.+)"""),
|
||||
Regex("""\s+(\S+)\s+\((.*?)\)\s+"[^"]*"\s+-\s+"[^"]*"\s(.+)"""),
|
||||
Regex("""\s+(\S+)\s+\((.+)\)\s+".+"\s+-\s+".+"\s+(.+)"""))
|
||||
Regex("""\s+(\S+)\s+\((.*?)\)\s+"[^"]*"\s+-\s+"[^"]*"\s(.+)""")
|
||||
)
|
||||
|
||||
fun MutableCollection<JdkId>.discoverJdksOnMacOS(project: Project) {
|
||||
val procBuilder = ProcessBuilder("/usr/libexec/java_home", "-V").redirectErrorStream(true)
|
||||
|
||||
@@ -1,228 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.gradle.plugins.tools
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.plugins.BasePlugin
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
import org.gradle.language.base.plugins.LifecycleBasePlugin
|
||||
import org.jetbrains.kotlin.konan.target.HostManager.Companion.hostIsMac
|
||||
import org.jetbrains.kotlin.konan.target.HostManager.Companion.hostIsMingw
|
||||
import java.io.File
|
||||
import kotlin.collections.List
|
||||
import kotlin.collections.MutableMap
|
||||
import kotlin.collections.addAll
|
||||
import kotlin.collections.drop
|
||||
import kotlin.collections.first
|
||||
import kotlin.collections.flatMap
|
||||
import kotlin.collections.forEach
|
||||
import kotlin.collections.listOf
|
||||
import kotlin.collections.map
|
||||
import kotlin.collections.mutableListOf
|
||||
import kotlin.collections.mutableMapOf
|
||||
import kotlin.collections.plusAssign
|
||||
import kotlin.collections.set
|
||||
import kotlin.collections.toTypedArray
|
||||
|
||||
open class NativePlugin : Plugin<Project> {
|
||||
override fun apply(project: Project) {
|
||||
project.apply<BasePlugin>()
|
||||
project.extensions.create("native", NativeToolsExtension::class.java, project)
|
||||
}
|
||||
}
|
||||
|
||||
abstract class ToolExecutionTask : DefaultTask() {
|
||||
@get:OutputFile
|
||||
abstract var output: File
|
||||
|
||||
@get:InputFiles
|
||||
abstract var input: List<File>
|
||||
|
||||
@get:Input
|
||||
abstract var cmd: String
|
||||
|
||||
@get:Input
|
||||
abstract var args: List<String>
|
||||
|
||||
@TaskAction
|
||||
fun action() {
|
||||
project.exec {
|
||||
executable(cmd)
|
||||
args(*this@ToolExecutionTask.args.toTypedArray())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ToolPatternImpl(val extension: NativeToolsExtension, val output:String, vararg val input: String):ToolPattern {
|
||||
val tool = mutableListOf<String>()
|
||||
val args = mutableListOf<String>()
|
||||
override fun ruleOut(): String = output
|
||||
override fun ruleInFirst(): String = input.first()
|
||||
override fun ruleInAll(): Array<String> = arrayOf(*input)
|
||||
|
||||
override fun flags(vararg args: String) {
|
||||
this.args.addAll(args)
|
||||
}
|
||||
|
||||
override fun tool(vararg arg: String) {
|
||||
tool.addAll(arg)
|
||||
}
|
||||
|
||||
override fun env(name: String) = emptyArray<String>()
|
||||
|
||||
fun configure(task: ToolExecutionTask, configureDepencies:Boolean) {
|
||||
extension.cleanupfiles += output
|
||||
task.input = input.map {
|
||||
extension.project.file(it)
|
||||
}
|
||||
task.dependsOn(":kotlin-native:dependencies:update")
|
||||
if (configureDepencies)
|
||||
task.input.forEach { task.dependsOn(it.name) }
|
||||
val file = extension.project.file(output)
|
||||
file.parentFile.mkdirs()
|
||||
task.output = file
|
||||
task.cmd = tool.first()
|
||||
task.args = listOf(*tool.drop(1).toTypedArray(), *args.toTypedArray())
|
||||
}
|
||||
}
|
||||
|
||||
open class SourceSet(
|
||||
val sourceSets: SourceSets,
|
||||
val name: String,
|
||||
val initialDirectory: File = sourceSets.project.projectDir,
|
||||
val initialSourceSet: SourceSet? = null,
|
||||
val rule: Pair<String, String>? = null
|
||||
) {
|
||||
var collection = sourceSets.project.objects.fileCollection() as FileCollection
|
||||
fun file(path: String) {
|
||||
collection = collection.plus(sourceSets.project.files("${initialDirectory.absolutePath}/$path"))
|
||||
}
|
||||
|
||||
fun dir(path: String) {
|
||||
sourceSets.project.fileTree("${initialDirectory.absolutePath}/$path").files.forEach {
|
||||
collection = collection.plus(sourceSets.project.files(it))
|
||||
}
|
||||
}
|
||||
|
||||
fun transform(suffixes: Pair<String, String>): SourceSet {
|
||||
return SourceSet(
|
||||
sourceSets,
|
||||
name,
|
||||
sourceSets.project.file("${sourceSets.project.buildDir}/$name/${suffixes.first}_${suffixes.second}/"),
|
||||
this,
|
||||
suffixes
|
||||
)
|
||||
}
|
||||
|
||||
fun implicitTasks(): Array<TaskProvider<*>> {
|
||||
rule ?: return emptyArray()
|
||||
initialSourceSet?.implicitTasks()
|
||||
return initialSourceSet!!.collection
|
||||
.filter { !it.isDirectory() }
|
||||
.filter { it.name.endsWith(rule.first) }
|
||||
.map { it.relativeTo(initialSourceSet.initialDirectory) }
|
||||
.map { it.path }
|
||||
.map { it to (it.substring(0, it.lastIndexOf(rule.first)) + rule.second) }
|
||||
.map {
|
||||
file(it.second)
|
||||
sourceSets.project.file("${initialSourceSet.initialDirectory.path}/${it.first}") to sourceSets.project.file("${initialDirectory.path}/${it.second}")
|
||||
}.map {
|
||||
sourceSets.project.tasks.register<ToolExecutionTask>(it.second.name, ToolExecutionTask::class.java) {
|
||||
val toolConfiguration = ToolPatternImpl(sourceSets.extension, it.second.path, it.first.path)
|
||||
sourceSets.extension.toolPatterns[rule]!!.invoke(toolConfiguration)
|
||||
toolConfiguration.configure(this, initialSourceSet.rule != null)
|
||||
}
|
||||
}.toTypedArray()
|
||||
}
|
||||
}
|
||||
|
||||
class SourceSets(val project: Project, val extension: NativeToolsExtension, val sources: MutableMap<String, SourceSet>) :
|
||||
MutableMap<String, SourceSet> by sources {
|
||||
operator fun String.invoke(initialDirectory: File = project.projectDir, configuration: SourceSet.() -> Unit) {
|
||||
sources[this] = SourceSet(this@SourceSets, this, initialDirectory).also {
|
||||
configuration(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interface Environment {
|
||||
operator fun String.invoke(vararg values: String)
|
||||
}
|
||||
|
||||
interface ToolPattern {
|
||||
fun ruleOut(): String
|
||||
fun ruleInFirst(): String
|
||||
fun ruleInAll(): Array<String>
|
||||
fun flags(vararg args: String): Unit
|
||||
fun tool(vararg arg: String): Unit
|
||||
fun env(name: String): Array<String>
|
||||
}
|
||||
|
||||
|
||||
typealias ToolPatternConfiguration = ToolPattern.() -> Unit
|
||||
typealias EnvironmentConfiguration = Environment.() -> Unit
|
||||
|
||||
class ToolConfigurationPatterns(
|
||||
val extension: NativeToolsExtension,
|
||||
val patterns: MutableMap<Pair<String, String>, ToolPatternConfiguration>
|
||||
) : MutableMap<Pair<String, String>, ToolPatternConfiguration> by patterns {
|
||||
operator fun Pair<String, String>.invoke(configuration: ToolPatternConfiguration) {
|
||||
patterns[this] = configuration
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class NativeToolsExtension(val project: Project) {
|
||||
val sourceSets = SourceSets(project, this, mutableMapOf<String, SourceSet>())
|
||||
val toolPatterns = ToolConfigurationPatterns(this, mutableMapOf<Pair<String, String>, ToolPatternConfiguration>())
|
||||
val cleanupfiles = mutableListOf<String>()
|
||||
fun sourceSet(configuration: SourceSets.() -> Unit) {
|
||||
sourceSets.configuration()
|
||||
}
|
||||
|
||||
var environmentConfiguration: EnvironmentConfiguration? = null
|
||||
fun environment(configuration: EnvironmentConfiguration) {
|
||||
environmentConfiguration = configuration
|
||||
}
|
||||
|
||||
fun suffixes(configuration: ToolConfigurationPatterns.() -> Unit) = toolPatterns.configuration()
|
||||
|
||||
fun target(name: String, vararg objSet: SourceSet, configuration: ToolPatternConfiguration) {
|
||||
project.tasks.withType<Delete>().named(LifecycleBasePlugin.CLEAN_TASK_NAME).configure {
|
||||
doLast {
|
||||
delete(*this@NativeToolsExtension.cleanupfiles.toTypedArray())
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.project.tasks.create<ToolExecutionTask>(name, ToolExecutionTask::class.java) {
|
||||
objSet.forEach {
|
||||
dependsOn(it.implicitTasks())
|
||||
}
|
||||
val deps = objSet.flatMap { it.collection.files }.map { it.path }
|
||||
val toolConfiguration = ToolPatternImpl(sourceSets.extension, "${project.buildDir.path}/$name", *deps.toTypedArray())
|
||||
toolConfiguration.configuration()
|
||||
toolConfiguration.configure(this, false )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun solib(name: String) = when {
|
||||
hostIsMingw -> "$name.dll"
|
||||
hostIsMac -> "lib$name.dylib"
|
||||
else -> "lib$name.so"
|
||||
}
|
||||
|
||||
fun lib(name:String) = when {
|
||||
hostIsMingw -> "$name.lib"
|
||||
else -> "lib$name.a"
|
||||
}
|
||||
@@ -10,16 +10,31 @@ import java.io.File
|
||||
import org.gradle.api.Project
|
||||
|
||||
open class PillExtension {
|
||||
/*
|
||||
* Here's how you can specify a custom variant:
|
||||
* `./gradlew pill -Dpill.variant=<NAME>`
|
||||
*/
|
||||
enum class Variant {
|
||||
BASE, // Includes compiler and IDE (default)
|
||||
FULL, // Includes compiler, IDE and Gradle plugin
|
||||
// Default variant (./gradlew pill)
|
||||
BASE() {
|
||||
override val includes = setOf(BASE)
|
||||
},
|
||||
|
||||
// Full variant (./gradlew pill -Dpill.variant=full)
|
||||
FULL() {
|
||||
override val includes = setOf(BASE, FULL)
|
||||
},
|
||||
|
||||
// Do not import the project to JPS model, but set some options for it
|
||||
NONE() {
|
||||
override val includes = emptySet<Variant>()
|
||||
},
|
||||
|
||||
// 'BASE' if the "jps-compatible" plugin is applied, 'NONE' otherwise
|
||||
DEFAULT() {
|
||||
override val includes = emptySet<Variant>()
|
||||
};
|
||||
|
||||
abstract val includes: Set<Variant>
|
||||
}
|
||||
|
||||
open var variant: Variant? = null
|
||||
open var variant: Variant = Variant.DEFAULT
|
||||
|
||||
open var excludedDirs: List<File> = emptyList()
|
||||
|
||||
@@ -30,7 +45,7 @@ open class PillExtension {
|
||||
|
||||
@Suppress("unused")
|
||||
fun serialize() = mapOf<String, Any?>(
|
||||
"variant" to variant?.name,
|
||||
"variant" to variant.name,
|
||||
"excludedDirs" to excludedDirs
|
||||
)
|
||||
}
|
||||
@@ -64,9 +64,6 @@ private fun createMavenMarkerPublication(
|
||||
): MavenPublication {
|
||||
return publications.create<MavenPublication>(declaration.name.toString() + "PluginMarkerMaven") {
|
||||
val pluginId: String = declaration.id
|
||||
val cGroupId = coordinates.groupId
|
||||
val cArtifactId = coordinates.artifactId
|
||||
val cVersion = coordinates.version
|
||||
artifactId = pluginId + PLUGIN_MARKER_SUFFIX
|
||||
groupId = pluginId
|
||||
pom.withXml {
|
||||
@@ -75,11 +72,11 @@ private fun createMavenMarkerPublication(
|
||||
val dependencies = root.appendChild(document.createElement("dependencies"))
|
||||
val dependency = dependencies.appendChild(document.createElement("dependency"))
|
||||
val groupId = dependency.appendChild(document.createElement("groupId"))
|
||||
groupId.textContent = cGroupId
|
||||
groupId.textContent = coordinates.groupId
|
||||
val artifactId = dependency.appendChild(document.createElement("artifactId"))
|
||||
artifactId.textContent = cArtifactId
|
||||
artifactId.textContent = coordinates.artifactId
|
||||
val version = dependency.appendChild(document.createElement("version"))
|
||||
version.textContent = cVersion
|
||||
version.textContent = coordinates.version
|
||||
}
|
||||
|
||||
pom.name.set(declaration.displayName)
|
||||
|
||||
@@ -6,15 +6,12 @@
|
||||
import com.jakewharton.dex.*
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.ListProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
import java.io.File
|
||||
|
||||
@CacheableTask
|
||||
abstract class DexMethodCount : DefaultTask() {
|
||||
open class DexMethodCount : DefaultTask() {
|
||||
|
||||
data class Counts(
|
||||
val total: Int,
|
||||
@@ -27,18 +24,16 @@ abstract class DexMethodCount : DefaultTask() {
|
||||
@Classpath
|
||||
lateinit var jarFile: File
|
||||
|
||||
@get:Optional
|
||||
@get:Input
|
||||
abstract val ownPackages: ListProperty<String>
|
||||
@Optional
|
||||
@Input
|
||||
var ownPackages: List<String>? = null
|
||||
|
||||
@Internal
|
||||
var artifactName: String? = null
|
||||
|
||||
private val projectName = project.name
|
||||
|
||||
@get:Input
|
||||
val artifactOrArchiveName: String
|
||||
get() = artifactName ?: projectName
|
||||
get() = artifactName ?: project.name
|
||||
|
||||
fun from(jar: Jar) {
|
||||
jarFile = jar.archiveFile.get().asFile
|
||||
@@ -46,13 +41,12 @@ abstract class DexMethodCount : DefaultTask() {
|
||||
dependsOn(jar)
|
||||
}
|
||||
|
||||
@Internal // plain output properties are not supported, mark as internal to suppress warning from validatePlugins
|
||||
@Internal // plain output properties are not supported, mark as internal to suppress warning from validateTaskProperties
|
||||
lateinit var counts: Counts
|
||||
|
||||
@get:OutputFile
|
||||
val detailOutputFile: File by lazy {
|
||||
project.buildDir.resolve("$artifactOrArchiveName-method-count.txt")
|
||||
}
|
||||
val detailOutputFile: File
|
||||
get() = project.buildDir.resolve("$artifactOrArchiveName-method-count.txt")
|
||||
|
||||
@TaskAction
|
||||
fun invoke() {
|
||||
@@ -65,9 +59,9 @@ abstract class DexMethodCount : DefaultTask() {
|
||||
val byPackage = this.groupingBy { it.`package` }.eachCount()
|
||||
val byClass = this.groupingBy { it.declaringType }.eachCount()
|
||||
|
||||
val ownPackages = ownPackages.map { list -> list.map { "$it." } }
|
||||
val byOwnPackages = if (ownPackages.isPresent) {
|
||||
this.partition { method -> ownPackages.get().any { method.declaringType.startsWith(it) } }.let {
|
||||
val ownPackages = ownPackages?.map { "$it." }
|
||||
val byOwnPackages = if (ownPackages != null) {
|
||||
this.partition { method -> ownPackages.any { method.declaringType.startsWith(it) } }.let {
|
||||
it.first.size to it.second.size
|
||||
}
|
||||
} else (null to null)
|
||||
@@ -84,7 +78,7 @@ abstract class DexMethodCount : DefaultTask() {
|
||||
private fun outputDetails(counts: Counts) {
|
||||
detailOutputFile.printWriter().use { writer ->
|
||||
writer.println("${counts.total.padRight()}\tTotal methods")
|
||||
ownPackages.orNull?.let { packages ->
|
||||
ownPackages?.let { packages ->
|
||||
writer.println("${counts.totalOwnPackages?.padRight()}\tTotal methods from packages ${packages.joinToString { "$it.*" }}")
|
||||
writer.println("${counts.totalOtherPackages?.padRight()}\tTotal methods from other packages")
|
||||
}
|
||||
@@ -102,24 +96,23 @@ abstract class DexMethodCount : DefaultTask() {
|
||||
}
|
||||
}
|
||||
|
||||
abstract class DexMethodCountStats : DefaultTask() {
|
||||
open class DexMethodCountStats : DefaultTask() {
|
||||
|
||||
@Internal
|
||||
lateinit var from: TaskProvider<DexMethodCount>
|
||||
|
||||
@get:InputFile
|
||||
internal abstract val inputFile: RegularFileProperty
|
||||
|
||||
@get:Input
|
||||
internal abstract val artifactOrArchiveName: Property<String>
|
||||
|
||||
@get:Input
|
||||
@get:Optional
|
||||
internal abstract val ownPackages: ListProperty<String>
|
||||
internal val inputFile
|
||||
get() = from.get().detailOutputFile
|
||||
|
||||
@TaskAction
|
||||
private fun printStats() {
|
||||
val artifactOrArchiveName = artifactOrArchiveName.get()
|
||||
inputFile.get().asFile.reader().useLines { lines ->
|
||||
val artifactOrArchiveName = from.get().artifactOrArchiveName
|
||||
inputFile.reader().useLines { lines ->
|
||||
fun String.getStatValue() = substringBefore("\t").trim()
|
||||
|
||||
val statsLineCount = if (!ownPackages.isPresent) 1 else 3
|
||||
val ownPackages = from.get().ownPackages
|
||||
val statsLineCount = if (ownPackages == null) 1 else 3
|
||||
val stats = lines.take(statsLineCount).map { it.getStatValue() }.toList()
|
||||
|
||||
val total = stats[0]
|
||||
@@ -129,7 +122,7 @@ abstract class DexMethodCountStats : DefaultTask() {
|
||||
println("##teamcity[buildStatisticValue key='DexMethodCount_${artifactOrArchiveName}' value='$total']")
|
||||
}
|
||||
|
||||
ownPackages.map { packages ->
|
||||
ownPackages?.let { packages ->
|
||||
val totalOwnPackages = stats[1]
|
||||
val totalOtherPackages = stats[2]
|
||||
|
||||
@@ -148,9 +141,7 @@ abstract class DexMethodCountStats : DefaultTask() {
|
||||
fun Project.printStats(dexMethodCount: TaskProvider<DexMethodCount>) {
|
||||
val dexMethodCountStats = tasks.register("dexMethodCountStats", DexMethodCountStats::class.java) {
|
||||
dependsOn(dexMethodCount)
|
||||
inputFile.set(dexMethodCount.flatMap { objects.fileProperty().apply { set(it.detailOutputFile) } })
|
||||
artifactOrArchiveName.set(dexMethodCount.map { it.artifactOrArchiveName })
|
||||
ownPackages.set(dexMethodCount.flatMap { it.ownPackages })
|
||||
from = dexMethodCount
|
||||
}
|
||||
|
||||
dexMethodCount.configure {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
package plugins
|
||||
|
||||
import PublishToMavenLocalSerializable
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.attributes.Usage
|
||||
@@ -14,10 +13,10 @@ import org.gradle.api.plugins.JavaBasePlugin
|
||||
import org.gradle.api.publish.PublishingExtension
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
|
||||
import org.gradle.api.publish.maven.tasks.PublishToMavenLocal
|
||||
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
|
||||
import org.gradle.api.tasks.TaskProvider
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.gradle.plugins.signing.Sign
|
||||
import org.gradle.plugins.signing.SigningExtension
|
||||
import org.gradle.plugins.signing.SigningPlugin
|
||||
import java.util.*
|
||||
@@ -28,6 +27,7 @@ class KotlinBuildPublishingPlugin @Inject constructor(
|
||||
) : Plugin<Project> {
|
||||
override fun apply(target: Project): Unit = with(target) {
|
||||
apply<MavenPublishPlugin>()
|
||||
apply<SigningPlugin>()
|
||||
|
||||
val publishedRuntime = configurations.maybeCreate(RUNTIME_CONFIGURATION).apply {
|
||||
isCanBeConsumed = false
|
||||
@@ -132,40 +132,32 @@ fun Project.configureDefaultPublishing() {
|
||||
}
|
||||
}
|
||||
|
||||
val signingRequired = project.providers.gradleProperty("signingRequired").forUseAtConfigurationTime().orNull?.toBoolean()
|
||||
?: project.providers.gradleProperty("isSonatypeRelease").forUseAtConfigurationTime().orNull?.toBoolean() ?: false
|
||||
|
||||
if (signingRequired) {
|
||||
apply<SigningPlugin>()
|
||||
configureSigning()
|
||||
}
|
||||
configureSigning()
|
||||
|
||||
tasks.register("install") {
|
||||
dependsOn(tasks.named("publishToMavenLocal"))
|
||||
}
|
||||
|
||||
// workaround for Gradle configuration cache
|
||||
// TODO: remove it when https://github.com/gradle/gradle/pull/16945 merged into used in build Gradle version
|
||||
tasks.withType(PublishToMavenLocal::class.java) {
|
||||
val originalTask = this
|
||||
val serializablePublishTask =
|
||||
tasks.register(originalTask.name + "Serializable", PublishToMavenLocalSerializable::class.java) {
|
||||
publication = originalTask.publication
|
||||
}
|
||||
originalTask.onlyIf { false }
|
||||
originalTask.dependsOn(serializablePublishTask)
|
||||
}
|
||||
|
||||
tasks.withType<PublishToMavenRepository>()
|
||||
.matching { it.name.endsWith("PublicationTo${KotlinBuildPublishingPlugin.REPOSITORY_NAME}Repository") }
|
||||
.all { configureRepository() }
|
||||
}
|
||||
|
||||
private fun Project.configureSigning() {
|
||||
val signingRequired = provider {
|
||||
project.findProperty("signingRequired")?.toString()?.toBoolean()
|
||||
?: project.property("isSonatypeRelease") as Boolean
|
||||
}
|
||||
|
||||
configure<SigningExtension> {
|
||||
setRequired(signingRequired)
|
||||
sign(extensions.getByType<PublishingExtension>().publications) // all publications
|
||||
useGpgCmd()
|
||||
}
|
||||
|
||||
tasks.withType<Sign>().configureEach {
|
||||
setOnlyIf { signingRequired.get() }
|
||||
}
|
||||
}
|
||||
|
||||
fun TaskProvider<PublishToMavenRepository>.configureRepository() =
|
||||
@@ -189,4 +181,4 @@ private fun PublishToMavenRepository.configureRepository() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,232 +7,185 @@
|
||||
// usages in build scripts are not tracked properly
|
||||
@file:Suppress("unused")
|
||||
|
||||
import org.gradle.api.InvalidUserDataException
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.artifacts.ProjectDependency
|
||||
import org.gradle.api.file.FileSystemOperations
|
||||
import org.gradle.api.internal.tasks.testing.filter.DefaultTestFilter
|
||||
import org.gradle.api.publish.internal.PublishOperation
|
||||
import org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal
|
||||
import org.gradle.api.publish.maven.internal.publisher.MavenNormalizedPublication
|
||||
import org.gradle.api.publish.maven.internal.publisher.MavenPublisher
|
||||
import org.gradle.api.publish.maven.internal.publisher.ValidatingMavenPublisher
|
||||
import org.gradle.api.publish.maven.tasks.AbstractPublishToMaven
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.TaskProvider
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import org.gradle.internal.serialization.Cached
|
||||
import org.gradle.kotlin.dsl.extra
|
||||
import org.gradle.kotlin.dsl.project
|
||||
import org.gradle.kotlin.dsl.support.serviceOf
|
||||
import java.io.File
|
||||
import java.lang.Character.isLowerCase
|
||||
import java.lang.Character.isUpperCase
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
|
||||
val kotlinGradlePluginAndItsRequired = arrayOf(
|
||||
":kotlin-allopen",
|
||||
":kotlin-noarg",
|
||||
":kotlin-sam-with-receiver",
|
||||
":kotlin-android-extensions",
|
||||
":kotlin-android-extensions-runtime",
|
||||
":kotlin-parcelize-compiler",
|
||||
":kotlin-build-common",
|
||||
":kotlin-compiler-embeddable",
|
||||
":native:kotlin-native-utils",
|
||||
":kotlin-util-klib",
|
||||
":kotlin-util-io",
|
||||
":kotlin-compiler-runner",
|
||||
":kotlin-daemon-embeddable",
|
||||
":kotlin-daemon-client",
|
||||
":kotlin-project-model",
|
||||
":kotlin-gradle-plugin-api",
|
||||
":kotlin-gradle-plugin",
|
||||
":kotlin-gradle-plugin-model",
|
||||
":kotlin-tooling-metadata",
|
||||
":kotlin-reflect",
|
||||
":kotlin-annotation-processing-gradle",
|
||||
":kotlin-test",
|
||||
":kotlin-gradle-subplugin-example",
|
||||
":kotlin-stdlib-common",
|
||||
":kotlin-stdlib",
|
||||
":kotlin-stdlib-jdk7",
|
||||
":kotlin-stdlib-jdk8",
|
||||
":kotlin-stdlib-js",
|
||||
":examples:annotation-processor-example",
|
||||
":kotlin-script-runtime",
|
||||
":kotlin-scripting-common",
|
||||
":kotlin-scripting-jvm",
|
||||
":kotlin-scripting-compiler-embeddable",
|
||||
":kotlin-scripting-compiler-impl-embeddable",
|
||||
":kotlin-serialization",
|
||||
":kotlin-test-js-runner",
|
||||
":native:kotlin-klib-commonizer-embeddable",
|
||||
":native:kotlin-klib-commonizer-api",
|
||||
":native:kotlin-native-utils"
|
||||
)
|
||||
|
||||
fun Task.dependsOnKotlinGradlePluginInstall() {
|
||||
kotlinGradlePluginAndItsRequired.forEach {
|
||||
dependsOn("${it}:install")
|
||||
}
|
||||
fun Task.dependsOnKotlinPluginInstall() {
|
||||
dependsOn(
|
||||
":kotlin-allopen:install",
|
||||
":kotlin-noarg:install",
|
||||
":kotlin-sam-with-receiver:install",
|
||||
":kotlin-android-extensions:install",
|
||||
":kotlin-parcelize-compiler:install",
|
||||
":kotlin-build-common:install",
|
||||
":kotlin-compiler-embeddable:install",
|
||||
":native:kotlin-native-utils:install",
|
||||
":kotlin-util-klib:install",
|
||||
":kotlin-util-io:install",
|
||||
":kotlin-compiler-runner:install",
|
||||
":kotlin-daemon-embeddable:install",
|
||||
":kotlin-daemon-client:install",
|
||||
":kotlin-gradle-plugin-api:install",
|
||||
":kotlin-gradle-plugin:install",
|
||||
":kotlin-gradle-plugin-model:install",
|
||||
":kotlin-reflect:install",
|
||||
":kotlin-annotation-processing-gradle:install",
|
||||
":kotlin-test:install",
|
||||
":kotlin-gradle-subplugin-example:install",
|
||||
":kotlin-stdlib-common:install",
|
||||
":kotlin-stdlib:install",
|
||||
":kotlin-stdlib-jdk8:install",
|
||||
":kotlin-stdlib-js:install",
|
||||
":examples:annotation-processor-example:install",
|
||||
":kotlin-script-runtime:install",
|
||||
":kotlin-scripting-common:install",
|
||||
":kotlin-scripting-jvm:install",
|
||||
":kotlin-scripting-compiler-embeddable:install",
|
||||
":kotlin-scripting-compiler-impl-embeddable:install",
|
||||
":kotlin-test-js-runner:install",
|
||||
":native:kotlin-klib-commonizer-embeddable:install"
|
||||
)
|
||||
}
|
||||
|
||||
fun Task.dependsOnKotlinGradlePluginPublish() {
|
||||
kotlinGradlePluginAndItsRequired.forEach {
|
||||
project.rootProject.tasks.findByPath("${it}:publish")?.let { task ->
|
||||
dependsOn(task)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parallel is redundant if @param jUnit5Enabled is true, because
|
||||
* JUnit5 supports parallel test execution by itself, without gradle help
|
||||
*/
|
||||
fun Project.projectTest(
|
||||
taskName: String = "test",
|
||||
parallel: Boolean = false,
|
||||
shortenTempRootName: Boolean = false,
|
||||
jUnit5Enabled: Boolean = false,
|
||||
body: Test.() -> Unit = {}
|
||||
): TaskProvider<Test> {
|
||||
val shouldInstrument = project.providers.gradleProperty("kotlin.test.instrumentation.disable")
|
||||
.forUseAtConfigurationTime().orNull?.toBoolean() != true
|
||||
if (shouldInstrument) {
|
||||
evaluationDependsOn(":test-instrumenter")
|
||||
}
|
||||
return getOrCreateTask<Test>(taskName) {
|
||||
doFirst {
|
||||
val commandLineIncludePatterns = (filter as? DefaultTestFilter)?.commandLineIncludePatterns ?: mutableSetOf()
|
||||
val patterns = filter.includePatterns + commandLineIncludePatterns
|
||||
if (patterns.isEmpty() || patterns.any { '*' in it }) return@doFirst
|
||||
patterns.forEach { pattern ->
|
||||
var isClassPattern = false
|
||||
val maybeMethodName = pattern.substringAfterLast('.')
|
||||
val maybeClassFqName = if (maybeMethodName.isFirstChar(::isLowerCase)) {
|
||||
pattern.substringBeforeLast('.')
|
||||
): TaskProvider<Test> = getOrCreateTask(taskName) {
|
||||
doFirst {
|
||||
val commandLineIncludePatterns = (filter as? DefaultTestFilter)?.commandLineIncludePatterns ?: mutableSetOf()
|
||||
val patterns = filter.includePatterns + commandLineIncludePatterns
|
||||
if (patterns.isEmpty() || patterns.any { '*' in it }) return@doFirst
|
||||
patterns.forEach { pattern ->
|
||||
var isClassPattern = false
|
||||
val maybeMethodName = pattern.substringAfterLast('.')
|
||||
val maybeClassFqName = if (maybeMethodName.isFirstChar(::isLowerCase)) {
|
||||
pattern.substringBeforeLast('.')
|
||||
} else {
|
||||
isClassPattern = true
|
||||
pattern
|
||||
}
|
||||
|
||||
if (!maybeClassFqName.substringAfterLast('.').isFirstChar(::isUpperCase)) {
|
||||
return@forEach
|
||||
}
|
||||
|
||||
val classFileNameWithoutExtension = maybeClassFqName.replace('.', '/')
|
||||
val classFileName = "$classFileNameWithoutExtension.class"
|
||||
|
||||
if (isClassPattern) {
|
||||
val innerClassPattern = "$pattern$*"
|
||||
if (pattern in commandLineIncludePatterns) {
|
||||
commandLineIncludePatterns.add(innerClassPattern)
|
||||
(filter as? DefaultTestFilter)?.setCommandLineIncludePatterns(commandLineIncludePatterns)
|
||||
} else {
|
||||
isClassPattern = true
|
||||
pattern
|
||||
filter.includePatterns.add(innerClassPattern)
|
||||
}
|
||||
}
|
||||
|
||||
if (!maybeClassFqName.substringAfterLast('.').isFirstChar(::isUpperCase)) {
|
||||
return@forEach
|
||||
}
|
||||
|
||||
val classFileNameWithoutExtension = maybeClassFqName.replace('.', '/')
|
||||
val classFileName = "$classFileNameWithoutExtension.class"
|
||||
|
||||
if (isClassPattern) {
|
||||
val innerClassPattern = "$pattern$*"
|
||||
if (pattern in commandLineIncludePatterns) {
|
||||
commandLineIncludePatterns.add(innerClassPattern)
|
||||
(filter as? DefaultTestFilter)?.setCommandLineIncludePatterns(commandLineIncludePatterns)
|
||||
} else {
|
||||
filter.includePatterns.add(innerClassPattern)
|
||||
val parentNames = if (jUnit5Enabled) {
|
||||
/*
|
||||
* If we run test from inner test class with junit 5 we need
|
||||
* to include all containing classes of our class
|
||||
*/
|
||||
val nestedNames = classFileNameWithoutExtension.split("$")
|
||||
mutableListOf(nestedNames.first()).also {
|
||||
for (s in nestedNames.subList(1, nestedNames.size)) {
|
||||
it += "${it.last()}\$$s"
|
||||
}
|
||||
}
|
||||
} else emptyList()
|
||||
|
||||
val parentNames = if (jUnit5Enabled) {
|
||||
/*
|
||||
* If we run test from inner test class with junit 5 we need
|
||||
* to include all containing classes of our class
|
||||
*/
|
||||
val nestedNames = classFileNameWithoutExtension.split("$")
|
||||
mutableListOf(nestedNames.first()).also {
|
||||
for (s in nestedNames.subList(1, nestedNames.size)) {
|
||||
it += "${it.last()}\$$s"
|
||||
}
|
||||
}
|
||||
} else emptyList()
|
||||
|
||||
include { treeElement ->
|
||||
val path = treeElement.path
|
||||
if (treeElement.isDirectory) {
|
||||
classFileNameWithoutExtension.startsWith(path)
|
||||
include { treeElement ->
|
||||
val path = treeElement.path
|
||||
if (treeElement.isDirectory) {
|
||||
classFileNameWithoutExtension.startsWith(path)
|
||||
} else {
|
||||
if (jUnit5Enabled) {
|
||||
path == classFileName || (path.endsWith(".class") && parentNames.any { path.startsWith(it) })
|
||||
} else {
|
||||
if (jUnit5Enabled) {
|
||||
path == classFileName || (path.endsWith(".class") && parentNames.any { path.startsWith(it) })
|
||||
} else {
|
||||
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
|
||||
}
|
||||
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldInstrument) {
|
||||
val instrumentationArgsProperty = project.providers.gradleProperty("kotlin.test.instrumentation.args")
|
||||
val testInstrumenterOutputs = project.tasks.findByPath(":test-instrumenter:jar")!!.outputs.files
|
||||
doFirst {
|
||||
val agent = testInstrumenterOutputs.singleFile
|
||||
val args = instrumentationArgsProperty.orNull?.let { "=$it" }.orEmpty()
|
||||
jvmArgs("-javaagent:$agent$args")
|
||||
}
|
||||
dependsOn(":test-instrumenter:jar")
|
||||
}
|
||||
|
||||
jvmArgs(
|
||||
"-ea",
|
||||
"-XX:+HeapDumpOnOutOfMemoryError",
|
||||
"-XX:+UseCodeCacheFlushing",
|
||||
"-XX:ReservedCodeCacheSize=256m",
|
||||
"-Djna.nosys=true"
|
||||
)
|
||||
|
||||
maxHeapSize = "1600m"
|
||||
systemProperty("idea.is.unit.test", "true")
|
||||
systemProperty("idea.home.path", project.intellijRootDir().canonicalPath)
|
||||
systemProperty("java.awt.headless", "true")
|
||||
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
|
||||
environment("PROJECT_CLASSES_DIRS", project.testSourceSet.output.classesDirs.asPath)
|
||||
environment("PROJECT_BUILD_DIR", project.buildDir)
|
||||
systemProperty("jps.kotlin.home", project.rootProject.extra["distKotlinHomeDir"]!!)
|
||||
systemProperty("kotlin.ni", if (project.rootProject.hasProperty("newInferenceTests")) "true" else "false")
|
||||
systemProperty("org.jetbrains.kotlin.skip.muted.tests", if (project.rootProject.hasProperty("skipMutedTests")) "true" else "false")
|
||||
|
||||
if (Platform[202].orHigher()) {
|
||||
systemProperty("idea.ignore.disabled.plugins", "true")
|
||||
}
|
||||
|
||||
var subProjectTempRoot: Path? = null
|
||||
val projectName = project.name
|
||||
val teamcity = project.rootProject.findProperty("teamcity") as? Map<*, *>
|
||||
if (project.findProperty("kotlin.test.instrumentation.disable")?.toString()?.toBoolean() != true) {
|
||||
doFirst {
|
||||
val systemTempRoot =
|
||||
// TC by default doesn't switch `teamcity.build.tempDir` to 'java.io.tmpdir' so it could cause to wasted disk space
|
||||
// Should be fixed soon on Teamcity side
|
||||
(teamcity?.get("teamcity.build.tempDir") as? String)
|
||||
?: System.getProperty("java.io.tmpdir")
|
||||
systemTempRoot.let {
|
||||
val prefix = (projectName + "Project_" + taskName + "_").takeUnless { shortenTempRootName }
|
||||
subProjectTempRoot = Files.createTempDirectory(File(systemTempRoot).toPath(), prefix)
|
||||
systemProperty("java.io.tmpdir", subProjectTempRoot.toString())
|
||||
val agent = tasks.findByPath(":test-instrumenter:jar")!!.outputs.files.singleFile
|
||||
val args = project.findProperty("kotlin.test.instrumentation.args")?.let { "=$it" }.orEmpty()
|
||||
jvmArgs("-javaagent:$agent$args")
|
||||
}
|
||||
dependsOn(":test-instrumenter:jar")
|
||||
}
|
||||
|
||||
jvmArgs(
|
||||
"-ea",
|
||||
"-XX:+HeapDumpOnOutOfMemoryError",
|
||||
"-XX:+UseCodeCacheFlushing",
|
||||
"-XX:ReservedCodeCacheSize=256m",
|
||||
"-Djna.nosys=true"
|
||||
)
|
||||
|
||||
maxHeapSize = "1600m"
|
||||
systemProperty("idea.is.unit.test", "true")
|
||||
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
|
||||
systemProperty("java.awt.headless", "true")
|
||||
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
|
||||
environment("PROJECT_CLASSES_DIRS", testSourceSet.output.classesDirs.asPath)
|
||||
environment("PROJECT_BUILD_DIR", buildDir)
|
||||
systemProperty("jps.kotlin.home", rootProject.extra["distKotlinHomeDir"]!!)
|
||||
systemProperty("kotlin.ni", if (rootProject.hasProperty("newInferenceTests")) "true" else "false")
|
||||
systemProperty("org.jetbrains.kotlin.skip.muted.tests", if (rootProject.hasProperty("skipMutedTests")) "true" else "false")
|
||||
|
||||
if (Platform[202].orHigher()) {
|
||||
systemProperty("idea.ignore.disabled.plugins", "true")
|
||||
}
|
||||
|
||||
var subProjectTempRoot: Path? = null
|
||||
doFirst {
|
||||
val teamcity = rootProject.findProperty("teamcity") as? Map<*, *>
|
||||
val systemTempRoot =
|
||||
// TC by default doesn't switch `teamcity.build.tempDir` to 'java.io.tmpdir' so it could cause to wasted disk space
|
||||
// Should be fixed soon on Teamcity side
|
||||
(teamcity?.get("teamcity.build.tempDir") as? String)
|
||||
?: System.getProperty("java.io.tmpdir")
|
||||
systemTempRoot.let {
|
||||
val prefix = (project.name + "Project_" + taskName + "_").takeUnless { shortenTempRootName }
|
||||
subProjectTempRoot = Files.createTempDirectory(File(systemTempRoot).toPath(), prefix)
|
||||
systemProperty("java.io.tmpdir", subProjectTempRoot.toString())
|
||||
}
|
||||
}
|
||||
|
||||
doLast {
|
||||
subProjectTempRoot?.let {
|
||||
try {
|
||||
delete(it)
|
||||
} catch (e: Exception) {
|
||||
project.logger.warn("Can't delete test temp root folder $it", e.printStackTrace())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val fs = project.serviceOf<FileSystemOperations>()
|
||||
doLast {
|
||||
subProjectTempRoot?.let {
|
||||
try {
|
||||
fs.delete {
|
||||
delete(it)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
logger.warn("Can't delete test temp root folder $it", e.printStackTrace())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parallel && !jUnit5Enabled) {
|
||||
maxParallelForks =
|
||||
project.providers.gradleProperty("kotlin.test.maxParallelForks").forUseAtConfigurationTime().orNull?.toInt()
|
||||
?: (Runtime.getRuntime().availableProcessors() / if (project.kotlinBuildProperties.isTeamcityBuild) 2 else 4).coerceAtLeast(1)
|
||||
}
|
||||
}.apply { configure(body) }
|
||||
if (parallel) {
|
||||
maxParallelForks =
|
||||
project.findProperty("kotlin.test.maxParallelForks")?.toString()?.toInt()
|
||||
?: (Runtime.getRuntime().availableProcessors() / if (kotlinBuildProperties.isTeamcityBuild) 2 else 4).coerceAtLeast(1)
|
||||
}
|
||||
body()
|
||||
}
|
||||
|
||||
private inline fun String.isFirstChar(f: (Char) -> Boolean) = isNotEmpty() && f(first())
|
||||
@@ -259,25 +212,18 @@ private fun Task.useAndroidConfiguration(systemPropertyName: String, configName:
|
||||
val configuration = with(project) {
|
||||
configurations.getOrCreate(configName)
|
||||
.also {
|
||||
if (it.allDependencies.matching { dep ->
|
||||
dep is ProjectDependency &&
|
||||
dep.targetConfiguration == configName &&
|
||||
dep.dependencyProject.path == ":dependencies:android-sdk"
|
||||
}.count() == 0) {
|
||||
dependencies.add(
|
||||
configName,
|
||||
dependencies.project(":dependencies:android-sdk", configuration = configName)
|
||||
)
|
||||
}
|
||||
dependencies.add(
|
||||
configName,
|
||||
dependencies.project(":dependencies:android-sdk", configuration = configName)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
dependsOn(configuration)
|
||||
|
||||
if (this is Test) {
|
||||
val androidFilePath = configuration.singleFile.canonicalPath
|
||||
doFirst {
|
||||
systemProperty(systemPropertyName, androidFilePath)
|
||||
systemProperty(systemPropertyName, configuration.singleFile.canonicalPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,30 +235,3 @@ fun Task.useAndroidSdk() {
|
||||
fun Task.useAndroidJar() {
|
||||
TaskUtils.useAndroidJar(this)
|
||||
}
|
||||
|
||||
// Workaround to make PublishToMavenLocal compatible with Gradle configuration cache
|
||||
// TODO: remove it when https://github.com/gradle/gradle/pull/16945 merged into used in build Gradle version
|
||||
abstract class PublishToMavenLocalSerializable : AbstractPublishToMaven() {
|
||||
private val normalizedPublication = Cached.of { this.computeNormalizedPublication() }
|
||||
|
||||
private fun computeNormalizedPublication(): MavenNormalizedPublication {
|
||||
val publicationInternal: MavenPublicationInternal = publicationInternal
|
||||
?: throw InvalidUserDataException("The 'publication' property is required")
|
||||
duplicatePublicationTracker.checkCanPublishToMavenLocal(publicationInternal)
|
||||
return publicationInternal.asNormalisedPublication()
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
open fun publish() {
|
||||
val normalizedPublication = normalizedPublication.get()
|
||||
object : PublishOperation(normalizedPublication.name, "mavenLocal") {
|
||||
override fun publish() {
|
||||
val localPublisher = mavenPublishers.getLocalPublisher(
|
||||
temporaryDirFactory
|
||||
)
|
||||
val validatingPublisher: MavenPublisher = ValidatingMavenPublisher(localPublisher)
|
||||
validatingPublisher.publish(normalizedPublication, null)
|
||||
}
|
||||
}.run()
|
||||
}
|
||||
}
|
||||
@@ -9,13 +9,13 @@ import org.gradle.internal.os.OperatingSystem
|
||||
|
||||
|
||||
fun Test.configureTestDistribution(configure: TestDistributionExtension.() -> Unit = {}) {
|
||||
if (extensions.findByType(TestDistributionExtension::class.java) == null) return
|
||||
|
||||
val isTeamcityBuild = project.kotlinBuildProperties.isTeamcityBuild
|
||||
val testDistributionEnabled = project.findProperty("kotlin.build.test.distribution.enabled")?.toString()?.toBoolean()
|
||||
?: isTeamcityBuild
|
||||
|
||||
useJUnitPlatform()
|
||||
extensions.configure(TestDistributionExtension::class.java) {
|
||||
enabled.set(true)
|
||||
enabled.set(testDistributionEnabled)
|
||||
maxRemoteExecutors.set(20)
|
||||
if (isTeamcityBuild) {
|
||||
requirements.set(setOf("os=${OperatingSystem.current().familyName}"))
|
||||
|
||||
@@ -5,7 +5,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.2'
|
||||
classpath 'com.android.tools.build:gradle:4.1.1'
|
||||
}
|
||||
}
|
||||
apply plugin: 'com.android.application'
|
||||
@@ -37,6 +37,14 @@ android {
|
||||
|
||||
packagingOptions { exclude 'META-INF/build.txt' }
|
||||
|
||||
//TODO run under java 6, cause there is error on implicit 'stream' import in 'asWithMutable' test
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
incremental = false
|
||||
}
|
||||
|
||||
dexOptions {
|
||||
dexInProcess false
|
||||
@@ -72,22 +80,6 @@ android {
|
||||
reflect0 {
|
||||
dimension "box"
|
||||
}
|
||||
|
||||
common_ir0 {
|
||||
dimension "box"
|
||||
}
|
||||
|
||||
common_ir1 {
|
||||
dimension "box"
|
||||
}
|
||||
|
||||
common_ir2 {
|
||||
dimension "box"
|
||||
}
|
||||
|
||||
reflect_ir0 {
|
||||
dimension "box"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,10 +19,6 @@ dependencies {
|
||||
testCompile(project(":kotlin-reflect"))
|
||||
testCompile(projectTests(":compiler:tests-common"))
|
||||
testCompile(commonDep("junit:junit"))
|
||||
testApi(projectTests(":compiler:test-infrastructure"))
|
||||
testApi(projectTests(":compiler:test-infrastructure-utils"))
|
||||
testApi(projectTests(":compiler:tests-compiler-utils"))
|
||||
testApi(projectTests(":compiler:tests-common-new"))
|
||||
|
||||
testCompile(projectTests(":jps-plugin"))
|
||||
testCompile(commonDep("junit:junit"))
|
||||
@@ -41,8 +37,6 @@ dependencies {
|
||||
testCompile(intellijPluginDep("java")) { includeJars("jps-builders") }
|
||||
testCompile(jpsStandalone()) { includeJars("jps-model") }
|
||||
testCompile(jpsBuildTest())
|
||||
|
||||
testCompile("org.junit.platform:junit-platform-launcher:${commonVer("org.junit.platform", "")}")
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.android.tests;
|
||||
|
||||
import org.jetbrains.kotlin.jps.build.BaseKotlinJpsBuildTestCase;
|
||||
import org.junit.Ignore;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@Ignore
|
||||
public class AndroidJpsBuildTestCase extends BaseKotlinJpsBuildTestCase {
|
||||
private static final String PROJECT_NAME = "android-module";
|
||||
private static final String SDK_NAME = "Android_SDK";
|
||||
|
||||
private final File workDir = new File(AndroidRunner.getPathManager().getTmpFolder());
|
||||
|
||||
public void doTest() {
|
||||
initProject();
|
||||
rebuildAllModules();
|
||||
buildAllModules().assertSuccessful();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getProjectName() {
|
||||
return "android-module";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runTest() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "AndroidJpsTest";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected File doGetProjectDir() throws IOException {
|
||||
return workDir;
|
||||
}
|
||||
|
||||
private void initProject() {
|
||||
addJdk(SDK_NAME, AndroidRunner.getPathManager().getPlatformFolderInAndroidSdk() + "/android.jar");
|
||||
loadProject(workDir.getAbsolutePath() + File.separator + PROJECT_NAME + ".ipr");
|
||||
}
|
||||
}
|
||||
@@ -46,8 +46,12 @@ public class AndroidRunner {
|
||||
|
||||
CodegenTestsOnAndroidGenerator.generate(pathManager);
|
||||
|
||||
System.out.println("Run tests on Android...");
|
||||
return CodegenTestsOnAndroidRunner.runTestsInEmulator(pathManager);
|
||||
System.out.println("Run tests on android...");
|
||||
TestSuite suite = CodegenTestsOnAndroidRunner.runTestsInEmulator(pathManager);
|
||||
//AndroidJpsBuildTestCase indirectly depends on UsefulTestCase which compiled against java 8
|
||||
//TODO: Need add separate run configuration for AndroidJpsBuildTestCase
|
||||
//suite.addTest(new AndroidJpsBuildTestCase());
|
||||
return suite;
|
||||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
|
||||
@@ -20,9 +20,7 @@ import com.intellij.openapi.util.Ref
|
||||
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.sourceFileProvider
|
||||
import org.jetbrains.kotlin.test.KotlinBaseTest
|
||||
import java.io.File
|
||||
import java.util.regex.Pattern
|
||||
|
||||
@@ -36,24 +34,28 @@ private data class OldPackageAndNew(val oldFqName: FqName, val newFqName: FqName
|
||||
|
||||
internal fun patchFilesAndAddTest(
|
||||
testFile: File,
|
||||
module: TestModule,
|
||||
services: TestServices,
|
||||
testFiles: List<KotlinBaseTest.TestFile>,
|
||||
filesHolder: CodegenTestsOnAndroidGenerator.FilesWriter
|
||||
): FqName {
|
||||
): FqName? {
|
||||
if (testFiles.any { it.name.endsWith(".java") }) {
|
||||
//TODO support java files
|
||||
return null
|
||||
}
|
||||
val ktFiles = testFiles.filter { it.name.endsWith(".kt") }
|
||||
if (ktFiles.isEmpty()) return null
|
||||
|
||||
val newPackagePrefix = testFile.path.replace("\\\\|-|\\.|/".toRegex(), "_")
|
||||
val oldPackage = Ref<FqName>()
|
||||
val isJvmName = Ref<Boolean>(false)
|
||||
val testFiles = module.files
|
||||
val isSingle = testFiles.size == 1
|
||||
val resultFiles = testFiles.map {
|
||||
val fileName = if (isSingle) it.name else testFile.name.substringBeforeLast(".kt") + "/" + it.name
|
||||
val content = services.sourceFileProvider.getContentOfSourceFile(it)
|
||||
TestClassInfo(
|
||||
fileName,
|
||||
changePackage(newPackagePrefix, content, oldPackage, isJvmName),
|
||||
changePackage(newPackagePrefix, it.content, oldPackage, isJvmName),
|
||||
oldPackage.get(),
|
||||
isJvmName.get(),
|
||||
getGeneratedClassName(File(fileName), content, newPackagePrefix, oldPackage.get())
|
||||
getGeneratedClassName(File(fileName), it.content, newPackagePrefix, oldPackage.get())
|
||||
)
|
||||
}
|
||||
val packages =
|
||||
|
||||
@@ -12,26 +12,16 @@ import com.intellij.openapi.util.io.FileUtilRt
|
||||
import org.jetbrains.kotlin.cli.common.output.writeAllTo
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.codegen.CodegenTestCase
|
||||
import org.jetbrains.kotlin.codegen.CodegenTestFiles
|
||||
import org.jetbrains.kotlin.codegen.GenerationUtils
|
||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.config.JvmTarget
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.*
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.model.DependencyKind
|
||||
import org.jetbrains.kotlin.test.model.FrontendKinds
|
||||
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest
|
||||
import org.jetbrains.kotlin.test.services.*
|
||||
import org.jetbrains.kotlin.test.services.configuration.CommonEnvironmentConfigurator
|
||||
import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator
|
||||
import org.jetbrains.kotlin.test.services.impl.BackendKindExtractorImpl
|
||||
import org.jetbrains.kotlin.test.services.impl.TemporaryDirectoryManagerImpl
|
||||
import org.jetbrains.kotlin.test.services.sourceProviders.AdditionalDiagnosticsSourceFilesProvider
|
||||
import org.jetbrains.kotlin.test.services.sourceProviders.CodegenHelpersSourceFilesProvider
|
||||
import org.jetbrains.kotlin.test.services.sourceProviders.CoroutineHelpersSourceFilesProvider
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
import org.junit.Assert
|
||||
import java.io.File
|
||||
@@ -54,18 +44,15 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
//keep it globally to avoid test grouping on TC
|
||||
private val generatedTestNames = hashSetOf<String>()
|
||||
|
||||
private val COMMON = FlavorConfig(TargetBackend.ANDROID,"common", 3)
|
||||
private val REFLECT = FlavorConfig(TargetBackend.ANDROID, "reflect", 1)
|
||||
private val COMMON = FlavorConfig("common", 3)
|
||||
private val REFLECT = FlavorConfig("reflect", 1)
|
||||
|
||||
private val COMMON_IR = FlavorConfig(TargetBackend.ANDROID_IR, "common_ir", 3)
|
||||
private val REFLECT_IR = FlavorConfig(TargetBackend.ANDROID_IR,"reflect_ir", 1)
|
||||
|
||||
class FlavorConfig(private val backend: TargetBackend, private val prefix: String, val limit: Int) {
|
||||
class FlavorConfig(private val prefix: String, val limit: Int) {
|
||||
|
||||
private var writtenFilesCount = 0
|
||||
|
||||
fun printStatistics() {
|
||||
println("FlavorTestCompiler for $backend: $prefix, generated file count: $writtenFilesCount")
|
||||
println("FlavorTestCompiler: $prefix, generated file count: $writtenFilesCount")
|
||||
}
|
||||
|
||||
fun getFlavorForNewFiles(newFilesCount: Int): String {
|
||||
@@ -148,47 +135,25 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
private fun generateTestsAndFlavourSuites() {
|
||||
println("Generating test files...")
|
||||
|
||||
val folders = arrayOf(
|
||||
File("compiler/testData/codegen/box"),
|
||||
File("compiler/testData/codegen/boxInline")
|
||||
)
|
||||
|
||||
generateTestMethodsForDirectories(
|
||||
TargetBackend.ANDROID,
|
||||
COMMON,
|
||||
REFLECT,
|
||||
*folders
|
||||
)
|
||||
|
||||
generateTestMethodsForDirectories(
|
||||
TargetBackend.ANDROID_IR,
|
||||
COMMON_IR,
|
||||
REFLECT_IR,
|
||||
*folders
|
||||
)
|
||||
generateTestMethodsForDirectories(File("compiler/testData/codegen/box"), File("compiler/testData/codegen/boxInline"))
|
||||
|
||||
pendingUnitTestGenerators.values.forEach { it.generate() }
|
||||
}
|
||||
|
||||
private fun generateTestMethodsForDirectories(
|
||||
backend: TargetBackend,
|
||||
commonFlavor: FlavorConfig,
|
||||
reflectionFlavor: FlavorConfig,
|
||||
vararg dirs: File
|
||||
) {
|
||||
private fun generateTestMethodsForDirectories(vararg dirs: File) {
|
||||
val holders = mutableMapOf<ConfigurationKey, FilesWriter>()
|
||||
|
||||
for (dir in dirs) {
|
||||
val files = dir.listFiles() ?: error("Folder with testData is empty: ${dir.absolutePath}")
|
||||
processFiles(files, holders, backend, commonFlavor, reflectionFlavor)
|
||||
processFiles(files, holders)
|
||||
}
|
||||
|
||||
holders.values.forEach {
|
||||
it.writeFilesOnDisk()
|
||||
}
|
||||
|
||||
commonFlavor.printStatistics()
|
||||
reflectionFlavor.printStatistics()
|
||||
COMMON.printStatistics()
|
||||
REFLECT.printStatistics()
|
||||
}
|
||||
|
||||
internal inner class FilesWriter(
|
||||
@@ -262,7 +227,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
|
||||
private fun getFlavorUnitTestFolder(flavourName: String): String {
|
||||
return pathManager.srcFolderInAndroidTmpFolder +
|
||||
"/androidTest${flavourName.replaceFirstChar(Char::uppercaseChar)}/java/" +
|
||||
"/androidTest${flavourName.capitalize()}/java/" +
|
||||
testClassPackage.replace(".", "/") + "/"
|
||||
}
|
||||
|
||||
@@ -272,14 +237,10 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(TestInfrastructureInternals::class)
|
||||
@Throws(IOException::class)
|
||||
private fun processFiles(
|
||||
files: Array<File>,
|
||||
holders: MutableMap<ConfigurationKey, FilesWriter>,
|
||||
backend: TargetBackend,
|
||||
commmonFlavor: FlavorConfig,
|
||||
reflectionFlavor: FlavorConfig
|
||||
holders: MutableMap<ConfigurationKey, FilesWriter>
|
||||
) {
|
||||
holders.values.forEach {
|
||||
it.writeFilesOnDiskIfNeeded()
|
||||
@@ -289,7 +250,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
if (file.isDirectory) {
|
||||
val listFiles = file.listFiles()
|
||||
if (listFiles != null) {
|
||||
processFiles(listFiles, holders, backend, commmonFlavor, reflectionFlavor)
|
||||
processFiles(listFiles, holders)
|
||||
}
|
||||
} else if (FileUtilRt.getExtension(file.name) != KotlinFileType.EXTENSION) {
|
||||
// skip non kotlin files
|
||||
@@ -298,7 +259,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
continue
|
||||
}
|
||||
|
||||
if (!InTextDirectivesUtils.isPassingTarget(backend.compatibleWith, file) ||
|
||||
if (!InTextDirectivesUtils.isPassingTarget(TargetBackend.JVM, file) ||
|
||||
InTextDirectivesUtils.isIgnoredTarget(TargetBackend.ANDROID, file)
|
||||
) {
|
||||
continue
|
||||
@@ -329,87 +290,31 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
if (fullFileText.contains("// SKIP_JDK6")) continue
|
||||
|
||||
if (hasBoxMethod(fullFileText)) {
|
||||
val testConfiguration = createTestConfiguration(file, backend)
|
||||
val services = testConfiguration.testServices
|
||||
|
||||
val moduleStructure = try {
|
||||
testConfiguration.moduleStructureExtractor.splitTestDataByModules(
|
||||
file.path,
|
||||
testConfiguration.directives,
|
||||
).also {
|
||||
services.register(TestModuleStructure::class, it)
|
||||
}
|
||||
} catch (e: ExceptionFromModuleStructureTransformer) {
|
||||
continue
|
||||
}
|
||||
val module = moduleStructure.modules.singleOrNull() ?: continue
|
||||
if (module.files.any { it.isJavaFile || it.isKtsFile }) continue
|
||||
if (module.files.isEmpty()) continue
|
||||
services.registerDependencyProvider(DependencyProviderImpl(services, moduleStructure.modules))
|
||||
|
||||
val testFiles = createTestFiles(file, fullFileText)
|
||||
val kind = KotlinBaseTest.extractConfigurationKind(testFiles)
|
||||
val jdkKind = KotlinBaseTest.getTestJdkKind(testFiles)
|
||||
val keyConfiguration = CompilerConfiguration()
|
||||
val configuratorForFlags = JvmEnvironmentConfigurator(services)
|
||||
with(configuratorForFlags) {
|
||||
val extractor = DirectiveToConfigurationKeyExtractor()
|
||||
extractor.provideConfigurationKeys()
|
||||
extractor.configure(keyConfiguration, module.directives)
|
||||
}
|
||||
val kind = configuratorForFlags.extractConfigurationKind(module.directives)
|
||||
val jdkKind = configuratorForFlags.extractJdkKind(module.directives)
|
||||
|
||||
keyConfiguration.languageVersionSettings = module.languageVersionSettings
|
||||
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, keyConfiguration)
|
||||
|
||||
val key = ConfigurationKey(kind, jdkKind, keyConfiguration.toString())
|
||||
val compiler = if (kind.withReflection) reflectionFlavor else commmonFlavor
|
||||
val compilerConfigurationProvider = services.compilerConfigurationProvider as CompilerConfigurationProviderImpl
|
||||
val compiler = if (kind.withReflection) REFLECT else COMMON
|
||||
val filesHolder = holders.getOrPut(key) {
|
||||
FilesWriter(compiler, compilerConfigurationProvider.createCompilerConfiguration(module)).also {
|
||||
FilesWriter(compiler, KotlinTestUtils.newConfiguration(kind, jdkKind,
|
||||
KtTestUtil.getAnnotationsJar()
|
||||
).apply {
|
||||
println("Creating new configuration by $key")
|
||||
}
|
||||
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, this)
|
||||
})
|
||||
}
|
||||
|
||||
patchFilesAndAddTest(file, module, services, filesHolder)
|
||||
patchFilesAndAddTest(file, testFiles, filesHolder)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun createTestConfiguration(testDataFile: File, backend: TargetBackend): TestConfiguration {
|
||||
return TestConfigurationBuilder().apply {
|
||||
configure(backend)
|
||||
testInfo = KotlinTestInfo(
|
||||
"org.jetbrains.kotlin.android.tests.AndroidRunner",
|
||||
"test${testDataFile.nameWithoutExtension.replaceFirstChar(Char::uppercaseChar)}",
|
||||
emptySet()
|
||||
)
|
||||
}.build(testDataFile.path)
|
||||
}
|
||||
|
||||
private fun TestConfigurationBuilder.configure(backend: TargetBackend) {
|
||||
globalDefaults {
|
||||
frontend = FrontendKinds.ClassicFrontend
|
||||
targetBackend = backend
|
||||
targetPlatform = JvmPlatforms.defaultJvmPlatform
|
||||
dependencyKind = DependencyKind.Binary
|
||||
}
|
||||
|
||||
useConfigurators(
|
||||
::CommonEnvironmentConfigurator,
|
||||
::JvmEnvironmentConfigurator
|
||||
)
|
||||
|
||||
useAdditionalSourceProviders(
|
||||
::AdditionalDiagnosticsSourceFilesProvider,
|
||||
::CoroutineHelpersSourceFilesProvider,
|
||||
::CodegenHelpersSourceFilesProvider,
|
||||
)
|
||||
|
||||
assertions = JUnit5Assertions
|
||||
useAdditionalService<TemporaryDirectoryManager>(::TemporaryDirectoryManagerImpl)
|
||||
useAdditionalService<BackendKindExtractor>(::BackendKindExtractorImpl)
|
||||
useSourcePreprocessor(*AbstractKotlinCompilerTest.defaultPreprocessors.toTypedArray())
|
||||
useDirectives(*AbstractKotlinCompilerTest.defaultDirectiveContainers.toTypedArray())
|
||||
}
|
||||
private fun createTestFiles(file: File, expectedText: String): List<KotlinBaseTest.TestFile> =
|
||||
CodegenTestCase.createTestFilesFromFile(file, expectedText, false, TargetBackend.JVM)
|
||||
|
||||
companion object {
|
||||
const val GRADLE_VERSION = "6.8.1" // update GRADLE_SHA_256 on change
|
||||
|
||||
@@ -71,20 +71,15 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
|
||||
return rootSuite
|
||||
}
|
||||
|
||||
private fun processReport(rootSuite: TestSuite, resultOutput: String) {
|
||||
private fun processReport(suite: TestSuite, resultOutput: String) {
|
||||
val reportFolder = File(flavorFolder())
|
||||
try {
|
||||
val folders = reportFolder.listFiles()
|
||||
assertTrue(folders != null && folders.isNotEmpty(), "No folders in ${reportFolder.path}")
|
||||
|
||||
folders.forEach {
|
||||
assertTrue("${it.path} is not directory") { it.isDirectory }
|
||||
val isIr = it.name.contains("_ir")
|
||||
val testCases = parseSingleReportInFolder(it)
|
||||
testCases.forEach { aCase ->
|
||||
if (isIr) aCase.name += "_ir"
|
||||
rootSuite.addTest(aCase)
|
||||
}
|
||||
testCases.forEach { aCase -> suite.addTest(aCase) }
|
||||
Assert.assertNotEquals("There is no test results in report", 0, testCases.size.toLong())
|
||||
}
|
||||
} catch (e: Throwable) {
|
||||
@@ -92,6 +87,10 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
|
||||
}
|
||||
}
|
||||
|
||||
private fun renameFlavorFolder() {
|
||||
val reportFolder = File(flavorFolder())
|
||||
reportFolder.renameTo(File(reportFolder.parentFile, reportFolder.name + "_d8"))
|
||||
}
|
||||
|
||||
private fun flavorFolder() = pathManager.tmpFolder + "/build/test/results/connected/flavors"
|
||||
|
||||
@@ -120,7 +119,7 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
|
||||
|
||||
private fun cleanAndBuildProject(gradleRunner: GradleRunner) {
|
||||
gradleRunner.clean()
|
||||
gradleRunner.assembleAndroidTest()
|
||||
gradleRunner.build()
|
||||
}
|
||||
|
||||
@Throws(IOException::class, SAXException::class, ParserConfigurationException::class)
|
||||
@@ -139,14 +138,21 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
|
||||
|
||||
return (0 until testCases.length).map { i ->
|
||||
val item = testCases.item(i) as Element
|
||||
val failure = item.getElementsByTagName("failure").takeIf { it.length != 0 }?.item(0)
|
||||
val failure = item.getElementsByTagName("failure")
|
||||
val name = item.getAttribute("name")
|
||||
|
||||
object : TestCase(name) {
|
||||
@Throws(Throwable::class)
|
||||
override fun runTest() {
|
||||
if (failure != null) {
|
||||
Assert.fail(failure.textContent)
|
||||
if (failure.length == 0) {
|
||||
object : TestCase(name) {
|
||||
@Throws(Throwable::class)
|
||||
override fun runTest() {
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
object : TestCase(name) {
|
||||
@Throws(Throwable::class)
|
||||
override fun runTest() {
|
||||
Assert.fail(failure.item(0).textContent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class UnitTestFileWriter(
|
||||
}
|
||||
|
||||
fun generate() {
|
||||
FileWriter(File(flavourFolder, flavourName.replaceFirstChar(Char::uppercaseChar) + ".java").also { it.parentFile.mkdirs() }).use { suite ->
|
||||
FileWriter(File(flavourFolder, flavourName.capitalize() + ".java").also { it.parentFile.mkdirs() }).use { suite ->
|
||||
val p = Printer(suite)
|
||||
p.println(
|
||||
"""package ${CodegenTestsOnAndroidGenerator.testClassPackage};
|
||||
@@ -35,7 +35,7 @@ class UnitTestFileWriter(
|
||||
|import ${CodegenTestsOnAndroidGenerator.baseTestClassPackage}.${CodegenTestsOnAndroidGenerator.baseTestClassName};
|
||||
|
|
||||
|/* This class is generated by ${CodegenTestsOnAndroidGenerator.generatorName}. DO NOT MODIFY MANUALLY */
|
||||
|public class ${flavourName.replaceFirstChar(Char::uppercaseChar)} extends ${CodegenTestsOnAndroidGenerator.baseTestClassName} {
|
||||
|public class ${flavourName.capitalize()} extends ${CodegenTestsOnAndroidGenerator.baseTestClassName} {
|
||||
|
|
||||
""".trimMargin()
|
||||
)
|
||||
|
||||
@@ -45,9 +45,9 @@ public class GradleRunner {
|
||||
OutputUtils.checkResult(result);
|
||||
}
|
||||
|
||||
public void assembleAndroidTest() {
|
||||
public void build() {
|
||||
System.out.println("Building gradle project...");
|
||||
GeneralCommandLine build = generateCommandLine("assembleAndroidTest");
|
||||
GeneralCommandLine build = generateCommandLine("build");
|
||||
build.addParameter("--stacktrace");
|
||||
build.addParameter("--warn");
|
||||
RunResult result = RunUtils.execute(build);
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.backend.common
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.resolve.sam.getAbstractMembers
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.typeUtil.replaceArgumentsWithNothing
|
||||
|
||||
class SamType constructor(val type: KotlinType) {
|
||||
|
||||
val classDescriptor: ClassDescriptor
|
||||
get() = type.constructor.declarationDescriptor as? ClassDescriptor ?: error("Sam/Fun interface not a class descriptor: $type")
|
||||
|
||||
val kotlinFunctionType: KotlinType
|
||||
get() = classDescriptor.defaultFunctionTypeForSamInterface!!
|
||||
|
||||
val originalAbstractMethod: SimpleFunctionDescriptor
|
||||
get() = getAbstractMembers(classDescriptor)[0] as SimpleFunctionDescriptor
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
return other is SamType && type == other.type
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return type.hashCode()
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "SamType($type)"
|
||||
}
|
||||
}
|
||||
|
||||
open class SamTypeFactory {
|
||||
fun createByValueParameter(valueParameter: ValueParameterDescriptor): SamType? {
|
||||
val singleArgumentType: KotlinType
|
||||
val originalSingleArgumentType: KotlinType?
|
||||
val varargElementType = valueParameter.varargElementType
|
||||
if (varargElementType != null) {
|
||||
singleArgumentType = varargElementType
|
||||
originalSingleArgumentType = valueParameter.original.varargElementType
|
||||
assert(originalSingleArgumentType != null) {
|
||||
"Value parameter and original value parameter have inconsistent varargs: " +
|
||||
valueParameter + "; " + valueParameter.original
|
||||
}
|
||||
} else {
|
||||
singleArgumentType = valueParameter.type
|
||||
originalSingleArgumentType = valueParameter.original.type
|
||||
}
|
||||
if (singleArgumentType.isError || originalSingleArgumentType!!.isError) {
|
||||
return null
|
||||
}
|
||||
// This can be true in case when the value parameter is in the method of a generic type with out-projection.
|
||||
// We approximate Inv<Captured#1> to Nothing, while Inv itself can be a SAM interface safe to call here
|
||||
// (see testData genericSamProjectedOut.kt for details)
|
||||
// In such a case we can't have a proper supertype since wildcards are not allowed there,
|
||||
// so we use Nothing arguments instead that leads to a raw type used for a SAM wrapper.
|
||||
// See org.jetbrains.kotlin.codegen.state.KotlinTypeMapper#writeGenericType to understand how
|
||||
// raw types and Nothing arguments relate.
|
||||
val originalTypeToUse =
|
||||
if (KotlinBuiltIns.isNothing(singleArgumentType))
|
||||
originalSingleArgumentType.replaceArgumentsWithNothing()
|
||||
else singleArgumentType
|
||||
return create(originalTypeToUse.removeExternalProjections())
|
||||
}
|
||||
|
||||
open fun isSamType(type: KotlinType): Boolean {
|
||||
val descriptor = type.constructor.declarationDescriptor
|
||||
return descriptor is ClassDescriptor && descriptor.isFun
|
||||
}
|
||||
|
||||
fun create(originalType: KotlinType): SamType? {
|
||||
return if (isSamType(originalType)) SamType(originalType) else null
|
||||
}
|
||||
|
||||
private fun KotlinType.removeExternalProjections(): KotlinType {
|
||||
val newArguments = arguments.map { TypeProjectionImpl(Variance.INVARIANT, it.type) }
|
||||
return replace(newArguments)
|
||||
}
|
||||
|
||||
companion object {
|
||||
val INSTANCE = SamTypeFactory()
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ fun mangleNameIfNeeded(name: String): String {
|
||||
if (c.isValidCharacter()) {
|
||||
append(c)
|
||||
} else {
|
||||
val hexString = Integer.toHexString(c.code)
|
||||
val hexString = Integer.toHexString(c.toInt())
|
||||
assert(hexString.length <= 4)
|
||||
append("_u").append(hexString)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
|
||||
// This object should help compiling against different ASM versions from different bunch versions
|
||||
object VersionIndependentOpcodes {
|
||||
const val ACC_RECORD = 0
|
||||
}
|
||||
@@ -116,12 +116,6 @@ object AbstractTypeMapper {
|
||||
return asmType
|
||||
}
|
||||
|
||||
typeConstructor.isScript() -> {
|
||||
val asmType = AsmTypes.JAVA_CLASS_TYPE
|
||||
with(context) { sw?.writeGenericType(type, asmType, mode) }
|
||||
return asmType
|
||||
}
|
||||
|
||||
typeConstructor.isTypeParameter() -> {
|
||||
val typeParameter = typeConstructor as TypeParameterMarker
|
||||
return mapType(context, typeParameter.representativeUpperBound(), mode, null).also { asmType ->
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.codegen.inline.FileMapping;
|
||||
import org.jetbrains.kotlin.codegen.inline.SMAPBuilder;
|
||||
import org.jetbrains.kotlin.codegen.inline.SourceMapper;
|
||||
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
|
||||
import org.jetbrains.org.objectweb.asm.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.GENERATE_SMAP;
|
||||
|
||||
public abstract class AbstractClassBuilder implements ClassBuilder {
|
||||
protected static final MethodVisitor EMPTY_METHOD_VISITOR = new MethodVisitor(Opcodes.API_VERSION) {};
|
||||
protected static final FieldVisitor EMPTY_FIELD_VISITOR = new FieldVisitor(Opcodes.API_VERSION) {};
|
||||
|
||||
private String thisName;
|
||||
|
||||
private final JvmSerializationBindings serializationBindings = new JvmSerializationBindings();
|
||||
|
||||
private String sourceName;
|
||||
|
||||
private String debugInfo;
|
||||
|
||||
public static class Concrete extends AbstractClassBuilder {
|
||||
private final ClassVisitor v;
|
||||
|
||||
public Concrete(@NotNull ClassVisitor v) {
|
||||
this.v = v;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public ClassVisitor getVisitor() {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public FieldVisitor newField(
|
||||
@NotNull JvmDeclarationOrigin origin,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@NotNull String desc,
|
||||
@Nullable String signature,
|
||||
@Nullable Object value
|
||||
) {
|
||||
FieldVisitor visitor = getVisitor().visitField(access, name, desc, signature, value);
|
||||
if (visitor == null) {
|
||||
return EMPTY_FIELD_VISITOR;
|
||||
}
|
||||
return visitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public MethodVisitor newMethod(
|
||||
@NotNull JvmDeclarationOrigin origin,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@NotNull String desc,
|
||||
@Nullable String signature,
|
||||
@Nullable String[] exceptions
|
||||
) {
|
||||
MethodVisitor visitor = getVisitor().visitMethod(access, name, desc, signature, exceptions);
|
||||
if (visitor == null) {
|
||||
return EMPTY_METHOD_VISITOR;
|
||||
}
|
||||
return visitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public JvmSerializationBindings getSerializationBindings() {
|
||||
return serializationBindings;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public AnnotationVisitor newAnnotation(@NotNull String desc, boolean visible) {
|
||||
return getVisitor().visitAnnotation(desc, visible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void done() {
|
||||
getVisitor().visitSource(sourceName, debugInfo);
|
||||
getVisitor().visitEnd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defineClass(
|
||||
@Nullable PsiElement origin,
|
||||
int version,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@Nullable String signature,
|
||||
@NotNull String superName,
|
||||
@NotNull String[] interfaces
|
||||
) {
|
||||
thisName = name;
|
||||
getVisitor().visit(version, access, name, signature, superName, interfaces);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSource(@NotNull String name, @Nullable String debug) {
|
||||
assert sourceName == null || sourceName.equals(name) : "inconsistent file name: " + sourceName + " vs " + name;
|
||||
sourceName = name;
|
||||
debugInfo = debug;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSMAP(@NotNull SourceMapper smap, boolean backwardsCompatibleSyntax) {
|
||||
if (!GENERATE_SMAP) return;
|
||||
|
||||
List<FileMapping> fileMappings = smap.getResultMappings();
|
||||
if (fileMappings.isEmpty()) return;
|
||||
|
||||
visitSource(fileMappings.get(0).getName(), SMAPBuilder.INSTANCE.build(fileMappings, backwardsCompatibleSyntax));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc) {
|
||||
getVisitor().visitOuterClass(owner, name, desc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitInnerClass(@NotNull String name, @Nullable String outerName, @Nullable String innerName, int access) {
|
||||
getVisitor().visitInnerClass(name, outerName, innerName, access);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getThisName() {
|
||||
assert thisName != null : "This name isn't set";
|
||||
return thisName;
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ class AccessorForFunctionDescriptor(
|
||||
if (calleeDescriptor.getUserData(INITIAL_DESCRIPTOR_FOR_SUSPEND_FUNCTION) != null) {
|
||||
userDataMap = LinkedHashMap<CallableDescriptor.UserDataKey<*>, Any>()
|
||||
userDataMap[INITIAL_DESCRIPTOR_FOR_SUSPEND_FUNCTION] =
|
||||
calleeDescriptor.getUserData(INITIAL_DESCRIPTOR_FOR_SUSPEND_FUNCTION)
|
||||
calleeDescriptor.getUserData(INITIAL_DESCRIPTOR_FOR_SUSPEND_FUNCTION)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,9 +20,11 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.resolve.calls.components.hasDefaultValue
|
||||
import org.jetbrains.kotlin.resolve.calls.model.*
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.overriddenTreeUniqueAsSequence
|
||||
import org.jetbrains.kotlin.utils.DFS
|
||||
import org.jetbrains.kotlin.utils.mapToIndex
|
||||
|
||||
class ArgumentAndDeclIndex(val arg: ResolvedValueArgument, val declIndex: Int)
|
||||
@@ -68,8 +70,12 @@ abstract class ArgumentGenerator {
|
||||
generateExpression(declIndex, argument)
|
||||
}
|
||||
is DefaultValueArgument -> {
|
||||
defaultArgs.mark(declIndex)
|
||||
generateDefault(declIndex, argument)
|
||||
if (calleeDescriptor?.defaultValueFromJava(declIndex) == true) {
|
||||
generateDefaultJava(declIndex, argument)
|
||||
} else {
|
||||
defaultArgs.mark(declIndex)
|
||||
generateDefault(declIndex, argument)
|
||||
}
|
||||
}
|
||||
is VarargValueArgument -> {
|
||||
generateVararg(declIndex, argument)
|
||||
@@ -97,6 +103,10 @@ abstract class ArgumentGenerator {
|
||||
throw UnsupportedOperationException("Unsupported vararg value argument #$i: $argument")
|
||||
}
|
||||
|
||||
protected open fun generateDefaultJava(i: Int, argument: DefaultValueArgument) {
|
||||
throw UnsupportedOperationException("Unsupported default java argument #$i: $argument")
|
||||
}
|
||||
|
||||
protected open fun generateOther(i: Int, argument: ResolvedValueArgument) {
|
||||
throw UnsupportedOperationException("Unsupported value argument #$i: $argument")
|
||||
}
|
||||
@@ -106,6 +116,28 @@ abstract class ArgumentGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
private fun CallableDescriptor.defaultValueFromJava(index: Int): Boolean = DFS.ifAny(
|
||||
listOf(this),
|
||||
{ current -> current.original.overriddenDescriptors.map { it.original } },
|
||||
{ descriptor ->
|
||||
descriptor.original.overriddenDescriptors.isEmpty() &&
|
||||
descriptor is JavaCallableMemberDescriptor &&
|
||||
descriptor.valueParameters[index].declaresDefaultValue()
|
||||
}
|
||||
)
|
||||
|
||||
fun shouldInvokeDefaultArgumentsStub(resolvedCall: ResolvedCall<*>): Boolean {
|
||||
val descriptor = resolvedCall.resultingDescriptor
|
||||
val valueArgumentsByIndex = resolvedCall.valueArgumentsByIndex ?: return false
|
||||
for (index in valueArgumentsByIndex.indices) {
|
||||
val resolvedValueArgument = valueArgumentsByIndex[index]
|
||||
if (resolvedValueArgument is DefaultValueArgument && !descriptor.defaultValueFromJava(index)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
fun getFunctionWithDefaultArguments(functionDescriptor: FunctionDescriptor): FunctionDescriptor {
|
||||
if (functionDescriptor.containingDeclaration !is ClassDescriptor) return functionDescriptor
|
||||
if (functionDescriptor.overriddenDescriptors.isEmpty()) return functionDescriptor
|
||||
@@ -123,4 +155,4 @@ fun getFunctionWithDefaultArguments(functionDescriptor: FunctionDescriptor): Fun
|
||||
function.valueParameters.any { valueParameter -> valueParameter.hasDefaultValue() }
|
||||
}
|
||||
?: functionDescriptor
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,7 @@ interface BaseExpressionCodegen {
|
||||
|
||||
fun consumeReifiedOperationMarker(typeParameter: TypeParameterMarker)
|
||||
|
||||
@JvmDefault
|
||||
fun putReifiedOperationMarkerIfTypeIsReifiedParameter(type: KotlinTypeMarker, operationKind: OperationKind) {
|
||||
with(typeSystem) {
|
||||
val (typeParameter, second) = extractReificationArgument(type) ?: return
|
||||
|
||||
@@ -72,6 +72,12 @@ class CallBasedArgumentGenerator(
|
||||
callGenerator.putValueIfNeeded(getJvmKotlinType(i), lazyVararg, ValueKind.GENERAL_VARARG, i)
|
||||
}
|
||||
|
||||
override fun generateDefaultJava(i: Int, argument: DefaultValueArgument) {
|
||||
val argumentValue = valueParameters[i].findJavaDefaultArgumentValue(valueParameterTypes[i], codegen.typeMapper)
|
||||
|
||||
callGenerator.putValueIfNeeded(getJvmKotlinType(i), argumentValue)
|
||||
}
|
||||
|
||||
override fun reorderArgumentsIfNeeded(args: List<ArgumentAndDeclIndex>) {
|
||||
callGenerator.reorderArgumentsIfNeeded(args, valueParameterTypes)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.codegen.state.StaticTypeMapperForOldBackend
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
||||
@@ -52,7 +51,7 @@ class CallableMethod(
|
||||
|
||||
override fun genInvokeInstruction(v: InstructionAdapter) {
|
||||
if (boxInlineClassBeforeInvoke) {
|
||||
StackValue.boxInlineClass(dispatchReceiverKotlinType!!, v, StaticTypeMapperForOldBackend)
|
||||
StackValue.boxInlineClass(dispatchReceiverKotlinType!!, v)
|
||||
}
|
||||
v.visitMethodInsn(
|
||||
invokeOpcode,
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.codegen.inline.SourceMapper;
|
||||
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
|
||||
import org.jetbrains.org.objectweb.asm.*;
|
||||
|
||||
public interface ClassBuilder {
|
||||
@NotNull
|
||||
FieldVisitor newField(
|
||||
@NotNull JvmDeclarationOrigin origin,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@NotNull String desc,
|
||||
@Nullable String signature,
|
||||
@Nullable Object value
|
||||
);
|
||||
|
||||
@NotNull
|
||||
MethodVisitor newMethod(
|
||||
@NotNull JvmDeclarationOrigin origin,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@NotNull String desc,
|
||||
@Nullable String signature,
|
||||
@Nullable String[] exceptions
|
||||
);
|
||||
|
||||
@NotNull
|
||||
JvmSerializationBindings getSerializationBindings();
|
||||
|
||||
@NotNull
|
||||
AnnotationVisitor newAnnotation(@NotNull String desc, boolean visible);
|
||||
|
||||
void done();
|
||||
|
||||
@NotNull
|
||||
ClassVisitor getVisitor();
|
||||
|
||||
void defineClass(
|
||||
@Nullable PsiElement origin,
|
||||
int version,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@Nullable String signature,
|
||||
@NotNull String superName,
|
||||
@NotNull String[] interfaces
|
||||
);
|
||||
|
||||
void visitSource(@NotNull String name, @Nullable String debug);
|
||||
|
||||
void visitSMAP(@NotNull SourceMapper smap, boolean backwardsCompatibleSyntax);
|
||||
|
||||
void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc);
|
||||
|
||||
void visitInnerClass(@NotNull String name, @Nullable String outerName, @Nullable String innerName, int access);
|
||||
|
||||
@NotNull
|
||||
String getThisName();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
@Suppress("UNUSED_PARAMETER", "unused")
|
||||
fun ClassBuilder.addRecordComponent(name: String, desc: String, signature: String?) {
|
||||
// newRecordComponent(name, desc, signature)
|
||||
}
|
||||
@@ -52,14 +52,13 @@ import org.jetbrains.org.objectweb.asm.Type;
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.getMappingFileName;
|
||||
|
||||
public class ClassFileFactory implements OutputFileCollection {
|
||||
private final GenerationState state;
|
||||
private final ClassBuilderFactory builderFactory;
|
||||
private final Map<String, OutAndSourceFileList> generators = Collections.synchronizedMap(new LinkedHashMap<>());
|
||||
private final Map<String, OutAndSourceFileList> generators = new LinkedHashMap<>();
|
||||
|
||||
private boolean isDone = false;
|
||||
|
||||
@@ -347,9 +346,7 @@ public class ClassFileFactory implements OutputFileCollection {
|
||||
|
||||
@Override
|
||||
public byte[] asBytes(ClassBuilderFactory factory) {
|
||||
synchronized(this) {
|
||||
return factory.asBytes(classBuilder);
|
||||
}
|
||||
return factory.asBytes(classBuilder);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,7 +40,6 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver;
|
||||
import org.jetbrains.kotlin.serialization.DescriptorSerializer;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.kotlin.types.SimpleType;
|
||||
import org.jetbrains.kotlin.backend.common.SamType;
|
||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils;
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions;
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||
@@ -158,14 +157,7 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
|
||||
for (int i = 0; i < superInterfaceTypes.size(); i++) {
|
||||
KotlinType superInterfaceType = superInterfaceTypes.get(i);
|
||||
sw.writeInterface();
|
||||
Type superInterfaceAsmType;
|
||||
if (samType != null && superInterfaceType.getConstructor() == samType.getType().getConstructor()) {
|
||||
superInterfaceAsmType = typeMapper.mapSupertype(superInterfaceType, null);
|
||||
sw.writeAsmType(superInterfaceAsmType);
|
||||
} else {
|
||||
superInterfaceAsmType = typeMapper.mapSupertype(superInterfaceType, sw);
|
||||
}
|
||||
superInterfaceAsmTypes[i] = superInterfaceAsmType.getInternalName();
|
||||
superInterfaceAsmTypes[i] = typeMapper.mapSupertype(superInterfaceType, sw).getInternalName();
|
||||
sw.writeInterfaceEnd();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.codegen.inline.SourceMapper;
|
||||
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
|
||||
import org.jetbrains.org.objectweb.asm.*;
|
||||
|
||||
public abstract class DelegatingClassBuilder implements ClassBuilder {
|
||||
@NotNull
|
||||
protected abstract ClassBuilder getDelegate();
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FieldVisitor newField(
|
||||
@NotNull JvmDeclarationOrigin origin,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@NotNull String desc,
|
||||
@Nullable String signature,
|
||||
@Nullable Object value
|
||||
) {
|
||||
return getDelegate().newField(origin, access, name, desc, signature, value);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public MethodVisitor newMethod(
|
||||
@NotNull JvmDeclarationOrigin origin,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@NotNull String desc,
|
||||
@Nullable String signature,
|
||||
@Nullable String[] exceptions
|
||||
) {
|
||||
return getDelegate().newMethod(origin, access, name, desc, signature, exceptions);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JvmSerializationBindings getSerializationBindings() {
|
||||
return getDelegate().getSerializationBindings();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public AnnotationVisitor newAnnotation(@NotNull String desc, boolean visible) {
|
||||
return getDelegate().newAnnotation(desc, visible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void done() {
|
||||
getDelegate().done();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ClassVisitor getVisitor() {
|
||||
return getDelegate().getVisitor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defineClass(
|
||||
@Nullable PsiElement origin,
|
||||
int version,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@Nullable String signature,
|
||||
@NotNull String superName,
|
||||
@NotNull String[] interfaces
|
||||
) {
|
||||
getDelegate().defineClass(origin, version, access, name, signature, superName, interfaces);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSource(@NotNull String name, @Nullable String debug) {
|
||||
getDelegate().visitSource(name, debug);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSMAP(@NotNull SourceMapper smap, boolean backwardsCompatibleSyntax) {
|
||||
getDelegate().visitSMAP(smap, backwardsCompatibleSyntax);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc) {
|
||||
getDelegate().visitOuterClass(owner, name, desc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitInnerClass(@NotNull String name, @Nullable String outerName, @Nullable String innerName, int access) {
|
||||
getDelegate().visitInnerClass(name, outerName, innerName, access);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getThisName() {
|
||||
return getDelegate().getThisName();
|
||||
}
|
||||
}
|
||||
@@ -232,7 +232,9 @@ public class DescriptorAsmUtil {
|
||||
int flags = getVisibilityAccessFlag(functionDescriptor, kind);
|
||||
flags |= getVarargsFlag(functionDescriptor);
|
||||
flags |= getDeprecatedAccessFlag(functionDescriptor);
|
||||
if (deprecationResolver.isDeprecatedHidden(functionDescriptor) || isInlineWithReified(functionDescriptor)) {
|
||||
if (deprecationResolver.isDeprecatedHidden(functionDescriptor) ||
|
||||
isInlineWithReified(functionDescriptor) ||
|
||||
functionDescriptor.isSuspend() && functionDescriptor.getVisibility().equals(DescriptorVisibilities.PRIVATE)) {
|
||||
flags |= ACC_SYNTHETIC;
|
||||
}
|
||||
return flags;
|
||||
@@ -425,6 +427,10 @@ public class DescriptorAsmUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (memberDescriptor instanceof FunctionDescriptor && ((FunctionDescriptor) memberDescriptor).isSuspend()) {
|
||||
return NO_FLAG_PACKAGE_PRIVATE;
|
||||
}
|
||||
|
||||
if (memberDescriptor instanceof AccessorForCompanionObjectInstanceFieldDescriptor) {
|
||||
return NO_FLAG_PACKAGE_PRIVATE;
|
||||
}
|
||||
|
||||
@@ -74,10 +74,7 @@ import org.jetbrains.kotlin.resolve.constants.*;
|
||||
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluatorKt;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmBindingContextSlices;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmConstantsKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.RuntimeAssertionInfo;
|
||||
import org.jetbrains.kotlin.resolve.jvm.*;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
|
||||
@@ -88,11 +85,9 @@ import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor;
|
||||
import org.jetbrains.kotlin.types.*;
|
||||
import org.jetbrains.kotlin.types.checker.ClassicTypeSystemContextImpl;
|
||||
import org.jetbrains.kotlin.types.expressions.DoubleColonLHS;
|
||||
import org.jetbrains.kotlin.types.model.KotlinTypeMarker;
|
||||
import org.jetbrains.kotlin.types.model.TypeParameterMarker;
|
||||
import org.jetbrains.kotlin.types.typesApproximation.CapturedTypeApproximationKt;
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions;
|
||||
import org.jetbrains.kotlin.backend.common.SamType;
|
||||
import org.jetbrains.org.objectweb.asm.Label;
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes;
|
||||
@@ -2695,7 +2690,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
}
|
||||
|
||||
@NotNull
|
||||
Callable resolveToCallable(@NotNull FunctionDescriptor fd, boolean superCall, @NotNull ResolvedCall<?> resolvedCall) {
|
||||
Callable resolveToCallable(@NotNull FunctionDescriptor fd, boolean superCall, @NotNull ResolvedCall resolvedCall) {
|
||||
IntrinsicMethod intrinsic = state.getIntrinsics().getIntrinsic(fd);
|
||||
if (intrinsic != null) {
|
||||
return intrinsic.toCallable(fd, superCall, resolvedCall, this);
|
||||
@@ -2703,8 +2698,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
|
||||
fd = SamCodegenUtil.resolveSamAdapter(fd);
|
||||
|
||||
List<ResolvedValueArgument> valueArguments = resolvedCall.getValueArgumentsByIndex();
|
||||
if (valueArguments != null && valueArguments.stream().anyMatch(it -> it instanceof DefaultValueArgument)) {
|
||||
if (ArgumentGeneratorKt.shouldInvokeDefaultArgumentsStub(resolvedCall)) {
|
||||
// When we invoke a function with some arguments mapped as defaults,
|
||||
// we later reroute this call to an overridden function in a base class that processes the default arguments.
|
||||
// If the base class is generic, this overridden function can have a different Kotlin signature
|
||||
@@ -3009,7 +3003,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
@NotNull
|
||||
private KotlinType approximateCapturedType(@NotNull KotlinType type) {
|
||||
if (state.getLanguageVersionSettings().supportsFeature(LanguageFeature.NewInference)) {
|
||||
TypeApproximator approximator = new TypeApproximator(state.getModule().getBuiltIns(), state.getLanguageVersionSettings());
|
||||
TypeApproximator approximator = new TypeApproximator(state.getModule().getBuiltIns());
|
||||
|
||||
KotlinType approximatedType =
|
||||
TypeUtils.contains(type, (containedType) -> CapturedTypeConstructorKt.isCaptured(containedType)) ?
|
||||
@@ -5534,11 +5528,4 @@ The "returned" value of try expression with no finally is either the last expres
|
||||
parentCodegen.getReifiedTypeParametersUsages().addUsedReifiedParameter(typeParameterDescriptor.getName().asString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putReifiedOperationMarkerIfTypeIsReifiedParameter(
|
||||
@NotNull KotlinTypeMarker type, @NotNull ReifiedTypeInliner.OperationKind operationKind
|
||||
) {
|
||||
BaseExpressionCodegen.DefaultImpls.putReifiedOperationMarkerIfTypeIsReifiedParameter(this, type, operationKind);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.jetbrains.kotlin.load.java.SpecialBuiltinMembers;
|
||||
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.*;
|
||||
import org.jetbrains.kotlin.resolve.annotations.ThrowUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.util.UnderscoreUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.constants.ArrayValue;
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||
@@ -1105,7 +1105,7 @@ public class FunctionCodegen {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
AnnotationDescriptor annotation = function.getAnnotations().findAnnotation(ThrowUtilKt.JVM_THROWS_ANNOTATION_FQ_NAME);
|
||||
AnnotationDescriptor annotation = function.getAnnotations().findAnnotation(AnnotationUtilKt.JVM_THROWS_ANNOTATION_FQ_NAME);
|
||||
if (annotation == null) return Collections.emptyList();
|
||||
|
||||
Collection<ConstantValue<?>> values = annotation.getAllValueArguments().values();
|
||||
@@ -1152,10 +1152,8 @@ public class FunctionCodegen {
|
||||
|
||||
// $default methods are never private to be accessible from other class files (e.g. inner) without the need of synthetic accessors
|
||||
// $default methods are never protected to be accessible from subclass nested classes
|
||||
// TODO: maybe best to generate private default in interface as private
|
||||
int visibilityFlag =
|
||||
(!isInterface(functionDescriptor.getContainingDeclaration()) || kind == OwnerKind.DEFAULT_IMPLS) &&
|
||||
(DescriptorVisibilities.isPrivate(functionDescriptor.getVisibility()) || isInlineOnlyPrivateInBytecode(functionDescriptor))
|
||||
DescriptorVisibilities.isPrivate(functionDescriptor.getVisibility()) || isInlineOnlyPrivateInBytecode(functionDescriptor)
|
||||
? AsmUtil.NO_FLAG_PACKAGE_PRIVATE : Opcodes.ACC_PUBLIC;
|
||||
int flags = visibilityFlag | getDeprecatedAccessFlag(functionDescriptor) | ACC_SYNTHETIC;
|
||||
if (!(functionDescriptor instanceof ConstructorDescriptor &&
|
||||
@@ -1687,11 +1685,10 @@ public class FunctionCodegen {
|
||||
|
||||
// Fake overrides in interfaces should be expanded to implementation to make proper default check
|
||||
if (JvmAnnotationUtilKt.checkIsImplementationCompiledToJvmDefault(memberDescriptor, mode)) {
|
||||
boolean isSyntheticInCompatibilityOrJvmDefault = isSynthetic && (mode.isCompatibility() || mode == JvmDefaultMode.ENABLE);
|
||||
return (kind != OwnerKind.DEFAULT_IMPLS && !isSyntheticInCompatibilityOrJvmDefault) ||
|
||||
return (kind != OwnerKind.DEFAULT_IMPLS && !isSynthetic) ||
|
||||
(kind == OwnerKind.DEFAULT_IMPLS &&
|
||||
(isSyntheticInCompatibilityOrJvmDefault ||
|
||||
(mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration))) && !DescriptorVisibilities.isPrivate(memberDescriptor.getVisibility()));
|
||||
(isSynthetic || //TODO: move synthetic method generation into interface
|
||||
(mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration))));
|
||||
} else {
|
||||
switch (kind) {
|
||||
case DEFAULT_IMPLS: return true;
|
||||
|
||||
@@ -34,8 +34,7 @@ import org.jetbrains.org.objectweb.asm.commons.Method;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.correctElementType;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.isPrimitive;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
|
||||
import static org.jetbrains.kotlin.codegen.DescriptorAsmUtil.*;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.JAVA_STRING_TYPE;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE;
|
||||
@@ -307,7 +306,7 @@ public class FunctionsFromAnyGeneratorImpl extends FunctionsFromAnyGenerator {
|
||||
|
||||
iv.load(secondParameterIndex, OBJECT_TYPE);
|
||||
iv.checkcast(wrapperType);
|
||||
StackValue.unboxInlineClass(wrapperType, wrapperKotlinType, iv, typeMapper);
|
||||
StackValue.unboxInlineClass(wrapperType, wrapperKotlinType, iv);
|
||||
iv.store(unboxedValueIndex, underlyingType.getType());
|
||||
|
||||
return unboxedValueIndex;
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.load.java.sam.JavaSingleAbstractMethodUtils
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.backend.common.SamTypeFactory
|
||||
|
||||
object JvmSamTypeFactory : SamTypeFactory() {
|
||||
override fun isSamType(type: KotlinType) = JavaSingleAbstractMethodUtils.isSamType(type)
|
||||
}
|
||||
@@ -660,8 +660,7 @@ public abstract class MemberCodegen<T extends KtPureElement/* TODO: & KtDeclarat
|
||||
List<VariableDescriptorWithAccessors> delegatedProperties = bindingContext.get(CodegenBinding.DELEGATED_PROPERTIES_WITH_METADATA, thisAsmType);
|
||||
if (delegatedProperties == null || delegatedProperties.isEmpty()) return;
|
||||
|
||||
int additionalFlags = context.getContextKind() != OwnerKind.DEFAULT_IMPLS && isInterface(context.getContextDescriptor()) ? ACC_PUBLIC : 0;
|
||||
v.newField(NO_ORIGIN, ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC | additionalFlags, JvmAbi.DELEGATED_PROPERTIES_ARRAY_NAME,
|
||||
v.newField(NO_ORIGIN, ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC, JvmAbi.DELEGATED_PROPERTIES_ARRAY_NAME,
|
||||
"[" + K_PROPERTY_TYPE, null, null);
|
||||
|
||||
if (!state.getClassBuilderMode().generateBodies) return;
|
||||
|
||||
@@ -34,13 +34,9 @@ import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.KtTypeAlias
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.MemberComparator
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||
import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_SYNTHETIC_ANNOTATION_FQ_NAME
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClass
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClassPart
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin
|
||||
@@ -129,19 +125,8 @@ class MultifileClassCodegenImpl(
|
||||
val superClassForFacade = if (shouldGeneratePartHierarchy) partInternalNamesSorted.last() else J_L_OBJECT
|
||||
|
||||
state.factory.newVisitor(MultifileClass(files.firstOrNull(), actualPackageFragment), facadeClassType, files).apply {
|
||||
var attributes = FACADE_CLASS_ATTRIBUTES
|
||||
|
||||
val nonJvmSyntheticParts = files.filterNot { it.isJvmSynthetic() }
|
||||
if (nonJvmSyntheticParts.isEmpty()) {
|
||||
attributes = attributes or Opcodes.ACC_SYNTHETIC
|
||||
} else if (nonJvmSyntheticParts.size < files.size) {
|
||||
for (part in nonJvmSyntheticParts) {
|
||||
state.diagnostics.report(ErrorsJvm.NOT_ALL_MULTIFILE_CLASS_PARTS_ARE_JVM_SYNTHETIC.on(part.packageDirective ?: part))
|
||||
}
|
||||
}
|
||||
|
||||
defineClass(
|
||||
singleSourceFile, state.classFileVersion, attributes,
|
||||
singleSourceFile, state.classFileVersion, FACADE_CLASS_ATTRIBUTES,
|
||||
facadeClassType.internalName, null, superClassForFacade, emptyArray()
|
||||
)
|
||||
if (singleSourceFile != null) {
|
||||
@@ -161,13 +146,6 @@ class MultifileClassCodegenImpl(
|
||||
}
|
||||
}
|
||||
|
||||
private fun KtFile.isJvmSynthetic(): Boolean {
|
||||
return annotationEntries.any { entry ->
|
||||
val descriptor = state.bindingContext[BindingContext.ANNOTATION, entry]
|
||||
descriptor?.annotationClass?.let(DescriptorUtils::getFqNameSafe) == JVM_SYNTHETIC_ANNOTATION_FQ_NAME
|
||||
}
|
||||
}
|
||||
|
||||
override fun generate() {
|
||||
assert(delegateGenerationTasks.isEmpty()) { "generate() is called twice for facade class $facadeFqName" }
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.resolve.calls.model.*
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
|
||||
internal class ObjectSuperCallArgumentGenerator(
|
||||
@@ -64,6 +65,12 @@ internal class ObjectSuperCallArgumentGenerator(
|
||||
pushDefaultValueOnStack(type, iv)
|
||||
}
|
||||
|
||||
public override fun generateDefaultJava(i: Int, argument: DefaultValueArgument) {
|
||||
val type = parameters[i].asmType
|
||||
val value = superValueParameters[i].findJavaDefaultArgumentValue(type, typeMapper)
|
||||
value.put(type, iv)
|
||||
}
|
||||
|
||||
public override fun generateVararg(i: Int, argument: VarargValueArgument) {
|
||||
generateSuperCallArgument(i)
|
||||
}
|
||||
|
||||
117
compiler/backend/src/org/jetbrains/kotlin/codegen/SamType.java
Normal file
117
compiler/backend/src/org/jetbrains/kotlin/codegen/SamType.java
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.codegen.state.TypeMapperUtilsKt;
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
|
||||
import org.jetbrains.kotlin.load.java.sam.JavaSingleAbstractMethodUtils;
|
||||
import org.jetbrains.kotlin.resolve.sam.SamConversionResolverImplKt;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.kotlin.types.KotlinTypeKt;
|
||||
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
|
||||
|
||||
public class SamType {
|
||||
@Nullable
|
||||
public static SamType createByValueParameter(@NotNull ValueParameterDescriptor valueParameter) {
|
||||
KotlinType singleArgumentType;
|
||||
KotlinType originalSingleArgumentType;
|
||||
KotlinType varargElementType = valueParameter.getVarargElementType();
|
||||
if (varargElementType != null) {
|
||||
singleArgumentType = varargElementType;
|
||||
originalSingleArgumentType = valueParameter.getOriginal().getVarargElementType();
|
||||
assert originalSingleArgumentType != null :
|
||||
"Value parameter and original value parameter have inconsistent varargs: " +
|
||||
valueParameter + "; " + valueParameter.getOriginal();
|
||||
} else {
|
||||
singleArgumentType = valueParameter.getType();
|
||||
originalSingleArgumentType = valueParameter.getOriginal().getType();
|
||||
}
|
||||
|
||||
if (KotlinTypeKt.isError(singleArgumentType) || KotlinTypeKt.isError(originalSingleArgumentType)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
KotlinType originalTypeToUse =
|
||||
// This can be true in case when the value parameter is in the method of a generic type with out-projection.
|
||||
// We approximate Inv<Captured#1> to Nothing, while Inv itself can be a SAM interface safe to call here
|
||||
// (see testData genericSamProjectedOut.kt for details)
|
||||
KotlinBuiltIns.isNothing(singleArgumentType)
|
||||
// In such a case we can't have a proper supertype since wildcards are not allowed there,
|
||||
// so we use Nothing arguments instead that leads to a raw type used for a SAM wrapper.
|
||||
// See org.jetbrains.kotlin.codegen.state.KotlinTypeMapper#writeGenericType to understand how
|
||||
// raw types and Nothing arguments relate.
|
||||
? TypeUtilsKt.replaceArgumentsWithNothing(originalSingleArgumentType)
|
||||
: singleArgumentType;
|
||||
|
||||
return create(TypeMapperUtilsKt.removeExternalProjections(originalTypeToUse));
|
||||
}
|
||||
public static SamType create(@NotNull KotlinType originalType) {
|
||||
if (!JavaSingleAbstractMethodUtils.isSamType(originalType)) return null;
|
||||
return new SamType(originalType);
|
||||
}
|
||||
|
||||
private final KotlinType type;
|
||||
|
||||
private SamType(@NotNull KotlinType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public KotlinType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getClassDescriptor() {
|
||||
ClassifierDescriptor classifier = type.getConstructor().getDeclarationDescriptor();
|
||||
assert classifier instanceof ClassDescriptor : "Sam/Fun interface not a class descriptor: " + classifier;
|
||||
return (ClassDescriptor) classifier;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public KotlinType getKotlinFunctionType() {
|
||||
ClassDescriptor descriptor = getClassDescriptor();
|
||||
//noinspection ConstantConditions
|
||||
return descriptor.getDefaultFunctionTypeForSamInterface();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public SimpleFunctionDescriptor getOriginalAbstractMethod() {
|
||||
return (SimpleFunctionDescriptor) SamConversionResolverImplKt.getAbstractMembers(getClassDescriptor()).get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return o instanceof SamType && type.equals(((SamType) o).type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return type.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SamType(" + type + ")";
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.inline.InlineUtil
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.kotlin.backend.common.SamType
|
||||
|
||||
class SamWrapperClasses(private val state: GenerationState) {
|
||||
|
||||
@@ -37,16 +36,14 @@ class SamWrapperClasses(private val state: GenerationState) {
|
||||
expressionCodegen: ExpressionCodegen,
|
||||
contextDescriptor: CallableMemberDescriptor
|
||||
): Type {
|
||||
val parentContext = expressionCodegen.context
|
||||
val isInsideInline = InlineUtil.isInlineOrContainingInline(parentContext.contextDescriptor) ||
|
||||
isInsideInlineLambdaContext(parentContext, state)
|
||||
val isInsideInline = InlineUtil.isInlineOrContainingInline(expressionCodegen.context.contextDescriptor) ||
|
||||
isInsideInlineLambdaContext(expressionCodegen.context, state)
|
||||
return samInterfaceToWrapperClass.getOrPut(WrapperKey(samType, file, isInsideInline)) {
|
||||
SamWrapperCodegen(state, samType, expressionCodegen.parentCodegen, parentContext, isInsideInline)
|
||||
.genWrapper(file, contextDescriptor)
|
||||
SamWrapperCodegen(state, samType, expressionCodegen.parentCodegen, isInsideInline).genWrapper(file, contextDescriptor)
|
||||
}
|
||||
}
|
||||
|
||||
private fun isInsideInlineLambdaContext(context: CodegenContext<*>, state: GenerationState): Boolean {
|
||||
private fun isInsideInlineLambdaContext(context: CodegenContext<*>, state: GenerationState):Boolean {
|
||||
var parent: CodegenContext<*>? = context
|
||||
while (parent != null && parent != state.rootContext) {
|
||||
if (parent is InlineLambdaContext) return true
|
||||
|
||||
@@ -21,9 +21,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.backend.common.CodegenUtil;
|
||||
import org.jetbrains.kotlin.codegen.context.ClassContext;
|
||||
import org.jetbrains.kotlin.codegen.context.CodegenContext;
|
||||
import org.jetbrains.kotlin.codegen.context.FieldOwnerContext;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
|
||||
import org.jetbrains.kotlin.config.LanguageFeature;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorImpl;
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil;
|
||||
@@ -38,7 +38,6 @@ import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.kotlin.backend.common.SamType;
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions;
|
||||
import org.jetbrains.org.objectweb.asm.Label;
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||
@@ -64,7 +63,6 @@ public class SamWrapperCodegen {
|
||||
private final KotlinTypeMapper typeMapper;
|
||||
private final SamType samType;
|
||||
private final MemberCodegen<?> parentCodegen;
|
||||
private final CodegenContext<?> parentContext;
|
||||
private final int visibility;
|
||||
private final int classFlags;
|
||||
public static final String SAM_WRAPPER_SUFFIX = "$0";
|
||||
@@ -73,7 +71,6 @@ public class SamWrapperCodegen {
|
||||
@NotNull GenerationState state,
|
||||
@NotNull SamType samType,
|
||||
@NotNull MemberCodegen<?> parentCodegen,
|
||||
@NotNull CodegenContext<?> parentContext,
|
||||
boolean isInsideInline
|
||||
) {
|
||||
this.state = state;
|
||||
@@ -81,10 +78,8 @@ public class SamWrapperCodegen {
|
||||
this.typeMapper = state.getTypeMapper();
|
||||
this.samType = samType;
|
||||
this.parentCodegen = parentCodegen;
|
||||
this.parentContext = parentContext;
|
||||
visibility = isInsideInline ? ACC_PUBLIC : NO_FLAG_PACKAGE_PRIVATE;
|
||||
int synth = state.getLanguageVersionSettings().supportsFeature(LanguageFeature.SamWrapperClassesAreSynthetic) ? ACC_SYNTHETIC : 0;
|
||||
classFlags = visibility | ACC_FINAL | ACC_SUPER | synth;
|
||||
classFlags = visibility | ACC_FINAL | ACC_SUPER;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -173,6 +168,7 @@ public class SamWrapperCodegen {
|
||||
|
||||
private void generateInnerClassInformation(@NotNull KtFile file, Type asmType, ClassBuilder cv) {
|
||||
parentCodegen.addSyntheticAnonymousInnerClass(new SyntheticInnerClassInfo(asmType.getInternalName(), classFlags));
|
||||
FieldOwnerContext<?> parentContext = parentCodegen.context;
|
||||
CodegenContext<?> outerContext = MemberCodegen.getNonInlineOuterContext(parentContext);
|
||||
assert outerContext != null :
|
||||
"Outer context for SAM wrapper " + asmType.getInternalName() + " is null, parentContext:" + parentContext;
|
||||
|
||||
@@ -20,14 +20,11 @@ import org.jetbrains.kotlin.codegen.coroutines.CoroutineCodegenUtilKt;
|
||||
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethods;
|
||||
import org.jetbrains.kotlin.codegen.pseudoInsns.PseudoInsnsKt;
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapperBase;
|
||||
import org.jetbrains.kotlin.codegen.state.StaticTypeMapperForOldBackend;
|
||||
import org.jetbrains.kotlin.config.LanguageFeature;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor;
|
||||
import org.jetbrains.kotlin.load.java.DescriptorsJvmAbiUtil;
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi;
|
||||
import org.jetbrains.kotlin.load.kotlin.TypeMappingMode;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.KtExpression;
|
||||
import org.jetbrains.kotlin.psi.ValueArgument;
|
||||
@@ -46,7 +43,6 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.kotlin.types.SimpleType;
|
||||
import org.jetbrains.kotlin.types.TypeUtils;
|
||||
import org.jetbrains.kotlin.types.model.KotlinTypeMarker;
|
||||
import org.jetbrains.org.objectweb.asm.Label;
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes;
|
||||
import org.jetbrains.org.objectweb.asm.Type;
|
||||
@@ -456,13 +452,11 @@ public abstract class StackValue {
|
||||
v.invokevirtual(methodOwner.getInternalName(), type.getClassName() + "Value", "()" + type.getDescriptor(), false);
|
||||
}
|
||||
|
||||
public static void boxInlineClass(
|
||||
@NotNull KotlinTypeMarker kotlinType, @NotNull InstructionAdapter v, @NotNull KotlinTypeMapperBase typeMapper
|
||||
) {
|
||||
Type boxedType = typeMapper.mapTypeCommon(kotlinType, TypeMappingMode.CLASS_DECLARATION);
|
||||
Type underlyingType = KotlinTypeMapper.mapUnderlyingTypeOfInlineClassType(kotlinType, typeMapper);
|
||||
public static void boxInlineClass(@NotNull KotlinType kotlinType, @NotNull InstructionAdapter v) {
|
||||
Type boxedType = KotlinTypeMapper.mapInlineClassTypeAsDeclaration(kotlinType);
|
||||
Type underlyingType = KotlinTypeMapper.mapUnderlyingTypeOfInlineClassType(kotlinType);
|
||||
|
||||
if (typeMapper.getTypeSystem().isNullableType(kotlinType) && !isPrimitive(underlyingType)) {
|
||||
if (TypeUtils.isNullableType(kotlinType) && !isPrimitive(underlyingType)) {
|
||||
boxOrUnboxWithNullCheck(v, vv -> invokeBoxMethod(vv, boxedType, underlyingType));
|
||||
}
|
||||
else {
|
||||
@@ -483,19 +477,14 @@ public abstract class StackValue {
|
||||
);
|
||||
}
|
||||
|
||||
public static void unboxInlineClass(
|
||||
@NotNull Type type,
|
||||
@NotNull KotlinTypeMarker targetInlineClassType,
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull KotlinTypeMapperBase typeMapper
|
||||
) {
|
||||
Type owner = typeMapper.mapTypeCommon(targetInlineClassType, TypeMappingMode.CLASS_DECLARATION);
|
||||
public static void unboxInlineClass(@NotNull Type type, @NotNull KotlinType targetInlineClassType, @NotNull InstructionAdapter v) {
|
||||
Type owner = KotlinTypeMapper.mapInlineClassTypeAsDeclaration(targetInlineClassType);
|
||||
|
||||
coerce(type, owner, v);
|
||||
|
||||
Type resultType = KotlinTypeMapper.mapUnderlyingTypeOfInlineClassType(targetInlineClassType, typeMapper);
|
||||
Type resultType = KotlinTypeMapper.mapUnderlyingTypeOfInlineClassType(targetInlineClassType);
|
||||
|
||||
if (typeMapper.getTypeSystem().isNullableType(targetInlineClassType) && !isPrimitive(resultType)) {
|
||||
if (TypeUtils.isNullableType(targetInlineClassType) && !isPrimitive(resultType)) {
|
||||
boxOrUnboxWithNullCheck(v, vv -> invokeUnboxMethod(vv, owner, resultType));
|
||||
}
|
||||
else {
|
||||
@@ -548,7 +537,7 @@ public abstract class StackValue {
|
||||
@Nullable KotlinType toKotlinType,
|
||||
@NotNull InstructionAdapter v
|
||||
) {
|
||||
if (coerceInlineClasses(fromType, fromKotlinType, toType, toKotlinType, v, StaticTypeMapperForOldBackend.INSTANCE)) return;
|
||||
if (coerceInlineClasses(fromType, fromKotlinType, toType, toKotlinType, v)) return;
|
||||
coerce(fromType, toType, v);
|
||||
}
|
||||
|
||||
@@ -584,8 +573,7 @@ public abstract class StackValue {
|
||||
@Nullable KotlinType fromKotlinType,
|
||||
@NotNull Type toType,
|
||||
@Nullable KotlinType toKotlinType,
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull KotlinTypeMapperBase typeMapper
|
||||
@NotNull InstructionAdapter v
|
||||
) {
|
||||
// NB see also requiresInlineClassBoxingOrUnboxing above
|
||||
|
||||
@@ -612,23 +600,23 @@ public abstract class StackValue {
|
||||
boolean isFromTypeUnboxed = isUnboxedInlineClass(fromKotlinType, fromType);
|
||||
boolean isToTypeUnboxed = isUnboxedInlineClass(toKotlinType, toType);
|
||||
if (isFromTypeUnboxed && !isToTypeUnboxed) {
|
||||
boxInlineClass(fromKotlinType, v, typeMapper);
|
||||
boxInlineClass(fromKotlinType, v);
|
||||
return true;
|
||||
}
|
||||
else if (!isFromTypeUnboxed && isToTypeUnboxed) {
|
||||
unboxInlineClass(fromType, toKotlinType, v, typeMapper);
|
||||
unboxInlineClass(fromType, toKotlinType, v);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (isFromTypeInlineClass) {
|
||||
if (isUnboxedInlineClass(fromKotlinType, fromType)) {
|
||||
boxInlineClass(fromKotlinType, v, typeMapper);
|
||||
boxInlineClass(fromKotlinType, v);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else { // isToTypeInlineClass is `true`
|
||||
if (isUnboxedInlineClass(toKotlinType, toType)) {
|
||||
unboxInlineClass(fromType, toKotlinType, v, typeMapper);
|
||||
unboxInlineClass(fromType, toKotlinType, v);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -637,7 +625,7 @@ public abstract class StackValue {
|
||||
}
|
||||
|
||||
public static boolean isUnboxedInlineClass(@NotNull KotlinType kotlinType, @NotNull Type actualType) {
|
||||
return KotlinTypeMapper.mapUnderlyingTypeOfInlineClassType(kotlinType, StaticTypeMapperForOldBackend.INSTANCE).equals(actualType);
|
||||
return KotlinTypeMapper.mapUnderlyingTypeOfInlineClassType(kotlinType).equals(actualType);
|
||||
}
|
||||
|
||||
public static void coerce(@NotNull Type fromType, @NotNull Type toType, @NotNull InstructionAdapter v) {
|
||||
|
||||
@@ -5,7 +5,18 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.codegen.AsmUtil.unboxPrimitiveTypeOrNull
|
||||
import org.jetbrains.kotlin.codegen.StackValue.*
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.load.java.Constant
|
||||
import org.jetbrains.kotlin.load.java.EnumEntry
|
||||
import org.jetbrains.kotlin.load.java.descriptors.NullDefaultValue
|
||||
import org.jetbrains.kotlin.load.java.descriptors.StringDefaultValue
|
||||
import org.jetbrains.kotlin.load.java.descriptors.getDefaultValueFromAnnotation
|
||||
import org.jetbrains.kotlin.load.java.lexicalCastFrom
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.utils.DFS
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
|
||||
@@ -75,3 +86,40 @@ class FunctionCallStackValue(
|
||||
resultKotlinType: KotlinType?,
|
||||
lambda: (v: InstructionAdapter) -> Unit
|
||||
) : OperationStackValue(resultType, resultKotlinType, lambda)
|
||||
|
||||
fun ValueParameterDescriptor.findJavaDefaultArgumentValue(targetType: Type, typeMapper: KotlinTypeMapper): StackValue {
|
||||
val descriptorWithDefaultValue = DFS.dfs(
|
||||
listOf(this.original),
|
||||
{ it.original.overriddenDescriptors.map(ValueParameterDescriptor::getOriginal) },
|
||||
object : DFS.AbstractNodeHandler<ValueParameterDescriptor, ValueParameterDescriptor?>() {
|
||||
var result: ValueParameterDescriptor? = null
|
||||
|
||||
override fun beforeChildren(current: ValueParameterDescriptor?): Boolean {
|
||||
if (current?.declaresDefaultValue() == true && current.getDefaultValueFromAnnotation() != null) {
|
||||
result = current
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun result(): ValueParameterDescriptor? = result
|
||||
}
|
||||
) ?: error("Should be at least one descriptor with default value: $this")
|
||||
|
||||
val defaultValue = descriptorWithDefaultValue.getDefaultValueFromAnnotation()
|
||||
if (defaultValue is NullDefaultValue) {
|
||||
return constant(null, targetType)
|
||||
}
|
||||
|
||||
val value = (defaultValue as StringDefaultValue).value
|
||||
val castResult = type.lexicalCastFrom(value) ?: error("Should be checked in frontend")
|
||||
|
||||
return when (castResult) {
|
||||
is EnumEntry -> enumEntry(castResult.descriptor, typeMapper)
|
||||
is Constant -> {
|
||||
val unboxedType = unboxPrimitiveTypeOrNull(targetType) ?: targetType
|
||||
return coercion(constant(castResult.value, unboxedType), targetType, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.codegen.coroutines.CoroutineCodegenUtilKt;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.codegen.when.SwitchCodegenProvider;
|
||||
import org.jetbrains.kotlin.codegen.when.WhenByEnumsMapping;
|
||||
import org.jetbrains.kotlin.config.JvmDefaultMode;
|
||||
import org.jetbrains.kotlin.config.LanguageFeature;
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings;
|
||||
import org.jetbrains.kotlin.coroutines.CoroutineUtilKt;
|
||||
@@ -56,7 +55,6 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.kotlin.backend.common.SamType;
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker;
|
||||
import org.jetbrains.org.objectweb.asm.Type;
|
||||
|
||||
@@ -89,7 +87,6 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
private final LanguageVersionSettings languageVersionSettings;
|
||||
private final ClassBuilderMode classBuilderMode;
|
||||
private final DelegatedPropertiesCodegenHelper delegatedPropertiesCodegenHelper;
|
||||
private final JvmDefaultMode jvmDefaultMode;
|
||||
|
||||
public CodegenAnnotatingVisitor(@NotNull GenerationState state) {
|
||||
this.bindingTrace = state.getBindingTrace();
|
||||
@@ -100,7 +97,6 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
this.languageVersionSettings = state.getLanguageVersionSettings();
|
||||
this.classBuilderMode = state.getClassBuilderMode();
|
||||
this.delegatedPropertiesCodegenHelper = new DelegatedPropertiesCodegenHelper(state);
|
||||
jvmDefaultMode = state.getJvmDefaultMode();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -589,7 +585,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
}
|
||||
|
||||
return AsmUtil.asmTypeByClassId(
|
||||
DescriptorUtils.isInterface(descriptor) && !jvmDefaultMode.getForAllMethodsWithBody()
|
||||
DescriptorUtils.isInterface(descriptor)
|
||||
? classId.createNestedClassId(Name.identifier(JvmAbi.DEFAULT_IMPLS_CLASS_NAME))
|
||||
: classId
|
||||
);
|
||||
@@ -862,7 +858,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
if (valueArguments == null) return;
|
||||
|
||||
for (ValueParameterDescriptor valueParameter : valueParametersWithSAMConversion) {
|
||||
SamType samType = JvmSamTypeFactory.INSTANCE.createByValueParameter(valueParameter);
|
||||
SamType samType = SamType.createByValueParameter(valueParameter);
|
||||
if (samType == null) continue;
|
||||
|
||||
ResolvedValueArgument resolvedValueArgument = valueArguments.get(valueParameter.getIndex());
|
||||
@@ -874,7 +870,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
}
|
||||
|
||||
private void recordSamTypeOnArgumentExpression(ValueParameterDescriptor valueParameter, ValueArgument valueArgument) {
|
||||
SamType samType = JvmSamTypeFactory.INSTANCE.createByValueParameter(valueParameter);
|
||||
SamType samType = SamType.createByValueParameter(valueParameter);
|
||||
if (samType == null) return;
|
||||
|
||||
recordSamTypeOnArgumentExpression(samType, valueArgument);
|
||||
@@ -956,7 +952,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
bindingTrace.record(SAM_CONSTRUCTOR_TO_ARGUMENT, expression, argumentExpression);
|
||||
|
||||
//noinspection ConstantConditions
|
||||
SamType samType = JvmSamTypeFactory.INSTANCE.create(callableDescriptor.getReturnType());
|
||||
SamType samType = SamType.create(callableDescriptor.getReturnType());
|
||||
bindingTrace.record(SAM_VALUE, argumentExpression, samType);
|
||||
}
|
||||
|
||||
@@ -973,7 +969,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
FunctionDescriptor original = SamCodegenUtil.getOriginalIfSamAdapter((FunctionDescriptor) operationDescriptor);
|
||||
if (original == null) return;
|
||||
|
||||
SamType samType = JvmSamTypeFactory.INSTANCE.createByValueParameter(original.getValueParameters().get(0));
|
||||
SamType samType = SamType.createByValueParameter(original.getValueParameters().get(0));
|
||||
if (samType == null) return;
|
||||
|
||||
IElementType token = expression.getOperationToken();
|
||||
@@ -1002,7 +998,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
List<KtExpression> indexExpressions = expression.getIndexExpressions();
|
||||
List<ValueParameterDescriptor> parameters = original.getValueParameters();
|
||||
for (ValueParameterDescriptor valueParameter : parameters) {
|
||||
SamType samType = JvmSamTypeFactory.INSTANCE.createByValueParameter(valueParameter);
|
||||
SamType samType = SamType.createByValueParameter(valueParameter);
|
||||
if (samType == null) continue;
|
||||
|
||||
if (isSetter && valueParameter.getIndex() == parameters.size() - 1) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import kotlin.collections.CollectionsKt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.codegen.JvmCodegenUtil;
|
||||
import org.jetbrains.kotlin.backend.common.SamType;
|
||||
import org.jetbrains.kotlin.codegen.SamType;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.codegen.when.WhenByEnumsMapping;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
|
||||
@@ -28,7 +28,7 @@ object ChangeBoxingMethodTransformer : MethodTransformer() {
|
||||
val map = hashMapOf<String, String>()
|
||||
for (primitiveType in JvmPrimitiveType.values()) {
|
||||
val name = primitiveType.wrapperFqName.topLevelClassInternalName()
|
||||
map[name] = "box${primitiveType.javaKeywordName.replaceFirstChar(Char::uppercaseChar)}"
|
||||
map[name] = "box${primitiveType.javaKeywordName.capitalize(Locale.US)}"
|
||||
}
|
||||
wrapperToInternalBoxing = map
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.codegen.coroutines
|
||||
import com.intellij.util.ArrayUtil
|
||||
import org.jetbrains.kotlin.backend.common.CodegenUtil
|
||||
import org.jetbrains.kotlin.builtins.isSuspendFunctionTypeOrSubtype
|
||||
import org.jetbrains.kotlin.cfg.index
|
||||
import org.jetbrains.kotlin.codegen.*
|
||||
import org.jetbrains.kotlin.codegen.binding.CalculatedClosure
|
||||
import org.jetbrains.kotlin.codegen.binding.CodegenBinding
|
||||
@@ -34,7 +35,6 @@ import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
||||
import org.jetbrains.kotlin.resolve.indexOrMinusOne
|
||||
import org.jetbrains.kotlin.resolve.isInlineClassType
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
|
||||
@@ -263,7 +263,7 @@ class CoroutineCodegenForLambda private constructor(
|
||||
|
||||
private fun ParameterDescriptor.isUnused(): Boolean =
|
||||
originalSuspendFunctionDescriptor is AnonymousFunctionDescriptor &&
|
||||
bindingContext[BindingContext.SUSPEND_LAMBDA_PARAMETER_USED, originalSuspendFunctionDescriptor to indexOrMinusOne()] != true
|
||||
bindingContext[BindingContext.SUSPEND_LAMBDA_PARAMETER_USED, originalSuspendFunctionDescriptor to index()] != true
|
||||
|
||||
private val generateErasedCreate: Boolean = allFunctionParameters().size <= 1
|
||||
|
||||
@@ -450,7 +450,7 @@ class CoroutineCodegenForLambda private constructor(
|
||||
if (parameter.type.isInlineClassType()) {
|
||||
load(cloneIndex, fieldInfoForCoroutineLambdaParameter.ownerType)
|
||||
load(index, AsmTypes.OBJECT_TYPE)
|
||||
StackValue.unboxInlineClass(AsmTypes.OBJECT_TYPE, parameter.type, this, typeMapper)
|
||||
StackValue.unboxInlineClass(AsmTypes.OBJECT_TYPE, parameter.type, this)
|
||||
putfield(
|
||||
fieldInfoForCoroutineLambdaParameter.ownerInternalName,
|
||||
fieldInfoForCoroutineLambdaParameter.fieldName,
|
||||
@@ -721,16 +721,9 @@ class CoroutineCodegenForNamedFunction private constructor(
|
||||
}
|
||||
|
||||
val isInterfaceMethod = DescriptorUtils.isInterface(suspendFunctionJvmView.containingDeclaration)
|
||||
val callableAccessorMethod =
|
||||
typeMapper.mapToCallableMethod(
|
||||
context.accessibleDescriptor(suspendFunctionJvmView.unwrapFrontendVersion(), null),
|
||||
// Obtain default impls method for interfaces
|
||||
isInterfaceMethod
|
||||
)
|
||||
|
||||
val callableMethod =
|
||||
typeMapper.mapToCallableMethod(
|
||||
suspendFunctionJvmView.unwrapFrontendVersion(),
|
||||
suspendFunctionJvmView,
|
||||
// Obtain default impls method for interfaces
|
||||
isInterfaceMethod
|
||||
)
|
||||
@@ -743,10 +736,10 @@ class CoroutineCodegenForNamedFunction private constructor(
|
||||
|
||||
if (suspendFunctionJvmView.isOverridable && !isInterfaceMethod && captureThisType != null) {
|
||||
val owner = captureThisType.internalName
|
||||
val impl = callableAccessorMethod.getAsmMethod().getImplForOpenMethod(owner)
|
||||
val impl = callableMethod.getAsmMethod().getImplForOpenMethod(owner)
|
||||
codegen.v.invokestatic(owner, impl.name, impl.descriptor, false)
|
||||
} else {
|
||||
callableAccessorMethod.genInvokeInstruction(codegen.v)
|
||||
callableMethod.genInvokeInstruction(codegen.v)
|
||||
}
|
||||
|
||||
if (inlineClassToBoxInInvokeSuspend != null) {
|
||||
@@ -756,7 +749,7 @@ class CoroutineCodegenForNamedFunction private constructor(
|
||||
generateCoroutineSuspendedCheck(languageVersionSettings)
|
||||
// Now we box the inline class
|
||||
StackValue.coerce(AsmTypes.OBJECT_TYPE, typeMapper.mapType(inlineClassToBoxInInvokeSuspend), this)
|
||||
StackValue.boxInlineClass(inlineClassToBoxInInvokeSuspend, this, typeMapper)
|
||||
StackValue.boxInlineClass(inlineClassToBoxInInvokeSuspend, this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -860,4 +853,4 @@ fun reportSuspensionPointInsideMonitor(element: KtElement, state: GenerationStat
|
||||
}
|
||||
|
||||
private fun FunctionDescriptor.allValueParameterTypes(): List<KotlinType> =
|
||||
(listOfNotNull(extensionReceiverParameter?.type)) + valueParameters.map { it.type }
|
||||
(listOfNotNull(extensionReceiverParameter?.type)) + valueParameters.map { it.type }
|
||||
@@ -201,38 +201,20 @@ class CoroutineTransformerMethodVisitor(
|
||||
|
||||
// When suspension point is inlined, it is in range of fake inliner variables.
|
||||
// Path from TABLESWITCH into unspilling goes to latter part of the range.
|
||||
// In this case the variables are uninitialized, initialize them, and split the local variable
|
||||
// range so that the local variable is only defined when initialized.
|
||||
// In this case the variables are uninitialized, initialize them
|
||||
private fun initializeFakeInlinerVariables(methodNode: MethodNode, stateLabels: List<LabelNode>) {
|
||||
for (stateLabel in stateLabels) {
|
||||
val newRecords = mutableListOf<LocalVariableNode>()
|
||||
for (record in methodNode.localVariables) {
|
||||
if (isFakeLocalVariableForInline(record.name) &&
|
||||
methodNode.instructions.indexOf(record.start) < methodNode.instructions.indexOf(stateLabel) &&
|
||||
methodNode.instructions.indexOf(stateLabel) < methodNode.instructions.indexOf(record.end)
|
||||
) {
|
||||
val newEnd = record.end
|
||||
val newStart = LabelNode()
|
||||
record.end = stateLabel
|
||||
methodNode.instructions.insert(stateLabel, withInstructionAdapter {
|
||||
iconst(0)
|
||||
store(record.index, Type.INT_TYPE)
|
||||
}.also {
|
||||
it.add(newStart)
|
||||
})
|
||||
newRecords.add(
|
||||
LocalVariableNode(
|
||||
record.name,
|
||||
record.desc,
|
||||
record.signature,
|
||||
newStart,
|
||||
newEnd,
|
||||
record.index
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
methodNode.localVariables.addAll(newRecords)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -999,7 +981,7 @@ class CoroutineTransformerMethodVisitor(
|
||||
else -> next = next.next
|
||||
}
|
||||
}
|
||||
return null
|
||||
return next
|
||||
}
|
||||
|
||||
// It's necessary to preserve some sensible invariants like there should be no jump in the middle of try-catch-block
|
||||
@@ -1235,27 +1217,6 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction:
|
||||
fun isAlive(insnIndex: Int, variableIndex: Int): Boolean =
|
||||
liveness[insnIndex].isAlive(variableIndex)
|
||||
|
||||
fun nextSuspensionPointEndLabel(insn: AbstractInsnNode): LabelNode {
|
||||
val suspensionPoint =
|
||||
InsnSequence(insn, method.instructions.last).firstOrNull { isAfterSuspendMarker(it) } ?: method.instructions.last
|
||||
return suspensionPoint as? LabelNode ?: suspensionPoint.findNextOrNull { it is LabelNode } as LabelNode
|
||||
}
|
||||
|
||||
fun nextSuspensionPointStartLabel(insn: AbstractInsnNode): LabelNode {
|
||||
val suspensionPoint =
|
||||
InsnSequence(insn, method.instructions.last).firstOrNull { isBeforeSuspendMarker(it) } ?: method.instructions.last
|
||||
return suspensionPoint as? LabelNode ?: suspensionPoint.findPreviousOrNull { it is LabelNode } as LabelNode
|
||||
}
|
||||
|
||||
fun min(a: LabelNode, b: LabelNode): LabelNode =
|
||||
if (method.instructions.indexOf(a) < method.instructions.indexOf(b)) a else b
|
||||
|
||||
fun max(a: LabelNode, b: LabelNode): LabelNode =
|
||||
if (method.instructions.indexOf(a) < method.instructions.indexOf(b)) b else a
|
||||
|
||||
fun containsSuspensionPoint(a: LabelNode, b: LabelNode): Boolean =
|
||||
InsnSequence(min(a, b), max(a, b)).none { isBeforeSuspendMarker(it) }
|
||||
|
||||
val oldLvt = arrayListOf<LocalVariableNode>()
|
||||
for (record in method.localVariables) {
|
||||
oldLvt += record
|
||||
@@ -1276,35 +1237,23 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction:
|
||||
// No variable in LVT -> do not add one
|
||||
val lvtRecord = oldLvt.findRecord(insnIndex, variableIndex) ?: continue
|
||||
if (lvtRecord.name == CONTINUATION_VARIABLE_NAME) continue
|
||||
// Extend lvt record to the next suspension point
|
||||
val endLabel = min(lvtRecord.end, nextSuspensionPointEndLabel(insn))
|
||||
val endLabel = insn as? LabelNode ?: insn.findNextOrNull { it is LabelNode } as? LabelNode ?: continue
|
||||
// startLabel can be null in case of parameters
|
||||
@Suppress("NAME_SHADOWING") val startLabel = startLabel ?: lvtRecord.start
|
||||
// Attempt to extend existing local variable node corresponding to the record in
|
||||
// the original local variable table.
|
||||
val recordToExtend: LocalVariableNode? = oldLvtNodeToLatestNewLvtNode[lvtRecord]
|
||||
if (recordToExtend != null && containsSuspensionPoint(recordToExtend.end, startLabel)) {
|
||||
var recordToExtend: LocalVariableNode? = oldLvtNodeToLatestNewLvtNode[lvtRecord]
|
||||
if (recordToExtend != null && InsnSequence(recordToExtend.end, startLabel).none { isBeforeSuspendMarker(it) }) {
|
||||
recordToExtend.end = endLabel
|
||||
} else {
|
||||
val node = LocalVariableNode(lvtRecord.name, lvtRecord.desc, lvtRecord.signature, startLabel, endLabel, lvtRecord.index)
|
||||
if (lvtRecord !in oldLvtNodeToLatestNewLvtNode) {
|
||||
method.localVariables.add(node)
|
||||
}
|
||||
method.localVariables.add(node)
|
||||
oldLvtNodeToLatestNewLvtNode[lvtRecord] = node
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val deadVariables = arrayListOf<Int>()
|
||||
outer@for (variableIndex in start until method.maxLocals) {
|
||||
if (oldLvt.none { it.index == variableIndex }) continue
|
||||
for (insnIndex in 0 until (method.instructions.size() - 1)) {
|
||||
if (isAlive(insnIndex, variableIndex)) continue@outer
|
||||
}
|
||||
deadVariables += variableIndex
|
||||
}
|
||||
|
||||
for (variable in oldLvt) {
|
||||
// $continuation and $result are dead, but they are used by debugger, as well as fake inliner variables
|
||||
// For example, $continuation is used to create async stack trace
|
||||
@@ -1313,26 +1262,10 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction:
|
||||
isFakeLocalVariableForInline(variable.name)
|
||||
) {
|
||||
method.localVariables.add(variable)
|
||||
continue
|
||||
}
|
||||
// this acts like $continuation for lambdas. For example, it is used by debugger to create async stack trace. Keep it.
|
||||
if (variable.name == "this" && !isForNamedFunction) {
|
||||
method.localVariables.add(variable)
|
||||
continue
|
||||
}
|
||||
|
||||
// Shrink LVT records of dead variables to the next suspension point
|
||||
if (variable.index in deadVariables) {
|
||||
method.localVariables.add(
|
||||
LocalVariableNode(
|
||||
variable.name,
|
||||
variable.desc,
|
||||
variable.signature,
|
||||
variable.start,
|
||||
min(variable.end, nextSuspensionPointStartLabel(variable.start)),
|
||||
variable.index
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,10 +90,7 @@ class AnonymousObjectTransformer(
|
||||
val node = MethodNode(access, name, desc, signature, exceptions)
|
||||
if (name == "<init>") {
|
||||
if (constructor != null) {
|
||||
throw RuntimeException(
|
||||
"Lambda, SAM or anonymous object should have only one constructor.\n" +
|
||||
"First:\n${constructor.nodeText}\n\nSecond:\n${node.nodeText}\n"
|
||||
)
|
||||
throw RuntimeException("Lambda, SAM or anonymous object should have only one constructor")
|
||||
}
|
||||
constructor = node
|
||||
} else {
|
||||
@@ -465,29 +462,6 @@ class AnonymousObjectTransformer(
|
||||
val indexToFunctionalArgument = transformationInfo.functionalArguments
|
||||
val capturedParams = HashSet<Int>()
|
||||
|
||||
// Possible cases where we need to add each lambda's captures separately:
|
||||
//
|
||||
// 1. Top-level object in an inline lambda that is *not* being inlined into another object. In this case, we
|
||||
// have no choice but to add a separate field for each captured variable. `capturedLambdas` is either empty
|
||||
// (already have the fields) or contains the parent lambda object (captures used to be read from it, but
|
||||
// the object will be removed and its contents inlined).
|
||||
//
|
||||
// 2. Top-level object in a named inline function. Again, there's no option but to add separate fields.
|
||||
// `capturedLambdas` contains all lambdas used by this object and nested objects.
|
||||
//
|
||||
// 3. Nested object, either in an inline lambda or an inline function. This case has two subcases:
|
||||
// * The object's captures are passed as separate arguments (e.g. KT-28064 style object that used to be in a lambda);
|
||||
// we *could* group them into `this$0` now, but choose not to. Lambdas are replaced by their captures to match.
|
||||
// * The object's captures are already grouped into `this$0`; this includes captured lambda parameters (for objects in
|
||||
// inline functions) and a reference to the outer object or lambda (for objects in lambdas), so `capturedLambdas` is
|
||||
// empty anyway.
|
||||
//
|
||||
// The only remaining case is a top-level object inside a (crossinline) lambda that is inlined into another object.
|
||||
// Then, the reference to the soon-to-be-removed lambda class containing the captures (and it exists, or else the object
|
||||
// would not have needed regeneration in the first place) is simply replaced with a reference to the outer object, and
|
||||
// that object will contain loose fields for everything we need to capture.
|
||||
val topLevelInCrossinlineLambda = parentFieldRemapper is InlinedLambdaRemapper && !parentFieldRemapper.parent!!.isRoot
|
||||
|
||||
//load captured parameters and patch instruction list
|
||||
// NB: there is also could be object fields
|
||||
val toDelete = arrayListOf<AbstractInsnNode>()
|
||||
@@ -496,12 +470,10 @@ class AnonymousObjectTransformer(
|
||||
val parameterAload = fieldNode.previous as VarInsnNode
|
||||
val varIndex = parameterAload.`var`
|
||||
val functionalArgument = indexToFunctionalArgument[varIndex]
|
||||
// If an outer `this` is already captured by this object, rename it if any inline lambda will capture
|
||||
// one of the same type, causing the code below to create a clash. Note that the values can be different.
|
||||
// TODO: this is only really necessary if there will be a name *and* type clash.
|
||||
val shouldRename = !topLevelInCrossinlineLambda && isThis0(fieldName) &&
|
||||
indexToFunctionalArgument.values.any { it is LambdaInfo && it.capturedVars.any { it.fieldName == fieldName } }
|
||||
val newFieldName = if (shouldRename) addUniqueField(fieldName + INLINE_FUN_THIS_0_SUFFIX) else fieldName
|
||||
val newFieldName = if (isThis0(fieldName) && shouldRenameThis0(parentFieldRemapper, indexToFunctionalArgument.values))
|
||||
getNewFieldName(fieldName, true)
|
||||
else
|
||||
fieldName
|
||||
val info = capturedParamBuilder.addCapturedParam(
|
||||
Type.getObjectType(transformationInfo.oldClassName), fieldName, newFieldName,
|
||||
Type.getType(fieldNode.desc), functionalArgument is LambdaInfo, null
|
||||
@@ -536,17 +508,35 @@ class AnonymousObjectTransformer(
|
||||
//For all inlined lambdas add their captured parameters
|
||||
//TODO: some of such parameters could be skipped - we should perform additional analysis
|
||||
val allRecapturedParameters = ArrayList<CapturedParamDesc>()
|
||||
if (!topLevelInCrossinlineLambda) {
|
||||
val capturedOuterThisTypes = mutableSetOf<String>()
|
||||
if (parentFieldRemapper !is InlinedLambdaRemapper || parentFieldRemapper.parent!!.isRoot) {
|
||||
// Possible cases:
|
||||
//
|
||||
// 1. Top-level object in an inline lambda that is *not* being inlined into another object. In this case, we
|
||||
// have no choice but to add a separate field for each captured variable. `capturedLambdas` is either empty
|
||||
// (already have the fields) or contains the parent lambda object (captures used to be read from it, but
|
||||
// the object will be removed and its contents inlined).
|
||||
//
|
||||
// 2. Top-level object in a named inline function. Again, there's no option but to add separate fields.
|
||||
// `capturedLambdas` contains all lambdas used by this object and nested objects.
|
||||
//
|
||||
// 3. Nested object, either in an inline lambda or an inline function. This case has two subcases:
|
||||
// * The object's captures are passed as separate arguments (e.g. KT-28064 style object that used to be in a lambda);
|
||||
// we could group them into `this$0` now, but choose not to. Lambdas are replaced by their captures.
|
||||
// * The object's captures are already grouped into `this$0`; this includes captured lambda parameters (for objects in
|
||||
// inline functions) and a reference to the outer object or lambda (for objects in lambdas), so `capturedLambdas` is
|
||||
// empty and the choice doesn't matter.
|
||||
//
|
||||
val alreadyAdded = HashMap<String, CapturedParamInfo>()
|
||||
for (info in capturedLambdas) {
|
||||
for (desc in info.capturedVars) {
|
||||
// Merge all outer `this` of the same type captured by inlined lambdas, since they have to be the same
|
||||
// object. Outer `this` captured by the original object itself should have been renamed above,
|
||||
// and can have a different value even if the same type is captured by a lambda.
|
||||
val recapturedParamInfo = if (isThis0(desc.fieldName))
|
||||
capturedParamBuilder.addCapturedParam(desc, desc.fieldName, !capturedOuterThisTypes.add(desc.type.className))
|
||||
else
|
||||
capturedParamBuilder.addCapturedParam(desc, addUniqueField(desc.fieldName + INLINE_TRANSFORMATION_SUFFIX), false)
|
||||
val key = desc.fieldName + "$$$" + desc.type.className
|
||||
val alreadyAddedParam = alreadyAdded[key]
|
||||
|
||||
val recapturedParamInfo = capturedParamBuilder.addCapturedParam(
|
||||
desc,
|
||||
alreadyAddedParam?.newFieldName ?: getNewFieldName(desc.fieldName, false),
|
||||
alreadyAddedParam != null
|
||||
)
|
||||
if (info is ExpressionLambda && info.isCapturedSuspend(desc)) {
|
||||
recapturedParamInfo.functionalArgument = NonInlineableArgumentForInlineableParameterCalledInSuspend
|
||||
}
|
||||
@@ -561,6 +551,10 @@ class AnonymousObjectTransformer(
|
||||
allRecapturedParameters.add(desc)
|
||||
|
||||
constructorParamBuilder.addCapturedParam(recapturedParamInfo, recapturedParamInfo.newFieldName).remapValue = composed
|
||||
|
||||
if (isThis0(desc.fieldName)) {
|
||||
alreadyAdded.put(key, recapturedParamInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (capturedLambdas.isNotEmpty()) {
|
||||
@@ -585,6 +579,24 @@ class AnonymousObjectTransformer(
|
||||
return constructorAdditionalFakeParams
|
||||
}
|
||||
|
||||
private fun shouldRenameThis0(parentFieldRemapper: FieldRemapper, values: Collection<FunctionalArgument>): Boolean {
|
||||
return if (isFirstDeclSiteLambdaFieldRemapper(parentFieldRemapper)) {
|
||||
values.any { it is LambdaInfo && it.capturedVars.any { isThis0(it.fieldName) } }
|
||||
} else false
|
||||
}
|
||||
|
||||
private fun getNewFieldName(oldName: String, originalField: Boolean): String {
|
||||
if (AsmUtil.CAPTURED_THIS_FIELD == oldName) {
|
||||
return if (!originalField) {
|
||||
oldName
|
||||
} else {
|
||||
//rename original 'this$0' in declaration site lambda (inside inline function) to use this$0 only for outer lambda/object access on call site
|
||||
addUniqueField(oldName + INLINE_FUN_THIS_0_SUFFIX)
|
||||
}
|
||||
}
|
||||
return addUniqueField(oldName + INLINE_TRANSFORMATION_SUFFIX)
|
||||
}
|
||||
|
||||
private fun addUniqueField(name: String): String {
|
||||
val existNames = fieldNames.getOrPut(name) { LinkedList() }
|
||||
val suffix = if (existNames.isEmpty()) "" else "$" + existNames.size
|
||||
@@ -592,4 +604,7 @@ class AnonymousObjectTransformer(
|
||||
existNames.add(newName)
|
||||
return newName
|
||||
}
|
||||
|
||||
private fun isFirstDeclSiteLambdaFieldRemapper(parentRemapper: FieldRemapper): Boolean =
|
||||
parentRemapper !is RegeneratedLambdaFieldRemapper && parentRemapper !is InlinedLambdaRemapper
|
||||
}
|
||||
|
||||
@@ -9,16 +9,15 @@ import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.utils.threadLocal
|
||||
import java.util.*
|
||||
|
||||
class GlobalInlineContext(private val diagnostics: DiagnosticSink) {
|
||||
// Ordered set of declarations and inline calls being generated right now.
|
||||
// No call in it should point to a declaration that's before it in the stack.
|
||||
private val inlineCallsAndDeclarations by threadLocal { LinkedList<Any? /* CallableDescriptor | PsiElement? */>() }
|
||||
private val inlineDeclarationSet by threadLocal { mutableSetOf<CallableDescriptor>() }
|
||||
private val inlineCallsAndDeclarations = LinkedList<Any? /* CallableDescriptor | PsiElement? */>()
|
||||
private val inlineDeclarationSet = mutableSetOf<CallableDescriptor>()
|
||||
|
||||
private val typesUsedInInlineFunctions by threadLocal { LinkedList<MutableSet<String>>() }
|
||||
private val typesUsedInInlineFunctions = LinkedList<MutableSet<String>>()
|
||||
|
||||
fun enterDeclaration(descriptor: CallableDescriptor) {
|
||||
assert(descriptor.original !in inlineDeclarationSet) { "entered inlining cycle on $descriptor" }
|
||||
|
||||
@@ -28,14 +28,12 @@ class InlineCache {
|
||||
}
|
||||
|
||||
inline fun <K, V : Any> SLRUMap<K, V>.getOrPut(key: K, defaultValue: () -> V): V {
|
||||
synchronized(this) {
|
||||
val value = get(key)
|
||||
return if (value == null) {
|
||||
val answer = defaultValue()
|
||||
put(key, answer)
|
||||
answer
|
||||
} else {
|
||||
value
|
||||
}
|
||||
val value = get(key)
|
||||
return if (value == null) {
|
||||
val answer = defaultValue()
|
||||
put(key, answer)
|
||||
answer
|
||||
} else {
|
||||
value
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.codegen.inline
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.util.ArrayUtil
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.codegen.*
|
||||
import org.jetbrains.kotlin.codegen.AsmUtil.isPrimitive
|
||||
@@ -19,6 +20,7 @@ import org.jetbrains.kotlin.config.JVMConfigurationKeys
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.incremental.components.Position
|
||||
import org.jetbrains.kotlin.incremental.components.ScopeKind
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
@@ -40,6 +42,8 @@ import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
import org.jetbrains.org.objectweb.asm.commons.Method
|
||||
import org.jetbrains.org.objectweb.asm.tree.*
|
||||
import java.util.*
|
||||
import kotlin.collections.HashSet
|
||||
import kotlin.math.max
|
||||
|
||||
abstract class InlineCodegen<out T : BaseExpressionCodegen>(
|
||||
@@ -107,9 +111,11 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
|
||||
)
|
||||
}
|
||||
|
||||
protected fun generateStub(text: String, codegen: BaseExpressionCodegen) {
|
||||
protected fun generateStub(resolvedCall: ResolvedCall<*>?, codegen: BaseExpressionCodegen) {
|
||||
leaveTemps()
|
||||
AsmUtil.genThrow(codegen.v, "java/lang/UnsupportedOperationException", "Call is part of inline cycle: $text")
|
||||
assert(resolvedCall != null)
|
||||
val message = "Call is part of inline cycle: " + resolvedCall!!.call.callElement.text
|
||||
AsmUtil.genThrow(codegen.v, "java/lang/UnsupportedOperationException", message)
|
||||
}
|
||||
|
||||
protected fun endCall(result: InlineResult, registerLineNumberAfterwards: Boolean) {
|
||||
@@ -480,7 +486,7 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
|
||||
assert(constantValue is Int) { "Mask should be of Integer type, but " + constantValue }
|
||||
maskValues.add(constantValue as Int)
|
||||
if (maskStartIndex == -1) {
|
||||
maskStartIndex = invocationParamBuilder.listAllParams().sumOf {
|
||||
maskStartIndex = invocationParamBuilder.listAllParams().sumBy {
|
||||
if (it is CapturedParamInfo) 0 else it.type.size
|
||||
}
|
||||
}
|
||||
@@ -598,6 +604,14 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
|
||||
return (directMember as? ImportedFromObjectCallableDescriptor<*>)?.callableFromObject ?: directMember
|
||||
}
|
||||
|
||||
private fun cloneMethodNode(methodNode: MethodNode): MethodNode {
|
||||
methodNode.instructions.resetLabels()
|
||||
return MethodNode(
|
||||
Opcodes.API_VERSION, methodNode.access, methodNode.name, methodNode.desc, methodNode.signature,
|
||||
ArrayUtil.toStringArray(methodNode.exceptions)
|
||||
).also(methodNode::accept)
|
||||
}
|
||||
|
||||
private fun doCreateMethodNodeFromCompiled(
|
||||
callableDescriptor: CallableMemberDescriptor,
|
||||
state: GenerationState,
|
||||
@@ -625,17 +639,35 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
|
||||
?: throw IllegalStateException("Couldn't find declaration file for $containerId")
|
||||
}
|
||||
|
||||
val methodNode = getMethodNodeInner(containerId, bytes, asmMethod, callableDescriptor) ?: return null
|
||||
|
||||
// KLUDGE: Inline suspend function built with compiler version less than 1.1.4/1.2-M1 did not contain proper
|
||||
// before/after suspension point marks, so we detect those functions here and insert the corresponding marks
|
||||
if (isLegacySuspendInlineFunction(callableDescriptor)) {
|
||||
insertLegacySuspendInlineMarks(methodNode.node)
|
||||
}
|
||||
|
||||
return methodNode
|
||||
}
|
||||
|
||||
private fun getMethodNodeInner(
|
||||
containerId: ClassId,
|
||||
bytes: ByteArray,
|
||||
asmMethod: Method,
|
||||
callableDescriptor: CallableMemberDescriptor
|
||||
): SMAPAndMethodNode? {
|
||||
val classType = AsmUtil.asmTypeByClassId(containerId)
|
||||
val methodNode = getMethodNode(bytes, asmMethod.name, asmMethod.descriptor, classType)
|
||||
var methodNode = getMethodNode(bytes, asmMethod.name, asmMethod.descriptor, classType)
|
||||
if (methodNode == null && requiresFunctionNameManglingForReturnType(callableDescriptor)) {
|
||||
val nameWithoutManglingSuffix = asmMethod.name.stripManglingSuffixOrNull()
|
||||
if (nameWithoutManglingSuffix != null) {
|
||||
val methodWithoutMangling = getMethodNode(bytes, nameWithoutManglingSuffix, asmMethod.descriptor, classType)
|
||||
if (methodWithoutMangling != null) return methodWithoutMangling
|
||||
methodNode = getMethodNode(bytes, nameWithoutManglingSuffix, asmMethod.descriptor, classType)
|
||||
}
|
||||
if (methodNode == null) {
|
||||
val nameWithImplSuffix = "$nameWithoutManglingSuffix-impl"
|
||||
methodNode = getMethodNode(bytes, nameWithImplSuffix, asmMethod.descriptor, classType)
|
||||
}
|
||||
return getMethodNode(bytes, "$nameWithoutManglingSuffix-impl", asmMethod.descriptor, classType)
|
||||
}
|
||||
|
||||
return methodNode
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user