Repository navigation
feat(jdk27): add demo for JEP 538 - #384
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The intermediate JEP 524 linking stub, metadata, and JDK 26 loader registration are missing.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds the JDK 27 third-preview PEM API demo and redirects the JEP 470 preview to it.
Changes:
- Demonstrates PEM encoding, encryption, decryption, and type inspection.
- Registers JEP 538 and updates JEP 470 as a linking demo.
- Adds corresponding JDK metadata.
| File | Description |
|---|---|
src/main/resources/JDK27Info.json |
Adds JEP 538 metadata. |
src/main/resources/JDK25Info.json |
Marks JEP 470 as superseded. |
src/main/java/org/javademos/java27/jep538/PemEncodingsDemo.java |
Implements the PEM API demo. |
src/main/java/org/javademos/java25/jep470/PemEncodingsDemo.java |
Converts JEP 470 into a linking stub. |
src/main/java/org/javademos/init/Java27DemoLoader.java |
Registers JEP 538. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
AloisSeckar
approved these changes
Sep 30, 2026
Owner
|
Thanks for the contribution @Akhil-1527 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #376
Closes #360
Adds
PemEncodingsDemounderjava27/jep538, with its JSON record and loader registration, and turns the JEP 470 demo into a linking class that points to it, as the issue asks. The JEP 470 JSON record now haslink: true, like the other replaced previews.The demo generates an EC key pair and walks through the main parts of the API:
PEMEncoderand decodes it back withPEMDecoder.decode(text, ECPublicKey.class)withEncryption, decrypts it withwithDecryption, and shows the newCryptoExceptionfor a wrong passwordKeyPairwith a non-default algorithm throughEncryptedPrivateKeyInfo.encrypt, then restores it withgetKeyPairPEMclass to keep the text before the BEGIN line, and to encode a type that has no Java class (with the newbyte[]constructor)BinaryEncodableto find out what a text holdsThe class header lists the changes in JDK 26 and JDK 27. For JDK 27 I compared the API of JDK 26.0.1 and JDK 27 with
javap, because the JEP 538 text also listsgetKeyPairas new, but it is already in JDK 26.One thing that surprised me: a private key restored from a
KeyPairPEM keeps the public key in its encoding, soequals()with the original key returns false. The demo compares the private value instead and explains why in a comment.mvn clean installand the full jar run pass locally on JDK 27. As suggested in the review, this PR also adds the JEP 524 linking class underjava26/jep524, with its JSON record and loader registration, so it closes #360 as well.