Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2335

RestEasy Microprofile Client has a immutable template problem/bug


    • Steps to Reproduce:

      In the attachment you can find a sample project.
      You don't need to run the quarkus server. Just execute the test. You gonna get the error immediately. Btw. I use maven.

      In the attachment you can find a sample project. You don't need to run the quarkus server. Just execute the test. You gonna get the error immediately. Btw. I use maven.


      The problem here is that, when I use a Interface (Rest Interface) for ex. here:

      public interface TagsApi {
          Map<String, Collection<Tag>> getAll(@PathParam("realm-id") String realmId);
          Collection<Tag> getTaggable(@PathParam("realm-id") String realmId, @PathParam("id") String taggableId);
          Map<String, Collection<Tag>> getAllTaggable(@PathParam("realm-id") String realmId, List<String> taggableIds);
          Tag get(@PathParam("realm-id") String realmId, @PathParam("id") String tagId);
          Response create(@PathParam("realm-id") String realmId, Tag tag);
          Response update(@PathParam("realm-id") String realmId, Tag tag);
          Response delete(@PathParam("realm-id") String realmId, @PathParam("tag-id") String tagId);
          Response updateTaggable(@PathParam("realm-id") String realmId, @PathParam("id") String taggableId, Collection<String> tagIds);

      You see the interface itself has a @Path and some methods have a path too and some of them doesn't have a path annotation so they referencing to the classPathAnnotation above. So now when you want to create a RestClient with:

      TagsApi tagsApi = RestClientBuilder.newBuilder().baseUri(URI.create("http://localhost:8080")).build(TagsApi.class);

      I get this error:

      org.eclipse.microprofile.rest.client.RestClientDefinitionException: Parameters and variables don't match on interface dev.isikemre.test.irmc.TagsApi::create

      Now, I debuged and reverse-engineered the code and I found this code below:

      The main problem is that the variable classTemplate is not immutable.
      At line 381 on the same file you see a assignment to template (a temporary variable) later in the code at 410 (like the github link above) you see that there is method call on the template variable. This mutates it and then the former classTemplate is now mutated.

      The former classTemplate's path was


      after the line 410 the path becomes


      and the second iteration in this for-loop (Line 392) got an error on line 406 because the method template.getPathParamNamesInDeclarationOrder() on line 390 returns a empty list because it cant find any pathparams, because it was mutated before.

      I hope I could explain it, well. It is a small and hidden bug.

        Gliffy Diagrams


          1. issue-resteasy-mp-client.zip
            21 kB
          2. screenshot-1.png
            601 kB
          3. screenshot-2.png
            802 kB
          4. screenshot-3.png
            2.32 MB
          5. screenshot-4.png
            1.08 MB



              • Assignee:
                weinanli Weinan Li
                isikemre Emre Isik
              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created: