Java Next - From Amber to Loom, from Panama to Valhalla
Conference (ADVANCED level)
Room 3
Score 0.15
Score 0.18
Score 0.19
Score 0.19
The match becomes increasingly accurate as the similarity score approaches zero.

Java's four big projects are entering the home stretch: Amber and Panama have already incubated, previewed, and even finalized some features, Loom and Valhalla are on track to follow soon. Time to take a closer look at how...

  • Project Amber makes the language more expressive and ready for today's and tomorrow's problems
  • Project Panama cuts through the isthmus separating Java from native code
  • Project Loom enables hassle-free and efficient structured concurrency
  • Project Valhalla mends the rift in Java's type system and improves performance

After this talk, you will know what to expect from Java in the next few years.

Nicolai Parlog

Nicolai (aka nipafx) is a Java enthusiast focused on language features and core APIs with a passion for learning and sharing - in articles, newsletters, and books; in tweets, videos, and streams; in demo repos and at conferences - more on all of that on He's a Java Developer Advocate at Oracle and organizer of Accento. That aside, he's best known for his haircut.

Generated Summary
WARNING: This summary was generated using GPT based on the transcript, as a result spelling mistakes and more importantly hallucinations can be present.

Exploring Four Projects to Enhance Java
Amber Tulum, Panama, Valhalla, and Java Next
String Composition
Nicola Pollock, a Java developer Advocate at Oracle, is discussing four projects that tackle shortcomings of Java: Amber Tulum, Panama, Valhalla, and Java Next. These projects focus on making Java more productive and expressive, as well as introducing data-oriented programming which is similar to functional programming. Nicola also talks about String Composition in Java, which is a new concept for creating select statements. This article discusses the use of querying in programming languages and the various options available to achieve this. It examines the use of regular concatenation and string formatter, as well as a made-up syntax involving backslash curly braces and referencing variables. It also looks at string templates, which involve creating a templated string with embedded variables or expressions, and then throwing it as a template processor to create a valid output. The article also introduces the concept of different template processors, such as one which does nothing but concatenate strings, and one that is smarter and can understand formatting strings. Finally, it discusses why strings are important in creating structured text for machines to read.
Validating Processor
A new type of processor called the 'Validating Processor' is being proposed in JDK 21 that would allow developers to use a string template as an input and generate a generic result as an output. This processor would not require a string as an intermediate representation, allowing for more efficient development. It would also provide better security against injection attacks. Additionally, JDK 21 will also include other features such as primitive types and pattern matching.
Project Panama
Project Panama is an effort to interconnect Java Virtual Machine (JVM) native code. It consists of three sub-projects, the Vector API, Foreign Function API, and Memory API. The Vector API allows users to compute a result from two float arrays, A and B, as C. This project is mainly aimed at beginners or programmers who want to switch over to Java. It is intended to make Java more expressive and reduce the amount of code needed to read and write. Pattern matching, switch, and record patterns have been finalized and targeted for Java 21. Template strings are also expected to be included in Java 21, along with a simplified Main. In 2024, more patterns are expected to be available. Project Panama is a new feature that provides a vector API and foreign memory API to increase the speed of computation. The vector API allows for faster processing of multiple data sets by using multi-word registers which can hold 16 floats and do one computation to produce 16 results. The foreign memory API provides two options for storing data off the Heap, ByteBuffer which is limited but faster, and Unsafe which is great but not safe. This feature is currently in preview and will hopefully be available soon. Project Panama aims to connect Java with the native world by providing safe, detailed, and high-performance APIs. The new form memory API allows users to safely allocate and deallocate memory and control allocation. The foreign function API uses method handles to model calls into foreign code and J extract to generate Java code for native libraries. Project Panama plans to release the first preview of its performing APIs in JDK 20. The Vector API has been around for a while and is stable and mature, but it may need to be changed once the Valhalla project progresses.
In order to stay up to date with the evolution of Java, one should focus on the State of Articles which give a good overview of the current understanding of the problem and solution. Valhalla is a project that aims to address the fundamental split in Java's type systems, such as primitive types and classes, in order to reduce overhead and memory interaction. It is recommended for those working in constrained environments, such as games on Android, to avoid creating references. Java is introducing value types and primitive classes as a way to optimize performance while still allowing for a unified type system. Value types have no identity, but they still allow for default values, immutability, and the ability to implement interfaces and methods. Primitive classes are similar to value types, but they also remove the need for references, meaning complex numbers would have no nullable values. These changes are expected to be implemented in the future. The proposal for Universal Generics is to allow all types including primitives and value classes in generics. This would help avoid the problem of boxing when dealing with generics and provide better performance than current primitives. Additionally, flattening may be used as an optimization when a variable is marked as a value class and cannot be null. This could lead to custom primitive types that have comparable performance to today's primitives. Java is resolving the fundamental conflict between design and performance by introducing Universal Generics and Specialized Generics. This will allow developers to write code that they want while achieving better performance.
Other Changes
These changes will also make it easier to create more robust APIs and reduce the amount of shared mutable state, leading to fewer bugs. Additionally, many APIs are being added or changed, such as a new Random Number Generator, Unix Domain Sockets instead of an HTTP loopback device, UTF-8 being the default everywhere, Simple Web Server, and improved tooling with JFR. Performance is also being improved with Class Data Sharing and better Garbage Collectors. Sean Mullen is in charge of security at OpenJDK and writes a blog post every six months about the security changes in each new Java release. He recommends reducing the usage of certain mechanisms such as Security Manager, Apple API, Primitive Wrapper Constructors, and Biased Locking as they will eventually be phased out. He encourages users to keep their dependencies and tools up to date and build on the current Java version, latest LTS, and Early Access builds. Adoption of Java 11 is slowly overtaking Java 8 and is expected to continue with Java 17 and 21.
Project Loom
Project Loom is focused on developing JVM features and APIs to support easy-to-use, high-throughput, lightweight concurrency and new programming models. A hypothetical HTTP request is used to illustrate how the JVM can be used efficiently with platform threads, but this can be limited. Non-blocking APIs are an alternative, however they can be harder to write, debug and profile. Virtual threads offer great thread utilization but involve a conflict between throughput and simplicity. FX, a member of the Java Platform Group at Oracle, discussed how an instance of the class threat can have a super low memory footprint and very small switching costs. This is achieved by scheduling through the runtime and not requiring an operating system thread while waiting. They can have millions of virtual threads waiting as it is very cheap, however it requires a carrier thread pool. Debugging this virtual threat will show it sitting in blocks. For more information on the Java Platform Group, FX suggests visiting the website or the Java YouTube channel.
Nicola Pollock's discussion of four projects to enhance Java provides a comprehensive overview of the current state of the language. Projects such as Amber Tulum, Panama, Valhalla, and Java Next are all making strides to improve performance, security, and the expressiveness of Java. Additionally, the introduction of string composition, the validating processor, and universal generics will make it easier for developers to write code that achieves their desired results with less overhead. With these projects and more, the future of Java looks bright.
You can also ask questions on the complete talk using Devoxx Insights