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

Class.getDeclaringClass() resolves unnecessary constant pool entries

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Won't Fix
    • P4
    • 9
    • 6
    • hotspot
    • generic
    • generic

    Description

      The HotSpot native implementation of
      Class.getDeclaringClass() cross-checks the relationship between
      the nested class and the enclosing class using the "inner_classes"
      attributes in respective class files of the two classes. The
      current implementation can resolve inner_classes entries which
      are class constants other than the two relevant classes. This wastes
      time and memory and can also trigger incorrect ClassCircularityErrors
      in some cases when getDeclaringClass() is called directly or indirectly
      in a class loader's loadClass() implementation.

      The HotSpot implementation of the getDeclaringClass()
      native method in jvm.cpp actually attempts to avoid
      resolving irrelevant constant pool entries by calling
      klass_name_at_matches() before calling klass_at().
      However, it then calls Reflection:check_for_inner_classes()
      which does not attempt to avoid constant pool class
      entries with irrelevant class names.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jdn Jeffrey Nisewanger (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: