RFR: 8202056: Expand serial warning to check for bad overloads of serial-related methods and ineffectual fields [v25]
Joe Darcy
darcy at openjdk.java.net
Thu Oct 21 19:35:22 UTC 2021
On Wed, 20 Oct 2021 12:29:43 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
>> Joe Darcy has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 80 commits:
>>
>> - Merge branch 'master' into JDK-8202056
>> - Do not warn for prence of serialVersionUID in interfaces.
>> - Sharpen type of method parameters to javac type.
>> - Merge branch 'master' into JDK-8202056
>> - Add support for warning on component type of an array.
>> - Merge branch 'master' into JDK-8202056
>> - Merge branch 'master' into JDK-8202056
>> - Merge branch 'master' into JDK-8202056
>> - Initial library updates for array component type check.
>> - Improve declared types to remove cast.
>> - ... and 70 more: https://git.openjdk.java.net/jdk/compare/c24fb852...4750141d
>
> test/langtools/tools/javac/warnings/Serial/ImproperSerialPF.java line 12:
>
>> 10: // Proper declaration of serialPersistentFields is:
>> 11: // private static final ObjectStreamField[] serialPersistentFields = ...
>> 12: public /*instance*/ Object serialPersistentFields = Boolean.TRUE;
>
> It might make sense to have tests that would verify every check made for the field - i.e. taking a field named "serialPersistentFields", which should be (I guess) `private`, `static`, `final`, and have type `ObjectStreamField[]`, and have a series of fields that fulfill all these properties except one, and verify the warning is produced. The test could be a some sort of a combo test, or not, that is less important, I think.
Acknowledged; this consider this for a future refinement.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5709
More information about the compiler-dev
mailing list