Previous release: JDK 16 released with 17 new features… Refuse not to obey!
JDK 17 is now available for free
JDK 16 was released just six months ago (2021/03/16), and JDK 17 is coming again (2021/09/14). Remember that JDK 15 was released on the same day, incidentally.
Although iPhone 13 was released, it is really not 13 fragrance, there is really no innovation and highlights, just like the apple style squeeze toothpaste, on 13 really squeezed to the essence, this time I want to say, JDK 17 more fragrance!!
IPhone 13 price cut?? JDK 17 directly dry to free!!
Oracle has announced that, starting with JDK 17, all subsequent JDKS are available for free!!
Java 17+ is now available for free use, including commercial use. For more details, read:
www.oracle.com/downloads/l…
Check out the latest Oracle Java support roadmap:
JDK 17 is the second long-term release of JDK 11 in 2018 and will be supported until September 2029, which, by the way, will be 8 years old.
The next third long support release will be JDK 21 in September 2023. This long support release is scheduled to be released every 2 years instead of every 3 years!
In addition, the non-long-term support version will still be issued once every six months. The next non-long-term support version is planned to be released in 2020/03, but it should not be used in production.
A look at the new features in JDK 17
ID | features | instructions |
---|---|---|
1 | 306:Restore Always-Strict Floating-Point Semantics | Restore floating-point definitions that always enforce strict patterns |
2 | 356:Enhanced Pseudo-Random Number Generators | Enhanced pseudo-random number generator |
3 | 382:New macOS Rendering Pipeline | New macOS rendering pipeline |
4 | 391:macOS/AArch64 Port | MacOS AArch64 port |
5 | 398:Deprecate the Applet API for Removal | Deprecated Applet API |
6 | 403:Strongly Encapsulate JDK Internals | JDK internal strong encapsulation |
7 | 406:Pattern Matching for switch (Preview) | Supports pattern matching for the Switch |
8 | 407:Remove RMI Activation | Remove RMI activation |
9 | 409:Sealed Classes | Seal type |
10 | 410:Remove the Experimental AOT and JIT Compiler | Removed experimental AOT and JIT compilers |
11 | 411:Deprecate the Security Manager for Removal | Deprecate the security manager |
12 | 412:Foreign Function & Memory API (Incubator) | External functions and memory apis (incubating) |
13 | 414:Vector API (Second Incubator) | Vector API (secondary incubation) |
14 | 415:Context-Specific Deserialization Filters | Context-specific deserialization filters |
With 14 enhancements, plus a number of performance, stability, and security improvements, as well as some incubation and preview features, Java will further improve developer productivity with these new changes.
New JDK 17 features in detail
Here are 14 new features in JDK 17, divided into five broad categories.
1. Language enhancement
409:Sealed Classes
This feature was first previewed in JDK 15, previewed again in JDK 16, and finally fully implemented in JDK 17.
Sealed classes can be used to enhance the Java programming language, preventing other classes or interfaces from extending or implementing them.
Consider the following example:
public abstract sealed class Student
permits ZhangSan, LiSi, ZhaoLiu {
...
}
Copy the code
Class Student is sealed, indicating that it is a sealed class and only the specified 3 subclasses are allowed to inherit.
This is awesome, with this feature, it means that in the future, you don’t just inherit, you just realize, you have to get permission. After the conversion, the stack length will write a detailed article, pay attention to the public number: Java technology stack, public number first time push oh.
2. Preview and incubation features
406:Pattern Matching for switch (Preview)
Support pattern matching for Switch (in preview)
Everyone familiar with the concept of instanceof pattern matching? If you’re not sure, check out this article: Java 14 pattern Matching, a great new feature!
JDK 17 supports pattern matching for switch statements. Take a look at the following example!
Old code:
static String formatter(Object o) {
String formatted = "unknown";
if (o instanceof Integer i) {
formatted = String.format("int %d", i);
} else if (o instanceof Long l) {
formatted = String.format("long %d", l);
} else if (o instanceof Double d) {
formatted = String.format("double %f", d);
} else if (o instanceof String s) {
formatted = String.format("String %s", s);
}
return formatted;
}
Copy the code
New writing method of pattern matching:
static String formatterPatternSwitch(Object o) {
return switch (o) {
case Integer i -> String.format("int %d", i);
case Long l -> String.format("long %d", l);
case Double d -> String.format("double %f", d);
case String s -> String.format("String %s", s);
default -> o.toString();
};
}
Copy the code
Support the Object type directly on the switch, which is equal to supporting multiple types at the same time, using pattern matching to get specific types, greatly simplifying the syntax, this function is quite practical, looking forward to the positive, stack length will be written in detail, pay attention to the public number: Java technology stack, public number first time to promote oh.
412:Foreign Function & Memory API (Incubator)
External functions and memory apis (incubating)
Improved apis introduced in JDK 14 and JDK 15 to call local libraries and work with local data by efficiently calling external functions (that is, code outside the JVM) and securely accessing external memory (memory outside the JVM). Interact with code and data outside of the Java runtime environment.
414: Vector API (Second Incubator)
Vector API (secondary incubation)
Vector API This is a new initial iteration of the incubator module, the module package: Jdk.incubator. Vector, used to represent vector computations that reliably compile at runtime to the best vector hardware instructions on a supported CPU architecture. Vector computations can provide better performance than equivalent scalar computations and are very common in areas such as machine learning, artificial intelligence, and cryptography.
This enhanced API allows vector computations to be expressed in a way that reliably compiles to the best vector instructions on a supported CPU architecture at runtime.
3. Core enhancement
306:Restore Always-Strict Floating-Point Semantics
Restore floating-point definitions that always enforce strict patterns.
Java originally had only strict floating-point semantics, but since JDK 1.2, subtle variations in these strict semantics were allowed by default to accommodate the limitations of the hardware architecture at the time, and these are now unnecessary and have been removed by JEP 306.
356:Enhanced Pseudo-Random Number Generators
The enhanced pseudorandom number generator, java.util.random package has been updated to improve interoperability between different PRNGs (pseudorandom number generators) and make it easier to base algorithms on requirements rather than hard-coding specific implementations.
This change includes new interface types and implementations for the pseudo-random number generator (PRNG), including jumpeable PRNGs and a detachable PRNG algorithm (LXM), as well as a new RandomGeneratorFactory class.
382:New macOS Rendering Pipeline
New macOS rendering pipeline.
This new pipeline reduces the JDK’s reliance on the deprecated Apple OpenGL API by implementing Java 2D rendering pipes for macOS using the new Apple Metal API.
415: Context-Specific Deserialization Filters
Context-specific deserialization filters.
Allows applications to configure context-specific and jenicle-selected filters through a JVM-wide filter factory to select a filter for each individual deserialization operation.
403:Strongly Encapsulate JDK Internals
JDK internal strong encapsulation, which is a continuation of JEP 396 in JDK 16, which started out by default with strong encapsulation of most JDK internal elements, with the exception of key internal apis like Sun.misc.unsafe, limiting access to them.
In addition, users can still opt for the loose, strong encapsulation that has been the default since JDK 9, which helps users upgrade effortlessly to future Java releases.
4. New platform support
391:macOS/AArch64 Port
MacOS AArch64 port, which provides a version of the JDK for macOS that can run locally on newer macOS systems based on Arm 64.
5. Discard and remove items
411:Deprecate the Security Manager for Removal
Deprecate the security manager.
Security Manager has been around since Java 1.0. It has not been a primary means of securing Java application code over the years and is rarely used to secure Java server-side code, so this release is deprecated and will be removed in a future release.
398:Deprecate the Applet API for Removal
Deprecate the Applet API.
An Applet is a Java program that runs in a Web browser, but applets have long been obsolete. Do any browsers still support Java applets? I don’t think any of you have heard of this?
407:Remove RMI Activation
Remove RMI activation.
The RMI activation mechanism was removed from JDK 15 in September 2020, and the remote method call (RMI) activation mechanism has now been removed. It should be noted that RMI activation is an outdated component of RMI and has been optional since Java 8.
410:Remove the Experimental AOT and JIT Compiler
Removed experimental AOT and JIT compilers.
AOT and JIT, two experimental compilers that have barely been used since they were introduced in JDK 9, have been removed in JDK 16 because of the more widely used alternatives and the amount of work required to maintain them. The source code was removed from the OpenJDK project.
JDK 17 is free. What’s the difference between OpenJDK and JDK?
Yes, although they are very close, but there is still a little difference!
1. The Oracle JDK provides a variety of installers and update rules, while the OpenJDK only provides a pure compressed package;
Usage Logging is only available in the Oracle JDK.
3. The Oracle JDK requires third-party encryption providers to sign using Java Encryption Extension (JCE), while the OpenJDK continues to allow unsigned third-party encryption providers;
Java -version output is also different. Oracle JDK returns Java and contains Oracle-specific identifiers. OpenJDK returns OpenJDK and does not contain Oracle-specific identifiers.
Oracle JDK 17+ is released under Oracle free Terms and conditions, while OpenJDK is released under GPLv2wCP.
6, Oracle, the JDK source code contains “Oracle PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.”, its Use is governed by license terms, The OpenJDK source code is available under the GPL license.
These are the six main differences.
conclusion
Finally, this article mainly introduces the JDK/Java 17 14 new feature fundamentals, behind the stack long time will also continue to update some new JDK features detailed tutorial, pay attention to the public number of Java technology stack first time push. If you want to see a history of Java 8+ series of new features, you can also read it in the public account menu.
Java 17 was released and Oracle announced that JDK 17 and later versions are free to use, including commercially. Does Oracle really have a conscience this time, or is it leaning toward some kind of pressure to go free?
Java is definitely on the decline, but it’s still going strong and is now one of the must-have languages in every major enterprise.
While most people are still using JDK 7/8, or even 6, and writing JDK 5 syntax, JDK 17+ is slowly coming to the fore as JDK 17+ becomes free, or JDK 8 will be replaced in the near future.
Previous Java tutorial and sample source code:
Github.com/javastacks/…
OracleJDK 17
www.oracle.com/java/techno…
OpenJDK 17
Openjdk.java.net/projects/jd…
Oracle JDK 17
www.oracle.com/java/techno…
OpenJDK 17
jdk.java.net/17/
Interested can download taste fresh!!
Finally, JDK 17+ is free. Would you consider using it? Take a vote!
Old iron friends, click on the view, forward support oh, also welcome to share to your more friends ~
Follow the Java technology stack and share the latest and most popular Java technologies
Copyright notice: this article is the public account “Java technology stack “original, original is not easy, reprint, quote the content of this article please indicate the source, do not plagiarize, wash manuscript, please respect others work achievements and intellectual property rights.
Recent hot articles recommended:
1.1,000+ Java Interview Questions and Answers (2021)
2. Don’t use if/ else on full screen again, try strategy mode, it smells good!!
3. Oh, my gosh! What new syntax is xx ≠ null in Java?
4.Spring Boot 2.5 is a blockbuster release, and dark mode is exploding!
5. “Java Development Manual (Songshan version)” the latest release, quick download!
Feel good, don’t forget to click on + forward oh!