<i18n dev> RFR: 8202056: Expand serial warning to check for bad overloads of serial-related methods and ineffectual fields
erikj at openjdk.java.net
Mon Sep 27 13:01:58 UTC 2021
On Mon, 27 Sep 2021 01:00:18 GMT, Joe Darcy <darcy at openjdk.org> wrote:
> This is an initial PR for expanded lint warnings done under two bugs:
> 8202056: Expand serial warning to check for bad overloads of serial-related methods and ineffectual fields
> 8160675: Issue lint warning for non-serializable non-transient instance fields in serializable type
> to get feedback on the general approach and test strategy before further polishing the implementation.
> The implementation initially started as an annotation processor I wrote several years ago. The refined version being incorporated into Attr has been refactored, had its checks expanded, and been partially ported to idiomatic javac coding style rather than using the javax.lang.model API from annotation processing.
> Subsequent versions of this PR are expected to move the implementation closer to idiomatic javac, in particular to use javac flags rather than javax.lang.model.Modifier's. Additional resources keys will be defined for the serialization-related fields and methods not having the expected modifiers, types, etc. The resource keys for the existing checks related to serialVersionUID and reused.
> Please also review the corresponding CSRs:
> Informative serialization-related warning messages must take into account whether a class, interface, annotation, record, and enum is being analyzed. Enum classes and record classes have special handling in serialization. This implementation under review has been augmented with checks for interface types recommended by Chris Hegarty in an attachment on 8202056.
> The JDK build has the Xlint:serial check enabled. The build did not pass with the augmented checks. For most modules, this PR contains the library changes necessary for the build to pass. I will start separate PRs in those library areas to get the needed SuppressWarning("serial") or other changes in place. For one module, I temporarily disabled the Xlint:serial check.
> In terms of performance, I have not done benchmarks of the JDK build with and without these changes, but informally the build seems to take about as long as before.
Build change looks ok.
Marked as reviewed by erikj (Reviewer).
More information about the i18n-dev