The rule Fields in non-serializable classes should not be "transient" (java:S2065) is a FP

SonarQube Community Edition Version 8.9.8 (build 54436)
Rule java:S2065

I don’t believe this rule is correct because transient can be used to exclude fields from sterilizers that use reflection (i.e. GSON), and these do not require a class to implement Serializable (in fact, to do so would be unnecessary typing in itself: the same reasoning given for removing the transient modifier in this rule).

Thanks for the feedback.

This is indeed a false positive. Here is a ticket where you can track the progress of the issue.

Regards,
Margarita

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.