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

Unsafe synchronization in BeanContextSupport.add(Object targetChild)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • tbd
    • None
    • client-libs
    • None

      The method java.beans.beancontext.BeanContextSupport.add(Object targetChild) performs a synchronization on an object received in argument which is an unsafe practice. This code will fail with primitive objects (JEP 401).

      The issue has been detected by running test api/java_beans/beancontext/BeanContextSupport/Simple.html
       with the VM flag -XX:DiagnoseSyncOnValueBasedClasses=1
      which produces the following result:

      fatal error: Synchronizing on object 0x0000100006057008 of klass java.lang.Integer at java.beans.beancontext.BeanContextSupport.add(BeanContextSupport.java:406)

            lcable Larry Cable
            fparain Frederic Parain
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: