From 7d0b4dde2510a7a09f20431528bbe09ba8a285ef Mon Sep 17 00:00:00 2001 From: fedinskiy Date: Tue, 27 Aug 2024 11:12:35 +0200 Subject: [PATCH] Add file with implicit call to blocking method (#1941) Reproducer for this fix: https://github.com/quarkusio/quarkus/pull/40721 (cherry picked from commit a2f4bc118b17654d2ed84ffec6e6f3cb0adce07b) --- .../java/com/redhat/BrokenBlockingApi.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 http/rest-client-reactive/src/main/java/com/redhat/BrokenBlockingApi.java diff --git a/http/rest-client-reactive/src/main/java/com/redhat/BrokenBlockingApi.java b/http/rest-client-reactive/src/main/java/com/redhat/BrokenBlockingApi.java new file mode 100644 index 000000000..a2cba7ab5 --- /dev/null +++ b/http/rest-client-reactive/src/main/java/com/redhat/BrokenBlockingApi.java @@ -0,0 +1,30 @@ +package com.redhat; // this bug can not be reproduced for classes in io.quarkus package + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Response; + +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; + +import io.quarkus.rest.client.reactive.ClientExceptionMapper; +import io.smallrye.common.annotation.Blocking; + +/** + * Reproducer for compilation failure + * See https://github.com/quarkusio/quarkus/issues/38275#issuecomment-2115117993 + */ +@RegisterRestClient +public interface BrokenBlockingApi { + @GET + @Path("/") + String request(); + + @Blocking + @ClientExceptionMapper + static RuntimeException toException(Response response) { + String entity = response.readEntity(String.class).isEmpty() + ? response.getStatusInfo().getReasonPhrase() + : response.readEntity(String.class); + return new RuntimeException(entity); + } +}