Jamie Mark Goodyear created CXF-8996: ----------------------------------------
Summary: JAXRS Bean introspection utility Beanspector relies on Class.getMethods natural order Key: CXF-8996 URL: https://issues.apache.org/jira/browse/CXF-8996 Project: CXF Issue Type: Improvement Components: JAX-RS Affects Versions: 4.0.4 Reporter: Jamie Mark Goodyear Fix For: 4.0.5 JAXRS Bean introspection utility Beanspector relies on Class.getMethods natural order. For most JVMs the Beanspector Tests will pass, however IBM Java does not return methods in the same ordering. Note: Class.getMethods does not provide a prescribed ordering of methods. When CXF 4.0.x main branch is built, we'll observe: {{Apache CXF JAX-RS Extensions: Search fails.}} {{{}[ERROR] Failures:{}}}{{{}[ERROR] org.apache.cxf.jaxrs.ext.search.BeanspectorTest.testMismatchedOverriddenBeans{}}}{{{}[ERROR] Run 1: BeanspectorTest.testMismatchedOverriddenBeans Expected exception: java.lang.IllegalArgumentException{}}}{{{}[ERROR] Run 2: BeanspectorTest.testMismatchedOverriddenBeans Expected exception: java.lang.IllegalArgumentException{}}}{{{}[ERROR] Run 3: BeanspectorTest.testMismatchedOverriddenBeans Expected exception: java.lang.IllegalArgumentException{}}}{{{}[ERROR] Run 4: BeanspectorTest.testMismatchedOverriddenBeans Expected exception: java.lang.IllegalArgumentException{}}} {{{}[ERROR] org.apache.cxf.jaxrs.ext.search.BeanspectorTest.testMismatchedOverriddenBeans - Time elapsed: 0.001 s <<< FAILURE!{}}}{{{}java.lang.AssertionError: Expected exception: java.lang.IllegalArgumentException{}}} We can improve this behaviour by detecting when IBM Java is in use, and having IBM process declared methods first, then process remaining methods. This will make IBM behave more like other JVMs. I will provide a PR with the change in place. Currently testing on a variety of platforms/JVMs to ensure tests pass. {{//Class.getMethods does not provide an ordering.}} {{//IBM Java tends to have a different ordering than other JVMs, so process declared methods first.}} {{//Process remaining methods after to not miss getter/setters.}} {{if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {}} {{processMethods(tclass.getDeclaredMethods());}} {{}}} {{processMethods(tclass.getMethods());}} -- This message was sent by Atlassian Jira (v8.20.10#820010)