Project Amber was introduced in early 2017 by one of the elite software engineers and project heads of the Java community, Brian Goetz. The goal of Project Amber was to discover and promote small-scale, productivity-oriented Java features that have been selected to be included in JDK Enhancement Proposal (JEPs) under the OpenJDK JEP process.
Project Amber follows specific selection criteria to shortlist features. Features have to go through at least one round of previews before they are included within the official version of Java SE. And even within this, for the implementation of a single feature, there are various JEPs for separate rounds of preview which are then standardized.
IMPACT ON THE JAVA COMMUNITY
Project Amber proved to be a very beneficial initiative from the top developers of Java. By welcoming various small but critical changes to the JDK, Java’s Project Amber has brought a significant change in the development process. What we foresee is that it will further improve the productivity of Java coders as well as make Java easier to understand for every beginner Java developer with the features it plans to roll out in the future. Although Java’s Project Amber has been in place since 2017, various JEPs has been delivered between Java 10 and Java 14. More are scheduled for inclusion in Java 15 as well as in upcoming future releases.
EXCITING UPDATES WE EXPECT FROM PROJECT AMBER
a. Quicker Updates
Project Amber aims to pace up the change process of releasing new JEPs. Thanks to Java’s Project Amber, useful new features will be added more frequently to the language by supporting the contribution made by the elite talent in the community. This approach is best suited for the faster pace at which the new Java versions are being released.
b. Discovering Top Talent
Java’s Project Amber also provides a platform for developers who have the potential to make a significant contribution to the Java platform. Thanks to Java’s Project Amber, top talent previously unknown to the community will get some much-needed exposure. Project Amber will bring them into the spotlight by giving them a chance to present their work in front of the whole Java community.
c. Attracting New Developers
The chance of gaining recognition is one of the most satisfying rewards for professionals in today’s crowded tech community. People now have various ways to contribute but they do not see a way to get the chance they deserve. Such a platform will encourage new Java developers to work towards sharpening their skills. They will also develop competencies that allow them to work with some of the leading developers of the Java platform.
Current Status Of JEPs
To date, Project Amber has successfully delivered the following JEPs:
a. JEP 286: Local-Variable Type Inference (JDK 10):
This feature allows Java coders to skip writing generic information several times in the same statement when they define variables.
For instance, the code snippet below compares Java 6 with Java 7:
List<String> strings = new ArrList<String>(); // code in Java 6
List<String> strings = new ArrList<>(); // code in Java 7
Later the complete feature was added to Java 10, allowing Java developers to define local variables without needing to rewrite the information about the type. This is commonly known as the “var” keyword within the Java community.
b. JEP 323: Local-Variable Syntax for Lambda Parameters (JDK 11)
JEP 323 was released as a part of JDK 11. In Java 10, we could define Lambda functions in two ways: Either by explicitly declaring the types or by completely omitting them. Now, ‘Allow “var”’ is to be used while declaring the formal parameters of implicitly typed lambda expressions. This saves developers’ time by reducing the redundancy in code.
c. JEP 361: Switch Expressions (JDK 14)
Switch expressions were released with Java 14. This feature allows a Java developer to use simpler, somewhat easier syntax when working with switch statements. It proves to be helpful specifically in identifying different responses based on the input. It saves time and makes it easier to work with switch expressions.
JEPs IN PROGRESS:
As mentioned above, before becoming a part of Java SE, JEPs are released as previews. After taking into account their performance and feedback from Java’s top developers, the next decision is made. Some JEPs may also be dropped. For instance, JEP 326 Raw String Literals was dropped after a preview as its performance did not match expectations.
See Also: VSCode Enhancements For Java Developers
The following JEPs are in progress and their previews have been already released with their respective JDKs:
a. JEP 348 Java Compiler Intrinsics For JDK APIs
This JEP will allow developers to optimize the performance of their overall code by tweaking the performance of important functions of code that are called very often. This will enhance overall performance.
It will let the developer give proper instructions to the compiler, to optimize the performance-specific Java Developer Kit (JDK) methods by assigning them as a candidate for compile-time intrinsification.
b. JEP 359 Records (Preview)
Thanks to Project Amber, what we know about this feature is that it aims to enhance the Java Programming Language with records. Records provide a compact syntax for declaring classes which are transparent holders for shallowly immutable data. This is a preview language feature in JDK 14.
c. JEP 360 Sealed Types (Preview)
This feature offers better encapsulation. The Java Programming Language can be significantly enhanced as sealed classes and interfaces restrict which other classes or interfaces may extend or implement them.
d. JEP 368 Text Blocks (Second Preview)
A text block is a multi-line string literal that facilitates the developers by eliminating the need for most escape sequences. Thereby it automatically formats the string predictably. It gives the developer more control over the format when desired. This is a preview language feature in JDK 14, which we would probably not know about if it weren’t for Project Amber.
e. JEP 375 Pattern Matching For instanceof (Second Preview)
Pattern matching will make it simpler to use the “instanceof” operator in Java. This feature works to check whether an object is an instance of a specific class and then extract components of that object for further processing.
As many of the features discussed here are still a work in progress, Java developers have much to look forward to from Project Amber. We expect Java’s Project Amber to include more features in the future. Such projects reflect the hard work of top software developers behind Java. Despite the responsibility and scrutiny it takes to complete each feature review and selection, they are dedicated to giving it their best to improve the platform. With the efforts of top talent, it isn’t just the Java platform that’s making impressive strides. It’s the whole community of elite developers.