EnumSet.class serialization broken - twice

Peter Levart peter.levart at gmail.com
Sun Jul 7 15:11:50 UTC 2019


On 7/7/19 4:31 PM, Peter Levart wrote:
> On 6/29/19 2:00 AM, Stuart Marks wrote:
>> Daniel Fuchs pointed me to a weird thing they had to do with the 
>> serialVersionUID in one of the JMX classes:
>>
>> https://hg.openjdk.java.net/jdk/jdk/file/c59f36ed7b52/src/java.management/share/classes/javax/management/MBeanAttributeInfo.java#l46 
>>
>>
>> Essentially the svuid for this class initialized in a static block, 
>> and its value is conditional based on the value of some system 
>> property. I don't think using a property is necessary for the EnumSet 
>> case. However, it does point out something interesting, which is that 
>> if the svuid is not initialized with a compile-time constant, and 
>> instead via a static block, the value doesn't appear in 
>> serialized-form.html. 

Hi Stuart,

I just realized that I was reading your last statement wrong. I though 
it was written as:

...if the svuid is not initialized with a compile-time constant, and 
instead via a static block, the value doesn't appear in serialized form.

And not as:

...if the svuid is not initialized with a compile-time constant, and 
instead via a static block, the value doesn't appear in serialized-form.html


You were only concerned about the generated javadoc and not about the 
actual "serialized form". Ok, I get it now. I have prepared webrev.02 to 
fix this.


Regards, Peter



More information about the core-libs-dev mailing list