Get rid of deprecated annotations and modifiers in project code
This commit is contained in:
@@ -52,7 +52,8 @@ object KotlinAntTaskUtil {
|
||||
return this
|
||||
}
|
||||
|
||||
synchronized fun getOrCreateClassLoader(): ClassLoader {
|
||||
@Synchronized
|
||||
fun getOrCreateClassLoader(): ClassLoader {
|
||||
val cached = classLoaderRef.get()
|
||||
if (cached != null) return cached
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.jetbrains.kotlin.types.JetType
|
||||
import org.jetbrains.kotlin.types.isDynamic
|
||||
import org.jetbrains.kotlin.utils.keysToMapExceptNulls
|
||||
import java.util.Comparator
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public object CodegenUtilKt {
|
||||
|
||||
@@ -35,7 +34,8 @@ public object CodegenUtilKt {
|
||||
// toTrait = Bar
|
||||
// delegateExpressionType = typeof(baz)
|
||||
// return Map<member of Foo, corresponding member of typeOf(baz)>
|
||||
public platformStatic fun getDelegates(
|
||||
@JvmStatic
|
||||
public fun getDelegates(
|
||||
descriptor: ClassDescriptor,
|
||||
toTrait: ClassDescriptor,
|
||||
delegateExpressionType: JetType? = null
|
||||
|
||||
@@ -56,7 +56,7 @@ public fun <Function : FunctionHandle, Signature> generateBridges(
|
||||
// If it's a concrete fake override, some of the bridges may be inherited from the super-classes. Specifically, bridges for all
|
||||
// declarations that are reachable from all concrete immediate super-functions of the given function. Note that all such bridges are
|
||||
// guaranteed to delegate to the same implementation as bridges for the given function, that's why it's safe to inherit them
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
for (overridden in function.getOverridden() as Iterable<Function>) {
|
||||
if (!overridden.isAbstract) {
|
||||
bridgesToGenerate.removeAll(findAllReachableDeclarations(overridden).map(signature))
|
||||
@@ -77,7 +77,7 @@ private fun <Function : FunctionHandle> findAllReachableDeclarations(function: F
|
||||
}
|
||||
}
|
||||
}
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
DFS.dfs(listOf(function), { it.getOverridden() as Iterable<Function> }, collector)
|
||||
return HashSet(collector.result())
|
||||
}
|
||||
|
||||
@@ -21,16 +21,19 @@ import org.jetbrains.org.objectweb.asm.Type
|
||||
|
||||
|
||||
public object CodegenContextUtil {
|
||||
public @JvmStatic fun getImplementationOwnerClassType(owner: CodegenContext<*>): Type? =
|
||||
@JvmStatic
|
||||
public fun getImplementationOwnerClassType(owner: CodegenContext<*>): Type? =
|
||||
when (owner) {
|
||||
is DelegatingFacadeContext -> owner.delegateToClassType
|
||||
is DelegatingToPartContext -> owner.implementationOwnerClassType
|
||||
else -> null
|
||||
}
|
||||
|
||||
public @JvmStatic fun getImplementationClassShortName(owner: CodegenContext<*>): String? =
|
||||
@JvmStatic
|
||||
public fun getImplementationClassShortName(owner: CodegenContext<*>): String? =
|
||||
getImplementationOwnerClassType(owner)?.let { AsmUtil.shortNameByAsmType(it) }
|
||||
|
||||
public @JvmStatic fun isImplClassOwner(owner: CodegenContext<*>): Boolean =
|
||||
@JvmStatic
|
||||
public fun isImplClassOwner(owner: CodegenContext<*>): Boolean =
|
||||
owner !is DelegatingFacadeContext
|
||||
}
|
||||
@@ -30,7 +30,6 @@ import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.signature.SignatureReader
|
||||
import org.jetbrains.org.objectweb.asm.signature.SignatureWriter
|
||||
import org.jetbrains.org.objectweb.asm.tree.*
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public class ReifiedTypeInliner(private val parametersMapping: ReifiedTypeParameterMappings?) {
|
||||
|
||||
@@ -56,10 +55,12 @@ public class ReifiedTypeInliner(private val parametersMapping: ReifiedTypeParame
|
||||
return insn.owner == IntrinsicMethods.INTRINSICS_CLASS_NAME && namePredicate(insn.name)
|
||||
}
|
||||
|
||||
platformStatic public fun isNeedClassReificationMarker(insn: AbstractInsnNode): Boolean =
|
||||
@JvmStatic
|
||||
public fun isNeedClassReificationMarker(insn: AbstractInsnNode): Boolean =
|
||||
isReifiedMarker(insn) { s -> s == NEED_CLASS_REIFICATION_MARKER_METHOD_NAME }
|
||||
|
||||
platformStatic public fun putNeedClassReificationMarker(v: MethodVisitor) {
|
||||
@JvmStatic
|
||||
public fun putNeedClassReificationMarker(v: MethodVisitor) {
|
||||
v.visitMethodInsn(
|
||||
Opcodes.INVOKESTATIC,
|
||||
IntrinsicMethods.INTRINSICS_CLASS_NAME, NEED_CLASS_REIFICATION_MARKER_METHOD_NAME,
|
||||
|
||||
@@ -17,11 +17,10 @@
|
||||
package org.jetbrains.kotlin.codegen.inline
|
||||
|
||||
import com.intellij.util.SmartFMap
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
object SMAPParser {
|
||||
|
||||
@platformStatic
|
||||
@JvmStatic
|
||||
/*null smap means that there is no any debug info in file (e.g. sourceName)*/
|
||||
public fun parseOrCreateDefault(mappingInfo: String?, source: String?, path: String, methodStartLine: Int, methodEndLine: Int): SMAP {
|
||||
if (mappingInfo == null || mappingInfo.isEmpty()) {
|
||||
@@ -41,7 +40,7 @@ object SMAPParser {
|
||||
return parse(mappingInfo)
|
||||
}
|
||||
|
||||
@platformStatic
|
||||
@JvmStatic
|
||||
public fun parse(mappingInfo: String): SMAP {
|
||||
val fileMappings = linkedMapOf<Int, FileMapping>()
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ class TryBlockCluster<T : IntervalWithHandler>(val blocks: MutableList<T>) {
|
||||
|
||||
|
||||
fun <T : IntervalWithHandler> doClustering(blocks: List<T>): List<TryBlockCluster<T>> {
|
||||
@data class TryBlockInterval(val startLabel: LabelNode, val endLabel: LabelNode)
|
||||
data class TryBlockInterval(val startLabel: LabelNode, val endLabel: LabelNode)
|
||||
|
||||
val clusters = linkedMapOf<TryBlockInterval, TryBlockCluster<T>>()
|
||||
blocks.forEach { block ->
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
import org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode
|
||||
import org.jetbrains.org.objectweb.asm.tree.InsnList
|
||||
import org.jetbrains.org.objectweb.asm.tree.MethodInsnNode
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public val PSEUDO_INSN_CALL_OWNER: String = "kotlin/jvm/internal/\$PseudoInsn"
|
||||
|
||||
|
||||
+4
-4
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.cli.common.messages
|
||||
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public data class CompilerMessageLocation private constructor(
|
||||
public val path: String?,
|
||||
public val line: Int,
|
||||
@@ -28,9 +26,11 @@ public data class CompilerMessageLocation private constructor(
|
||||
path + (if (line != -1 || column != -1) " (" + line + ":" + column + ")" else "")
|
||||
|
||||
companion object {
|
||||
public platformStatic val NO_LOCATION: CompilerMessageLocation = CompilerMessageLocation(null, -1, -1, null)
|
||||
@JvmStatic
|
||||
public val NO_LOCATION: CompilerMessageLocation = CompilerMessageLocation(null, -1, -1, null)
|
||||
|
||||
public platformStatic fun create(
|
||||
@JvmStatic
|
||||
public fun create(
|
||||
path: String?,
|
||||
line: Int,
|
||||
column: Int,
|
||||
|
||||
@@ -99,7 +99,7 @@ public object Main {
|
||||
runner.run(classpath, arguments)
|
||||
}
|
||||
|
||||
@jvmStatic
|
||||
@JvmStatic
|
||||
public fun main(args: Array<String>) {
|
||||
try {
|
||||
run(args)
|
||||
|
||||
@@ -49,9 +49,7 @@ import org.jetbrains.kotlin.utils.PathUtil
|
||||
import java.io.File
|
||||
import java.lang.management.ManagementFactory
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
SuppressWarnings("UseOfSystemOutOrSystemErr")
|
||||
public open class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
||||
|
||||
override fun doExecute(arguments: K2JVMCompilerArguments, services: Services, messageCollector: MessageCollector, rootDisposable: Disposable): ExitCode {
|
||||
@@ -244,7 +242,8 @@ public open class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
||||
}
|
||||
}
|
||||
|
||||
platformStatic public fun main(args: Array<String>) {
|
||||
@JvmStatic
|
||||
public fun main(args: Array<String>) {
|
||||
CLICompiler.doMain(K2JVMCompiler(), args)
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.jetbrains.kotlin.compiler.plugin.*
|
||||
|
||||
public object PluginCliParser {
|
||||
|
||||
@platformStatic
|
||||
@JvmStatic
|
||||
fun loadPlugins(arguments: CommonCompilerArguments, configuration: CompilerConfiguration) {
|
||||
val classLoader = PluginURLClassLoader(
|
||||
arguments.pluginClasspaths
|
||||
@@ -103,7 +103,8 @@ public object PluginCliParser {
|
||||
private class PluginURLClassLoader(urls: Array<URL>, parent: ClassLoader) : ClassLoader(Thread.currentThread().getContextClassLoader()) {
|
||||
private val childClassLoader: SelfThenParentURLClassLoader = SelfThenParentURLClassLoader(urls, parent)
|
||||
|
||||
override synchronized fun loadClass(name: String, resolve: Boolean): Class<*> {
|
||||
@Synchronized
|
||||
override fun loadClass(name: String, resolve: Boolean): Class<*> {
|
||||
return try {
|
||||
childClassLoader.findClass(name)
|
||||
}
|
||||
|
||||
+1
-1
@@ -193,7 +193,7 @@ public class CliLightClassGenerationSupport(project: Project) : LightClassGenera
|
||||
}
|
||||
}
|
||||
|
||||
public open class CliBindingTrace TestOnly constructor() : BindingTraceContext() {
|
||||
public open class CliBindingTrace @TestOnly constructor() : BindingTraceContext() {
|
||||
private var kotlinCodeAnalyzer: KotlinCodeAnalyzer? = null
|
||||
|
||||
override fun toString(): String {
|
||||
|
||||
@@ -87,7 +87,6 @@ import org.jetbrains.kotlin.utils.PathUtil
|
||||
import java.io.File
|
||||
import java.util.ArrayList
|
||||
import java.util.Comparator
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public class KotlinCoreEnvironment private constructor(
|
||||
parentDisposable: Disposable,
|
||||
@@ -250,7 +249,8 @@ public class KotlinCoreEnvironment private constructor(
|
||||
private var ourApplicationEnvironment: JavaCoreApplicationEnvironment? = null
|
||||
private var ourProjectCount = 0
|
||||
|
||||
platformStatic public fun createForProduction(
|
||||
@JvmStatic
|
||||
public fun createForProduction(
|
||||
parentDisposable: Disposable, configuration: CompilerConfiguration, configFilePaths: List<String>
|
||||
): KotlinCoreEnvironment {
|
||||
// JPS may run many instances of the compiler in parallel (there's an option for compiling independent modules in parallel in IntelliJ)
|
||||
@@ -272,7 +272,9 @@ public class KotlinCoreEnvironment private constructor(
|
||||
return environment
|
||||
}
|
||||
|
||||
TestOnly platformStatic public fun createForTests(
|
||||
@TestOnly
|
||||
@JvmStatic
|
||||
public fun createForTests(
|
||||
parentDisposable: Disposable, configuration: CompilerConfiguration, extensionConfigs: List<String>
|
||||
): KotlinCoreEnvironment {
|
||||
// Tests are supposed to create a single project and dispose it right after use
|
||||
@@ -358,7 +360,8 @@ public class KotlinCoreEnvironment private constructor(
|
||||
}
|
||||
|
||||
// made public for Upsource
|
||||
platformStatic public fun registerApplicationServices(applicationEnvironment: JavaCoreApplicationEnvironment) {
|
||||
@JvmStatic
|
||||
public fun registerApplicationServices(applicationEnvironment: JavaCoreApplicationEnvironment) {
|
||||
with(applicationEnvironment) {
|
||||
registerFileType(JetFileType.INSTANCE, "kt")
|
||||
registerFileType(JetFileType.INSTANCE, JetParserDefinition.STD_SCRIPT_SUFFIX)
|
||||
@@ -374,7 +377,8 @@ public class KotlinCoreEnvironment private constructor(
|
||||
}
|
||||
|
||||
// made public for Upsource
|
||||
platformStatic public fun registerProjectServices(projectEnvironment: JavaCoreProjectEnvironment) {
|
||||
@JvmStatic
|
||||
public fun registerProjectServices(projectEnvironment: JavaCoreProjectEnvironment) {
|
||||
with (projectEnvironment.getProject()) {
|
||||
registerService(javaClass<JetScriptDefinitionProvider>(), JetScriptDefinitionProvider())
|
||||
registerService(javaClass<KotlinJavaPsiFacade>(), KotlinJavaPsiFacade(this))
|
||||
|
||||
@@ -31,7 +31,7 @@ public inline fun <reified T : Any> ComponentProvider.get(): T {
|
||||
return getService(javaClass<T>())
|
||||
}
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
public fun <T : Any> ComponentProvider.getService(request: Class<T>): T {
|
||||
return resolve(request)!!.getValue() as T
|
||||
}
|
||||
|
||||
+33
-17
@@ -23,19 +23,22 @@ import javax.inject.Inject
|
||||
import kotlin.test.*
|
||||
|
||||
class ComponentContainerTest {
|
||||
Test fun should_throw_when_not_composed() {
|
||||
@Test
|
||||
fun should_throw_when_not_composed() {
|
||||
val container = StorageComponentContainer("test")
|
||||
fails {
|
||||
container.resolve<TestComponentInterface>()
|
||||
}
|
||||
}
|
||||
|
||||
Test fun should_resolve_to_null_when_empty() {
|
||||
@Test
|
||||
fun should_resolve_to_null_when_empty() {
|
||||
val container = createContainer("test") { }
|
||||
assertNull(container.resolve<TestComponentInterface>())
|
||||
}
|
||||
|
||||
Test fun should_resolve_to_instance_when_registered() {
|
||||
@Test
|
||||
fun should_resolve_to_instance_when_registered() {
|
||||
val container = createContainer("test") { useImpl<TestComponent>() }
|
||||
|
||||
val descriptor = container.resolve<TestComponentInterface>()
|
||||
@@ -47,7 +50,8 @@ class ComponentContainerTest {
|
||||
}
|
||||
}
|
||||
|
||||
Test fun should_resolve_instance_dependency() {
|
||||
@Test
|
||||
fun should_resolve_instance_dependency() {
|
||||
val container = createContainer("test") {
|
||||
useInstance(ManualTestComponent("name"))
|
||||
useImpl<TestClientComponent>()
|
||||
@@ -68,7 +72,8 @@ class ComponentContainerTest {
|
||||
assertFalse(instance.dep.disposed) // should not dispose manually passed instances
|
||||
}
|
||||
|
||||
Test fun should_resolve_type_dependency() {
|
||||
@Test
|
||||
fun should_resolve_type_dependency() {
|
||||
val container = createContainer("test") {
|
||||
useImpl<TestComponent>()
|
||||
useImpl<TestClientComponent>()
|
||||
@@ -87,7 +92,8 @@ class ComponentContainerTest {
|
||||
assertTrue(instance.dep.disposed)
|
||||
}
|
||||
|
||||
Test fun should_resolve_multiple_types() {
|
||||
@Test
|
||||
fun should_resolve_multiple_types() {
|
||||
createContainer("test") {
|
||||
useImpl<TestComponent>()
|
||||
useImpl<TestClientComponent>()
|
||||
@@ -99,7 +105,8 @@ class ComponentContainerTest {
|
||||
}
|
||||
}
|
||||
|
||||
Test fun should_resolve_singleton_types_to_same_instances() {
|
||||
@Test
|
||||
fun should_resolve_singleton_types_to_same_instances() {
|
||||
createContainer("test") {
|
||||
useImpl<TestComponent>()
|
||||
useImpl<TestClientComponent>()
|
||||
@@ -113,7 +120,8 @@ class ComponentContainerTest {
|
||||
}
|
||||
}
|
||||
|
||||
Test fun should_resolve_adhoc_types_to_same_instances() {
|
||||
@Test
|
||||
fun should_resolve_adhoc_types_to_same_instances() {
|
||||
createContainer("test") {
|
||||
useImpl<TestAdhocComponent1>()
|
||||
useImpl<TestAdhocComponent2>()
|
||||
@@ -128,7 +136,8 @@ class ComponentContainerTest {
|
||||
}
|
||||
}
|
||||
|
||||
Test fun should_resolve_iterable() {
|
||||
@Test
|
||||
fun should_resolve_iterable() {
|
||||
createContainer("test") {
|
||||
useImpl<TestComponent>()
|
||||
useImpl<TestClientComponent>()
|
||||
@@ -144,7 +153,8 @@ class ComponentContainerTest {
|
||||
}
|
||||
}
|
||||
|
||||
Test fun should_resolve_java_iterable() {
|
||||
@Test
|
||||
fun should_resolve_java_iterable() {
|
||||
createContainer("test") {
|
||||
useImpl<TestComponent>()
|
||||
useImpl<TestClientComponent>()
|
||||
@@ -163,7 +173,8 @@ class ComponentContainerTest {
|
||||
}
|
||||
}
|
||||
|
||||
Test fun should_distinguish_generic() {
|
||||
@Test
|
||||
fun should_distinguish_generic() {
|
||||
createContainer("test") {
|
||||
useImpl<TestGenericClient>()
|
||||
useImpl<TestStringComponent>()
|
||||
@@ -177,8 +188,9 @@ class ComponentContainerTest {
|
||||
}
|
||||
}
|
||||
|
||||
Ignore("Need generic type substitution")
|
||||
Test fun should_resolve_generic_adhoc() {
|
||||
@Ignore("Need generic type substitution")
|
||||
@Test
|
||||
fun should_resolve_generic_adhoc() {
|
||||
createContainer("test") {
|
||||
useImpl<TestImplicitGenericClient>()
|
||||
}.use {
|
||||
@@ -189,7 +201,8 @@ class ComponentContainerTest {
|
||||
}
|
||||
}
|
||||
|
||||
Test fun should_fail_with_invalid_cardinality() {
|
||||
@Test
|
||||
fun should_fail_with_invalid_cardinality() {
|
||||
createContainer("test") {
|
||||
useImpl<TestComponent>()
|
||||
useInstance(TestComponent())
|
||||
@@ -211,7 +224,8 @@ class ComponentContainerTest {
|
||||
}
|
||||
}
|
||||
|
||||
Test fun should_inject_properties_of_singletons() {
|
||||
@Test
|
||||
fun should_inject_properties_of_singletons() {
|
||||
val withSetters = createContainer("test") {
|
||||
useImpl<WithSetters>()
|
||||
}.get<WithSetters>()
|
||||
@@ -219,7 +233,8 @@ class ComponentContainerTest {
|
||||
assertTrue(withSetters.isSetterCalled)
|
||||
}
|
||||
|
||||
Test fun should_not_inject_properties_of_instances() {
|
||||
@Test
|
||||
fun should_not_inject_properties_of_instances() {
|
||||
val withSetters = WithSetters()
|
||||
createContainer("test") {
|
||||
useInstance(withSetters)
|
||||
@@ -228,7 +243,8 @@ class ComponentContainerTest {
|
||||
assertFalse(withSetters.isSetterCalled)
|
||||
}
|
||||
|
||||
Test fun should_discover_dependencies_recursively() {
|
||||
@Test
|
||||
fun should_discover_dependencies_recursively() {
|
||||
class C
|
||||
|
||||
class B {
|
||||
|
||||
@@ -35,38 +35,46 @@ public object JvmFileClassUtil {
|
||||
public val JVM_MULTIFILE_CLASS: FqName = FqName("kotlin.jvm.JvmMultifileClass")
|
||||
public val JVM_MULTIFILE_CLASS_SHORT = JVM_MULTIFILE_CLASS.shortName().asString()
|
||||
|
||||
public @JvmStatic fun getFileClassInfo(file: JetFile, jvmFileClassAnnotations: ParsedJmvFileClassAnnotations?): JvmFileClassInfo =
|
||||
@JvmStatic
|
||||
public fun getFileClassInfo(file: JetFile, jvmFileClassAnnotations: ParsedJmvFileClassAnnotations?): JvmFileClassInfo =
|
||||
if (jvmFileClassAnnotations != null)
|
||||
getFileClassInfoForAnnotation(file, jvmFileClassAnnotations)
|
||||
else
|
||||
getDefaultFileClassInfo(file)
|
||||
|
||||
public @JvmStatic fun getFileClassInfoForAnnotation(file: JetFile, jvmFileClassAnnotations: ParsedJmvFileClassAnnotations): JvmFileClassInfo =
|
||||
@JvmStatic
|
||||
public fun getFileClassInfoForAnnotation(file: JetFile, jvmFileClassAnnotations: ParsedJmvFileClassAnnotations): JvmFileClassInfo =
|
||||
if (jvmFileClassAnnotations.multipleFiles)
|
||||
JvmMultifileClassPartInfo(getHiddenPartFqName(file, jvmFileClassAnnotations),
|
||||
getFacadeFqName(file, jvmFileClassAnnotations))
|
||||
else
|
||||
JvmSimpleFileClassInfo(getFacadeFqName(file, jvmFileClassAnnotations), true)
|
||||
|
||||
public @JvmStatic fun getDefaultFileClassInfo(file: JetFile): JvmFileClassInfo =
|
||||
@JvmStatic
|
||||
public fun getDefaultFileClassInfo(file: JetFile): JvmFileClassInfo =
|
||||
JvmSimpleFileClassInfo(PackagePartClassUtils.getPackagePartFqName(file.packageFqName, file.name), false)
|
||||
|
||||
public @JvmStatic fun getFacadeFqName(file: JetFile, jvmFileClassAnnotations: ParsedJmvFileClassAnnotations): FqName =
|
||||
@JvmStatic
|
||||
public fun getFacadeFqName(file: JetFile, jvmFileClassAnnotations: ParsedJmvFileClassAnnotations): FqName =
|
||||
file.packageFqName.child(Name.identifier(jvmFileClassAnnotations.name))
|
||||
|
||||
public @JvmStatic fun getPartFqNameForDeserializedCallable(callable: DeserializedCallableMemberDescriptor): FqName {
|
||||
@JvmStatic
|
||||
public fun getPartFqNameForDeserializedCallable(callable: DeserializedCallableMemberDescriptor): FqName {
|
||||
val implClassName = getImplClassName(callable)
|
||||
val packageFqName = (callable.containingDeclaration as PackageFragmentDescriptor).fqName
|
||||
return packageFqName.child(implClassName)
|
||||
}
|
||||
|
||||
public @JvmStatic fun getImplClassName(callable: DeserializedCallableMemberDescriptor): Name =
|
||||
@JvmStatic
|
||||
public fun getImplClassName(callable: DeserializedCallableMemberDescriptor): Name =
|
||||
callable.nameResolver.getName(callable.proto.getExtension(JvmProtoBuf.implClassName))
|
||||
|
||||
public @JvmStatic fun getHiddenPartFqName(file: JetFile, jvmFileClassAnnotations: ParsedJmvFileClassAnnotations): FqName =
|
||||
@JvmStatic
|
||||
public fun getHiddenPartFqName(file: JetFile, jvmFileClassAnnotations: ParsedJmvFileClassAnnotations): FqName =
|
||||
file.packageFqName.child(Name.identifier(manglePartName(jvmFileClassAnnotations.name, file.name)))
|
||||
|
||||
public @JvmStatic fun getMultifilePackageFacadePartInfo(file: JetFile): JvmFileClassInfo {
|
||||
@JvmStatic
|
||||
public fun getMultifilePackageFacadePartInfo(file: JetFile): JvmFileClassInfo {
|
||||
val packageFqName = file.packageFqName
|
||||
val packageFacadeFqName = PackageClassUtils.getPackageClassFqName(packageFqName)
|
||||
val filePartName = manglePartName(packageFacadeFqName.shortName().asString(), file.name)
|
||||
@@ -74,13 +82,16 @@ public object JvmFileClassUtil {
|
||||
return JvmMultifileClassPartInfo(filePartFqName, packageFacadeFqName)
|
||||
}
|
||||
|
||||
public @JvmStatic fun manglePartName(facadeName: String, fileName: String): String =
|
||||
@JvmStatic
|
||||
public fun manglePartName(facadeName: String, fileName: String): String =
|
||||
"${facadeName}__${PackagePartClassUtils.getFilePartShortName(fileName)}"
|
||||
|
||||
public @JvmStatic fun getFileClassInfoNoResolve(file: JetFile): JvmFileClassInfo =
|
||||
@JvmStatic
|
||||
public fun getFileClassInfoNoResolve(file: JetFile): JvmFileClassInfo =
|
||||
getFileClassInfo(file, parseJvmNameOnFileNoResolve(file))
|
||||
|
||||
public @JvmStatic fun parseJvmNameOnFileNoResolve(file: JetFile): ParsedJmvFileClassAnnotations? {
|
||||
@JvmStatic
|
||||
public fun parseJvmNameOnFileNoResolve(file: JetFile): ParsedJmvFileClassAnnotations? {
|
||||
val jvmName = findAnnotationEntryOnFileNoResolve(file, JVM_NAME_SHORT) ?: return null
|
||||
val nameExpr = jvmName.valueArguments.firstOrNull()?.getArgumentExpression() ?: return null
|
||||
val name = getLiteralStringFromRestrictedConstExpression(nameExpr) ?: return null
|
||||
@@ -89,7 +100,8 @@ public object JvmFileClassUtil {
|
||||
return ParsedJmvFileClassAnnotations(name, isMultifileClassPart)
|
||||
}
|
||||
|
||||
public @JvmStatic fun findAnnotationEntryOnFileNoResolve(file: JetFile, shortName: String): JetAnnotationEntry? =
|
||||
@JvmStatic
|
||||
public fun findAnnotationEntryOnFileNoResolve(file: JetFile, shortName: String): JetAnnotationEntry? =
|
||||
file.fileAnnotationList?.annotationEntries?.firstOrNull {
|
||||
it.calleeExpression?.constructorReferenceExpression?.getReferencedName() == shortName
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.jetbrains.kotlin.types.JetType
|
||||
import org.jetbrains.kotlin.types.TypeUtils
|
||||
import org.jetbrains.kotlin.types.checker.JetTypeChecker
|
||||
import org.jetbrains.kotlin.types.upperIfFlexible
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public class RuntimeAssertionInfo(public val needNotNullAssertion: Boolean, public val message: String) {
|
||||
public interface DataFlowExtras {
|
||||
@@ -47,7 +46,8 @@ public class RuntimeAssertionInfo(public val needNotNullAssertion: Boolean, publ
|
||||
}
|
||||
|
||||
companion object {
|
||||
platformStatic public fun create(
|
||||
@JvmStatic
|
||||
public fun create(
|
||||
expectedType: JetType,
|
||||
expressionType: JetType,
|
||||
dataFlowExtras: DataFlowExtras
|
||||
|
||||
+2
-1
@@ -24,7 +24,8 @@ import org.jetbrains.kotlin.resolve.BindingTrace
|
||||
import org.jetbrains.kotlin.resolve.CodeAnalyzerInitializer
|
||||
|
||||
public open class JavaClassFinderPostConstruct {
|
||||
PostConstruct public open fun postCreate() {}
|
||||
@PostConstruct
|
||||
public open fun postCreate() {}
|
||||
}
|
||||
|
||||
public class JavaLazyAnalyzerPostConstruct : JavaClassFinderPostConstruct() {
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public object SamConversionResolverImpl : SamConversionResolver {
|
||||
return SingleAbstractMethodUtils.createSamConstructorFunction(scope.getContainingDeclaration(), classifier)
|
||||
}
|
||||
|
||||
suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override fun <D : FunctionDescriptor> resolveSamAdapter(original: D): D? {
|
||||
return when {
|
||||
!SingleAbstractMethodUtils.isSamAdapterNecessary(original) -> null
|
||||
|
||||
@@ -19,11 +19,10 @@ package org.jetbrains.kotlin.load.kotlin
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public interface JvmVirtualFileFinder : VirtualFileFinder, KotlinClassFinder {
|
||||
public object SERVICE {
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun getInstance(project: Project): JvmVirtualFileFinder =
|
||||
ServiceManager.getService(project, javaClass<JvmVirtualFileFinderFactory>()).create(GlobalSearchScope.allScope(project))
|
||||
}
|
||||
|
||||
+1
-2
@@ -19,13 +19,12 @@ package org.jetbrains.kotlin.load.kotlin
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public interface JvmVirtualFileFinderFactory : VirtualFileFinderFactory {
|
||||
override fun create(scope: GlobalSearchScope): JvmVirtualFileFinder
|
||||
|
||||
public object SERVICE {
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun getInstance(project: Project): JvmVirtualFileFinderFactory =
|
||||
ServiceManager.getService(project, javaClass<JvmVirtualFileFinderFactory>())
|
||||
}
|
||||
|
||||
+18
-9
@@ -31,7 +31,8 @@ import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf
|
||||
import java.util.*
|
||||
|
||||
public object PackagePartClassUtils {
|
||||
public @JvmStatic fun getPathHashCode(file: VirtualFile): Int =
|
||||
@JvmStatic
|
||||
public fun getPathHashCode(file: VirtualFile): Int =
|
||||
file.path.toLowerCase().hashCode()
|
||||
|
||||
private val PART_CLASS_NAME_SUFFIX = "Kt"
|
||||
@@ -54,35 +55,43 @@ public object PackagePartClassUtils {
|
||||
"_$str"
|
||||
|
||||
@TestOnly
|
||||
public @JvmStatic fun getDefaultPartFqName(facadeClassFqName: FqName, file: VirtualFile): FqName =
|
||||
@JvmStatic
|
||||
public fun getDefaultPartFqName(facadeClassFqName: FqName, file: VirtualFile): FqName =
|
||||
getPackagePartFqName(facadeClassFqName.parent(), file.name)
|
||||
|
||||
public @JvmStatic fun getPackagePartFqName(packageFqName: FqName, fileName: String): FqName {
|
||||
@JvmStatic
|
||||
public fun getPackagePartFqName(packageFqName: FqName, fileName: String): FqName {
|
||||
val partClassName = getFilePartShortName(fileName)
|
||||
return packageFqName.child(Name.identifier(partClassName))
|
||||
}
|
||||
|
||||
@Deprecated("Migrate to JvmFileClassesProvider")
|
||||
public @JvmStatic fun getPackagePartInternalName(file: JetFile): String =
|
||||
@JvmStatic
|
||||
public fun getPackagePartInternalName(file: JetFile): String =
|
||||
JvmClassName.byFqNameWithoutInnerClasses(getPackagePartFqName(file)).internalName
|
||||
|
||||
@Deprecated("Migrate to JvmFileClassesProvider")
|
||||
public @JvmStatic fun getPackagePartFqName(file: JetFile): FqName =
|
||||
@JvmStatic
|
||||
public fun getPackagePartFqName(file: JetFile): FqName =
|
||||
getPackagePartFqName(file.packageFqName, file.name)
|
||||
|
||||
public @JvmStatic fun getPackagePartFqName(callable: DeserializedCallableMemberDescriptor): FqName {
|
||||
@JvmStatic
|
||||
public fun getPackagePartFqName(callable: DeserializedCallableMemberDescriptor): FqName {
|
||||
val implClassName = callable.nameResolver.getName(callable.proto.getExtension(JvmProtoBuf.implClassName))
|
||||
val packageFqName = (callable.containingDeclaration as PackageFragmentDescriptor).fqName
|
||||
return packageFqName.child(implClassName)
|
||||
}
|
||||
|
||||
public @JvmStatic fun getFilesWithCallables(files: Collection<JetFile>): List<JetFile> =
|
||||
@JvmStatic
|
||||
public fun getFilesWithCallables(files: Collection<JetFile>): List<JetFile> =
|
||||
files.filter { fileHasTopLevelCallables(it) }
|
||||
|
||||
public @JvmStatic fun fileHasTopLevelCallables(file: JetFile): Boolean =
|
||||
@JvmStatic
|
||||
public fun fileHasTopLevelCallables(file: JetFile): Boolean =
|
||||
file.declarations.any { it is JetProperty || it is JetNamedFunction }
|
||||
|
||||
public @JvmStatic fun getFilePartShortName(fileName: String): String =
|
||||
@JvmStatic
|
||||
public fun getFilePartShortName(fileName: String): String =
|
||||
getPartClassName(FileUtil.getNameWithoutExtension(fileName))
|
||||
|
||||
}
|
||||
+1
-1
@@ -53,7 +53,7 @@ public class VirtualFileKotlinClass private constructor(
|
||||
private val LOG = Logger.getInstance(javaClass<VirtualFileKotlinClass>())
|
||||
private val perfCounter = PerformanceCounter.create("Binary class from Kotlin file")
|
||||
|
||||
deprecated("Use KotlinBinaryClassCache")
|
||||
@Deprecated("Use KotlinBinaryClassCache")
|
||||
fun create(file: VirtualFile): VirtualFileKotlinClass? {
|
||||
return perfCounter.time {
|
||||
assert(file.getFileType() == JavaClassFileType.INSTANCE) { "Trying to read binary data from a non-class file $file" }
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ internal class IncrementalPackagePartProvider private constructor(
|
||||
}
|
||||
|
||||
companion object {
|
||||
@jvmStatic
|
||||
@JvmStatic
|
||||
public fun create(
|
||||
parent: PackagePartProvider,
|
||||
sourceFiles: Collection<JetFile>,
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.jetbrains.kotlin.resolve.TargetEnvironment
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactoryService
|
||||
import java.util.ArrayList
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public class JvmPlatformParameters(
|
||||
public val moduleByJavaClass: (JavaClass) -> ModuleInfo
|
||||
@@ -84,7 +83,8 @@ public object JvmAnalyzerFacade : AnalyzerFacade<JvmPlatformParameters>() {
|
||||
override val moduleParameters: ModuleParameters
|
||||
get() = TopDownAnalyzerFacadeForJVM.JVM_MODULE_PARAMETERS
|
||||
|
||||
public platformStatic fun getAllFilesToAnalyze(project: Project, moduleInfo: ModuleInfo?, baseFiles: Collection<JetFile>): List<JetFile> {
|
||||
@JvmStatic
|
||||
public fun getAllFilesToAnalyze(project: Project, moduleInfo: ModuleInfo?, baseFiles: Collection<JetFile>): List<JetFile> {
|
||||
val allFiles = ArrayList(baseFiles)
|
||||
for (externalDeclarationsProvider in ExternalDeclarationsProvider.getInstances(project)) {
|
||||
allFiles.addAll(externalDeclarationsProvider.getExternalDeclarations(moduleInfo))
|
||||
|
||||
+1
-1
@@ -166,7 +166,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager) : JetScopeImp
|
||||
private fun collectSyntheticPropertiesByName(result: SmartList<PropertyDescriptor>?, type: TypeConstructor, name: Name, processedTypes: MutableSet<TypeConstructor>?): SmartList<PropertyDescriptor>? {
|
||||
if (processedTypes != null && !processedTypes.add(type)) return result
|
||||
|
||||
@suppress("NAME_SHADOWING")
|
||||
@Suppress("NAME_SHADOWING")
|
||||
var result = result
|
||||
|
||||
val classifier = type.declarationDescriptor
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.analyzer
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.types.ErrorUtils
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public data open class AnalysisResult protected constructor(
|
||||
public val bindingContext: BindingContext,
|
||||
@@ -43,15 +42,18 @@ public data open class AnalysisResult protected constructor(
|
||||
companion object {
|
||||
public val EMPTY: AnalysisResult = success(BindingContext.EMPTY, ErrorUtils.getErrorModule())
|
||||
|
||||
platformStatic public fun success(bindingContext: BindingContext, module: ModuleDescriptor): AnalysisResult {
|
||||
@JvmStatic
|
||||
public fun success(bindingContext: BindingContext, module: ModuleDescriptor): AnalysisResult {
|
||||
return AnalysisResult(bindingContext, module, true)
|
||||
}
|
||||
|
||||
platformStatic public fun success(bindingContext: BindingContext, module: ModuleDescriptor, shouldGenerateCode: Boolean): AnalysisResult {
|
||||
@JvmStatic
|
||||
public fun success(bindingContext: BindingContext, module: ModuleDescriptor, shouldGenerateCode: Boolean): AnalysisResult {
|
||||
return AnalysisResult(bindingContext, module, shouldGenerateCode)
|
||||
}
|
||||
|
||||
platformStatic public fun error(bindingContext: BindingContext, error: Throwable): AnalysisResult {
|
||||
@JvmStatic
|
||||
public fun error(bindingContext: BindingContext, error: Throwable): AnalysisResult {
|
||||
return Error(bindingContext, error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class PseudocodeVariableDataCollector(
|
||||
) {
|
||||
val lexicalScopeVariableInfo = computeLexicalScopeVariableInfo(pseudocode)
|
||||
|
||||
suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
public fun <D> collectData(
|
||||
traversalOrder: TraversalOrder,
|
||||
mergeDataWithLocalDeclarations: Boolean,
|
||||
|
||||
@@ -197,7 +197,7 @@ public fun getExpectedTypePredicate(value: PseudoValue, bindingContext: BindingC
|
||||
}
|
||||
}
|
||||
|
||||
is MagicInstruction -> @suppress("NON_EXHAUSTIVE_WHEN") when (it.kind) {
|
||||
is MagicInstruction -> @Suppress("NON_EXHAUSTIVE_WHEN") when (it.kind) {
|
||||
AND, OR ->
|
||||
addSubtypesOf(builtIns.getBooleanType())
|
||||
|
||||
|
||||
@@ -112,14 +112,14 @@ public fun ContextForNewModule(
|
||||
return MutableModuleContextImpl(module, projectContext)
|
||||
}
|
||||
|
||||
deprecated("Used temporarily while we are in transition from to lazy resolve")
|
||||
@Deprecated("Used temporarily while we are in transition from to lazy resolve")
|
||||
public open class TypeLazinessToken {
|
||||
deprecated("Used temporarily while we are in transition from to lazy resolve")
|
||||
@Deprecated("Used temporarily while we are in transition from to lazy resolve")
|
||||
public open fun isLazy(): Boolean = false
|
||||
}
|
||||
|
||||
deprecated("Used temporarily while we are in transition from to lazy resolve")
|
||||
@Deprecated("Used temporarily while we are in transition from to lazy resolve")
|
||||
public class LazyResolveToken : TypeLazinessToken() {
|
||||
deprecated("Used temporarily while we are in transition from to lazy resolve")
|
||||
@Deprecated("Used temporarily while we are in transition from to lazy resolve")
|
||||
override fun isLazy() = true
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.jetbrains.kotlin.lexer.JetTokens
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.*
|
||||
import org.jetbrains.kotlin.utils.sure
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public object PositioningStrategies {
|
||||
private open class DeclarationHeader<T : JetDeclaration> : PositioningStrategy<T>() {
|
||||
@@ -234,7 +233,7 @@ public object PositioningStrategies {
|
||||
}
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun modifierSetPosition(vararg tokens: JetModifierKeywordToken): PositioningStrategy<JetModifierListOwner> {
|
||||
return object : PositioningStrategy<JetModifierListOwner>() {
|
||||
override fun mark(element: JetModifierListOwner): List<TextRange> {
|
||||
|
||||
@@ -48,7 +48,6 @@ import org.jetbrains.kotlin.types.Variance
|
||||
import org.jetbrains.kotlin.types.checker.JetTypeChecker
|
||||
import java.io.PrintWriter
|
||||
import java.io.StringWriter
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public object Renderers {
|
||||
|
||||
@@ -107,7 +106,7 @@ public object Renderers {
|
||||
.joinToString(separator = "\n", prefix = "\n") { DescriptorRenderer.FQ_NAMES_IN_TYPES.render(it) }
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun <T> commaSeparated(itemRenderer: Renderer<T>): Renderer<Collection<T>> = Renderer {
|
||||
collection ->
|
||||
StringBuilder {
|
||||
@@ -142,7 +141,7 @@ public object Renderers {
|
||||
renderCannotCaptureTypeParameterError(it, TabledDescriptorRenderer.create()).toString()
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun renderConflictingSubstitutionsInferenceError(
|
||||
inferenceErrorData: InferenceErrorData, result: TabledDescriptorRenderer
|
||||
): TabledDescriptorRenderer {
|
||||
@@ -197,7 +196,7 @@ public object Renderers {
|
||||
return result
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun renderParameterConstraintError(
|
||||
inferenceErrorData: InferenceErrorData, renderer: TabledDescriptorRenderer
|
||||
): TabledDescriptorRenderer {
|
||||
@@ -214,7 +213,7 @@ public object Renderers {
|
||||
}
|
||||
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun renderNoInformationForParameterError(
|
||||
inferenceErrorData: InferenceErrorData, result: TabledDescriptorRenderer
|
||||
): TabledDescriptorRenderer {
|
||||
@@ -239,7 +238,7 @@ public object Renderers {
|
||||
.text("Please specify it explicitly."))
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun renderUpperBoundViolatedInferenceError(
|
||||
inferenceErrorData: InferenceErrorData, result: TabledDescriptorRenderer
|
||||
): TabledDescriptorRenderer {
|
||||
@@ -298,7 +297,7 @@ public object Renderers {
|
||||
return result
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun renderCannotCaptureTypeParameterError(
|
||||
inferenceErrorData: InferenceErrorData, result: TabledDescriptorRenderer
|
||||
): TabledDescriptorRenderer {
|
||||
|
||||
@@ -122,7 +122,7 @@ public fun createContainerForLazyResolve(
|
||||
useImpl<ResolveSession>()
|
||||
}
|
||||
|
||||
jvmOverloads
|
||||
@JvmOverloads
|
||||
public fun createLazyResolveSession(
|
||||
moduleContext: ModuleContext,
|
||||
declarationProviderFactory: DeclarationProviderFactory,
|
||||
|
||||
@@ -30,7 +30,8 @@ import kotlin.platform.*
|
||||
*/
|
||||
class KDocLinkParser(): PsiParser {
|
||||
companion object {
|
||||
platformStatic public fun parseMarkdownLink(root: IElementType, chameleon: ASTNode): ASTNode {
|
||||
@JvmStatic
|
||||
public fun parseMarkdownLink(root: IElementType, chameleon: ASTNode): ASTNode {
|
||||
val parentElement = chameleon.getTreeParent().getPsi()
|
||||
val project = parentElement.getProject()
|
||||
val builder = PsiBuilderFactory.getInstance().createBuilder(project,
|
||||
|
||||
@@ -109,7 +109,7 @@ abstract public class JetClassOrObject :
|
||||
|
||||
public fun getSecondaryConstructors(): List<JetSecondaryConstructor> = getBody()?.getSecondaryConstructors().orEmpty()
|
||||
|
||||
deprecated(value = "It's no more possible to determine it exactly using AST. Use ClassDescriptor.getKind() instead")
|
||||
@Deprecated(value = "It's no more possible to determine it exactly using AST. Use ClassDescriptor.getKind() instead")
|
||||
public fun isAnnotation(): Boolean =
|
||||
getAnnotation(KotlinBuiltIns.FQ_NAMES.annotation.shortName().asString()) != null || hasModifier(JetTokens.ANNOTATION_KEYWORD)
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public abstract class JetConstructor<T : JetConstructor<T>> : JetDeclarationStub
|
||||
|
||||
override fun getTypeReference() = null
|
||||
|
||||
throws(IncorrectOperationException::class)
|
||||
@Throws(IncorrectOperationException::class)
|
||||
override fun setTypeReference(typeRef: JetTypeReference?) = throw IncorrectOperationException("setTypeReference to constructor")
|
||||
|
||||
override fun getColon() = findChildByType<PsiElement>(JetTokens.COLON)
|
||||
@@ -76,7 +76,7 @@ public abstract class JetConstructor<T : JetConstructor<T>> : JetDeclarationStub
|
||||
|
||||
override fun getNameIdentifier() = null
|
||||
|
||||
throws(IncorrectOperationException::class)
|
||||
@Throws(IncorrectOperationException::class)
|
||||
override fun setName(name: String): PsiElement = throw IncorrectOperationException("setName to constructor")
|
||||
|
||||
override fun getPresentation() = ItemPresentationProviders.getItemPresentation(this)
|
||||
|
||||
@@ -26,7 +26,7 @@ public interface JetElement : NavigatablePsiElement {
|
||||
|
||||
public fun <R, D> accept(visitor: JetVisitor<R, D>, data: D): R
|
||||
|
||||
@deprecated("Don't use getReference() on JetElement for the choice is unpredictable")
|
||||
@Deprecated("Don't use getReference() on JetElement for the choice is unpredictable")
|
||||
override fun getReference(): PsiReference?
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class JetObjectDeclaration : JetClassOrObject {
|
||||
|
||||
override fun getNameIdentifier(): PsiElement? = getNameAsDeclaration()?.getNameIdentifier()
|
||||
|
||||
override fun setName(NonNls name: String): PsiElement {
|
||||
override fun setName(@NonNls name: String): PsiElement {
|
||||
val declarationName = getNameAsDeclaration()
|
||||
if (declarationName == null) {
|
||||
val psiFactory = JetPsiFactory(getProject())
|
||||
|
||||
@@ -180,7 +180,7 @@ public class JetPsiFactory(private val project: Project) {
|
||||
val file = createFile(text)
|
||||
val declarations = file.getDeclarations()
|
||||
assert(declarations.size() == 1) { "${declarations.size()} declarations in $text" }
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val result = declarations.first() as TDeclaration
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.intellij.psi.impl.source.tree.LeafPsiElement
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
public interface ValueArgument {
|
||||
IfNotParsed
|
||||
@IfNotParsed
|
||||
public fun getArgumentExpression(): JetExpression?
|
||||
|
||||
public fun getArgumentName(): ValueArgumentName?
|
||||
|
||||
@@ -93,7 +93,7 @@ public fun <TElement : JetElement> createByPattern(pattern: String, vararg args:
|
||||
}
|
||||
|
||||
// convert arguments that can be converted into plain text
|
||||
@suppress("NAME_SHADOWING")
|
||||
@Suppress("NAME_SHADOWING")
|
||||
val args = args.zip(argumentTypes).map {
|
||||
val (arg, type) = it
|
||||
if (type is PlainTextArgumentType)
|
||||
|
||||
@@ -90,7 +90,7 @@ public fun PsiElement.getParentOfTypesAndPredicate<T : PsiElement>(
|
||||
): T? {
|
||||
var element = if (strict) getParent() else this
|
||||
while (element != null) {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
when {
|
||||
(parentClasses.isEmpty() || parentClasses.any { parentClass -> parentClass.isInstance(element) }) && predicate(element!! as T) ->
|
||||
return element as T
|
||||
@@ -144,7 +144,7 @@ public inline fun PsiElement.getParentOfTypeAndBranch<reified T : PsiElement>(st
|
||||
return getParentOfType<T>(strict)?.getIfChildIsInBranch(this, branch)
|
||||
}
|
||||
|
||||
public tailRecursive fun PsiElement.getOutermostParentContainedIn(container: PsiElement): PsiElement? {
|
||||
public tailrec fun PsiElement.getOutermostParentContainedIn(container: PsiElement): PsiElement? {
|
||||
val parent = getParent()
|
||||
return if (parent == container) this else parent?.getOutermostParentContainedIn(container)
|
||||
}
|
||||
@@ -157,7 +157,7 @@ public inline fun <reified T : PsiElement> PsiElement.forEachDescendantOfType(no
|
||||
forEachDescendantOfType<T>({ true }, action)
|
||||
}
|
||||
|
||||
public inline fun <reified T : PsiElement> PsiElement.forEachDescendantOfType(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) canGoInside: (PsiElement) -> Boolean, noinline action: (T) -> Unit) {
|
||||
public inline fun <reified T : PsiElement> PsiElement.forEachDescendantOfType(crossinline canGoInside: (PsiElement) -> Boolean, noinline action: (T) -> Unit) {
|
||||
this.accept(object : PsiRecursiveElementVisitor() {
|
||||
override fun visitElement(element: PsiElement) {
|
||||
if (canGoInside(element)) {
|
||||
@@ -175,7 +175,7 @@ public inline fun <reified T : PsiElement> PsiElement.anyDescendantOfType(noinli
|
||||
return findDescendantOfType<T>(predicate) != null
|
||||
}
|
||||
|
||||
public inline fun <reified T : PsiElement> PsiElement.anyDescendantOfType(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) canGoInside: (PsiElement) -> Boolean, noinline predicate: (T) -> Boolean = { true }): Boolean {
|
||||
public inline fun <reified T : PsiElement> PsiElement.anyDescendantOfType(crossinline canGoInside: (PsiElement) -> Boolean, noinline predicate: (T) -> Boolean = { true }): Boolean {
|
||||
return findDescendantOfType<T>(canGoInside, predicate) != null
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ public inline fun <reified T : PsiElement> PsiElement.findDescendantOfType(noinl
|
||||
return findDescendantOfType<T>({ true }, predicate)
|
||||
}
|
||||
|
||||
public inline fun <reified T : PsiElement> PsiElement.findDescendantOfType(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) canGoInside: (PsiElement) -> Boolean, noinline predicate: (T) -> Boolean = { true }): T? {
|
||||
public inline fun <reified T : PsiElement> PsiElement.findDescendantOfType(crossinline canGoInside: (PsiElement) -> Boolean, noinline predicate: (T) -> Boolean = { true }): T? {
|
||||
var result: T? = null
|
||||
this.accept(object : PsiRecursiveElementVisitor() {
|
||||
override fun visitElement(element: PsiElement) {
|
||||
@@ -206,7 +206,7 @@ public inline fun <reified T : PsiElement> PsiElement.collectDescendantsOfType(n
|
||||
return collectDescendantsOfType<T>({ true }, predicate)
|
||||
}
|
||||
|
||||
public inline fun <reified T : PsiElement> PsiElement.collectDescendantsOfType(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) canGoInside: (PsiElement) -> Boolean, noinline predicate: (T) -> Boolean = { true }): List<T> {
|
||||
public inline fun <reified T : PsiElement> PsiElement.collectDescendantsOfType(crossinline canGoInside: (PsiElement) -> Boolean, noinline predicate: (T) -> Boolean = { true }): List<T> {
|
||||
val result = ArrayList<T>()
|
||||
forEachDescendantOfType<T>(canGoInside) {
|
||||
if (predicate(it)) {
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.psi.JetEnumEntrySuperclassReferenceExpression
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinEnumEntrySuperclassReferenceExpressionStub
|
||||
import org.jetbrains.kotlin.psi.stubs.impl.KotlinEnumEntrySuperclassReferenceExpressionStubImpl
|
||||
|
||||
public class JetEnumEntrySuperClassReferenceExpressionElementType(NonNls debugName: String)
|
||||
public class JetEnumEntrySuperClassReferenceExpressionElementType(@NonNls debugName: String)
|
||||
: JetStubElementType<KotlinEnumEntrySuperclassReferenceExpressionStub, JetEnumEntrySuperclassReferenceExpression>(
|
||||
debugName,
|
||||
javaClass<JetEnumEntrySuperclassReferenceExpression>(),
|
||||
|
||||
@@ -48,13 +48,13 @@ public open class StubIndexService protected constructor() {
|
||||
return KotlinFileStubImpl(file, file.packageFqNameByTree.asString(), file.isScriptByTree)
|
||||
}
|
||||
|
||||
throws(IOException::class)
|
||||
@Throws(IOException::class)
|
||||
public open fun serializeFileStub(stub: KotlinFileStub, dataStream: StubOutputStream) {
|
||||
dataStream.writeName(stub.getPackageFqName().asString())
|
||||
dataStream.writeBoolean(stub.isScript())
|
||||
}
|
||||
|
||||
throws(IOException::class)
|
||||
@Throws(IOException::class)
|
||||
public open fun deserializeFileStub(dataStream: StubInputStream): KotlinFileStub {
|
||||
val packageFqNameAsString = dataStream.readName()
|
||||
val isScript = dataStream.readBoolean()
|
||||
@@ -62,7 +62,7 @@ public open class StubIndexService protected constructor() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
@jvmStatic
|
||||
@JvmStatic
|
||||
public fun getInstance(): StubIndexService {
|
||||
return ServiceManager.getService(StubIndexService::class.java) ?: NO_INDEX
|
||||
}
|
||||
|
||||
@@ -20,16 +20,17 @@ import org.jetbrains.kotlin.psi.JetModifierList
|
||||
|
||||
import org.jetbrains.kotlin.lexer.JetTokens.MODIFIER_KEYWORDS_ARRAY
|
||||
import org.jetbrains.kotlin.lexer.JetModifierKeywordToken
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public object ModifierMaskUtils {
|
||||
init {
|
||||
assert(MODIFIER_KEYWORDS_ARRAY.size() <= 32, "Current implementation depends on the ability to represent modifier list as bit mask")
|
||||
}
|
||||
|
||||
platformStatic public fun computeMaskFromModifierList(modifierList: JetModifierList): Int = computeMask { modifierList.hasModifier(it) }
|
||||
@JvmStatic
|
||||
public fun computeMaskFromModifierList(modifierList: JetModifierList): Int = computeMask { modifierList.hasModifier(it) }
|
||||
|
||||
platformStatic public fun computeMask(hasModifier: (JetModifierKeywordToken) -> Boolean): Int {
|
||||
@JvmStatic
|
||||
public fun computeMask(hasModifier: (JetModifierKeywordToken) -> Boolean): Int {
|
||||
var mask = 0
|
||||
for ((index, modifierKeywordToken) in MODIFIER_KEYWORDS_ARRAY.withIndex()) {
|
||||
if (hasModifier(modifierKeywordToken)) {
|
||||
@@ -39,13 +40,15 @@ public object ModifierMaskUtils {
|
||||
return mask
|
||||
}
|
||||
|
||||
platformStatic public fun maskHasModifier(mask: Int, modifierToken: JetModifierKeywordToken): Boolean {
|
||||
@JvmStatic
|
||||
public fun maskHasModifier(mask: Int, modifierToken: JetModifierKeywordToken): Boolean {
|
||||
val index = MODIFIER_KEYWORDS_ARRAY.indexOf(modifierToken)
|
||||
assert(index >= 0, "All JetModifierKeywordTokens should be present in MODIFIER_KEYWORDS_ARRAY")
|
||||
return (mask and (1 shl index)) != 0
|
||||
}
|
||||
|
||||
platformStatic public fun maskToString(mask: Int): String {
|
||||
@JvmStatic
|
||||
public fun maskToString(mask: Int): String {
|
||||
val sb = StringBuilder()
|
||||
sb.append("[")
|
||||
var first = true
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.jetbrains.kotlin.psi.JetAnnotationEntry
|
||||
import org.jetbrains.kotlin.psi.JetFile
|
||||
import org.jetbrains.kotlin.resolve.source.getPsi
|
||||
import java.util.ArrayList
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public object DescriptorToSourceUtils {
|
||||
private fun collectEffectiveReferencedDescriptors(result: MutableList<DeclarationDescriptor>, descriptor: DeclarationDescriptor) {
|
||||
@@ -44,19 +43,19 @@ public object DescriptorToSourceUtils {
|
||||
result.add(descriptor)
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun getEffectiveReferencedDescriptors(descriptor: DeclarationDescriptor): Collection<DeclarationDescriptor> {
|
||||
val result = ArrayList<DeclarationDescriptor>()
|
||||
collectEffectiveReferencedDescriptors(result, descriptor.getOriginal())
|
||||
return result
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun getSourceFromDescriptor(descriptor: DeclarationDescriptor): PsiElement? {
|
||||
return (descriptor as? DeclarationDescriptorWithSource)?.getSource()?.getPsi()
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun getSourceFromAnnotation(descriptor: AnnotationDescriptor): JetAnnotationEntry? {
|
||||
return descriptor.source.getPsi() as? JetAnnotationEntry
|
||||
}
|
||||
@@ -65,13 +64,13 @@ public object DescriptorToSourceUtils {
|
||||
// Returns PSI element for descriptor. If there are many relevant elements (e.g. it is fake override
|
||||
// with multiple declarations), returns null. It can't find declarations in builtins or decompiled code.
|
||||
// In IDE, use DescriptorToSourceUtilsIde instead.
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun descriptorToDeclaration(descriptor: DeclarationDescriptor): PsiElement? {
|
||||
val effectiveReferencedDescriptors = getEffectiveReferencedDescriptors(descriptor)
|
||||
return if (effectiveReferencedDescriptors.size() == 1) getSourceFromDescriptor(effectiveReferencedDescriptors.firstOrNull()!!) else null
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun getContainingFile(declarationDescriptor: DeclarationDescriptor): JetFile? {
|
||||
// declarationDescriptor may describe a synthesized element which doesn't have PSI
|
||||
// To workaround that, we find a top-level parent (which is inside a PackageFragmentDescriptor), which is guaranteed to have PSI
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
||||
import java.util.ArrayList
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public class ImportDirectiveProcessor(
|
||||
private val qualifiedExpressionResolver: QualifiedExpressionResolver
|
||||
@@ -161,7 +160,8 @@ public class ImportDirectiveProcessor(
|
||||
|
||||
public fun canAllUnderImportFromClass(descriptor: ClassDescriptor): Boolean = !descriptor.getKind().isSingleton()
|
||||
|
||||
platformStatic public fun canImportMembersFrom(
|
||||
@JvmStatic
|
||||
public fun canImportMembersFrom(
|
||||
descriptors: Collection<DeclarationDescriptor>,
|
||||
reference: JetSimpleNameExpression,
|
||||
trace: BindingTrace,
|
||||
|
||||
@@ -41,7 +41,6 @@ import org.jetbrains.kotlin.types.Variance.INVARIANT
|
||||
import org.jetbrains.kotlin.types.Variance.IN_VARIANCE
|
||||
import org.jetbrains.kotlin.types.Variance.OUT_VARIANCE
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public class TypeResolver(
|
||||
private val annotationResolver: AnnotationResolver,
|
||||
@@ -327,7 +326,7 @@ public class TypeResolver(
|
||||
}
|
||||
|
||||
companion object {
|
||||
@platformStatic
|
||||
@JvmStatic
|
||||
public fun resolveProjectionKind(projectionKind: JetProjectionKind): Variance {
|
||||
return when (projectionKind) {
|
||||
JetProjectionKind.IN -> IN_VARIANCE
|
||||
|
||||
@@ -44,7 +44,6 @@ import org.jetbrains.kotlin.resolve.source.getPsi
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||
import org.jetbrains.kotlin.psi.JetTypeParameterListOwner
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
|
||||
class VarianceChecker(private val trace: BindingTrace) {
|
||||
@@ -80,7 +79,8 @@ class VarianceChecker(private val trace: BindingTrace) {
|
||||
)
|
||||
|
||||
companion object {
|
||||
platformStatic fun recordPrivateToThisIfNeeded(trace: BindingTrace, descriptor: CallableMemberDescriptor) {
|
||||
@JvmStatic
|
||||
fun recordPrivateToThisIfNeeded(trace: BindingTrace, descriptor: CallableMemberDescriptor) {
|
||||
if (isIrrelevant(descriptor) || descriptor.getVisibility() != Visibilities.PRIVATE) return
|
||||
|
||||
val psiElement = descriptor.getSource().getPsi()
|
||||
|
||||
@@ -99,7 +99,7 @@ public class CallCompleter(
|
||||
context: BasicCallResolutionContext,
|
||||
results: OverloadResolutionResultsImpl<D>
|
||||
) {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val candidates = (if (context.collectAllCandidates) {
|
||||
results.getAllCandidates()!!
|
||||
}
|
||||
@@ -279,7 +279,7 @@ public class CallCompleter(
|
||||
val cachedData = getResolutionResultsCachedData(expression, context) ?: return null
|
||||
val (cachedResolutionResults, cachedContext, tracing) = cachedData
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val cachedResults = cachedResolutionResults as OverloadResolutionResultsImpl<CallableDescriptor>
|
||||
val contextForArgument = cachedContext.replaceBindingTrace(context.trace)
|
||||
.replaceExpectedType(context.expectedType).replaceCollectAllCandidates(false)
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ public class CallableDescriptorCollectors<D : CallableDescriptor>(val collectors
|
||||
Iterable<CallableDescriptorCollector<D>> {
|
||||
override fun iterator(): Iterator<CallableDescriptorCollector<D>> = collectors.iterator()
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
companion object {
|
||||
public val FUNCTIONS_AND_VARIABLES: CallableDescriptorCollectors<CallableDescriptor> =
|
||||
CallableDescriptorCollectors(listOf(
|
||||
|
||||
@@ -38,11 +38,11 @@ import org.jetbrains.kotlin.types.expressions.OperatorConventions
|
||||
import org.jetbrains.kotlin.types.isDynamic
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import java.util.ArrayList
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
object DynamicCallableDescriptors {
|
||||
|
||||
platformStatic fun createDynamicDescriptorScope(call: Call, owner: DeclarationDescriptor) = object : JetScopeImpl() {
|
||||
@JvmStatic
|
||||
fun createDynamicDescriptorScope(call: Call, owner: DeclarationDescriptor) = object : JetScopeImpl() {
|
||||
override fun getContainingDeclaration() = owner
|
||||
|
||||
override fun printScopeStructure(p: Printer) {
|
||||
|
||||
@@ -82,7 +82,7 @@ public fun JetCallElement.getValueArgumentsInParentheses(): List<ValueArgument>
|
||||
|
||||
public fun Call.getValueArgumentListOrElement(): JetElement = getValueArgumentList() ?: getCalleeExpression() ?: getCallElement()
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
private fun List<ValueArgument?>.filterArgsInParentheses() = filter { it !is JetFunctionLiteralArgument } as List<ValueArgument>
|
||||
|
||||
public fun Call.getValueArgumentForExpression(expression: JetExpression): ValueArgument? {
|
||||
@@ -177,7 +177,7 @@ public fun JetExpression.getFunctionResolvedCallWithAssert(context: BindingConte
|
||||
assert(resolvedCall.getResultingDescriptor() is FunctionDescriptor) {
|
||||
"ResolvedCall for this expression must be ResolvedCall<? extends FunctionDescriptor>: ${this.getTextWithLocation()}"
|
||||
}
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return resolvedCall as ResolvedCall<out FunctionDescriptor>
|
||||
}
|
||||
|
||||
|
||||
+6
-5
@@ -38,7 +38,6 @@ import org.jetbrains.kotlin.types.expressions.OperatorConventions
|
||||
import java.math.BigInteger
|
||||
import java.util.ArrayList
|
||||
import java.util.HashMap
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public class ConstantExpressionEvaluator(
|
||||
internal val builtIns: KotlinBuiltIns
|
||||
@@ -209,12 +208,14 @@ public class ConstantExpressionEvaluator(
|
||||
|
||||
|
||||
companion object {
|
||||
platformStatic public fun getConstant(expression: JetExpression, bindingContext: BindingContext): CompileTimeConstant<*>? {
|
||||
@JvmStatic
|
||||
public fun getConstant(expression: JetExpression, bindingContext: BindingContext): CompileTimeConstant<*>? {
|
||||
val constant = getPossiblyErrorConstant(expression, bindingContext) ?: return null
|
||||
return if (!constant.isError) constant else null
|
||||
}
|
||||
|
||||
platformStatic fun getPossiblyErrorConstant(expression: JetExpression, bindingContext: BindingContext): CompileTimeConstant<*>? {
|
||||
@JvmStatic
|
||||
fun getPossiblyErrorConstant(expression: JetExpression, bindingContext: BindingContext): CompileTimeConstant<*>? {
|
||||
return bindingContext.get(BindingContext.COMPILE_TIME_VALUE, expression)
|
||||
}
|
||||
}
|
||||
@@ -835,7 +836,7 @@ private val BOOLEAN = CompileTimeType<Boolean>()
|
||||
private val STRING = CompileTimeType<String>()
|
||||
private val ANY = CompileTimeType<Any>()
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
private fun <A, B> binaryOperation(
|
||||
a: CompileTimeType<A>,
|
||||
b: CompileTimeType<B>,
|
||||
@@ -844,7 +845,7 @@ private fun <A, B> binaryOperation(
|
||||
checker: Function2<BigInteger, BigInteger, BigInteger>
|
||||
) = BinaryOperationKey(a, b, functionName) to Pair(operation, checker) as Pair<Function2<Any?, Any?, Any>, Function2<BigInteger, BigInteger, BigInteger>>
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
private fun <A> unaryOperation(
|
||||
a: CompileTimeType<A>,
|
||||
functionName: String,
|
||||
|
||||
+2
-1
@@ -58,5 +58,6 @@ public class MutableDiagnosticsWithSuppression(
|
||||
modificationTracker.incModificationCount()
|
||||
}
|
||||
|
||||
TestOnly public fun getReadonlyView(): DiagnosticsWithSuppression = readonlyView()
|
||||
@TestOnly
|
||||
public fun getReadonlyView(): DiagnosticsWithSuppression = readonlyView()
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ class LazyImportResolver(
|
||||
|
||||
private inner class ImportDirectiveResolveCache(private val directive: JetImportDirective) {
|
||||
|
||||
volatile var importResolveStatus: ImportResolveStatus? = null
|
||||
@Volatile var importResolveStatus: ImportResolveStatus? = null
|
||||
|
||||
fun scopeForMode(mode: LookupMode): JetScope {
|
||||
val status = importResolveStatus
|
||||
|
||||
+2
-2
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.psi.JetFile
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import java.util.HashSet
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public abstract class DeclarationProviderFactoryService {
|
||||
|
||||
@@ -36,7 +35,8 @@ public abstract class DeclarationProviderFactoryService {
|
||||
): DeclarationProviderFactory
|
||||
|
||||
companion object {
|
||||
public platformStatic fun createDeclarationProviderFactory(
|
||||
@JvmStatic
|
||||
public fun createDeclarationProviderFactory(
|
||||
project: Project,
|
||||
storageManager: StorageManager,
|
||||
syntheticFiles: Collection<JetFile>,
|
||||
|
||||
+1
-1
@@ -142,7 +142,7 @@ public class LazyAnnotationDescriptor(
|
||||
|
||||
if (!resolutionResults.isSingleResult()) return mapOf()
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return resolutionResults.getResultingCall().getValueArguments()
|
||||
.mapValues { val (valueParameter, resolvedArgument) = it;
|
||||
if (resolvedArgument == null) null
|
||||
|
||||
+3
-3
@@ -103,7 +103,7 @@ public open class LazyClassMemberScope(
|
||||
OverridingUtil.generateOverridesInFunctionGroup(name, fromSupertypes, ArrayList(result), thisDescriptor, object : OverridingUtil.DescriptorSink {
|
||||
override fun addFakeOverride(fakeOverride: CallableMemberDescriptor) {
|
||||
assert(exactDescriptorClass.isInstance(fakeOverride)) { "Wrong descriptor type in an override: " + fakeOverride + " while expecting " + exactDescriptorClass.getSimpleName() }
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
result.add(fakeOverride as D)
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ public open class LazyClassMemberScope(
|
||||
}
|
||||
}
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
protected override fun getNonDeclaredProperties(name: Name, result: MutableSet<VariableDescriptor>) {
|
||||
createPropertiesFromPrimaryConstructorParameters(name, result)
|
||||
|
||||
@@ -323,7 +323,7 @@ public open class LazyClassMemberScope(
|
||||
|
||||
private val EXTRACT_PROPERTIES: MemberExtractor<PropertyDescriptor> = object : MemberExtractor<PropertyDescriptor> {
|
||||
override fun extract(extractFrom: JetType, name: Name): Collection<PropertyDescriptor> {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return extractFrom.memberScope.getProperties(name, NoLookupLocation.FOR_ALREADY_TRACKED) as Collection<PropertyDescriptor>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.scopes.utils.takeSnapshot
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
|
||||
public class LexicalScopeImpl jvmOverloads constructor(
|
||||
public class LexicalScopeImpl @JvmOverloads constructor(
|
||||
parent: LexicalScope,
|
||||
override val ownerDescriptor: DeclarationDescriptor,
|
||||
override val isOwnerDescriptorAccessibleByLabel: Boolean,
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.*
|
||||
|
||||
// Writes to: maps
|
||||
|
||||
public class WritableScopeImpl @jvmOverloads constructor(
|
||||
public class WritableScopeImpl @JvmOverloads constructor(
|
||||
outerScope: JetScope,
|
||||
private val ownerDeclarationDescriptor: DeclarationDescriptor,
|
||||
override val redeclarationHandler: RedeclarationHandler,
|
||||
|
||||
@@ -87,7 +87,7 @@ public fun LexicalScope.getDescriptorsFiltered(
|
||||
}
|
||||
|
||||
|
||||
@deprecated("Use getOwnProperties instead")
|
||||
@Deprecated("Use getOwnProperties instead")
|
||||
public fun LexicalScope.getLocalVariable(name: Name): VariableDescriptor? {
|
||||
processForMeAndParent {
|
||||
if (it is LazyFileScope) {
|
||||
@@ -120,7 +120,7 @@ public fun LexicalScope.asJetScope(): JetScope {
|
||||
|
||||
public fun JetScope.memberScopeAsFileScope(): FileScope = MemberScopeToFileScopeAdapter(this)
|
||||
|
||||
@deprecated("Remove this method after scope refactoring")
|
||||
@Deprecated("Remove this method after scope refactoring")
|
||||
public fun JetScope.asLexicalScope(): LexicalScope
|
||||
= if (this is LexicalToJetScopeAdapter) {
|
||||
lexicalScope
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public interface SymbolUsageValidator {
|
||||
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ public class LockBasedLazyResolveStorageManager(private val storageManager: Stor
|
||||
storageManager.compute { context.addOwnDataTo(trace, commitDiagnostics) }
|
||||
}
|
||||
|
||||
TestOnly
|
||||
@TestOnly
|
||||
override fun <K, V> getSliceContents(slice: ReadOnlySlice<K, V>) = storageManager.compute { context.getSliceContents<K, V>(slice) }
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -22,13 +22,12 @@ import org.jetbrains.kotlin.types.JetType
|
||||
import org.jetbrains.kotlin.lexer.JetTokens
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.Nullability
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import kotlin.platform.platformStatic
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValue
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace
|
||||
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext
|
||||
|
||||
object SenselessComparisonChecker {
|
||||
platformStatic fun checkSenselessComparisonWithNull(
|
||||
@JvmStatic fun checkSenselessComparisonWithNull(
|
||||
expression: JetBinaryExpression,
|
||||
left: JetExpression,
|
||||
right: JetExpression,
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.openapi.application.Application
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import java.lang.ref.WeakReference
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public open class MappedExtensionProvider<T, R>
|
||||
protected constructor(
|
||||
@@ -49,13 +48,15 @@ protected constructor(
|
||||
}
|
||||
|
||||
companion object {
|
||||
platformStatic public fun <T, R> create(epName: ExtensionPointName<T>, map: (List<T>) -> R): MappedExtensionProvider<T, R>
|
||||
@JvmStatic
|
||||
public fun <T, R> create(epName: ExtensionPointName<T>, map: (List<T>) -> R): MappedExtensionProvider<T, R>
|
||||
= MappedExtensionProvider(epName, map)
|
||||
}
|
||||
}
|
||||
|
||||
public class ExtensionProvider<T>(epName: ExtensionPointName<T>) : MappedExtensionProvider<T, List<T>>(epName, { it }) {
|
||||
companion object {
|
||||
platformStatic public fun <T> create(epName: ExtensionPointName<T>): ExtensionProvider<T> = ExtensionProvider(epName)
|
||||
@JvmStatic
|
||||
public fun <T> create(epName: ExtensionPointName<T>): ExtensionProvider<T> = ExtensionProvider(epName)
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,8 @@ public abstract class PerformanceCounter protected constructor(val name: String)
|
||||
}
|
||||
}
|
||||
|
||||
public jvmOverloads fun create(name: String, reenterable: Boolean = false): PerformanceCounter {
|
||||
@JvmOverloads
|
||||
public fun create(name: String, reenterable: Boolean = false): PerformanceCounter {
|
||||
return if (reenterable)
|
||||
ReenterableCounter(name)
|
||||
else
|
||||
|
||||
+3
-3
@@ -308,7 +308,7 @@ public open class KotlinLightClassForExplicitDeclaration(
|
||||
|
||||
private fun isAbstract(): Boolean = classOrObject.hasModifier(ABSTRACT_KEYWORD) || isInterface
|
||||
|
||||
override fun hasModifierProperty(NonNls name: String): Boolean = getModifierList().hasModifierProperty(name)
|
||||
override fun hasModifierProperty(@NonNls name: String): Boolean = getModifierList().hasModifierProperty(name)
|
||||
|
||||
override fun isDeprecated(): Boolean {
|
||||
val jetModifierList = classOrObject.modifierList ?: return false
|
||||
@@ -357,8 +357,8 @@ public open class KotlinLightClassForExplicitDeclaration(
|
||||
return qualifiedName != null && thisDescriptor != null && checkSuperTypeByFQName(thisDescriptor, qualifiedName, checkDeep)
|
||||
}
|
||||
|
||||
throws(IncorrectOperationException::class)
|
||||
override fun setName(NonNls name: String): PsiElement {
|
||||
@Throws(IncorrectOperationException::class)
|
||||
override fun setName(@NonNls name: String): PsiElement {
|
||||
getOrigin().setName(name)
|
||||
return this
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class KotlinLightClassForFacade private constructor(
|
||||
|
||||
override fun getModifierList() = modifierList
|
||||
|
||||
override fun hasModifierProperty(NonNls name: String) = modifierList.hasModifierProperty(name)
|
||||
override fun hasModifierProperty(@NonNls name: String) = modifierList.hasModifierProperty(name)
|
||||
|
||||
override fun isDeprecated() = false
|
||||
|
||||
@@ -176,7 +176,7 @@ public class KotlinLightClassForFacade private constructor(
|
||||
|
||||
override fun getInitializers() = PsiClassInitializer.EMPTY_ARRAY
|
||||
|
||||
override fun findInnerClassByName(NonNls name: String, checkBases: Boolean) = null
|
||||
override fun findInnerClassByName(@NonNls name: String, checkBases: Boolean) = null
|
||||
|
||||
override fun getName() = facadeClassFqName.shortName().asString()
|
||||
|
||||
|
||||
+1
-1
@@ -22,6 +22,6 @@ public interface CommandLineProcessor {
|
||||
public val pluginId: String
|
||||
public val pluginOptions: Collection<CliOption>
|
||||
|
||||
throws(CliOptionProcessingException::class)
|
||||
@Throws(CliOptionProcessingException::class)
|
||||
public fun processOption(option: CliOption, value: String, configuration: CompilerConfiguration)
|
||||
}
|
||||
@@ -143,7 +143,8 @@ public object KotlinCompilerClient {
|
||||
}
|
||||
|
||||
|
||||
@JvmStatic public fun main(vararg args: String) {
|
||||
@JvmStatic
|
||||
public fun main(vararg args: String) {
|
||||
val compilerId = CompilerId()
|
||||
val daemonOptions = DaemonOptions()
|
||||
val daemonLaunchingOptions = DaemonJVMOptions()
|
||||
@@ -351,7 +352,7 @@ public object KotlinCompilerClient {
|
||||
makeRunFilenameString(timestamp = "lock",
|
||||
digest = compilerId.compilerClasspath.map { File(it).absolutePath }.distinctStringsDigest(),
|
||||
port = "0"))
|
||||
private @Volatile var locked = acquireLockFile(lockFile)
|
||||
@Volatile private var locked = acquireLockFile(lockFile)
|
||||
private val channel = if (locked) RandomAccessFile(lockFile, "rw").channel else null
|
||||
private val lock = channel?.lock()
|
||||
|
||||
|
||||
@@ -271,9 +271,11 @@ public data class CompilerId(
|
||||
}
|
||||
|
||||
companion object {
|
||||
public @JvmStatic fun makeCompilerId(vararg paths: File): CompilerId = makeCompilerId(paths.asIterable())
|
||||
@JvmStatic
|
||||
public fun makeCompilerId(vararg paths: File): CompilerId = makeCompilerId(paths.asIterable())
|
||||
|
||||
public @JvmStatic fun makeCompilerId(paths: Iterable<File>): CompilerId =
|
||||
@JvmStatic
|
||||
public fun makeCompilerId(paths: Iterable<File>): CompilerId =
|
||||
CompilerId(compilerClasspath = paths.map { it.absolutePath }, compilerDigest = paths.getFilesClasspathDigest())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,8 @@ public object CompileDaemon {
|
||||
return null
|
||||
}
|
||||
|
||||
@JvmStatic public fun main(args: Array<String>) {
|
||||
@JvmStatic
|
||||
public fun main(args: Array<String>) {
|
||||
|
||||
log.info("Kotlin compiler daemon version " + (loadVersionFromResource() ?: "<unknown>"))
|
||||
log.info("daemon JVM args: " + ManagementFactory.getRuntimeMXBean().inputArguments.joinToString(" "))
|
||||
|
||||
@@ -91,7 +91,7 @@ class CompileServiceImpl<Compiler: CLICompiler<*>>(
|
||||
|
||||
// internal implementation stuff
|
||||
|
||||
private @Volatile var _lastUsedSeconds = nowSeconds()
|
||||
@Volatile private var _lastUsedSeconds = nowSeconds()
|
||||
public val lastUsedSeconds: Long get() = if (rwlock.isWriteLocked || rwlock.readLockCount - rwlock.readHoldCount > 0) nowSeconds() else _lastUsedSeconds
|
||||
|
||||
val log by lazy { Logger.getLogger("compiler") }
|
||||
|
||||
@@ -206,7 +206,7 @@ class LazyOperationsLog(
|
||||
private fun <T> Any.field(name: String): T {
|
||||
val field = this.javaClass.getDeclaredField(name)
|
||||
field.setAccessible(true)
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return field.get(this) as T
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ public class LoggingStorageManager(
|
||||
var c = this
|
||||
while (true) {
|
||||
result.addAll(c.getDeclaredFields().toList())
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val superClass = (c as Class<Any>).getSuperclass() as Class<Any>?
|
||||
if (superClass == null) break
|
||||
if (c == superClass) break
|
||||
|
||||
@@ -138,7 +138,7 @@ public class KotlinCliJavaFileManagerTest : PsiTestCase() {
|
||||
TestCase.assertNull("Should not find class in empty scope", manager.findClass("foo.Test", GlobalSearchScope.EMPTY_SCOPE))
|
||||
}
|
||||
|
||||
private fun configureManager(Language("JAVA") text: String, className: String): KotlinCliJavaFileManagerImpl {
|
||||
private fun configureManager(@Language("JAVA") text: String, className: String): KotlinCliJavaFileManagerImpl {
|
||||
val root = PsiTestUtil.createTestProjectStructure(myProject, myModule, PlatformTestCase.myFilesToDelete)
|
||||
val pkg = root.createChildDirectory(this, "foo")
|
||||
val dir = myPsiManager.findDirectory(pkg)
|
||||
|
||||
@@ -23,11 +23,13 @@ import java.io.FileInputStream
|
||||
import java.util.zip.ZipInputStream
|
||||
|
||||
public class TestStdlibWithDxTest {
|
||||
Test public fun testRuntimeWithDx() {
|
||||
@Test
|
||||
public fun testRuntimeWithDx() {
|
||||
doTest(ForTestCompileRuntime.runtimeJarForTests())
|
||||
}
|
||||
|
||||
Test public fun testReflectWithDx() {
|
||||
@Test
|
||||
public fun testReflectWithDx() {
|
||||
doTest(ForTestCompileRuntime.reflectJarForTests())
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public abstract class AbstractLocalClassProtoTest : TestCaseWithTmpdir() {
|
||||
}
|
||||
|
||||
private fun assertHasAnnotationData(clazz: Class<*>) {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val annotation = clazz.getAnnotation(
|
||||
clazz.getClassLoader().loadClass(JvmAnnotationNames.KOTLIN_CLASS.asString()) as Class<Annotation>
|
||||
)
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Services private constructor(private val map: Map<Class<*>, Any>) {
|
||||
}
|
||||
|
||||
public fun <T> get(interfaceClass: Class<T>): T {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return map.get(interfaceClass) as T
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.progress
|
||||
|
||||
import com.intellij.openapi.progress.ProcessCanceledException
|
||||
import com.intellij.openapi.progress.ProgressIndicatorProvider
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public class CompilationCanceledException : ProcessCanceledException()
|
||||
|
||||
@@ -29,12 +28,13 @@ public interface CompilationCanceledStatus {
|
||||
public object ProgressIndicatorAndCompilationCanceledStatus {
|
||||
private var canceledStatus: CompilationCanceledStatus? = null
|
||||
|
||||
platformStatic
|
||||
synchronized public fun setCompilationCanceledStatus(newCanceledStatus: CompilationCanceledStatus?): Unit {
|
||||
@JvmStatic
|
||||
@Synchronized
|
||||
public fun setCompilationCanceledStatus(newCanceledStatus: CompilationCanceledStatus?): Unit {
|
||||
canceledStatus = newCanceledStatus
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun checkCanceled(): Unit {
|
||||
ProgressIndicatorProvider.checkCanceled()
|
||||
canceledStatus?.checkCanceled()
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.utils
|
||||
import java.io.File
|
||||
import javax.xml.bind.DatatypeConverter.parseBase64Binary
|
||||
import javax.xml.bind.DatatypeConverter.printBase64Binary
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public class KotlinJavascriptMetadata(public val abiVersion: Int, public val moduleName: String, public val body: ByteArray) {
|
||||
public val isAbiVersionCompatible: Boolean = KotlinJavascriptMetadataUtils.isAbiVersionCompatible(abiVersion)
|
||||
@@ -36,15 +35,15 @@ public object KotlinJavascriptMetadataUtils {
|
||||
*/
|
||||
private val METADATA_PATTERN = "(?m)\\w+\\.$KOTLIN_JAVASCRIPT_METHOD_NAME\\((\\d+),\\s*(['\"])([^'\"]*)\\2,\\s*(['\"])([^'\"]*)\\4\\)".toPattern()
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public val ABI_VERSION: Int = 3
|
||||
|
||||
public fun replaceSuffix(filePath: String): String = filePath.substringBeforeLast(JS_EXT) + META_JS_SUFFIX
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun isAbiVersionCompatible(abiVersion: Int): Boolean = abiVersion == ABI_VERSION
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun hasMetadata(text: String): Boolean =
|
||||
KOTLIN_JAVASCRIPT_METHOD_NAME_PATTERN.matcher(text).find() && METADATA_PATTERN.matcher(text).find()
|
||||
|
||||
@@ -60,7 +59,7 @@ public object KotlinJavascriptMetadataUtils {
|
||||
public fun formatMetadataAsString(moduleName: String, content: ByteArray): String =
|
||||
"// Kotlin.$KOTLIN_JAVASCRIPT_METHOD_NAME($ABI_VERSION, \"$moduleName\", \"${printBase64Binary(content)}\");\n"
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun loadMetadata(file: File): List<KotlinJavascriptMetadata> {
|
||||
assert(file.exists()) { "Library " + file + " not found" }
|
||||
val metadataList = arrayListOf<KotlinJavascriptMetadata>()
|
||||
@@ -77,10 +76,10 @@ public object KotlinJavascriptMetadataUtils {
|
||||
return metadataList
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun loadMetadata(path: String): List<KotlinJavascriptMetadata> = loadMetadata(File(path))
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun parseMetadata(text: String, metadataList: MutableList<KotlinJavascriptMetadata>) {
|
||||
// Check for literal pattern first in order to reduce time for large files without metadata
|
||||
if (!KOTLIN_JAVASCRIPT_METHOD_NAME_PATTERN.matcher(text).find()) return
|
||||
|
||||
@@ -27,7 +27,6 @@ import java.util.jar.Attributes
|
||||
import java.util.jar.JarFile
|
||||
import java.util.jar.Manifest
|
||||
import java.util.zip.ZipFile
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public object LibraryUtils {
|
||||
private val LOG = Logger.getInstance(javaClass<LibraryUtils>())
|
||||
@@ -65,33 +64,33 @@ public object LibraryUtils {
|
||||
TITLE_KOTLIN_JAVASCRIPT_LIB = jsLib
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun getJarFile(classesRoots: List<VirtualFile>, jarName: String): VirtualFile? {
|
||||
return classesRoots.firstOrNull { it.name == jarName }
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun getKotlinJsModuleName(library: File): String? {
|
||||
return getManifestMainAttributesFromJarOrDirectory(library)?.getValue(KOTLIN_JS_MODULE_ATTRIBUTE_NAME)
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun isOldKotlinJavascriptLibrary(library: File): Boolean =
|
||||
checkAttributeValue(library, TITLE_KOTLIN_JAVASCRIPT_LIB, Attributes.Name.SPECIFICATION_TITLE) && getKotlinJsModuleName(library) != null
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun isKotlinJavascriptLibraryWithMetadata(library: File): Boolean = KotlinJavascriptMetadataUtils.loadMetadata(library).isNotEmpty()
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun isKotlinJavascriptLibrary(library: File): Boolean =
|
||||
isOldKotlinJavascriptLibrary(library) || isKotlinJavascriptLibraryWithMetadata(library)
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun isKotlinJavascriptStdLibrary(library: File): Boolean {
|
||||
return checkAttributeValue(library, TITLE_KOTLIN_JAVASCRIPT_STDLIB, Attributes.Name.IMPLEMENTATION_TITLE)
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun copyJsFilesFromLibraries(libraries: List<String>, outputLibraryJsPath: String) {
|
||||
for (library in libraries) {
|
||||
val file = File(library)
|
||||
@@ -106,12 +105,12 @@ public object LibraryUtils {
|
||||
}
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun traverseJsLibraries(libs: List<File>, action: (content: String, path: String)->Unit) {
|
||||
libs.forEach { traverseJsLibrary(it, action) }
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun traverseJsLibrary(lib: File, action: (content: String, path: String)->Unit) {
|
||||
when {
|
||||
lib.isDirectory() -> traverseDirectory(lib, action)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.jetbrains.kotlin.utils.concurrent.block
|
||||
|
||||
public class LockedClearableLazyValue<T: Any>(val lock: Any, val init: () -> T) {
|
||||
private volatile var value: T? = null
|
||||
@Volatile private var value: T? = null
|
||||
|
||||
public fun get(): T {
|
||||
val _v1 = value
|
||||
@@ -28,7 +28,7 @@ public class LockedClearableLazyValue<T: Any>(val lock: Any, val init: () -> T)
|
||||
return synchronized(lock) {
|
||||
val _v2 = value
|
||||
// Suppress because of https://youtrack.jetbrains.com/issue/KT-6176
|
||||
@suppress("UNNECESSARY_NOT_NULL_ASSERTION")
|
||||
@Suppress("UNNECESSARY_NOT_NULL_ASSERTION")
|
||||
if (_v2 != null) {
|
||||
_v2!!
|
||||
}
|
||||
|
||||
+3
-3
@@ -45,7 +45,6 @@ import org.jetbrains.kotlin.types.typeUtil.createProjection
|
||||
import org.jetbrains.kotlin.types.typeUtil.replaceAnnotations
|
||||
import org.jetbrains.kotlin.utils.sure
|
||||
import java.util.HashSet
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
private val JAVA_LANG_CLASS_FQ_NAME: FqName = FqName("java.lang.Class")
|
||||
|
||||
@@ -288,12 +287,13 @@ class LazyJavaTypeResolver(
|
||||
}
|
||||
|
||||
public object FlexibleJavaClassifierTypeCapabilities : FlexibleTypeCapabilities {
|
||||
platformStatic fun create(lowerBound: JetType, upperBound: JetType) = DelegatingFlexibleType.create(lowerBound, upperBound, this)
|
||||
@JvmStatic
|
||||
fun create(lowerBound: JetType, upperBound: JetType) = DelegatingFlexibleType.create(lowerBound, upperBound, this)
|
||||
|
||||
override val id: String get() = "kotlin.jvm.PlatformType"
|
||||
|
||||
override fun <T : TypeCapability> getCapability(capabilityClass: Class<T>, jetType: JetType, flexibility: Flexibility): T? {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return when (capabilityClass) {
|
||||
javaClass<CustomTypeVariable>(), javaClass<Specificity>() -> Impl(flexibility) as T
|
||||
else -> null
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ public object RawTypeCapabilities : TypeCapabilities {
|
||||
}
|
||||
|
||||
override fun <T : TypeCapability> getCapability(capabilityClass: Class<T>): T? {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return when(capabilityClass) {
|
||||
javaClass<CustomSubstitutionCapability>() -> RawSubstitutionCapability as T
|
||||
javaClass<CustomFlexibleRendering>() -> RawFlexibleRendering as T
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ public fun <D : CallableMemberDescriptor> D.enhanceSignature(): D {
|
||||
val enhancedReturnType = parts(isCovariant = true) { it.getReturnType()!! }.enhance()
|
||||
|
||||
if (this is JavaCallableMemberDescriptor) {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return this.enhance(enhancedReceiverType, enhancedValueParametersTypes, enhancedReturnType) as D
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ private fun <D : CallableMemberDescriptor> D.parts(isCovariant: Boolean, collect
|
||||
return SignatureParts(
|
||||
collector(this),
|
||||
this.getOverriddenDescriptors().map {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
collector(it as D)
|
||||
},
|
||||
isCovariant
|
||||
|
||||
@@ -16,22 +16,24 @@
|
||||
|
||||
package org.jetbrains.kotlin.load.kotlin
|
||||
|
||||
import kotlin.platform.platformStatic
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
// The purpose of this class is to hold a unique signature of either a method or a field, so that annotations on a member can be put
|
||||
// into a map indexed by these signatures
|
||||
data class MemberSignature private constructor(private val signature: String) {
|
||||
companion object {
|
||||
platformStatic public fun fromMethodNameAndDesc(nameAndDesc: String): MemberSignature {
|
||||
@JvmStatic
|
||||
public fun fromMethodNameAndDesc(nameAndDesc: String): MemberSignature {
|
||||
return MemberSignature(nameAndDesc)
|
||||
}
|
||||
|
||||
platformStatic public fun fromFieldNameAndDesc(name: Name, desc: String): MemberSignature {
|
||||
@JvmStatic
|
||||
public fun fromFieldNameAndDesc(name: Name, desc: String): MemberSignature {
|
||||
return MemberSignature(name.asString() + "#" + desc)
|
||||
}
|
||||
|
||||
platformStatic public fun fromMethodSignatureAndParameterIndex(signature: MemberSignature, index: Int): MemberSignature {
|
||||
@JvmStatic
|
||||
public fun fromMethodSignatureAndParameterIndex(signature: MemberSignature, index: Int): MemberSignature {
|
||||
return MemberSignature(signature.signature + "@" + index)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,8 @@ public class PackageParts(val packageFqName: String) {
|
||||
packageFqName.hashCode() * 31 + parts.hashCode()
|
||||
|
||||
companion object {
|
||||
@jvmStatic public fun PackageParts.serialize(builder: JvmPackageTable.PackageTable.Builder) {
|
||||
@JvmStatic
|
||||
public fun PackageParts.serialize(builder: JvmPackageTable.PackageTable.Builder) {
|
||||
if (this.parts.isNotEmpty()) {
|
||||
val packageParts = JvmPackageTable.PackageParts.newBuilder()
|
||||
packageParts.setPackageFqName(this.packageFqName)
|
||||
|
||||
+4
-5
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.serialization.jvm
|
||||
import com.google.protobuf.ExtensionRegistryLite
|
||||
import org.jetbrains.kotlin.serialization.ClassData
|
||||
import org.jetbrains.kotlin.serialization.PackageData
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public object JvmProtoBufUtil {
|
||||
public val EXTENSION_REGISTRY: ExtensionRegistryLite = run {
|
||||
@@ -28,15 +27,15 @@ public object JvmProtoBufUtil {
|
||||
registry
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun readClassDataFrom(encodedData: Array<String>): ClassData = readClassDataFrom(BitEncoding.decodeBytes(encodedData))
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun readClassDataFrom(data: ByteArray): ClassData = ClassData.read(data, EXTENSION_REGISTRY)
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun readPackageDataFrom(encodedData: Array<String>): PackageData = readPackageDataFrom(BitEncoding.decodeBytes(encodedData))
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun readPackageDataFrom(data: ByteArray): PackageData = PackageData.read(data, EXTENSION_REGISTRY)
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import java.lang.reflect.Constructor
|
||||
import java.lang.reflect.Field
|
||||
import java.lang.reflect.Method
|
||||
|
||||
suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||
private val TYPES_ELIGIBLE_FOR_SIMPLE_VISIT = setOf(
|
||||
// Primitives
|
||||
javaClass<java.lang.Integer>(), javaClass<java.lang.Character>(), javaClass<java.lang.Byte>(), javaClass<java.lang.Long>(),
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.builtins
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import java.util.Collections
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public object CompanionObjectMapping {
|
||||
private val classes = linkedSetOf<ClassDescriptor>()
|
||||
@@ -33,10 +32,12 @@ public object CompanionObjectMapping {
|
||||
classes.add(builtIns.getEnum())
|
||||
}
|
||||
|
||||
public platformStatic fun allClassesWithIntrinsicCompanions(): Set<ClassDescriptor> =
|
||||
@JvmStatic
|
||||
public fun allClassesWithIntrinsicCompanions(): Set<ClassDescriptor> =
|
||||
Collections.unmodifiableSet(classes)
|
||||
|
||||
public platformStatic fun hasMappingToObject(classDescriptor: ClassDescriptor): Boolean {
|
||||
@JvmStatic
|
||||
public fun hasMappingToObject(classDescriptor: ClassDescriptor): Boolean {
|
||||
return DescriptorUtils.isCompanionObject(classDescriptor) &&
|
||||
classDescriptor.getContainingDeclaration() in classes
|
||||
}
|
||||
|
||||
+2
-3
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.descriptors.annotations
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public class AnnotationsImpl : Annotations {
|
||||
private val annotations: List<AnnotationDescriptor>
|
||||
@@ -33,7 +32,7 @@ public class AnnotationsImpl : Annotations {
|
||||
// List<AnnotationDescriptor> and List<AnnotationWithTarget> have the same signature
|
||||
private constructor(
|
||||
targetedAnnotations: List<AnnotationWithTarget>,
|
||||
@suppress("UNUSED_PARAMETER") i: Int
|
||||
@Suppress("UNUSED_PARAMETER") i: Int
|
||||
) {
|
||||
this.targetedAnnotations = targetedAnnotations
|
||||
this.annotations = targetedAnnotations.filter { it.target == null }.map { it.annotation }
|
||||
@@ -61,7 +60,7 @@ public class AnnotationsImpl : Annotations {
|
||||
override fun toString() = annotations.toString()
|
||||
|
||||
companion object {
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun create(annotationsWithTargets: List<AnnotationWithTarget>): AnnotationsImpl {
|
||||
return AnnotationsImpl(annotationsWithTargets, 0)
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public interface LookupLocation {
|
||||
}
|
||||
|
||||
public enum class NoLookupLocation : LookupLocation {
|
||||
@deprecated("Use more suitable constant if possible")
|
||||
@Deprecated("Use more suitable constant if possible")
|
||||
UNSORTED,
|
||||
FROM_IDE,
|
||||
FROM_BACKEND,
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ public class CapturedType(
|
||||
override fun getDelegate(): JetType = delegateType
|
||||
|
||||
override fun <T : TypeCapability> getCapability(capabilityClass: Class<T>): T? {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return if (capabilityClass == javaClass<SubtypingRepresentatives>()) this as T
|
||||
else super<DelegatingType>.getCapability(capabilityClass)
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class EnumValue(
|
||||
|
||||
public abstract class ErrorValue : ConstantValue<Unit>(Unit) {
|
||||
|
||||
deprecated("Should not be called, for this is not a real value, but a indication of an error")
|
||||
@Deprecated("Should not be called, for this is not a real value, but a indication of an error")
|
||||
override val value: Unit
|
||||
get() = throw UnsupportedOperationException()
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public interface JetScope {
|
||||
public fun getDeclarationsByLabel(labelName: Name): Collection<DeclarationDescriptor>
|
||||
|
||||
// Temporary overloads which will be dropped when all usages will be processed
|
||||
@deprecated("Provide `location` explicitly", replaceWith = ReplaceWith("getClassifier(name, NoLookupLocation.UNSORTED)"))
|
||||
@Deprecated("Provide `location` explicitly", replaceWith = ReplaceWith("getClassifier(name, NoLookupLocation.UNSORTED)"))
|
||||
public final fun getClassifier(name: Name): ClassifierDescriptor? = getClassifier(name, NoLookupLocation.UNSORTED)
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,7 @@ public class SubstitutingScope(private val workerScope: JetScope, private val su
|
||||
|
||||
val substituted = substitutedDescriptors!!.getOrPut(descriptor, { descriptor.substitute(substitutor) })
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return substituted as D?
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -17,14 +17,14 @@
|
||||
package org.jetbrains.kotlin.types;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public class DisjointKeysUnionTypeSubstitution private constructor(
|
||||
private val first: TypeSubstitution,
|
||||
private val second: TypeSubstitution
|
||||
) : TypeSubstitution() {
|
||||
companion object {
|
||||
platformStatic public fun create(first: TypeSubstitution, second: TypeSubstitution): TypeSubstitution {
|
||||
@JvmStatic
|
||||
public fun create(first: TypeSubstitution, second: TypeSubstitution): TypeSubstitution {
|
||||
if (first.isEmpty()) return second
|
||||
if (second.isEmpty()) return first
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user