Skip to content

Conversation

@nimakarimipour
Copy link
Member

@nimakarimipour nimakarimipour commented Feb 13, 2025

With the new specification for @nullable type-use annotations, the correct placement for annotating the component type of an array is as follows:

@Nullable Object arr[]

However, when parsing this expression, Javaparser associates the annotation with the entire Object[] arr node rather than the intended component type @Nullable Object.

This PR addresses this issue by adding a workaround ensuring correct annotation placement and includes a comprehensive set of tests to validate the fix.

@nimakarimipour nimakarimipour added the bug Something isn't working label Feb 13, 2025
@nimakarimipour nimakarimipour self-assigned this Feb 13, 2025
@nimakarimipour nimakarimipour merged commit 3dd84c6 into master Feb 13, 2025
7 checks passed
@nimakarimipour nimakarimipour deleted the nimak/fix-issue-with-array branch February 13, 2025 04:14
@nimakarimipour nimakarimipour restored the nimak/fix-issue-with-array branch February 13, 2025 04:14
@nimakarimipour nimakarimipour deleted the nimak/fix-issue-with-array branch February 13, 2025 23:41
agrieve pushed a commit to agrieve/NullAwayAnnotator that referenced this pull request Apr 3, 2025
…t type (ucr-riple#268)

With the new specification for @nullable type-use annotations, the correct placement for annotating the component type of an array is as follows:
```java
@nullable Object arr[]
```
However, when parsing this expression, Javaparser associates the annotation with the entire `Object[] arr` node rather than the intended component type `@Nullable Object`.

This PR addresses this issue by adding a workaround ensuring correct annotation placement and includes a comprehensive set of tests to validate the fix.
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

Successfully merging this pull request may close these issues.

2 participants