mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:10:43 +07:00
API dumps: dump experimental APIs into a separate file api-dump-experimental.txt
GitOrigin-RevId: 2073b4ee9a1c8c13742aad0554a4e87b3f9c0fac
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7c8f647878
commit
81747daafe
@@ -12,7 +12,6 @@ import org.objectweb.asm.Opcodes
|
||||
import org.objectweb.asm.Type
|
||||
import org.objectweb.asm.tree.AnnotationNode
|
||||
import java.nio.file.Path
|
||||
import kotlin.collections.set
|
||||
import kotlin.io.path.ExperimentalPathApi
|
||||
import kotlin.io.path.inputStream
|
||||
import kotlin.io.path.name
|
||||
@@ -86,6 +85,14 @@ class API internal constructor(
|
||||
val publicApi: List<ApiClass> by lazy {
|
||||
publicApi(index, signatures)
|
||||
}
|
||||
|
||||
private val stableAndExperimentalApi: Pair<List<ApiClass>, List<ApiClass>> by lazy {
|
||||
stableAndExperimentalApi(publicApi)
|
||||
}
|
||||
|
||||
val stableApi: List<ApiClass> get() = stableAndExperimentalApi.first
|
||||
|
||||
val experimentalApi: List<ApiClass> get() = stableAndExperimentalApi.second
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,6 +264,40 @@ private fun publicApi(index: ApiIndex, classSignatures: List<ClassBinarySignatur
|
||||
return result
|
||||
}
|
||||
|
||||
private fun stableAndExperimentalApi(classSignatures: List<ApiClass>): Pair<List<ApiClass>, List<ApiClass>> {
|
||||
val stableClassSignatures = ArrayList<ApiClass>()
|
||||
val experimentalClassSignatures = ArrayList<ApiClass>()
|
||||
for (classSignature in classSignatures) {
|
||||
if (classSignature.flags.annotationExperimental) {
|
||||
// the whole class is experimental
|
||||
experimentalClassSignatures.add(classSignature)
|
||||
continue
|
||||
}
|
||||
val stableMembers = ArrayList<ApiMember>()
|
||||
val experimentalMembers = ArrayList<ApiMember>()
|
||||
for (member in classSignature.members) {
|
||||
val memberList = if (member.flags.annotationExperimental) {
|
||||
experimentalMembers
|
||||
}
|
||||
else {
|
||||
stableMembers
|
||||
}
|
||||
memberList.add(member)
|
||||
}
|
||||
if (experimentalMembers.isEmpty()) {
|
||||
// a stable class has only stable members
|
||||
stableClassSignatures.add(classSignature)
|
||||
continue
|
||||
}
|
||||
// keep only experimental members
|
||||
experimentalClassSignatures.add(classSignature.copy(members = experimentalMembers))
|
||||
|
||||
// keep only stable members but also keep the signature in the stable list even if all members are experimental
|
||||
stableClassSignatures.add(classSignature.copy(members = stableMembers))
|
||||
}
|
||||
return Pair(stableClassSignatures, experimentalClassSignatures)
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalPathApi::class)
|
||||
private fun classFilePaths(classRoot: Path): Sequence<Path> {
|
||||
return classRoot
|
||||
|
||||
Reference in New Issue
Block a user