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

(reflect) getDeclaredMethod, getMethod, getDeclaredField, getField cause many classes to be loaded

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • P3
    • tbd
    • 7
    • core-libs
    • None

    Description

      The current implementation of getting a single method (i.e. Class.getDeclaredMethod and getMethod) has the same class loading effect as Class.getDeclaredMethods and Class.getMethods to obtain all methods. It will resolve all types declared in the method signatures.

      Similiarly for Class.getDeclaredField and getField, getting a single field will cause loading of the class of all types for all fields like Class.getDeclaredFields and getFields.

      This causes additional classes that are not used to be loaded. e.g.
      java.awt.PopupMenu and other classes loaded due to java.awt.Component.class.getDeclaredMethod() call.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mchung Mandy Chung
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Imported:
                Indexed: