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

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

XMLWordPrintable

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

      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.

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

              Created:
              Updated:
              Imported:
              Indexed: