2736 } |
2736 } |
2737 } |
2737 } |
2738 return; |
2738 return; |
2739 } |
2739 } |
2740 |
2740 |
2741 // tell if two classes have the same enclosing class (at package level) |
|
2742 bool InstanceKlass::is_same_package_member(const Klass* class2, TRAPS) const { |
|
2743 if (class2 == this) return true; |
|
2744 if (!class2->is_instance_klass()) return false; |
|
2745 |
|
2746 // must be in same package before we try anything else |
|
2747 if (!is_same_class_package(class2)) |
|
2748 return false; |
|
2749 |
|
2750 // As long as there is an outer_this.getEnclosingClass, |
|
2751 // shift the search outward. |
|
2752 const InstanceKlass* outer_this = this; |
|
2753 for (;;) { |
|
2754 // As we walk along, look for equalities between outer_this and class2. |
|
2755 // Eventually, the walks will terminate as outer_this stops |
|
2756 // at the top-level class around the original class. |
|
2757 bool ignore_inner_is_member; |
|
2758 const Klass* next = outer_this->compute_enclosing_class(&ignore_inner_is_member, |
|
2759 CHECK_false); |
|
2760 if (next == NULL) break; |
|
2761 if (next == class2) return true; |
|
2762 outer_this = InstanceKlass::cast(next); |
|
2763 } |
|
2764 |
|
2765 // Now do the same for class2. |
|
2766 const InstanceKlass* outer2 = InstanceKlass::cast(class2); |
|
2767 for (;;) { |
|
2768 bool ignore_inner_is_member; |
|
2769 Klass* next = outer2->compute_enclosing_class(&ignore_inner_is_member, |
|
2770 CHECK_false); |
|
2771 if (next == NULL) break; |
|
2772 // Might as well check the new outer against all available values. |
|
2773 if (next == this) return true; |
|
2774 if (next == outer_this) return true; |
|
2775 outer2 = InstanceKlass::cast(next); |
|
2776 } |
|
2777 |
|
2778 // If by this point we have not found an equality between the |
|
2779 // two classes, we know they are in separate package members. |
|
2780 return false; |
|
2781 } |
|
2782 |
|
2783 bool InstanceKlass::find_inner_classes_attr(int* ooff, int* noff, TRAPS) const { |
2741 bool InstanceKlass::find_inner_classes_attr(int* ooff, int* noff, TRAPS) const { |
2784 constantPoolHandle i_cp(THREAD, constants()); |
2742 constantPoolHandle i_cp(THREAD, constants()); |
2785 for (InnerClassesIterator iter(this); !iter.done(); iter.next()) { |
2743 for (InnerClassesIterator iter(this); !iter.done(); iter.next()) { |
2786 int ioff = iter.inner_class_info_index(); |
2744 int ioff = iter.inner_class_info_index(); |
2787 if (ioff != 0) { |
2745 if (ioff != 0) { |