Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JAX-RS Application class hierarchy handling #16237

Merged
merged 2 commits into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,9 @@ private static Set<String> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class RestApplicationPathTestCase {
.overrideConfigKey("quarkus.rest.path", "/foo")
.overrideConfigKey("quarkus.http.root-path", "/app")
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(HelloResource.class, BarApp.class));
.addClasses(HelloResource.class, BarApp.class, BaseApplication.class));

/**
* Using @ApplicationPath will overlay/replace `quarkus.rest.path`.
Expand All @@ -33,7 +33,10 @@ public class RestApplicationPathTestCase {
* This path will also be relative to the configured HTTP root
*/
@ApplicationPath("/bar")
public static class BarApp extends Application {
public static class BarApp extends BaseApplication {
}

public static abstract class BaseApplication extends Application {
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ public static ApplicationScanningResult scanForApplicationClass(IndexView index,
ClassInfo selectedAppClass = null;
boolean blocking = false;
for (ClassInfo applicationClassInfo : applications) {
if (Modifier.isAbstract(applicationClassInfo.flags())) {
continue;
}
if (selectedAppClass != null) {
throw new RuntimeException("More than one Application class: " + applications);
}
Expand Down