From 343153754c59d0eba86622c3a562dea4c0e66594 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Thu, 5 Jan 2023 13:34:21 +0200 Subject: [PATCH] Ensure that Kotlin implementation of QuarkusApplication works properly Fixes: #30190 Follows up on: #30058 (which incorrectly checked for QuarkusApplication as a superclass) (cherry picked from commit d5fb7fcacb724e51c66d45b3725468324a970d56) --- .../deployment/steps/MainClassBuildStep.java | 20 +++++-------------- .../src/main/kotlin/org/acme/Main.kt | 15 ++++++++++++++ 2 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 integration-tests/gradle/src/main/resources/kotlin-grpc-project/src/main/kotlin/org/acme/Main.kt diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java index 5238f2e607e2f..947e55779c7b5 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java @@ -418,25 +418,15 @@ public MainClassBuildItem mainClassBuildStep(BuildProducer d.equals(mainClassDotName)); + if (!hasQuarkusApplicationInterface) { className += "Kt"; } } diff --git a/integration-tests/gradle/src/main/resources/kotlin-grpc-project/src/main/kotlin/org/acme/Main.kt b/integration-tests/gradle/src/main/resources/kotlin-grpc-project/src/main/kotlin/org/acme/Main.kt new file mode 100644 index 0000000000000..46b8d7e400e0d --- /dev/null +++ b/integration-tests/gradle/src/main/resources/kotlin-grpc-project/src/main/kotlin/org/acme/Main.kt @@ -0,0 +1,15 @@ +package org.acme + +import io.quarkus.runtime.Quarkus +import io.quarkus.runtime.QuarkusApplication +import io.quarkus.runtime.annotations.QuarkusMain + +@QuarkusMain +class Main : QuarkusApplication { + + @Throws(Exception::class) + override fun run(vararg args: String?): Int { + Quarkus.waitForExit() + return 0 + } +}