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

Class.getConstructor() performance regression

XMLWordPrintable

    • b154
    • Not verified

        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.

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

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

                Created:
                Updated:
                Resolved: