Sonar not able to analyze the project with pattern matching for switch

Hi Team,

We are running SonarQube community edition version 8.9.6. Since we do not have Java 17 support here, we have installed a FindBugs plugin, version 4.0.6. Now we are able to get report for Java 17 projects but there is still an issue with Java-17 specific support. For example, pattern matching for switch, sonar not able to analyze the project. It is complaining about the line:
case Integer i → String.format( “int %d”, i );

Can you please help us to understand if we can get this feature in our current SonarQube(8.9.6) with latest version FindBugs plugin which already exists in our instance

Thanks in advance!

Hi,

Support for new language features is not backported to the LTS, so this won’t be available.

 
HTH,
Ann

Hi Ann,

Thank you for your answer. Can you please let us know when we can get a support for Pattern matching for switch.

Regards,
M G Preethi

Hi M G,

I believe you can get it by upgrading to the latest version.

If you have to stay on the LTS, then look for the new LTS in 2023 Q1.

 
HTH,
Ann

1 Like

Ann,

Could you clarify what you meant by “upgrading to the latest version” → latest version of what, Java, or SonarQube (I’m running version 10.0 build 68432 and still seeing this problem), and “if you have to stay on the LTS, then look for the new LTDS in 2023 Q1” → Based on the prior cadence, the next Java LTS will be JDK 23, which won’t be available until 2024 Q4; that’s quite a long time to wait for a fix to this issue, especially if you are making liberal use of the switch pattern matching feature in conjunction with sealed classes.

Hi @cssprs,

The conversation was about SonarQube. :smiley:

Since you’re on 10.0, then you’ve already upgraded past what was the latest version a year ago when this thread was live.

If you’re having a problem, please create a new thread with all the details.

 
Ann