Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ Originally, there were only a few cherry-picked demos for features I find most i
- Folder [`org.javademos.init`](https://github.com/AloisSeckar/demos-java/tree/master/src/main/java/org/javademos/init) contains helper classes, one for every JDK version, that were introduced mostly to reduce number of imports per class. Also it allows to turn on/off whole sub-set for given JDK version, if needed.
- Last but not least, [`Main.java`](https://github.com/AloisSeckar/demos-java/blob/master/src/main/java/org/javademos/Main.java) class is the main entrypoint - it starts by displaying current JVM info, then loads all demos from the helper files and runs them one by one. The output depends on their implementation.

**Note:** Currently, there is a transition period, when JDK 22 and older files are not yet fully transferred to the new structure. Once you get familiar with this project better, you can also help with that aside from implementing new demos for lates JEPs.
**Note:** Currently, there is a transition period, when JDK 22 and older files are not yet fully transferred to the new structure. Once you get familiar with this project better, you can also help with that aside from implementing new demos for latest JEPs.

## Demo implementation

**NOTE:** Due to transition period, some information here may not correspond with the current state of the source code. Feel free to ask when in doubt.

[`IDemo` interface](/src/main/java/org/javademos/commons/IDemo.java) prescribes two methods:
- `info()` - unified header, that only needs to be supplied with JEP number. Then it looks up the text info in Map defined in [`DemoInfo` class](/src/main/java/org/javademos/commons/DemoInfo.java) and prints it in a standardized way.
- `info()` - unified header, that only needs to be supplied with JEP number. Then it looks up the text info in Map defined in [`JEPInfo` class](/src/main/java/org/javademos/commons/JEPInfo.java) and prints it in a standardized way.
- `demo()` - this is the actual implementation of whatever can be shown to demonstrate tne new features introduced with the given JEP.

The code part in `demo()` method can contain little to no actual code. For many JEPs that are altering the internals of JVM or implementations of JDK library classes, only printing out some text summary may be enough to cover it.
Expand All @@ -51,11 +51,11 @@ Current referential implementation is [MarkdownComments.java for JEP 467](/src/m

## Contributions

**If you want to help with some issue, please check if it not assigned yet first!** Lets avoid unncessesary conflicts and disappointments before they can happen.
**If you want to help with some issue, please check if it is not assigned yet first!** Let's avoid unnecessary conflicts and disappointments before they can happen.

Currently, the focus is on implementing demos for all features of JDK versions going down from 25. Focused issues are being opened. However, if you feel like creating demo for some other JEP, which doesn't have issue yet, you are very much welcome to do so! Just let me know by opening an issue, so it can be properly tracked and your contribution can be recognized. Rememeber, many JEPs are not covered yet.
Currently, the focus is on implementing demos for all features of JDK versions going down from 25. Focused issues are being opened. However, if you feel like creating demo for some other JEP, which doesn't have issue yet, you are very much welcome to do so! Just let me know by opening an issue, so it can be properly tracked and your contribution can be recognized. Remember, many JEPs are not covered yet.

Issues are tagged with labels. If you are here for the first time, look for `good first issue` label which indicates relatively smaller and simplier tasks. Tasks labeled with `advanced` will require better understanding of this project structure and they are recommended to users who already have some PRs accepted. Before starting to work on any issue, be sure you understand the task clearly to avoid unnecessary re-work. If in doubt, please, ask in the issue comments.
Issues are tagged with labels. If you are here for the first time, look for `good first issue` label which indicates relatively smaller and simpler tasks. Tasks labeled with `advanced` will require better understanding of this project structure, and they are recommended to users who already have some PRs accepted. Before starting to work on any issue, be sure you understand the task clearly to avoid unnecessary re-work. If in doubt, please, ask in the issue comments.

A number of JEP demos exist already, but they're not fully transferred to the new style (with Markdown comments) or there are some inconsistencies with the majority of the project. So this is also an option for your contributions.

Expand All @@ -77,8 +77,8 @@ We can always discuss under each individual issue/PR, how to turn your invaluabl
- Place the new file accordingly into the project structure (correct JDK and JEP folder).
- If your implementation creates any files, save them under the repository-local `tmp/` folder. This folder is gitignored to prevent untracked artifacts.
- Follow the markdown style comments to describe the class.
- Do not hesitate to use (standard) comments inside your code - remember the desired usecase is future users will check the code to figure out how the feature works.
- Do not forget to add required record to the respective JSON resource file (JEP name and brief, but meaningful description). **Keep the records ordered by JEP number ascending.**
- Do not hesitate to use (standard) comments inside your code - remember the desired use case is future users will check the code to figure out how the feature works.
- Do not forget to add required record to the respective JSON resource file. **Keep the records ordered by JEP number ascending.** This record should follow next structure: JEP number, JDK version, name, brief description, link (true if this JEP is replaced by another JEP), code (true if it contains code and not only comments describing JEP).
- Do not forget to add your new demo into the respective helper class for the JDK version, so it gets executed from `Main.java`. Always add comment with JEP number for better clarity. **Keep the demos ordered by JEP number ascending.**
- Make sure you are not accidentally submitting some other files or changes that are not related to PR topic.
- Because this project might be quite active with multiple contributors working on same files, please make sure your fork is in sync with the `master` branch of the original repository before submitting the PR. Double-check the "Files changed" tab of your PR and avoid posting anything not relevant to your changes.
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/org/javademos/commons/JEPInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ public class JEPInfo {

private JEPInfo() {}

public record JEPDataInfo(String name, String dscr) {}
public record JEPData(int jep, JEPDataInfo info) {}
public record JEPData(int jep, int jdk, String name, String dscr, boolean link, boolean code) {}

public static Map<Integer, JEPDataInfo> JEP_INFO = getAllEntries();
public static Map<Integer, JEPData> JEP_INFO = getAllEntries();

private static Map<Integer, JEPDataInfo> getAllEntries() {
var jeps = new HashMap<Integer, JEPDataInfo>();
private static Map<Integer, JEPData> getAllEntries() {
var jeps = new HashMap<Integer, JEPData>();

var sources = Arrays.asList(14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25);
for (Integer src : sources) {
Expand All @@ -28,7 +27,7 @@ private static Map<Integer, JEPDataInfo> getAllEntries() {
}.getType();
var gson = new Gson();
List<JEPData> data = gson.fromJson(br, JEPListType);
data.forEach(d -> jeps.put(d.jep(), d.info()));
data.forEach(d -> jeps.put(d.jep(), d));
} catch (IOException e) {
e.printStackTrace(System.out);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ public class KeyDerivationApiPreview implements IDemo {
@Override
public void demo() {
info(478);
System.out.println("This was a preview JEP. Please see the final implementation in JEP 510.");
}
}
32 changes: 18 additions & 14 deletions src/main/resources/JDK14Info.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
[ {
[
{
"jep": 305,
"info": {
"name": "JEP 305 - Pattern Matching for instanceof (Preview)",
"dscr": "Preview of Pattern Matching for instanceof. Finalized in JEP 394 (JDK 16)."
}
"jdk": 14,
"name": "JEP 305 - Pattern Matching for instanceof (Preview)",
"dscr": "Preview of Pattern Matching for instanceof. Finalized in JEP 394 (JDK 16).",
"link": true,
"code": false
},
{
"jep": 359,
"info": {
"jep": 359,
"jdk": 14,
"name": "JEP 359 - Records (Preview)",
"dscr": "Up-to-date demo moved to org.javademos.java16.jep395.RecordDemo (JEP 395)"
}
},
"dscr": "Up-to-date demo moved to org.javademos.java16.jep395.RecordDemo (JEP 395)",
"link": true,
"code": false
},
{
"jep": 370,
"info": {
"name": "JEP 370 - Foreign-Memory Access API (Incubator)",
"dscr": "Up-to-date demo moved to `org.javademos.java22.jep454.ForeignFunctionMemoryDemo` (JEP 454)"
}
"jdk": 14,
"name": "JEP 370 - Foreign-Memory Access API (Incubator)",
"dscr": "Up-to-date demo moved to `org.javademos.java22.jep454.ForeignFunctionMemoryDemo` (JEP 454)",
"link": true,
"code": false
}
]
67 changes: 41 additions & 26 deletions src/main/resources/JDK15Info.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,58 @@
[ {
[
{
"jep": 360,
"jdk": 15,
"name": "JEP 360 - Sealed Classes (Preview)",
"dscr": "Preview of Sealed Classes. Finalized in JEP 409 (JDK 17).",
"link": true,
"code": false
},
{
"jep": 371,
"info": {
"name": "JEP 371 - Hidden Classes",
"dscr": "Introduces hidden classes that cannot be used directly by bytecode of other classes and can be unloaded independently"
}
"jdk": 15,
"name": "JEP 371 - Hidden Classes",
"dscr": "Introduces hidden classes that cannot be used directly by bytecode of other classes and can be unloaded independently",
"link": false,
"code": true
},
{
"jep": 372,
"info": {
"name": "JEP 372 - Remove the Nashorn JavaScript Engine",
"dscr": "Remove the Nashorn JavaScript script engine, APIs, and the jjs tool. No code demo applicable as the feature was removed."
}
"jdk": 15,
"name": "JEP 372 - Remove the Nashorn JavaScript Engine",
"dscr": "Remove the Nashorn JavaScript script engine, APIs, and the jjs tool. No code demo applicable as the feature was removed.",
"link": false,
"code": false
},
{
{
"jep": 375,
"info": {
"name": "JEP 375 - Pattern Matching for instanceof (Second Preview)",
"dscr": "Second preview of Pattern Matching for instanceof. Finalized in JEP 394 (JDK 16)."
}
"jdk": 15,
"name": "JEP 375 - Pattern Matching for instanceof (Second Preview)",
"dscr": "Second preview of Pattern Matching for instanceof. Finalized in JEP 394 (JDK 16).",
"link": true,
"code": false
},
{
"jep": 381,
"info": {
"name": "JEP 381 - Remove the Solaris and SPARC Ports",
"dscr": "Removed the source code and build support for Solaris/SPARC, Solaris/x64, and Linux/SPARC ports. No code demo applicable."
}
"jdk": 15,
"name": "JEP 381 - Remove the Solaris and SPARC Ports",
"dscr": "Removed the source code and build support for Solaris/SPARC, Solaris/x64, and Linux/SPARC ports. No code demo applicable.",
"link": false,
"code": false
},
{
"jep": 383,
"info": {
"name": "JEP 383 - Foreign-Memory Access API (Second Incubator)",
"dscr": "Up-to-date demo moved to `org.javademos.java22.jep454.ForeignFunctionMemoryDemo` (JEP 454)"
}
"jdk": 15,
"name": "JEP 383 - Foreign-Memory Access API (Second Incubator)",
"dscr": "Up-to-date demo moved to `org.javademos.java22.jep454.ForeignFunctionMemoryDemo` (JEP 454)",
"link": true,
"code": false
},
{
"jep": 384,
"info": {
"jep": 384,
"jdk": 15,
"name": "JEP 384 - Records (Second Preview)",
"dscr": "Up-to-date demo moved to org.javademos.java16.jep395.RecordDemo (JEP 395)"
"dscr": "Up-to-date demo moved to org.javademos.java16.jep395.RecordDemo (JEP 395)",
"link": true,
"code": false
}
}
]
108 changes: 61 additions & 47 deletions src/main/resources/JDK16Info.json
Original file line number Diff line number Diff line change
@@ -1,84 +1,98 @@
[
{
"jep": 338,
"info": {
"name": "JEP 338 - Vector API (Incubator)",
"dscr": "Up-to-date demo moved to `org.javademos.java25.jep508.VectorAPIDemo` (JEP 508)"
}
"jdk": 16,
"name": "JEP 338 - Vector API (Incubator)",
"dscr": "Up-to-date demo moved to `org.javademos.java25.jep508.VectorAPIDemo` (JEP 508)",
"link": true,
"code": false
},
{
"jep": 380,
"info": {
"name": "JEP 380 - Unix-Domain Socket Channels",
"desc": "Add support for Unix-domain sockets, commonly used for inter-process communication on the same host."
}
"jdk": 16,
"name": "JEP 380 - Unix-Domain Socket Channels",
"dscr": "Add support for Unix-domain sockets, commonly used for inter-process communication on the same host.",
"link": false,
"code": true
},

{
"jep": 386,
"info": {
"name": "JEP 386 - Alpine Linux Port",
"dscr": "Ports the JDK to Alpine Linux and other Linux distributions using musl as their primary C library on x64 and AArch64."
}
"jdk": 16,
"name": "JEP 386 - Alpine Linux Port",
"dscr": "Ports the JDK to Alpine Linux and other Linux distributions using musl as their primary C library on x64 and AArch64.",
"link": false,
"code": false
},
{
"jep": 388,
"info": {
"name": "JEP 388 - Windows/AArch64 Port",
"desc": "Port the JDK to Windows/AArch64 (ARM64)."
}
"jdk": 16,
"name": "JEP 388 - Windows/AArch64 Port",
"dscr": "Port the JDK to Windows/AArch64 (ARM64).",
"link": false,
"code": false
},
{
"jep": 389,
"info": {
"name": "JEP 389 - Foreign Linker API (Incubator)",
"dscr": "Up-to-date demo moved to `org.javademos.java22.jep454.ForeignFunctionMemoryDemo` (JEP 454)"
}
"jdk": 16,
"name": "JEP 389 - Foreign Linker API (Incubator)",
"dscr": "Up-to-date demo moved to `org.javademos.java22.jep454.ForeignFunctionMemoryDemo` (JEP 454)",
"link": true,
"code": false
},
{
"jep": 390,
"jdk": 16,
"name": "JEP 390 - Warnings for Value-Based Classes",
"desc": "Designate wrapper classes as value-based and add warnings about attempts to synchronize on them."
"dscr": "Designate wrapper classes as value-based and add warnings about attempts to synchronize on them.",
"link": false,
"code": true
},
{
"jep": 392,
"info": {
"name": "JEP 392 - Packaging Tool",
"dscr": "Finalizes the jpackage tool for creating native application installers (MSI, EXE, DMG, PKG, DEB, RPM)."
}
"jdk": 16,
"name": "JEP 392 - Packaging Tool",
"dscr": "Finalizes the jpackage tool for creating native application installers (MSI, EXE, DMG, PKG, DEB, RPM).",
"link": false,
"code": false
},
{
"jep": 393,
"info": {
"name": "JEP 393 - Foreign-Memory Access API (Third Incubator)",
"dscr": "Up-to-date demo moved to `org.javademos.java22.jep454.ForeignFunctionMemoryDemo` (JEP 454)"
}
"jdk": 16,
"name": "JEP 393 - Foreign-Memory Access API (Third Incubator)",
"dscr": "Up-to-date demo moved to `org.javademos.java22.jep454.ForeignFunctionMemoryDemo` (JEP 454)",
"link": true,
"code": false
},

{
"jep": 394,
"info": {
"name": "JEP 394 - Pattern Matching for instanceof",
"dscr": "Enhances instanceof operator to perform pattern matching, reducing boilerplate code."
}
"jdk": 16,
"name": "JEP 394 - Pattern Matching for instanceof",
"dscr": "Enhances instanceof operator to perform pattern matching, reducing boilerplate code.",
"link": false,
"code": true
},
{
"jep": 396,
"name": "Strongly Encapsulate JDK Internals by Default",
"desc": "Strongly encapsulate all internal elements of the JDK by default, allowing access only via the `--illegal-access` option."
"jep": 395,
"jdk": 16,
"name": "JEP 395 - Records",
"dscr": "Finalizes Records, transparent carriers for immutable data; see RecordDemo.java",
"link": false,
"code": true
},
{
"jep": 395,
"info": {
"name": "JEP 395 - Records",
"dscr": "Finalizes Records, transparent carriers for immutable data; see RecordDemo.java"
}
"jep": 396,
"jdk": 16,
"name": "JEP 396 - Strongly Encapsulate JDK Internals by Default",
"dscr": "Strongly encapsulate all internal elements of the JDK by default, allowing access only via the `--illegal-access` option.",
"link": false,
"code": true
},
{
"jep": 397,
"info": {
"jep": 397,
"jdk": 16,
"name": "JEP 397 - Sealed Classes (Second Preview)",
"dscr": "Up-to-date demo moved to org.javademos.java17.jep409.SealedDemo (JEP 409)"
"dscr": "Up-to-date demo moved to org.javademos.java17.jep409.SealedDemo (JEP 409)",
"link": true,
"code": false
}
}
]
Loading