openrewrite / rewrite-static-analysis

OpenRewrite recipes for identifying and fixing static analysis issues.
Apache License 2.0
32 stars 51 forks source link

`Comparators` should be `Serializable`.`RSPEC-2063` #32

Open yeikel opened 2 years ago

yeikel commented 2 years ago

https://rules.sonarsource.com/java/RSPEC-2063

tkvangorder commented 2 years ago

This should also schedule AddSerialVersionUidToSerializable since we already have a recipe in place to do this work.

This will also need to consider any instance variables in the comparator (to make sure those are serializable).

You could probably call this method and make any non-serializable fields as transient:

https://github.com/openrewrite/rewrite/blob/main/rewrite-java/src/main/java/org/openrewrite/java/cleanup/FixSerializableFields.java