Skip to content

A set of regression fixes where we differed from Java's Properties - #100

Merged
quintesse merged 4 commits into
mainfrom
regression_fixes
Oct 26, 2026
Merged

quintesse merged 4 commits into
mainfrom
regression_fixes

Conversation

@quintesse

@quintesse quintesse commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator
  • parse separator continuations with pending backslash states
  • decode Unicode escapes after removing line continuations
  • reject malformed and non-ASCII Unicode escapes
  • preserve blank and comment lines after empty continuations

These were all corner cases where Codejive Properties did not behave like Java Properties.

To make these fixes possible the core parser loop was refactored somewhat to enable a more extensive state machine.

A continuation between the key and its optional delimiter ended separator
parsing too early, leaving the delimiter in the value. Use pending-backslash
states to keep continuations in the separator and ordinary escapes in the value.
Unicode escapes split across continued lines were rejected because the parser
required four adjacent hex digits before joining the lines. Remove line
continuations before decoding escapes in keys and values.
Unicode escapes accepted non-ASCII digits, and malformed escapes produced
inconsistent exceptions. Require four ASCII hexadecimal digits and reject
invalid sequences with IllegalArgumentException.
A continuation-only prefix made following comments and blank lines into
properties, introducing spurious keys. Preserve these prefixes as formatting
and match the JDK behavior for empty continuations at EOF.
@quintesse
quintesse merged commit 7a247ef into main Oct 26, 2026
1 check passed
@quintesse
quintesse deleted the regression_fixes branch October 26, 2026 12:21
@quintesse

Copy link
Copy Markdown
Collaborator Author

@wleeaf I would be interested to know how these fixes handle your extensive test suite. You think you'd be able to test it before I create a new release?

@wleeaf

wleeaf commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

I ran the differential corpus against main (7a247ef): 20,061 inputs (63 hand-written edge cases plus random mixes of escapes, \uXXXX, line continuations, comments, CR/LF/CRLF line endings and Latin-1 bytes), each loaded with java.util.Properties (JDK 21) and with codejive Properties, plus a store() and JDK reload of the codejive result.

  • main: no differences. All 14,760 inputs that the JDK loads give the same keys and values, and store() reloads to the same map. The 5,301 inputs with a malformed \u escape now throw IllegalArgumentException, like the JDK.
  • No regressions: no input that matched on v0.0.8 or on main right before A set of regression fixes where we differed from Java's Properties #100 differs now.
  • Right before A set of regression fixes where we differed from Java's Properties #100, 1,091 inputs differed (for example \u00a\ + newline + a=b threw instead of giving the key ª, and a lone \ line with CRLF produced an empty key), and the malformed escapes threw RuntimeException. On v0.0.8 it was 3,553 inputs, plus the same exception type difference.
  • A second corpus of the same size with a different seed gives the same result: no differences on main.

@quintesse

Copy link
Copy Markdown
Collaborator Author

So you are okay with creating a new release, right?

Or do you see any other issues that still need to be fixed?

@wleeaf

wleeaf commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Nothing outstanding from my side. The differential shows no differences from java.util.Properties on main, and the only cases I had noted, the lone \ line and the continuation inside a key, are covered by #98 and #100. Fine to release as far as I can see.

@quintesse

Copy link
Copy Markdown
Collaborator Author

OK, version 0.1.0 released!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants