Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8154932

@BeanProperty: should the "enumerationValues" element be used for any checks when calling the bean's setter?

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 9
    • client-libs

      Not sure if an issue, but filing for clarification.

      Please see the following test "bean":

      public static class D {

          public static int V1 = 1;
          public static int V2 = 2;

          private int x;

          @BeanProperty(
              description = "test property",
              preferred = true,
              required = true,
              enumerationValues = {"V1", "V2"})
          public void setX(int v) { x = v; }
          public int getX() { return x; }
      }

      1. should any checks be performed when executing, e.g., "(new D).setX(-100)" (e.g., any exception be thrown?), or these data are purely informational?
      2. the same question for the annotated getter (please see the attached test code) - especially if the property is read-only (e.g., user violates his own constrains).

      For now (JDK9 b114) nothing happens when setting invalid value.

        1. Test.java
          3 kB
          Alexander Stepanov

            Unassigned Unassigned
            avstepan Alexander Stepanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: