Proposal: JDK-8231640 - (prop) Canonical property storage

Jaikiran Pai jai.forums2013 at gmail.com
Wed Aug 25 10:51:41 UTC 2021


Hello Roger,

On 24/08/21 8:14 pm, Roger Riggs wrote:
> Hi Jaikiran,
>
> Thanks for taking this on and getting it started.
>
> One use case of canonical storage is repeatable builds.
> It would be useful to identify the uses in the JDK that would need to 
> be changed to use the new function.

Surprisingly, the usage of the current "store" APIs within the JDK 
appears to be very minimal. I'm hoping I didn't miss them, but from what 
I see the Properties.store(...) which takes the Writer as a param isn't 
used in anywhere within source of the JDK. The Properties.store(...) 
which takes an OutputStream as a parameter gets used in the following 
few places:

1. jdk.internal.vm.VMSupport#serializePropertiesToByteArray - Looking at 
the implementation in this method and as the name suggests, the 
Properties is being written out a byte array. This method gets called 
from native code, from what I can see. I'll need a bit of help on this 
one to understand whether that usage in the native code would benefit 
from switching to the new API (when it is introduced) for 
reproducibility when it comes to this call in 
VMSupport#serializePropertiesToByteArray.

2. sun.net.www.MimeTable#saveAsProperties - This is a "protected" method 
and from what I could see, doesn't get called anywhere in the JDK code. 
Furthermore, This class resides in an internal package (sun.net.www) and 
although it implements the public java.net.FileNameMap interface, the 
"saveAsProperties" isn't a method exposed on that interface. So I think 
this existing code/method wouldn't need to be updated to use the new API.

3. sun.font.FcFontConfiguration#writeFcInfo - This method writes out a 
"cache file" which appears to be an internal implementation detail of 
the FcFontConfiguration. More specifically, the contents of this file 
apparently is "JDK Font Configuration", going by the comment it adds to 
that file. This file gets written out to the "user.home" directory and 
as far as I can see it, is only used/relevant to this 
FcFontConfiguration. In context of reproducibility and the new API, I 
think using that new API here could have a potential benefit of 
reproducibility on the same system. However, someone with more 
experience of this code would have to review if at all this 
reproducibility is desirable.

These are the only references I could find in the JDK code (I didn't 
include test cases).

One thing I do remember is the JDK build (through the make files) would 
have certain Java code it would call to do some build steps. Is there a 
easy way to find all such build related Java files within the JDK? I 
would like to see if there are any references/calls to this method from 
those build files. I am doing some searches myself, but knowing where to 
search will give me more confidence that I haven't missed out any.

-Jaikiran






More information about the core-libs-dev mailing list