BeanContextSupport.add(Object) synchronizes on its argument

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • 27
    • Affects Version/s: 27
    • Component/s: client-libs
    • None

      java.beans.beancontext.BeanContextSupport.add(Object targetChild)
      synchronizes on its argument.

      This can be anything, including a type which is a Valhalla value type (eg Integer) and you can't synchronize on a value type.

      import java.beans.beancontext.BeanContextSupport;

      public class BCT {

          public static void main(String[] argv) {
              BeanContextSupport bcs = new BeanContextSupport();
              bcs.add(Integer.valueOf(1));
          }
      }

      % java --enable-preview BCT
      Exception in thread "main" java.lang.IdentityException: Cannot synchronize on an instance of value class java.lang.Integer
      at java.desktop/java.beans.beancontext.BeanContextSupport.add(BeanContextSupport.java:425)
      at BCT.main(BCT.java:7)

            Assignee:
            Philip Race
            Reporter:
            Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: