-
Bug
-
Resolution: Fixed
-
P4
-
None
A type annotation applied to a lambda parameter with a 'var' type has no type to annotate:
Predicate<String> p = (@TypeAnno var s) -> true;
A rule in 9.7.4 handles this for local variables, but neglects to mention lambda parameters.
Proposed change:
"If the annotation appears before a void method declaration or a ~~local~~ variable declaration that uses var (§14.4**, §15.27.1**), then there is no closest type. If the annotation's interface is deemed to apply only to the type which is closest to the annotation, a compile-time error occurs.
https://mail.openjdk.org/pipermail/compiler-dev/2022-October/020593.html
Predicate<String> p = (@TypeAnno var s) -> true;
A rule in 9.7.4 handles this for local variables, but neglects to mention lambda parameters.
Proposed change:
"If the annotation appears before a void method declaration or a ~~local~~ variable declaration that uses var (§14.4**, §15.27.1**), then there is no closest type. If the annotation's interface is deemed to apply only to the type which is closest to the annotation, a compile-time error occurs.
https://mail.openjdk.org/pipermail/compiler-dev/2022-October/020593.html