diff --git a/resteasy-client-microprofile/src/main/java/org/jboss/resteasy/microprofile/client/RestClientBuilderImpl.java b/resteasy-client-microprofile/src/main/java/org/jboss/resteasy/microprofile/client/RestClientBuilderImpl.java index a6ae08bff0c..0e6247c8525 100644 --- a/resteasy-client-microprofile/src/main/java/org/jboss/resteasy/microprofile/client/RestClientBuilderImpl.java +++ b/resteasy-client-microprofile/src/main/java/org/jboss/resteasy/microprofile/client/RestClientBuilderImpl.java @@ -364,22 +364,16 @@ private void verifyInterface(Class typeDef) { // invalid parameter Path classPathAnno = typeDef.getAnnotation(Path.class); - final Set classLevelVariables = new HashSet<>(); - ResteasyUriBuilder classTemplate = null; - if (classPathAnno != null) { - classTemplate = (ResteasyUriBuilder) UriBuilder.fromUri(classPathAnno.value()); - classLevelVariables.addAll(classTemplate.getPathParamNamesInDeclarationOrder()); // TODO: doesn't seem to be used! - } - ResteasyUriBuilder template; + ResteasyUriBuilder template = null; for (Method method : methods) { - Path methodPathAnno = method.getAnnotation(Path.class); if (methodPathAnno != null) { template = classPathAnno == null ? (ResteasyUriBuilder) UriBuilder.fromUri(methodPathAnno.value()) : (ResteasyUriBuilder) UriBuilder.fromUri(classPathAnno.value() + "/" + methodPathAnno.value()); - } else { - template = classTemplate; + } else if (classPathAnno != null) { + template = (ResteasyUriBuilder) UriBuilder.fromUri(classPathAnno.value()); } + if (template == null) { continue; } diff --git a/resteasy-client-microprofile/src/test/java/org/jboss/resteasy/microprofile/client/RESTEASY_2335_Resource.java b/resteasy-client-microprofile/src/test/java/org/jboss/resteasy/microprofile/client/RESTEASY_2335_Resource.java new file mode 100644 index 00000000000..491cbb8f8d3 --- /dev/null +++ b/resteasy-client-microprofile/src/test/java/org/jboss/resteasy/microprofile/client/RESTEASY_2335_Resource.java @@ -0,0 +1,15 @@ +package org.jboss.resteasy.microprofile.client; + +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; + +@Path("/{id}") +public interface RESTEASY_2335_Resource { + @GET + String get(@PathParam("id") String id); + + @POST + String post(@PathParam("id") String id); +} diff --git a/resteasy-client-microprofile/src/test/java/org/jboss/resteasy/microprofile/client/RESTEASY_2335_Test.java b/resteasy-client-microprofile/src/test/java/org/jboss/resteasy/microprofile/client/RESTEASY_2335_Test.java new file mode 100644 index 00000000000..60369bc1507 --- /dev/null +++ b/resteasy-client-microprofile/src/test/java/org/jboss/resteasy/microprofile/client/RESTEASY_2335_Test.java @@ -0,0 +1,15 @@ +package org.jboss.resteasy.microprofile.client; + +import org.eclipse.microprofile.rest.client.RestClientBuilder; +import org.junit.Test; + +import java.net.URI; + +public class RESTEASY_2335_Test { + public static final String HTTP_LOCALHOST_8080 = "http://localhost:8080"; + + @Test + public void test2335() { + RestClientBuilder.newBuilder().baseUri(URI.create(HTTP_LOCALHOST_8080)).build(RESTEASY_2335_Resource.class); + } +}