From d65d3b51e1c540af9dac5d6c4a1bcd150885f45f Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Mon, 5 Apr 2021 10:56:25 +0300 Subject: [PATCH] Fix JAX-RS Application class hierarchy handling in RESTEasy Classic Fixes: #16228 --- .../common/deployment/ResteasyServerCommonProcessor.java | 3 +++ .../resteasy/test/root/ApplicationPathHttpRootTest.java | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java b/extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java index f7c82dac4244f..965d7218bd412 100755 --- a/extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java +++ b/extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java @@ -953,6 +953,9 @@ private static Set getAllowedClasses(IndexView index) { Application application; ClassInfo selectedAppClass = null; for (ClassInfo applicationClassInfo : applications) { + if (Modifier.isAbstract(applicationClassInfo.flags())) { + continue; + } if (selectedAppClass != null) { throw new RuntimeException("More than one Application class: " + applications); } diff --git a/extensions/resteasy-classic/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/root/ApplicationPathHttpRootTest.java b/extensions/resteasy-classic/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/root/ApplicationPathHttpRootTest.java index 932d8a26f9097..7119705b9ae3c 100644 --- a/extensions/resteasy-classic/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/root/ApplicationPathHttpRootTest.java +++ b/extensions/resteasy-classic/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/root/ApplicationPathHttpRootTest.java @@ -23,7 +23,7 @@ public class ApplicationPathHttpRootTest { @RegisterExtension static QuarkusUnitTest runner = new QuarkusUnitTest() .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) - .addClasses(HelloResource.class, HelloApp.class) + .addClasses(HelloResource.class, HelloApp.class, BaseApplication.class) .addAsResource(new StringAsset("quarkus.http.root-path=/foo"), "application.properties")); @Test @@ -44,7 +44,11 @@ public String hello() { } @ApplicationPath("hello") - public static class HelloApp extends Application { + public static class HelloApp extends BaseApplication { + + } + + public static abstract class BaseApplication extends Application { }