<Swing Dev> JDK 9 RFR of JDK-8034169: Fix serial lint warnings in javax.swing

Joe Darcy joe.darcy at oracle.com
Fri Feb 14 04:00:58 UTC 2014


On 02/13/2014 02:31 AM, Alan Bateman wrote:
> On 13/02/2014 08:00, Joe Darcy wrote:
>> Hello,
>>
>> Please review the largely tedious but straightforward fix for
>>
>>     JDK-8034169: Fix serial lint warnings in javax.swing
>>     http://cr.openjdk.java.net/~darcy/8034169.0/
>>
>> With the change, all of java.swing and it subclasses compile cleanly 
>> with the lint warning enabled.
>>
>> Generally the serial warnings were address by an 
>> @SuppressWarnings("serial") annotation; the annotation included a 
>> comment about the justification for the suppressions.
>>
>> In a small percentage of cases, a serialVersionUID field was added. 
>> When such a field was added, the serialver computation was checked 
>> for consistency on JDK6 and JDK 8.
>>
>> (Note that the javax.swing.text.html.parser.Element type has actually 
>> different serialVersionUIDs on JDK 6 and 8.)
> I skimmed through the changes and I don't see anything obviously 
> wrong. However I am puzzled by some of the inconsistencies. For 
> example in javax.swing.event then some of the events have the warning 
> but some do not, they are examples in a few other packages too.

If a superclass had the standard swing serialization disclaimer, I put 
@SuppressWarning("serial") on its subclasses. This covered most of the 
cases. If one of the non-transient fields had teh swing disclaimer, I 
added a note that that effect, and if the class was neither public nor 
protected, I generally added a "JDK-implementation class" disclaimer.

> This caught my eye because of the addition of SUID to public types 
> when I assumed they would have the warning and so have 
> @SuppressWarnings("serial"). Maybe this needs someone familiar with 
> the history in this area to say whether it is true that some of the 
> public types can be serialized in the compatible way across releases.
>
>

For exception types, types not meeting the criteria above (especially if 
they haven't been modified in many years), I added a SUID, but those 
cases were relatively few.

Hope this explanation helps; thanks for the review,

-Joe




More information about the swing-dev mailing list