Skip to content

Commit

Permalink
Prevent REST Client handling of abstract classes
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Sep 3, 2024
1 parent c249f75 commit 92dca03
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public static ResourceScanningResult scanResources(
MethodInfo annotatedMethod = methodAnnotationInstance.target().asMethod();
ClassInfo classWithJaxrsMethod = annotatedMethod.declaringClass();
if (Modifier.isAbstract(annotatedMethod.flags())
&& Modifier.isAbstract(classWithJaxrsMethod.flags())
&& Modifier.isInterface(classWithJaxrsMethod.flags())
&& !clientInterfaces.containsKey(classWithJaxrsMethod.name())) {
clientInterfaces.put(classWithJaxrsMethod.name(), "");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.quarkus.it.rest.client.http2;

import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;

@Path("/greet")
public abstract class AbstractGreetingResource {

@GET
@Produces(MediaType.TEXT_PLAIN)
public abstract String hello();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.quarkus.it.rest.client.http2;

public class GreetingResource extends AbstractGreetingResource {
@Override
public String hello() {
return "Hello";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package io.quarkus.it.rest.client.http2;

import static io.restassured.RestAssured.when;

import org.junit.jupiter.api.Test;

import io.quarkus.test.junit.QuarkusTest;

@QuarkusTest
class GreetingResourceTest {

@Test
void testGreeting() {
when()
.get("/greet")
.then()
.statusCode(200);
}
}

0 comments on commit 92dca03

Please sign in to comment.