Hello OpenJDK Core Libraries Team,
I hope this message finds you well. My name is Achyuta Shrimate, and I am
writing to express my interest in contributing to the OpenJDK project,
specifically to the java.util.Properties class.
Problem Statement:
Currently, java.util.Properties.store() serializes values by escaping all
special characters (\n, \t, \\, etc.) into their escaped representations.
This makes the resulting .properties file machine-readable but difficult
for humans to read and edit, particularly for values that contain multiline
content or indentation.
For example, a value containing a newline gets stored as:
Project.Imports=0rg,\n maven,\n eclipse
Whereas a developer would expect to read:
Project.Imports=0rg,\
maven,\
eclipse
OR
Project.Imports=0rg,
maven,
eclipse
Proposed Addition:
I would like to propose the addition of the following public method to
java.util.Properties:
public void storeFormatted(FileWriter fileWriter, String comments)
throws IOException
This method would:
- Mirror the existing store(Writer, String) pattern internally by
delegating to a private storeFormatted0(BufferedWriter, String) method,
consistent with the existing store() → store0() design
- Reuse the existing saveConvert() for key serialization
- Introduce a lightweight restoreEscapes() helper that un-escapes only \\
→ \, \n → newline, and \t → tab in values, leaving all other escape
sequences untouched
- Preserve the existing sorted key output behavior introduced in recent
JDK versions
- Be fully additive with zero changes to existing store() behavior
I am willing to:
- Draft a formal JEP or raise a bug/enhancement on the OpenJDK issue
tracker if the team considers this worthwhile
- Write the full implementation and accompanying JTreg tests
- Iterate on the API design based on community feedback, including which
escape sequences to restore (currently proposing \\, \n, \t as a minimal
baseline)
I would greatly appreciate any guidance on the right process to move this
forward and whether this aligns with the team's current priorities for
java.util.Properties.
Thank you for your time and for maintaining such a foundational part of the
Java ecosystem. I would be filing the Individual OCA and then be will be
ready to contribute on this issue.
Best regards,
*Name:* Achyuta Shrimate
*Github: *ASAnonymousS
*Email: *[email protected]