Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-7966

Beanspector throws IllegalArgumentException when dealing with overridden methods

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.2.9, 3.3.2
    • 3.2.10, 3.3.3
    • None
    • None
    • Unknown

    Description

      Let's consider the following pojos: 

      public class A { 
              private String value; 
      
              public String getValue()\{ ... } 
              public void setValue(String value) \{ ... } 
      } 
      
      public class B { 
              
              private A aValue; 
      
              public A getAValue()\{ ... } 
              public void setAValue(A avalue) \{ ... } 
      } 
      

      And assume one extends these pojos and decorates them with JPA annotations. 

      To leverage CXF org.apache.cxf.jaxrs.ext.search.SearchContext and JPACriteriaQueryVisitor as explained in the docs (http://cxf.apache.org/docs/jax-rs-search.html#JAX-RSSearch-JPA2.0) and perform searches like 

      _s=aValue==*search token* 

      in OpenJPA one has to override the EntityB.getAValue as follows: 

      @Entity 
      // ... other JPA annotations are omitted 
      public class EntityB extends B { 
              
              @Override 
              // We need to specialize return type to EntityA to make SearchContext work 
              public EntityA getAValue()\{ ... } 
      
              // This method definition is needed to avoid java.lang.VerifyError from JPA provider 
              public void setAValue(EntityA avalue) \{ ... } 
      } 
      

      But with this scenario, the current implementation of org.apache.cxf.jaxrs.ext.search.Beanspector<T> fails, throwing IllegalArgumentException: Accessor 'aValue' type mismatch, getter type is X while setter type is Y, X and Y depending on the order of the EntityB's methods as returned by the Class.getMethods(). 

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              matteor matteo rulli
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m