Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Question about Obtaining the Element Type within the List Type #13

Open
liushengahn opened this issue Nov 20, 2024 · 2 comments
Open

Question about Obtaining the Element Type within the List Type #13

liushengahn opened this issue Nov 20, 2024 · 2 comments

Comments

@liushengahn
Copy link

Dear Doop developers,
Hello!
I've encountered a problem regarding type handling while using Doop. When dealing with data structures containing the List type, I'm not sure how to accurately obtain the specific type information of the elements contained within the List type. For example, if I have a List, I hope there's a way to determine that the elements in this List are of the Integer type within the Doop framework.
Thank you very much for taking the time to answer my question. I'm looking forward to your reply and guidance.
Thank you!

@liushengahn
Copy link
Author

I've used the --generate-artifacts-map parameter, but it seems that there's no effect. Or maybe I don't know where the generated content is.

@anantoni
Copy link
Contributor

Hi,

Java's data structures lose the type information at bytecode level due to type erasure, e.g., List becomes List. Since Doop uses facts generated from Java bytecode it is not possible to recover this information accurately, you could only do so with some sort of heuristic.

As for the flag you mentioned, --generate-artifacts-map generates a map between classes and their containing jar files, it's not related to what you are looking for.

I hope this clears things out.

@anantoni anantoni reopened this Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants