InelliJ IDEA navigation in this scenario in Kotlin language
Answered
Consider this kotlin interface:
interface Command
interface CommandHandler<Q: Command, R> {
fun handle(command: Q): R
}
data class TestCommand(): Command //does not really mather, inside just some @field:JsonProperty("value") val blabla: String
Now there is a Spring Service for example:
@RestController
@RequestMapping("/test")
class TestEndpoint(private val testCommandHandler: CommandHandler<TestCommand, Unit>)
{
@PostMapping("/aaa")
fun testMethod(@RequestBody command: TestCommand): ResponseEntity<Void> {
testCommandHandler.handle(command)
}
Consider that when you left click on "handle" you will go straight to CommandHandler interface rather than to one and only:
@Component
class TestCommandHandler(): CommandHandler<TestCommand, Unit> {
override fun handle(command: TestCommand) {
(...)
}
Is there an option how to navigate straight to one and only implementation of this interface?
Please sign in to leave a comment.
I think you want "Go to implementation" (Ctrl+Alt+B): https://www.jetbrains.com/help/idea/navigating-through-the-source-code.html#go_to_implementation
"I think you want "Go to implementation" (Ctrl+Alt+B):"
Not really - this option will show me all implementations of
Hey,
Alexey - is the scenario clear?
I asked this question with more informations here:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/360010459120-IntelliJ-IDEA-navigation-in-this-scenario-in-Kotlin-language
https://discuss.kotlinlang.org/t/intellij-idea-navigation-in-this-scenario-in-kotlin-language/20844
Thanks for the example project! I think what you are describing is https://youtrack.jetbrains.com/issue/KT-38739, please watch the issue for updates.