Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

allow navigating from ClassInfo to its member classes #180

Closed
Ladicek opened this issue Mar 24, 2022 · 1 comment · Fixed by #185
Closed

allow navigating from ClassInfo to its member classes #180

Ladicek opened this issue Mar 24, 2022 · 1 comment · Fixed by #185
Assignees
Milestone

Comments

@Ladicek
Copy link
Contributor

Ladicek commented Mar 24, 2022

For a class, the InnerClasses bytecode attribute contains (among others) names of all its member classes. They can be recognized by outer_class_info_index being != 0. If that outer_class_info_index points to the "current" class, we know it is "our" member class. The name of the member class can be found using inner_name_index.

Names (as in, DotNames) of all member classes could be stored in the ClassInfo and serialized. That would allow, in addition to current navigation from a class to its enclosing class, also navigating from a class to its member classes.

Open questions:

  1. If I have a bunch of classes like this

    class A {
      class B {
        class C {
        }
      }
    }

    What should A's set of member classes contain? Only B, or B and C? I'd say just B. If you want C, you should navigate to it from B.

  2. Member class names in bytecode are stored in a simple form. So if I have a class com.example.A which has a member class B, we know its name is B. Do we want to return a full name of com.example.A$B? I'd say yes, it's actually pretty simple to create a componentized name of this form.

  3. What about local classes and anonymous classes? I'd say we can just ignore them, at least for now.

@Ladicek Ladicek self-assigned this Apr 14, 2022
@Ladicek Ladicek added this to the 3.0.0 milestone Apr 14, 2022
@Ladicek Ladicek linked a pull request Apr 14, 2022 that will close this issue
@Ladicek
Copy link
Contributor Author

Ladicek commented Apr 14, 2022

Done in #185.

@Ladicek Ladicek closed this as completed Apr 14, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant