Skip to content

Java 7 only - PropertyPathFactoryBean requires a bean setter in version 3.1.1.RELEASE. Works fine under Java 6. [SPR-9414] #14050

Closed

Description

@spring-projects-issues

David Boden opened SPR-9414 and commented

Exactly the same example specified in issue #13589 now works fine in Java 6 (after the bug fix) but does not work under Java 7, specifically tested under Oracle JDK 1.7.0_04.

The workaround is also available in issue #13589.


Affects: 3.1.1

Sub-tasks:

Issue Links:

13 votes, 10 watchers

Activity

  1. spring-projects-issues commented on May 16, 2012

    @spring-projects-issues
    CollaboratorAuthor

    David Boden commented

    Example stack trace:

    Caused by: org.springframework.beans.NotReadablePropertyException: Invalid property 'options' of bean class [com.example.CoreCommandLineArgumentProcessorImpl]: Bean property 'options' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
    at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:729)
    at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:576)
    at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:553)
    at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:719)
    at org.springframework.beans.factory.config.PropertyPathFactoryBean.getObject(PropertyPathFactoryBean.java:208)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
    ... 37 more

  2. spring-projects-issues commented on May 16, 2012

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

    Thanks, David. Can you confirm whether ExtendedBeanInfoTests passes for you under JDK 7? If you haven't built the framework before, it's quite easy these days.

  3. spring-projects-issues commented on Aug 2, 2012

    @spring-projects-issues
    CollaboratorAuthor

    Daniel Mavis commented

    Just ran the ExtendedBeanInfoTests (on master 04bfc80) under JDK 7 (update 5) and it fails for the standardReadMethodsAndOverloadedNonStandardWriteMethods test method. Note all tests do pass for JDK 6 (update 33).

  4. spring-projects-issues commented on Aug 3, 2012

    @spring-projects-issues
    CollaboratorAuthor

    Daniel Mavis commented

    I found this issue while investigating a problem with PropertyAccessorFactory.forBeanPropertyAccess under Java 7. I wrote an additional test case for the ExtendedBeanInfoTests to demonstrate the issue (note this passes under Java 6):

    @Test
    public void exampleFailure() throws IntrospectionException {
    	@SuppressWarnings("unused") class Parent {
    		public Number getProperty1() {
    			return 1;
    		}
    	}
    	
    	class Child extends Parent {
    		@Override
    		public Integer getProperty1() {
    			return 2;
    		}
    	}
    	
    	{
    		ExtendedBeanInfo bi = new ExtendedBeanInfo(Introspector.getBeanInfo(Parent.class));
    		assertThat(hasReadMethodForProperty(bi, "property1"), is(true)); //passes
    	}
    	{
    		ExtendedBeanInfo bi = new ExtendedBeanInfo(Introspector.getBeanInfo(Child.class));
    		assertThat(hasReadMethodForProperty(bi, "property1"), is(true)); //fails???
    	}
    }
    

    I can open a new issue if necessary, but it appears there may be more than one issue with the ExtendedBeanInfo class under Java 7.

  5. spring-projects-issues commented on Aug 3, 2012

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

    @Daniel, no need for a new issue at this point. Thanks for the test.

  6. spring-projects-issues commented on Sep 9, 2012

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

    This issue is now resolved with the commit shown below.

    More importantly, with the completion of #14357 ExtendedBeanInfo is now no longer part of the default code path, meaning that even though this regression has been fixed, it would no longer be encountered anyway. Note that #14357 applies only to 3.2 and beyond, whereas the specific fix addressed by this issue will be backported to 3.1.x with #14412.

    commit b50bb5071ac353e77e9d38c72f888de3add923b2
    Author: Chris Beams <[email protected]>
    Commit: Chris Beams <[email protected]>
    
        Address various ExtendedBeanInfo bugs
        
         - Ensure that ExtendedBeanInfoTests succeeds when building under JDK 7
        
         - Improve handling of read and write method registration where
           generic interfaces are involved, per SPR-9453
        
         - Add repro test for SPR-9702, in which EBI fails to register
           an indexed read method under certain circumstances
        
        Issue: SPR-9702, SPR-9414, SPR-9453
    
  7. 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.

  8. added
    type: bug
    in: core
    has: votes-jira
    on Jan 11, 2019
  9. added this to the 3.1.3 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

    has: votes-jirain: coretype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions