JDK-8132973 : @BeanProperty: what is the correct output in case of repeating annotations?
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.beans
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-08-04
  • Updated: 2017-05-17
  • Resolved: 2016-05-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b124Fixed
Related Reports
Relates :  
Relates :  
Description
What is the correct behavior in the following case?


import java.beans.*;

public class PropertyAccessLevelTest {
    
    public static class C1 {
        private boolean x;
        @BeanProperty(hidden = true, expert = true, description = "xxx")
        public void setX(boolean b) { x = b; }
        @BeanProperty(hidden = false, expert = false, description = "yyy")
        public boolean getX() { return x; }
    }

    public static class C2 {
        private boolean x;
        @BeanProperty(hidden = false, expert = false, description = "yyy")
        public void setX(boolean b) { x = b; }
        @BeanProperty(hidden = true, expert = true, description = "xxx")
        public boolean getX() { return x; }
    }

    private static void runTest(Class<?> c) throws Exception {

        BeanInfo i = Introspector.getBeanInfo(c, Object.class);
        PropertyDescriptor pd[] = i.getPropertyDescriptors();
        for (PropertyDescriptor d: pd) {
            System.out.print(d.getShortDescription());
            System.out.print(", hidden = " + d.isHidden());
            System.out.println(", expert = " + d.isExpert());
        }
    }
    
    public static void main(String[] args) throws Exception {
        runTest(C1.class);
        runTest(C2.class);
    }
}

Output (Win 7, JDK9 b72):
yyy, hidden = true, expert = true
xxx, hidden = true, expert = true
Comments
URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/b050aa286bc5 User: lana Date: 2016-06-22 19:53:10 +0000
22-06-2016

URL: http://hg.openjdk.java.net/jdk9/client/jdk/rev/b050aa286bc5 User: serb Date: 2016-05-26 13:13:12 +0000
26-05-2016

please update test/java/beans/Introspector/BeanPropertyTest.java, test/java/beans/Introspector/AnonymousClassBeanPropertyTest.java after the bug fix
26-04-2016