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

MethodHandleProxies.WRAPPER_TYPES is not thread-safe

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      java.lang.invoke.MethodHandleProxies.WRAPPER_TYPES is a java.util.Set backed by a java.util.WeakHashMap, which is not thread-safe. And it is accessed without external synchronization.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      The non-threadsafe can, for instance, result in a wrong return value in MethodHandleProxies.isWrapperInstance(), because the caller thread may not have observed the `WRAPPER_TYPES.add` call on the defining thread of the wrapper class. (WeakHashMap might also throw exceptions on certain concurrent modifications)


            liach Chen Liang
            webbuggrp Webbug Group
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: