JonnyB
(Johannes Becker)
July 21, 2022, 2:49pm
1
With JDK 16 pattern matching was introduced (JEP 394: Pattern Matching for instanceof )
if (someObject instanceof final Foo foo) {
fails with
[ERROR] Unable to parse source file : '.../SomeClass.java'
[ERROR] Parse error at line xxx column xx: Syntax error on token "final", delete this token
whereas
if (someObject instanceof Foo foo) {
works.
Anyone can confirm this?
Community Edition Version 8.9.8 (build 54436)
Colin
(Colin)
July 21, 2022, 2:50pm
2
Hey there.
As asked in the topic template, what version of SonarQube are you using?
Colin
(Colin)
July 21, 2022, 2:53pm
4
Thanks.
Support for Java 16 was introduced in SonarQube v9.0 – the current supported v9.x of SonarQube is SonarQube v9.5 (which also supports parsing Java 17 and 18!)
JonnyB
(Johannes Becker)
July 21, 2022, 2:55pm
5
Thanks for the quick reply. Mystery solved!