Skip to content

Use Path and Instant at the main Java 11 API entry points #716

Description

@bbottema

Why

With the 10.0.0 library baseline moving to Java 11, the public API can offer Path and Instant at the places where users currently have to convert back to File and Date.

This should be a focused pass over common entry points, not a mechanical duplication of every overload combination.

Proposed additions

Review and add the useful cases, starting with:

  • a Path source for ConfigLoader;
  • Path overloads for EML and Outlook MSG import;
  • Path overloads for text/HTML body files and cryptographic key, keystore and certificate files;
  • fixingSentDate(Instant) and a matching Instant-based accessor;
  • EmailConverter.emailToEMLByteArray(Email) so callers do not have to round-trip wire content through a Java String.

The new methods should delegate to the existing implementation paths. Existing File, InputStream and Date methods remain supported, since they are still useful and removing them would create migration work without a real benefit.

API review

Before adding overloads, inventory the public File and Date methods and choose a consistent naming rule. Avoid creating a combinatorial set of Path × Session × security configuration methods where one Path-based entry point or builder can cover the use case.

Path methods that open a stream must close only streams they create. Existing caller-supplied InputStream ownership rules must stay unchanged and be documented consistently.

These additions are convenience API only. Internal storage and Java serialization do not need to change from Date to Instant just to expose a modern accessor.

Related history

#235 introduced the current caller-controlled sent date. #707 moved the 10.0.0 library baseline to Java 11. For input ownership, #354 established that callers close streams they supply, while #669 and #670 fixed the corresponding rule for streams opened internally by File overloads.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions