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

Fix type detection of nested annotations #3604

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

facboy
Copy link

@facboy facboy commented Feb 12, 2024

Fix type detection of annotations that are nested within the same (or other) classes. I came across this bug when trying to copy an annotation from a field to a constructor, where that annotation was an inner class of the field that the annotated class belonged to, eg:

@RequiredArgsConstructor
@Getter
public class SimpleNestedAnnotation {

	@TA private final int someVal;

	@Retention(RetentionPolicy.RUNTIME)
	public @interface TA {}
}

Lombok fails to find the annotation and so doesn't copy it to the constructor. There is a test project that reproduces this error too: https://github.com/facboy/lombok-bug

@rzwitserloot
Copy link
Collaborator

Hi @facboy - your commit's message is a bit terse and there's no other context. Which can be allright, we can always review the patch. However, you ran your code autoformatter so that's going to take hours. Without some indication as to what you're trying to address with this we're not going to review this; we'd have to close it, unreviewed. Which is sad.

Can you update this PR, or, probably better, open a new one, with a bit more context as to what it is trying to accomplish, and ensure that you do not run autoformatters, because that makes timely review impossible.

The build file update looks relevant but is clearly not related to 'Fix type detection of nested annotations' - a separate PR would be best, but if you must include it here - at least make that a separate commit.

without further chat: Close this unmerged 2024-10-20.

@facboy
Copy link
Author

facboy commented Sep 11, 2024

geez, i didn't even notice the formatting change, will fix that.

also will address the other comments.

This commit fixes type detection of java annotations that are nested
within the annotated class. A simple example of this can be seen in the
test class `SimpleNestedAnnotation.java`.
The `<fail>` task had an invalid declaration - it can't have an `if` and a nested `<condition>`
@facboy
Copy link
Author

facboy commented Oct 21, 2024

Addressed comments (hopefully), and added some more detail to the description.

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

Successfully merging this pull request may close these issues.

2 participants