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

Determining non-namespaced class types results in a NPE #11

Open
cspray opened this issue Jul 19, 2022 · 2 comments
Open

Determining non-namespaced class types results in a NPE #11

cspray opened this issue Jul 19, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@cspray
Copy link
Owner

cspray commented Jul 19, 2022

It is possible to annotate an anonymous class with an attribute and not have a namespacedName property present. This same problem, presumably, exists with a class that isn't namespaced. This ticket should ensure that all class types can be properly gathered.

@cspray cspray self-assigned this Jul 20, 2022
@cspray cspray added the bug Something isn't working label Jul 20, 2022
@cspray cspray changed the title Annotating an anonymous class results in a NPE Determining non-namespaced class types results in a NPE Jul 20, 2022
@cspray
Copy link
Owner Author

cspray commented Jul 22, 2022

After more research this is only a problem when attributing an anonymous class. A comprehensive strategy for how to deal with this needs to be designed. What is actually supposed to happen when this library finds an anonymous class with attributes is probably entirely contextual. Perhaps just ignoring it, perhaps keep track of what files/lines the anonymous class was found, or perhaps throw an exception. Depending on what you're trying to do with the Attribute either of these might be valid.

@cspray
Copy link
Owner Author

cspray commented Jun 15, 2024

After giving this some more thought, if you're using Annotated Target it is because you want the code constructs before you're actually running the code. I couldn't think of a scenario where Annotated Target could provide its features on an attributed anonymous class. For now, we're gonna throw an exception until somebody can present a valid use case and solution for adding attributes to an anonymous class in the use cases Annotated Target is trying to support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant