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

Class.getConstructor() performance regression

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b154
    • Verification:
      Not verified

      Backports

        Description

        Additional security checks have been added to various methods of java.lang.Class, which caused a performance regression. These checks only need to be performed when a SecurityManager is enabled, but the code is structured in a way that additional methods are called even when a SecurityManager is not enabled, such as the relatively expensive Reflection.getCallerClass method.

        The fix is to restructure the calls to checkMemberAccess and checkPackageAccess so that they are only invoked when a SecurityManager is enabled.

          Attachments

          1. Clazz.java
            3 kB
          2. ClazzWithSecurityManager.java
            3 kB
          3. webrev.zip
            268 kB

            Issue Links

              Activity

                People

                Assignee:
                redestad Claes Redestad
                Reporter:
                asaha Abhijit Saha
                Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: