Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.beans.IntrospectionException: type mismatch between indexed and non-indexed methods: <method_name> [SPR-8937] #13577

Closed
spring-issuemaster opened this issue Dec 15, 2011 · 4 comments
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Dec 15, 2011

Dan Avila opened SPR-8937 and commented

This is an extension to https://jira.springsource.org/browse/SPR-8491.

I have a bean that extends a JTable. When that bean is created, I see the following error:

java.beans.IntrospectionException: type mismatch between indexed and non-indexed methods: rowHeight

JTable has two setter methods:

  • setRowHeight(row, rowHeight);
  • setRowHeight(rowHeight);

I'm guessing the first method is the culprit.

This problem is preventing me from upgrading to 3.1.0.RELEASE from 3.0.6.RELEASE.

I did not explore much to find a workaround.


Affects: 3.1 GA

Attachments:

Issue Links:

  • #14663 Overhaul non-void JavaBean write method support
  • #13571 Regression - Introspection with BeanUtils started failing for java.math.BigDecimal
  • #17183 ExtendedBeanInfo test fails on JDK 8u40 Build b19

1 votes, 3 watchers

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jan 24, 2012

Thomas Risberg commented

I have come across this issue as well - seems the problem is that the code doesn't follow the JavaBean specification since for an indexed property any non indexed access should accept or return arrays of the indexed type and not individual objects. This did not cause an exception in Spring 3.0.x though, so something has changed.

I'm attaching a sample project that illustrates this issue.

-Thomas

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jan 24, 2012

Thomas Risberg commented

#13577 test case

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Feb 13, 2012

Chris Beams commented

commit b787a68f2050df179f7036b209aa741230a02477
Author: Chris Beams <cbeams@vmware.com>
Date:   Mon Feb 13 13:50:38 2012 +0100

    Avoid 'type mismatch' errors in ExtendedBeanInfo
    
    Prior to this commit, ExtendedBeanInfo would add non-indexed write
    methods without consideration for the presence of indexed read/write
    methods, which is invalid per the JavaBeans spec and per the behavior
    of java.beans.Introspector.  That is, a method with the signature
    
        void setFoo(Foo foo)
    
    Should never be registered as a write method if the following method
    signature is also present in the class
    
        void setFoo(int i, Foo foo)
    
    In most cases, this oversight caused no problems, but in certain
    situations where a bean actually contains such a mismatch of methods,
    "type mismatch" errors were thrown when ExtendedBeanInfo attempted the
    illegal addition against the underlying property descriptor.
    
    The implementation is now more careful about checking the parameter type
    of write methods -- if the property descriptor in question is an
    IndexedPropertyDescriptor, i.e. has an indexed write method, then any
    non-indexed write method candidate must have a single *array* parameter,
    which conforms to the spec and to Introspector behavior.
    
    Issue: SPR-8937
@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Nov 25, 2012

Chris Beams commented

A general note to watchers of ExtendedBeanInfo-related issues: #14663 is a major refactoring of ExtendedBeanInfo and overall support for non-void returning setter methods.

If you have submitted a reproduction project with this issue, we have run it through its paces against these new changes, but we would like to ask you to do the same against your actual applications.

Please consider updating your dev or test builds to work against 3.1.4.BUILD-SNAPSHOT and/or 3.2.0.BUILD-SNAPSHOT to verify, and we would appreciate any feedback, even if it's to let us know that all is well. So that we can consolidate feedback, please add your comments to #14663, and mention the original issue(s) that you were watching.

Thanks!

Note also that testing against 3.1.4 is preferable to 3.2.0 because ExtendedBeanInfo is always in the code path in the latter, while in 3.2.0 we've optimized things such that ExtendedBeanInfo is only in play for bean classes that have one or more non-void returning setter methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.