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

Remove extra ElementTypes in all synthetic annotations #346

Closed
wants to merge 4 commits into from

Conversation

theron-wang
Copy link
Collaborator

@theron-wang theron-wang commented Jul 31, 2024

This change allows na-705 to be reproducible. I discovered this one change was able to reproduce the error when running Specimin with --jarPath path/to/checker-qual.jar. Since @Retention(RetentionPolicy.RUNTIME) is the most generous, it should work for all cases (i.e. CLASS and SOURCE). (see comment below)

Copy link
Collaborator

@kelloggm kelloggm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find!

@kelloggm kelloggm enabled auto-merge (squash) July 31, 2024 16:59
@theron-wang
Copy link
Collaborator Author

Never mind, it looks like @Retention(RetentionPolicy.RUNTIME) was a red herring (the checker jar also only used @Target(TYPE, TYPE_USE). The issue for this was an over-correction in #327, where I included all ElementTypes in @Target. In fact, the only change I needed to make was to add ElementType.Type. I believe that the extra definition of ElementType.Field, in this case, caused the annotation to be incorrectly processed by NullAway.

@theron-wang theron-wang changed the title Add RetentionPolicy.RUNTIME to all synthetic annotations Remove extra ElementTypes in all synthetic annotations Jul 31, 2024
@theron-wang theron-wang requested a review from kelloggm July 31, 2024 17:35
@kelloggm kelloggm disabled auto-merge July 31, 2024 17:54
@kelloggm
Copy link
Collaborator

@theron-wang I think this is still off - now not only is na-705 failing, but na-97 is, too.

@theron-wang
Copy link
Collaborator Author

theron-wang commented Jul 31, 2024

@kelloggm Looks like ElementType.FIELD is needed to reproduce na-97, but its presence in na-705 prevents the NullAway from reproducing the bug. I tried removing @Target altogether for both examples, but na-705 still is not being reproduced. I believe that the issue is that na-705 uses CF annotations, which are type use, versus the Javax annotations in na-97, which do not have a target by default. I don't think there is way to differentiate between the two cases (we can't check by context, since both na-97 and na-705 @Nullable annotations apply to fields), so the best way to still reproduce na-705 is to run it with the checker-qual.jar. What are your thoughts? We could just close this PR and add a checker-qual dependency in specimin-evaluation for na-705, but that is an unsatisfying solution.

@theron-wang
Copy link
Collaborator Author

Closed as per njit-jerse/specimin-evaluation#12.

@theron-wang theron-wang closed this Aug 1, 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

Successfully merging this pull request may close these issues.

2 participants