JetBrains / JetBrains/Grammar-Kit
Erroneous @Nullable annotation on generated getter
- Dominant language
- Java
- Stars
- 771
- Forks
- 137
- Avg merge
- 11h 14m
- Merged PRs (30d)
- 1
Description
In my grammar the automatically generated getter seems to be producing a slightly odd result for getUpperBound, which is marked as @Nullable, when it should be @NotNull just like its twin getLowerBound.
```
range ::= LSB string RANGE_OPERATOR string RSB {
methods = [
getLowerBound="/string[0]"
getUpperBound="/string[1]"
]
}
```
generates:
```
@NotNull
List getStringList();
@NotNull
EBNFString getGetLowerBound();
@Nullable
EBNFString getGetUpperBound();
```
For the interface and unless I'm mistaken that last method should definitely be @NotNull like the lower bound is.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the grammar method-generation logic that infers nullability for the getLowerBound and getUpperBound paths shown in the issue, then compare how each generated getter is classified. Done means the generated getGetUpperBound() declaration is annotated @NotNull like getGetLowerBound().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100