Uploaded image for project: 'Quarkus'
  1. Quarkus
  2. QUARKUS-1039

Handle Class.getMethods() returning multiple getters with just the return type differring

    XMLWordPrintable

Details

    Description

      This can happen when getters are defined in an implement interface with a different return type (a supertype); in that case we get two getters for the same property in the array returned by `Class.getMethods()`.

      Since the order of methods in that array is unspecified, in some cases it will work (super method then overridden method => we keep the overridden method), and in others it won't (overridden method then super method => we keep the super method).

      Changing the loop to keep the most specific getter only fixes the problem.

      I wasn't able to reproduce the problem in a unit test, but I know it happens with my JVM (OpenJDK 11) for `JaxbEmbeddable.getAttributes()`, and it caused `BytecodeRecorder` to fail, especially with the tests added by #16630 .

      Fixes #16954

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              probinso_jira Quarkus JIRA Bot
              Pablo Gonzalez Granados Pablo Gonzalez Granados (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: