Skip to content

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

Closed

Description

@spring-projects-issues

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:

1 votes, 3 watchers

Activity

  1. spring-projects-issues commented on Jan 24, 2012

    @spring-projects-issues
    CollaboratorAuthor

    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

  2. spring-projects-issues commented on Jan 24, 2012

    @spring-projects-issues
    CollaboratorAuthor

    Thomas Risberg commented

    #13577 test case

  3. spring-projects-issues commented on Feb 13, 2012

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

    commit b787a68f2050df179f7036b209aa741230a02477
    Author: Chris Beams <[email protected]>
    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
    
  4. spring-projects-issues commented on Nov 25, 2012

    @spring-projects-issues
    CollaboratorAuthor

    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.

  5. added
    type: bug
    in: core
    on Jan 11, 2019
  6. added this to the 3.1.1 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coretype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions