File tree Expand file tree Collapse file tree 2 files changed +20
-15
lines changed
core/deployment/src/main/java/io/quarkus/deployment/steps
integration-tests/gradle/src/main/resources/kotlin-grpc-project/src/main/kotlin/org/acme Expand file tree Collapse file tree 2 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -419,25 +419,15 @@ public MainClassBuildItem mainClassBuildStep(BuildProducer<GeneratedClassBuildIt
419
419
}
420
420
421
421
private static String sanitizeMainClassName (ClassInfo mainClass , IndexView index ) {
422
- String className = mainClass .name ().toString ();
422
+ DotName mainClassDotName = mainClass .name ();
423
+ String className = mainClassDotName .toString ();
423
424
if (isKotlinClass (mainClass )) {
424
425
MethodInfo mainMethod = mainClass .method ("main" ,
425
426
ArrayType .create (Type .create (DotName .createSimple (String .class .getName ()), Type .Kind .CLASS ), 1 ));
426
427
if (mainMethod == null ) {
427
- ClassInfo classToCheck = mainClass ;
428
- boolean hasQuarkusApplicationSuperClass = false ;
429
- while (classToCheck != null ) {
430
- DotName superName = classToCheck .superName ();
431
- if (superName .equals (QUARKUS_APPLICATION )) {
432
- hasQuarkusApplicationSuperClass = true ;
433
- break ;
434
- }
435
- if (superName .equals (OBJECT )) {
436
- break ;
437
- }
438
- classToCheck = index .getClassByName (superName );
439
- }
440
- if (!hasQuarkusApplicationSuperClass ) {
428
+ boolean hasQuarkusApplicationInterface = index .getAllKnownImplementors (QUARKUS_APPLICATION ).stream ().map (
429
+ ClassInfo ::name ).anyMatch (d -> d .equals (mainClassDotName ));
430
+ if (!hasQuarkusApplicationInterface ) {
441
431
className += "Kt" ;
442
432
}
443
433
}
Original file line number Diff line number Diff line change
1
+ package org.acme
2
+
3
+ import io.quarkus.runtime.Quarkus
4
+ import io.quarkus.runtime.QuarkusApplication
5
+ import io.quarkus.runtime.annotations.QuarkusMain
6
+
7
+ @QuarkusMain
8
+ class Main : QuarkusApplication {
9
+
10
+ @Throws(Exception ::class )
11
+ override fun run (vararg args : String? ): Int {
12
+ Quarkus .waitForExit()
13
+ return 0
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments