The Java analyzer detects rules specific to Java 16 features

Hi Java developers,

We released the parsing and the analysis of Java 16 projects with SonarQube 9.0.

Java 16 brings many new features and especially the long expected records. I am therefore very happy to announce that we created 9 new rules dedicated to Java 16 and updated 20 existing ones.

New rules:

  • S6201: Pattern Matching for “instanceof” operator should be used instead of simple “instanceof” + cast
  • S6204: “Stream.toList()” method should be used instead of “collectors” when unmodifiable list needed
  • S6206: Records should be used instead of ordinary classes when representing immutable data structure
  • S6207: Redundant constructors/methods should be avoided in records
  • S6209: Members ignored during record serialization should not be used
  • S6211: Custom getter method should not be used to override record’s getter behavior
  • S6216: Reflection should not be used to increase accessibility of records’ fields
  • S6218: Equals method should be overridden in records containing array fields
  • S6219: ‘serialVersionUID’ field should not be set to ‘0L’ in records

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

Richard