Fix annotations being not expected in the middle of an array type by java parser#22391
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
hamzaremmal
left a comment
There was a problem hiding this comment.
Hi @fan-tom. thanks for contributing to Scala 3 🎉 . Your changes only covers half of the issue (type annotations on array). To fully close the linked issue, a fix for path selection has to be submitted. Would you like to try fixing it or should we take it from here ? Your changes for annotations on array types are correct and can be merged when all the requirements to close the issue are met.
|
Thanks @hamzaremmal
Definitely, but I need inputs for that, like what's |
|
Oh, I just got that original issue speaks about such syntax |
…ava parser Java parser doesn't expect an annotation in the next types, while it should: - `Object @my.Ann []` - `Object @my.Ann [] @my.OtherAnn []` closes scala#19642
|
@hamzaremmal hasn't |
ed25fca to
9c971be
Compare
Ah yes, it does |
|
Backport / Same fix for Scala 2: |
|
Added an additional test case here: #26188 |
Backport the Scala 3 Java parser fix for annotations that appear before array brackets, such as String @nullable [] and nested annotated arrays. Scala 3 fixed the same parser gap in scala/scala3#22391. This applies the corresponding optArrayBrackets change to the Scala 2 Java parser and extends the existing Java type annotation positive test.
Closes #19642
Currently Java parser doesn't expect annotation between type name and square brackets in an array type, or between pairs of square brackets in nested array types.
I added a call to corresponding parser method
annotationswhen parsing array types.I also changed an unnecessary
vartoval, as IDEA suggested.