commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Donaghy (JIRA)" <j...@apache.org>
Subject [jira] [Created] (BEANUTILS-415) Read method returned for a generic method overridden in a subclass is inconsistent between java 1.6 and 1.7
Date Thu, 24 May 2012 13:05:54 GMT
Michael Donaghy created BEANUTILS-415:
-----------------------------------------

             Summary: Read method returned for a generic method overridden in a subclass is
inconsistent between java 1.6 and 1.7
                 Key: BEANUTILS-415
                 URL: https://issues.apache.org/jira/browse/BEANUTILS-415
             Project: Commons BeanUtils
          Issue Type: Bug
          Components: Bean / Property Utils
         Environment: Linux/maven
            Reporter: Michael Donaghy
            Priority: Minor


The test below passes when run under java 1.7, but fails under java 1.6. I feel the behaviour
should be consistent between the two. I will provide more details if there is any difficulty
reproducing.


import static org.fest.assertions.Assertions.assertThat;
import java.beans.PropertyDescriptor;
import java.util.Arrays;
import org.apache.commons.beanutils.PropertyUtils;
import org.junit.Test;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;

public class PropertyUtilsTest {
    public static class Superclass<S> {
        private S property;
        public S getProperty() {
            return property;
        }
    }

    public static class Subclass extends Superclass<String> {
        @Override
        public String getProperty() {
            return super.getProperty();
        }
    }

    @Test
    public void usesSubclassAccessorMethod() throws Exception {
        final PropertyDescriptor[] descriptors = PropertyUtils.getPropertyDescriptors(PropertyUtilsTest.Subclass.class);
        final PropertyDescriptor descriptor = Iterables.find(Arrays.asList(descriptors), new
Predicate<PropertyDescriptor>() {

            @Override
            public boolean apply(final PropertyDescriptor input) {
                return "property".equals(input.getName());
            }
        });
        assertThat(descriptor.getReadMethod()).isEqualTo(Subclass.class.getMethod("getProperty")).isNotEqualTo(Superclass.class.getMethod("getProperty"));
    }
}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message