Get rid of deprecated annotations and modifiers in project code
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user