The Java analyzer detects new rules specific from Java 9 to Java 15

Hi Java developers,

Java versions are coming out every 6 months and bring out new syntaxes, features, helping you to be more efficient in your daily work.

We keep up to date our Java analyzer at the same pace to enable scan of recent Java versions. However nothing was done yet to consider how changes from Java 9 to Java 15 versions impacted our rules.

I am very happy to announce that we impacted 21 rules to adapt them to recent language changes.

On top of that, we added 5 new Code Smells targeting Java 9 to Java 15 versions:

  • S6202: Operator “instanceof” should be used instead of “A.class.isInstance()”
  • S6203: Text blocks should not be used in complex expressions
  • S6205: Switch arrow labels should not use redundant keywords
  • S6208: Comma-separated labels should be used in Switch with colon case
  • S6212: Local-Variable Type Inference should be used

This is available now on SonarCloud and will come with SonarQube 8.9.

Richard

2 Likes

A post was split to a new topic: S6212: Always replacing variable with “var” may be confusing