Skip to content

Commit

Permalink
fix compile error from pr-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hundun000 committed Aug 20, 2024
1 parent 575b7ed commit 7ace541
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public abstract class AbstractSubCommandGroup(
private val reflector by lazy { SubCommandReflector(this, GroupedCommandSubCommandAnnotationResolver) }

@ExperimentalCommandDescriptors
public final override val provideOverloads: List<CommandSignatureFromKFunction> by lazy {
public final override val overloads: List<CommandSignatureFromKFunction> by lazy {
reflector.findSubCommands().also {
reflector.validate(it)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ internal object GroupedCommandSubCommandAnnotationResolver :
override fun getDescription(ownerCommand: Any, function: KFunction<*>): String? =
function.findAnnotation<AbstractSubCommandGroup.AnotherDescription>()?.value

override fun hasPropertyAnnotation(command: Any, kProperty: KProperty<*>): Boolean =
override fun isCombinedCommand(command: Any, kProperty: KProperty<*>): Boolean =
kProperty.hasAnnotation<AbstractSubCommandGroup.AnotherCombinedCommand>()

}
Expand All @@ -125,15 +125,15 @@ internal object SimpleCommandSubCommandAnnotationResolver :
override fun getDescription(ownerCommand: Command, function: KFunction<*>): String =
ownerCommand.description

override fun hasPropertyAnnotation(command: Command, kProperty: KProperty<*>): Boolean = false
override fun isCombinedCommand(command: Command, kProperty: KProperty<*>): Boolean = false
}

internal interface SubCommandAnnotationResolver<T> {
fun hasAnnotation(ownerCommand: T, function: KFunction<*>): Boolean
fun getSubCommandNames(ownerCommand: T, function: KFunction<*>): Array<out String>
fun getAnnotatedName(ownerCommand: T, parameter: KParameter): String?
fun getDescription(ownerCommand: T, function: KFunction<*>): String?
fun hasPropertyAnnotation(command: T, kProperty: KProperty<*>): Boolean
fun isCombinedCommand(command: T, kProperty: KProperty<*>): Boolean
}

@ConsoleExperimentalApi
Expand Down Expand Up @@ -232,7 +232,7 @@ internal class SubCommandReflector<T: Any>(
throw IllegalCommandDeclarationException(owner, this, message)
}

private fun KProperty<*>.isSubCommandProviderProperty(): Boolean = annotationResolver.hasPropertyAnnotation(owner, this)
private fun KProperty<*>.isSubCommandProviderProperty(): Boolean = annotationResolver.isCombinedCommand(owner, this)
private fun KFunction<*>.isSubCommandFunction(): Boolean = annotationResolver.hasAnnotation(owner, this)
private fun KFunction<*>.checkExtensionReceiver() {
this.extensionReceiverParameter?.let { receiver ->
Expand Down Expand Up @@ -396,7 +396,7 @@ internal class SubCommandReflector<T: Any>(
.filter { it is SubCommandGroup }
.flatMap { property ->
property as SubCommandGroup
property.provideOverloads
property.overloads
}.toList()

val list: MutableList<CommandSignatureFromKFunction> = ArrayList()
Expand Down

0 comments on commit 7ace541

Please sign in to comment.