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

Can code that checks classes in InnerClasses attributes be simplified?

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • 13
    • 12
    • hotspot

      Currently, JVM code that is looking at the classes listed in the InnerClasses attrbute in order to find a specific class, compares the class names, then loads the class, and then compares the Klass*'s. Can this be simplified by removing the Klass* comparison ?

      For example, in this code in InstanceKlass::find_inner_classes_attr(), if the klass names match, will 'this' ever not equal 'inner_klass' ?

              int ioff = iter.inner_class_info_index();
              if (ioff != 0) {
                // Check to see if the name matches the class we're looking for
                // before attempting to find the class.
                if (i_cp->klass_name_at_matches(this, ioff)) {
                  Klass* inner_klass = i_cp->klass_at(ioff, CHECK_false);
                  if (this == inner_klass) {

      Similar code is in Reflection::check_for_inner_class().

      If the Klass* comparison can be removed then the calls to cp->klass_at() can also be removed.

            hseigel Harold Seigel (Inactive)
            hseigel Harold Seigel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: