Foojay Podcast #28: Java 21 Has Arrived!
JavaJava Core

Foojay Podcast #28: Java 21 Has Arrived!

Since 2018, we get a new version of Java every 6 months.

And version 21, released during today, is a long-term support version that can be used for many years.

It also brings a lot of new features and improvements in both the language and the runtime.

Actually, there are so many that we’ll probably not get all of them discussed in this podcast!

Let’s see what our experts find the most important facts we need to know about Java 21.

Podcast Apps

You can listen and subscribe to the Foojay Podcast on:

Guests

Mohamed Taman

Piotr Przybyl

Simon Ritter

Podcast

Host: Frank Delporte

Content

00:00 Intro and introduction of the guests

01:51 Excitement about the OpenJDK 21 release

04:18 What is Long Term Support?
https://twitter.com/nipafx/status/1676908785313492992

06:07 Every OpenJDK release is stable and production-ready
https://www.linkedin.com/posts/mohamedtaman_aws-activity-7101961717521264640-F8jh

11:44 Next LTS in two years

12:06 Should you wait a bit before using 21?

13:07 About JEPs, new versus incubator and preview
https://openjdk.org/projects/jdk/21/

17:13 JEP 444: Virtual Threads
https://softwaregarden.dev/en/posts/new-java/loom/dont-look-at-virtual-threads/

22:30 JEP 430: String Templates
https://blogs.oracle.com/javamagazine/post/java-21-sneak-peek

26:05 JEP 440: Record Patterns + JEP 441 Pattern Matching for switch

27:11 JEP 442: Foreign Function & Memory API (Third Preview)

29:05 Energy efficiency of Java

https://thenewstack.io/which-programming-languages-use-the-least-electricity/

30:55 How Java evolves by inspiration of other languages

33:56 Difference between OpenJDK projects and JEPs

35:06 JEP 445: Unnamed Classes and Instance Main Methods (Preview)

40:55 Dummies book “OpenJDK Migration”
https://foojay.io/today/book-announcement-openjdk-migration-guide-for-dummies/

42:28 What will Java 22 bring?

43:27 JEP 443: Unnamed Patterns and Variables (Preview)

45:18 JEP 439: Generational ZGC
https://foojay.io/today/what-should-i-know-about-garbage-collection-as-a-java-developer/

49:33 Performance improvements by using newer runtimes

51:23 JEP 451: Prepare to Disallow the Dynamic Loading of Agents

52:37 Looking back at the 6-month release cycle introduction

55:00 Outro

Transcript

Automatically generated from the audio, so it can contain errors in names and technical terms. Suggest a correction.

[0:00] Hello and welcome to this new edition of the Foojay podcast Java 21 is here let’s talk about the evolution of java and all the Fantastic new features in this version since 2018 we get a new version of java every six months and version 21 released this month will be a long-term support version that can be used for many years it also brings a lot of new features and improvements in both the language and the runtime actually there are so many that will probably not get all of them discussed in this podcast let’s see what our experts find the most important facts we need to know about Java 21 hi nice to see you again and thank you for inviting me to this amazing podcasts and gladly also that these amazing people joining us expertise from everywhere so my name is Mohammed Taman and I’m working as a chief Solutions Architects for Nortel and I’m Java Champion speaker I love Java as we all do so this is why I’m here hello my name is thank you very much for inviting me I am self-employed as software Gardener and software garden.dev and I’ve been working with Java since 1.3 so I’m pretty thrilled that it’s you know

[1:24] After all the ups and downs it’s evolving really fast these days and I’m really happy to be here hi yes I’m Simon Ritter I’m the deputy CTO at Azul and it’s very good to be here today to share my thoughts on what’s going on with JDK 21 and I’m Frankel Porter host of this podcast I’m a technical writer at Azul but very interested in everything that’s happening in Java and that’s why I’m creating these podcasts yes 21 we are there it’s a pity they don’t release it on September 21st it’s on the 19th if I’m correct are you excited as me about this new version yes for sure this is why here to discuss all the excited you know features coming up and this is also one of the short release six months release Cadence that will bring a lot of gypsy and features alongside since the new you know version that release case Cadence that we had since Java 9.

[2:27] So yeah it’s a big release so this is why I’m excited about yes it’s also a difficult release I would say from my point of view as edutainer because just as you said Muhammad when you take a look at previous releases when we had like a few chaps a handful of Jabs right then I could easily cover them in one of these Deep dive sessions like two or three hours just a few days ago I was trying to give like such a similar talk that was with Jack and we had two hours and I was I had really the feeling that I was scratching the surface of java 21 in two hours and I I’m of course perfectly aware that big things like especially like future threats didn’t happen just over these two preview releases right but it’s but it’s surely a very big big thing I’m not sure if you will agree and maybe it’s like overstatement but it may seem that it’s like a you know that Java is going to be born again in a way yeah I completely agree yeah it’s interesting it because as you say this is quite a substantial release from the point of view of Jabs there are 15 Japs in JDK 21

[3:39] And that is a big number because if you go back and you look at some of the earlier ones the earlier versions we’ve had ones where they’ve only been like you know maybe four or five so the fact that we’ve got 15 Japs and eight of those are Full Features seven of them are preview features or incubator modules which still means that they’re new to the platform or revisions of the features in the platform and I think that yes I think because this is a long-term sport release there are a number of things that they wanted to kind of get in especially with like virtual threads make sure that was a full feature so that people could start using that in production as part of the long term support release we already mentioned a few things which we should dive into is jeps is long-term supported this kind of stuff let’s start with the long-term supported early this summer Nikolai Bardock of Oracle he’s got some confusion on Twitter and he had a video with I call it a clickbait title it’s Java 21 is no long-term support version and as he says don’t worry there’ll be plenty of JDK 21

[4:46] Builds that get free timely updates and lots of companies that offer commercial support but that doesn’t make 21 an LTS version who can explain what’s happening here yeah I mean I think that was confusing and I like Nikola he’s very good at explaining some of the technical details of java but I do think that particular thing that he did was not misleading but it was too technically accurate I think is the way I would describe it because what he was talking about was the fact that if you look at OpenJDK is the source code of the Java platform it’s the open source version of java now that doesn’t have the concept of long-term support releases so he’s quite writing what he says there but the thing is that when people want to use Java they use a distribution this is the same as we have with Linux it’s always the analogy that I use you know Linux is an open source project you have distributions so the distributions of java and Oracle are the one who started the long-term support versions fortunately all of the distributions other than Oracle have a lined along the

[5:56] Same long-term sport versions so jdk21 is most definitely a long-term support version for all distributions I will leave it there okay yeah we already discussed this a bit in the podcast about Java 20. every release of java is a stable release so it’s a full usable product safe to use in production or deployment whatever you want to do with Java if you want to use a new feature which gets released in what then is called a short-term support version you can just use it in production that’s a good Java to use correct yes most most definitely and this is what puzzles me when I like go in the wild and like talk to people that they are they seem to be so obsessed with the LTS therefore they’re skipping all these intermediate versions so sort of despite not having any paid support so this is like LTS means something if there’s this other person who will pick pick up the phone right or like respond to your ticket or performance issues or what not like whatever you encounter if you just like I’m not gonna say leave the YOLO live but if if you don’t care to have like a proper commercial support then what’s

[7:16] The big deal I mean I guess then you should be updating each other like every six months basically it’s a good point from my point of view I have a always debate about this like we have only two migrates since I’m working for companies and they are always thinking like LTS is the proper way to move from version to version which is okay we can think it like this but as Peter says like each six months release Cadence version is the stable version actually and it take it receives support every six months if we take Azul for example this support release cadences even is not LTS quarterly or monthly base or even based on your subscription so this is a great addition to the community and this is why it drives me to you know for our elevation Innovation lab or even when we would like to migrate smooth only we have to take this release kid in six months features these GDK versions into consideration in order to move smoothly especially we have a lot of duplications and removals it’s not like before you know yes we are background compatible but in order to evolve and innovate in

[8:29] The Java platform we have to duplicate all Technologies non-use why we have to support something doesn’t make any sense this idea brought to us like we literally start not depending on LTS so much until sometimes we have versions that yeah we need this feature we need this performance and memory management so let’s go for production no problem since we don’t use any breaking change even if we have preview feature for project Amber for example yeah we know that mostly it’s receives the second cycle of review it becomes better so it becomes more stabilized so we can make use of it so yes people always fear of like okay what’s new I have a post on LinkedIn very long debate someone asking me when I say like we have to move from java eight now we are 21. so someone just said to me what is the new if I can do everything I do in Java 8 and Java 9.

[9:31] Yes this means and Java 11 or 21 yes if you are using the same apis and you don’t use anything else you can just still use Java 8 and it would be dead because recently Amazon you know they will drop the support for Java 8 for all these Services soon that’s always the better but this is how we think about it and it becomes more easier to move forward like this definitely yeah I agree with both of you because you know people do discount the intermediate releases between the long-term sport ones especially in production and I do get some of the value of that because people are looking for that stability that they want in terms of being able to maintain updates but I think the certainly when I talk to people about this one of the things that I really try to get across is that even if you’re you’re sort of aligning on long-term support releases and that’s your strategy what you must be doing is testing with those intermediate releases so that you are not jumping a lot when you move from like 17 to 21 you need to test intermediate releases so that you’re aware of what those changes are

[10:39] Make sure your applications aren’t affected by any like Muhammad said you know sometimes we’re moving apis you need to be aware of any changes that might affect your application so I think that’s the important thing there are different kinds of changes to different JDK releases so there are these games of course that you can get like a nicer API or better syntax or something that’s something you can possibly achieve or make it simpler for like new stuff obviously you’re not going to rewrite what you already have however there are a lot of things that happen under the hood that your code is not even aware of this and I get guess the best example of this was compact strings without touching recompiling doing anything if you had like a proper Latin one strings they suddenly occupied like almost half of the hip right without even like redoing the jars and this is what you were missing this is what you’re still missing if you’re on Java 8 you’re paying for that memory you’re paying that garbage correction cycles and what not so the world has advanced you decide to stay still and therefore you’re

[11:43] Losing in the race and the next long-term support is 26 25. it’s two years indeed if you now start with 21 and then wait for the next one then you’re losing two years of evolution in Java and that’s a bit the story yeah that’s a pretty important message here there are also companies who say yeah we’re gonna change to 21 but we’re gonna wait one year before it’s stable do you think that’s necessary I think it’s probably wise and the reason I say that is because yes we’re introducing new features and you know although as you quite rightly say Frank you know or other people have said you know each of these releases is stable so that there isn’t like beta testing of things and it’s not like the there are potentially things that they haven’t finished the work on but it is important to understand that when new features are added there is obviously a testing phase because Oracle and the openj DK developers are not able to test everything straight away so it needs to be out in the wild people testing it against all those Frameworks all of those different platforms to make sure that everything works in the way they

[12:55] Expect it to so there will be some things that will need to be you know fine-tuned and a few bugs that need to be ironed out so a lot of people as you say are going to wait maybe a year to deploy let’s dive into the Jabs themselves so Japs or Java enhancement proposals and you’re managed within the opengidk project now if you go to the website of opengdk.org I will add all the links to the show notes of course there you can see in the projects GDK 21 a list with all the Japs and there we have a list of new features and incubators and previews now the new features are the ones that are really available for everyone you can just run Java with 21 and you have the new features now what is then the story about the incubator and preview they are the same but something related to API side and something related to the features so preview features that we call a feature behind the flag but you have to enable flag there’s there’s enable preview in order to use it from your command or your ID so it’s different version compilation but this is how you have to have a flag to make use of it so it’s done on your

[14:10] Own risk because there is my future changes happens that could break and we have a lot of example of this like if we are taking into example like pattern matching per switch and record patterns for example so in the previous version Java 20 it has been introduced that it could be pattern record pattern could be used in four enhance it for Loop and in this version it has been dropped so if you start using this feature and yes it will work in Java 20 and start using Java 21 it will introduce you know compile solution error this is not supported anymore so this is why we have feature for incubator it’s similar but for API for example in JDK then we introduced for example clients HTTP client API but it wasn’t completely finalized so it has to be in under gdk.incupider dot whatever the name is of the module until it goes to production then it will be released in separate on its own GDK which was Simon he can correct me if I’m wrong it’s like jabra.net.http and then all the apis when it goes to production but this is similar concept and you have to use also the flag to enable it but the one from

[15:33] The API side which is classes you know and all of these kind of things and interfaces and the other one preview features when we call it it’s for the features itself at the compiler level yes I mean the preview features and incubator modules is something that’s reasonably new and that is as a result of the six months release cycle we couldn’t do this before because if you introduced a preview feature in let’s say jdk6 you’d be waiting four years until you could then change that feature in JDK 7. it just doesn’t make any sense but with a six month release Cadence preview features and incubator modules is a wonderful way of evolving the platform in a controlled manner but still allowing for feedback which might result in changes to whatever’s being developed and we’ve seen as Muhammad quite Riley points out you know various examples of this in you know pattern matching in switch where we move from using break to using yield as the way of returning the value and things like that no actually that’s not pattern matching this which is it that’s that’s actually switch Expressions sorry my

[16:34] Badge Solutions the one thing to really get across about both of these things is that they’re not again beta testing this is not incomplete features it’s not still development so a phase this is fully formed everything is ready available and you can use it the only reason is classes preview or incubator is so that there is time for feedback people can suggest things that they think would be improvements and then there is still the time to make changes before it is formalized as part of the specification and thanks to having a very big Java community and a lot of people who are really eager to try out new features there is a lot of feedback and improvements and Evolutions okay as you said Simon there are indeed eight new features seven in preview and incubator pick one which one is your favorite that’s a tricky one I mean I guess the obvious one is virtual threads because that is a substantial change it not in terms so much of the program the way you program although there are some differences in terms of the way you actually create threads but the thread objects are still the same it’s more the

[17:42] Underlying JVM in terms of how we handle threads in that type of scenario so this is all about you know thread per request type of applications where you’ve got like a web server or something like that where you’ve got lots of incoming connections and you allocate a thread for each of those requests and that doesn’t necessarily scale very well if you’re mapping a thread at the Java level into a thread at the platform level because you simply can’t scale to thousands and tens of thousands of operating system threats and often with the threads that are being used there most of the time they’re blocking because they’re waiting for i o or database access and things like that so what the JVM’s now able to do is to say okay we’ve got a virtual thread and we can then have that the virtual threads mapped and many threads to a single platform thread so whilst the thread is blocked another thread of the JVM level can make use of the platform thread and you get much more better use of the resources available in your system so I think it is very substantial change which is really good for a lot of

[18:48] Enterprise applications I think that’s also one of the most written features on Foojay and other blocks I’ve seen very impressive numbers of being able of doing thousands of things more in the same time will we see the most use of this in Frameworks like spring or server things which are actually implementing these virtual threats and hiding a bit of the logic to development yeah now this is a good point you see because one of the things that you mustn’t think about with virtual threads is that it is a Panacea for all problems and that simply by applying virtual threads suddenly you’re going to get better performance and that’s something you really do need to avoid because it is a situation where if you have got lots of threads which are mostly blocked because they’re waiting for Io or database access or whatever then you can get better performance but if your threads are CPU bound and they’re doing a lot of work and they’re not blocking virtual threads will give you nothing in terms of performance in fact it may degrade your performance because you’re then trying to do context

[19:53] Switching between different threads on a platform thread and that then provides an overhead so you do need to be careful in terms of how you use the it’s not just like a blanket okay let’s change everything to use Virtual threads and it’ll be great and so yes when you talk about spring and platforms like that I think they will look very carefully at what they’re doing to make sure that they use them in the appropriate way to get whatever performance benefits are available from that yes I think one of the examples is HTTP handling getting something from a database switching to another HTTP call and in between that’s the kind of use cases where you get the benefits of virtual threats yes that’s why I think there is or I suspect there is no single like system-wide or Global switch that let now let’s start all the threats to be virtual right because there are like virtual threats are going to shine when it’s because they’re really great when it comes to waiting and you wait for Io right so then they’re they’re great but when we have like a really competition heavy tasks they may

[20:53] Actually degrade like just like simos said but there’s actually we have to think about it more they for example they don’t provide any phone yes right whoever shouts taxi industry right louder gets the taxi so they for example they’re different than parallel streams in this regard when you take the whole right like through all the steps right and then you have to think about even more when you add logging which is just IO and then just when you log something like just log the progress right they’re going to get unmounted from the platform thread right and so on and yes so that’s why I think many companies and like vendors are going to be really prolonging this maybe it’s not even going to take a year but longer right I mean Simon you were there you obviously know how long it took for generics right to really kick in I hope that virtual threats with get adopted earlier but they are they’re not like cure for every disease right they just for this like let’s write let’s handle things asynchronously using this synchronously looking code and that’s pretty much it right we have

[22:00] To be we have to be careful about this I would say we’ll see how they like it evolves like with the structured concurrency and so on in the future because this will be like a new new idioms for Java developers much easier to talk again to start using those are all good points especially like when we talk about reactive programming which is really really complex way of doing these kind of things structure concurrency yes will help simplifying this more and more in straightforward natural Paradigm of programming okay so we know the favorite one Jeff of Simon so that means filtering Muhammad that you cannot choose virtual threats that’s already taken do you have other favorite ones for me like string template to be honest because I like string features and enhancement has been done through since GDK even 9 and quieter mentioned during compact before so there is always this is one of the biggest you know Java type that has been used and will be used always and this it’s always source of you know memory consumptions and if you don’t take care of it and security issues and everything and as Peter

[23:14] Before mentioned that Java evolving as an evolving we have a lot of enhanced and simplification done since even text block one of the greatest since Java it came to production Java 15 text blocks so it was amazing feature to simplify the long you know text without any kind of identation and plusing and quotation and you know this is was really cumbersome and with string templates it’s a still preview feature because it’s a new one we’re still waiting for feedback to enhance more and more but when I tried it I have a great article about it in Java magazine I hope to be published soon and I tried the feature out that I found that like it’s amazing because it’s it’s a preview features I have mentioned because it’s a new it’s complement actually the Java’s current string levelers and text block by combining you know like literal text which is embedded with embedded expression and processories to generate customized outcome in a secure way this language features and its API should completely simplify the Java programming by enabling Street forward expression of the string and incorporate

[24:30] Runtime computed values so you cannot just inject anything and it would be run away and this is improved security and strength template aim is to improve definitely not just you know giving abilities and functionality also readability of the Expressions enhanced programming security this is very very important and also increase flexibility and easier usage of the API to accept the string written in non-java languages you know this is also one great feature of this so the ability to develop non-string Expressions through the combination of literal text and embedded expression is also a key objective with this API and Egypt 430. so it’s a great feature I like it so much and because you know we’re writing SQL string we are parsing XML we are passing Json and you know how hard it is to pass some values and go and also compare some the compromise the security so it’s very important with a string template we can do this with networks that came out of the box and we can develop our custom processors even if we would like to have engines like SQL or something like these kind of things with

[25:50] Specific security you would like to check we can have it customized it’s it’s out of the books feature to be honest to be used yeah and I’m also excited about sequence collection but I will give boiler also a chance to speak about his favorite one all right thanks I guess I will still leave you a sequence collection I mean I’m I’m somewhat like not entirely happy how geometry collections look like but it’s a like a topic for another discussion okay yeah but I’d like what you said about other languages therefore as since then the last one I decided I will pick two sorry gentlemen so I like two things one is everything that’s around pattern matching you know so it started with record ports and switch expressions and then we’re combining them together and so on because this will make data processing for people much easier so this data-driven flaws or payloads or just like you know programs or all algorithms tackling this like we have some data in like in the source and we have to pump it somewhere will be much easier for all these people who are not necessarily experiencing programming

[27:01] In Java right so then like mean showing like a little demo or this is how we can do that like you know even for this like single-use programs or something would be much easier and then what I’d also like and I observe it we all observe it it’s like this never-ending story it’s this foreign functions and memory API it’s because it allows us calling then like if you don’t know what these are about these are about handling of hip memory so the garbage collector doesn’t play with it like you have to handle it manually sort of like malloc and free and then you have to oh then you can call native stuff and then I’m I’m sorry like if I’m pushing it a bit too far and I absolutely don’t want to start any of this holy language walls but think about it like what python really is it’s a nice syntax wrapper around C right and now with these two combined Java will be able to follow this path being much more energy efficient right and with like you know static types with compiler and everything so it will be as easy and maybe even faster to call the underlying native stuff pump tremendous amounts of

[28:16] Data using nice syntax and then get the results out right in the Advent of you know AI ML and whatnot this might be like that’s why I think it’s it’s really being reborn in a way because like I’m sorry we started with a language that was supposed to handle fridges and microwaves then we were writing beautiful charts using Java Outlets then we switch to backends and now we are going to you know yet for another ecosystem so for like a language or a like ecosystem that’s 28 years old it’s for me it’s it’s amazing I mean most of my sort of career I’ve been doing Java right and now I see like yet another sort of Market opening and I think it’s beautiful about if Energy Efficiency a few years ago there was a lot of rumor about a study where they said if C is the Anchor Point then Java is twice using twice as much energy but python is using 70 times more energy for the same function and now you’re saying Java is becoming more energy efficient so we’re getting very close then to see it’s in the fourth grade actually yes and the programming language one of the least consumption

[29:35] Language that you can use as an efficient for energy and electricity and processing now so it’s a graded like first grade after C and you know the most speedy which is the one that touches the hardware immediately and the Java becomes highly ranked above all the other language coaches so we are happy to see this and this order says like there is a new era especially in Big Data we are in the era of data and cloud and AI you need a much of processing and if you are trying to scale your machine to con to have more memory just to do some processing for large files and this is very unefficient to be honest like because you are consuming a lot of memory with waste of time a waste of resources which is required only for one hour or half an hour or five minutes or something but if you take this out of the hip and processing it just get the result it means you are saving resources you’re saving money and cost this is very beneficial for the management board and you look at it and it would be more efficient because you don’t have to use a lot of resources and you know Big Data they tried to do this kind of like spark

[30:50] They try to innovate something like this they’re trying to make use of it and what’s amazingly we have we when we see a very good case and study and solution is it’s adopted in the open gtk and then driven by the people they brought these cases so we’re trying to align some people say it’s like yeah you didn’t bring something new sorry there is languages have this yes but hey Java is not just the small languages that it can break out and just introduce it’s an ecosystem it’s a lot of vendors it’s behind this thing like there is a lot of people has to agree to adopt all of this so I think I didn’t have that and I agree with by Peter and Muhammad about this because Java is a language you know we pull a lot of things from other places I mean even when Java was first released it wasn’t a completely new idea garbage collection have been done before object-oriented languages have been done before it used the c c syntax to make it easier to migrate so it’s always been about taking ideas from other languages and we’ve seen that a lot but you know if you listen to what James Gosling said

[31:57] When he first wrote the language he said it’s designed to be a Blue Collar programming language it’s about getting the job done in the most efficient way it’s not an academic exercise it’s not about you know how can I make it my kind of language it’s about how to get the job done in the most efficient way and that’s what we’re seeing that’s still held true today 28 years after job was launched and that’s what I find amazing about the Japs they follow up on each other and that’s why they use the six month release cycle like the whole Evolution with records and the pattern matching there is already the ID we want to do to be able to do this in a few versions so we’re working towards this goal it’s not let’s fastly Implement something that everyone is requesting it’s not just throwing a new feature into Java it’s really how does this fit into the language how does this fit into the goal of where we want to be few versions correct yeah and I have to say that you know in response to that if you look at the work that people like Brian Gertz have done and Mark Reinhold in terms of evolving the Java

[33:08] Platform especially Brian with the whole project Amber he’s done such a good job and I know it’s not just him but he’s the Chief Architect a lot of people help him with this but the way that they have evolved the language is to my mind so well done in not like you said just throwing new features at it and hoping that they stick it’s like thinking them through very carefully there’s a lot of discussion on like the amber mailing list and people have the opportunity to provide input and Brighton is so good about responding to people if you read the album mailing list he will write a very detailed response to people when they come up with a new idea and he he’s he’s very good about explaining well this is a good idea but you know it doesn’t actually make sense in terms of what we’re trying to do with the platform things like that so I really do take my hand off to him for that you’re touching now the projects like project Amber Project Crack where Azul was also involved what is the order of a project versus a so a is a JDK enhancement proposal and if you look at the definition of it

[34:12] It is supposed to be a small self-contained change to the platform which is at least I think it’s three months worth of work so it’s not a tiny change it’s a change that requires a bit of work but it’s not a huge change the projects that you talk about so Amber Valhalla and Panama and things like that they’re bigger projects which have a much greater impact on the platform as a whole and each of those projects will result in a number of jets individual Jets and we’ve seen that already with Amber and with Panama markers that’s the whole Forum function and foreign memory interface that piote was talking about so you could say that the takes a part of a project to introduce increments in Java to reach at some point the full project yes okay I think that’s a fair way of saying it and I have to pick my favorite because I also have one favorite I do love to talk about Java and introduce the language I also create a tutorial for Foojay so it’s the removal of the whole hassle around the mean so that’s 445 you don’t need to explain anymore why you need that public static main string or

[35:28] Accept it looks like a small change but it can actually make it a lot easier to get people into Java correct is that a goal this is the main goal since we introduced J shell for example it’s always we need to bring the new student because they have bison they have different languages which doesn’t require a lot of ceremony to do you know the Halo world and for us for me it’s I don’t care about it because like I love to write object oriented but for a new student because they are lazy enough to not learn and they will have a questions and why we do that in our time we love to explain every single keyword and we feel powerful and excited to know about what we are doing but nowadays as you can see people cannot even read five seconds even you know long and the Shorties we are in the era of shortness so yes this is to the main idea here to bring people more especially students into you know the language easily without complex you know ceremony about it then when they learn it they will start to they will get into it later on because they will see it and when they involved so this is

[36:42] The same idea when we have G shell yes we used it as a professionals and student because you don’t need IDE I just can have an interpreter I will use it and that’s it and then we enhancing more and more for this kind of things bringing in newcomers to create initiative of programming without any a big verb as things and explanation and questions mark why static why meanwhy just like that but I see it in some other way if I saw it I would like no I need the complete ceremony as as for me I think so it’s nice the same feeling yeah I’m going to be very controversial here and I’m going to say that this is my least favorite feature in jdk21 and I liked it because I think it’s a bad feature don’t get me wrong about that and I do absolutely see the benefit but I think that the idea of making it simpler to write a hello world application is it doesn’t really help us in a great way yes if you look at your very first program in Java you can make it simpler and you don’t have to worry about what are these bugs and you know the class structure and all sorts of things like that but the moment you move

[37:52] Beyond that you’re going to have to start understanding all the details about how the platform works and so making that very first program or even you know like a couple of programs very simple and straightforward I guess it’ll make it more attractive to a few people but I don’t think it’s really making that much of a change J shell is definitely something I like because I use that a lot because if you try if you’re trying to do a little bit you’re trying to write some code and sometimes you get hung up on a small piece of code and the syntax and how it actually works and being able to extract that out into J shell and being able to work on it in isolation it’s great and I like that and it is also useful as you said as Muhammad said for helping people get into the whole idea of job without having an IDE and even the idea of executing directly from a Java source code file without having to go through the two-step process of compiling and then running it I like that as well but yeah the changing Main and things like that I like I said controversial but I’m I’m

[38:57] Not totally sold on that one I’ll give you some negative feedback I’m sure but I guess it may come from the I’m sorry like when I look at our thesis I guess it’s quite safe to assume that none of us started programming in Java so for us it’s like you know the concept of main passing arguments and whatnot that was when we picked up Java it was already natural right it was encoded into our brains and it’s not new for the newcomers I myself worked as a bootcamp teacher good life trying to explain what is like encapsulation in 15 minutes right and yeah so I I’m not so sure if it’s going to be long term good or bad I guess it will help some people to pick Java as their first language you know when they’re sitting there like a quote-unquote basement right and just see hey maybe I can use my PC for something more than just playing right and of course course for people who write like single-use scripts or when they don’t care that much about performance because let’s say it’s just extracted piece of code from like a sophisticated system without any bloated framework and just

[40:09] Need to pump like data from A to B that’s also my going to be useful but I also like to think that this is like maybe like a tiny significant so it’s only tiny signal that Java in general is also adopting to the times right so at the time like two decades ago newcomers already knew any other C derived language and these days it’s no longer true perhaps so maybe we just need people to pick Java as their very first programming language or they trade language without these constraints right like public study so maybe maybe that’s the reason and in that regard I like it that it’s responding to this to these needs like the change of the society in general Simon I want to touch one thing with you is your book so we had a lot of reviews also on Foojay as we said before the discussion with long-term support or not so you have the open APK project which is the source code of java and then you have all the Distributors and that’s actually the story that you want to tell with your book correct yes it was the idea of helping people understand how simple and straightforward it is to

[41:27] Migrate from one distribution of OpenJDK to another distribution of OG OpenJDK and really sort of help people understand all the sort of issues behind that in terms of thinking about what different distributions provide in terms of support and you know things like that because of course from a feature perspective we’re building from the same source code and so you’re going to have identical functionality but it’s also important to understand things like the tck so the technology compatibility kit which is part of the Java SE standard defined by the JCP through all the different jsrs and understanding that gives you that extra level of confidence that if you’ve run all the tck tests on a distribution that it really is going to be a drop in replacement and you’re not going to have to worry about changing your application code recompiling your application in order to run it on a different distribution so that was kind of the idea behind the book was to help people understand how that process can work I also will add a link to the book in the show notes it’s free for everyone so they can

[42:27] Download the ebook we’ve said it before there is a six month release cycle so that means that we’re already now discussing Java 21 but we can already look forward to 22. any idea what that will bring there are no Jabs yet none but I can guarantee that there will be some that will be follow-ups on the existing preview features in JDK 21 and incubator modules so who knows Vector API is on its sick iteration as an incubator module maybe in 22 we’ll get a final API I must admit I’m not quite convinced why we’re spending so long on that one I don’t know why that one’s taking so much time to finalize but I think there will be some things in that range maybe some more pattern matching you know Pierre to mentioned this and that’s another one of my kind of favorite things in this release is the fact that we’ve got more pattern matching things especially the idea of unnamed patterns and variables I think that’s a great exactly I wanted to speak about yes they wanted to speak about this to be honest because this is something like introduce really good relability and you know we are

[43:41] Both different concepts but they are related nameless pattern correspond to a compound or frequent without explicit mentioning of its like names or types whereas nameless variables can be assigned to a value but remain unused so it’s the same like we dropped underscore to make use of it in some other way then this is the time to use underscore as a name variable so represent which is represent both of them so this literally enhancement it’s a small assignment has said but it’s increase and enhanced readability of pretty good pattern by just omitting redundant nested patterns and to enhance the mental ability of the code to identify variables that needs to be declared but won’t be used I am looking forward to this it’s a preview maybe it will be final because if you don’t have a lot of feedback it’d be nice to have it that’s been otherwise yeah I can imagine it’ll be finalized in 22. that’s my prediction at least the other thing is maybe they’ll extend that a little bit further and allow you to use it in Lambda Expressions that would also be very good that was the original idea behind making

[44:48] A single underscore which used to be a valid variable name in JDK 8 and earlier and then in jdk9 they made it a reserved word in effect so you couldn’t use it as a variable name and the original idea was to use that as an unnamed variable in Lambda Expressions but now that we have pattern matching as well they did it with that first so this is the same concept like VAR we have it for you know normal introduction then we another enhancement has came into Java 11 to use it with London expressions take the same constant thank you for this point we talked a lot about jeps that really influenced the language and the runtime but there are also things happening inside the runtime like the garbage collector there was I think a feature that is not included is with Shenandoah where something has changed but there is 439 about generational zakisi can you give a bit of details of what’s happening there okay this is like yeah it’s as Simon mentioned before it comes sometimes we have a lot of enhancement comes like thousands of enhancement and security and API and some classes and interfaces and things

[45:55] That is not mentioned at the gyps but this is like release notes for and forwards and Bug fixing and alignment and everything but when it comes to GIFS yeah it requires significant time of work as Simon mentioned so this is why they are introduced but they are not related to change the language as a like synthetic or even as the incubator or preview feature for new things it’s just ongoing it’s related to gvm it’s related to the distribution of the GDK or some other security enhancement but takes more time so about this one this chip 439 for the generational zgc it’s aimed to enhance the application performance to expanding you know the Z garbage collector and its capability to manage distinct generations of young and old objects young objects often have a short life span and introducing a separate generation that should enable the GC to perform more frequent collection of young objects so application that use the generation generational the GT which first appeared in by the way in Java 11 as an experimental feature and goes for production are expected to gain several advantages one of these like reduce

[47:17] Reduce changes to allocate the delays decreased heat memory over the overhead requirements and also a diminished CPU overload and overhead from garbage collection activities so these advantages definitely should be attainable without a notable decrease in the robots compared to the non-generational variant of zgc I’m so excited about what I saw the other day so I was yeah preparing this like why you should migrate or pump your SDK version and I really love this changes to SDK that make my application run faster without me moving a thing here or moving it just slightly so yeah ztc the whole point if you don’t know about cgc and Shenandoah is that we have really short stop the world courses right so when we’re basically garbage collector shouts everybody freeze right and your application has to park everything so you can do like this like garbage collection and compacting and everything and I have like very biased and subjective benchmarkish sort of code and I’ve run it with Java 15 with z2c and the longest pause I detected or recorded was 1.1 millisecond and then I

[48:42] Run this exactly the same code with cgc using Java 21 the latest EA that’s supposed to be GA and the longest post was 27 microseconds just like so if this was my payload right my actual like protection stuff I would be switching to Java 21 already I mean so like yeah or not I don’t care like and then I see this you know this all these folks like from The High Frequency trading or whatnot being so like what so why did we bother with all these Primitives and whatnot like what did we avoid avoid like this garbage collection collector languages and so on and now it’s like micro seconds it’s it’s really it’s really happening I’m I’m really excited about this changes and that also changes like to G1 and other garbage collectors right and then it’s like they sometimes they might not make it into but they make tremendous impact on your pill because you don’t have to even recompile your code just change it Fly go to like how you build your image how you deploy your application and that’s it for me it’s almost like magic almost like Christmas

[49:57] So that’s the same story as you said with the strings improvements in string yeah just jump to a new version of the runtime and your existing code will run a lot smoother you know if if you run it if you’re using GDK 8 for your program and just migrated you didn’t do anything to Java 11 you will gain a performance hit like up to 60 percent out of the box without changing anything this is because of the gvm enhancement garbage collection and you know since even this release Cadence we start to have a bunch of garbage collection not just contributed from Oracle or open GDK Community it’s outside of the community like red hat Azul and this like we have bunch for different cases so we have more performance gains when we move on to migrate to new GDK not just because of the language feature or something like I always say the Java platform is about the gvm not the language because then you can use coffee and I can use whatever it’s synthetic sugar how to use this gvm this is why you have different bulgar languages that finally at the end they have to use the gvm to compile and

[51:15] Run so these enhancement things like all about the gvm and you know all its components I this is why I love Java the question here is do we have enough time just for one another small discussion because relating to what Frank was saying about and in fact Muhammad was saying about in terms of changes which are at the JVM level rather than the syntax level and the API level there’s one here that’s quite interesting which is jet 451 prepare to disallow the dynamic loading of Agents I know that has been mentioned in the list that somebody came up with what’s interesting about this is related to security which is to make the platform more robust and more hardened in terms of things like that so this is a jet which is just proposing at the moment that will issue warnings when you try and load Dynamic agents at runtime and at some point in the future they may turn off the ability to do that by default and what we’re also seeing is that leading in another direction as well there’s a big discussion at the moment on the JDK dev mailing Alias about doing the same thing for jni and

[52:21] The foreign function for a memory apis and that I think is quite interesting because that has created a like I said a lot of discussion about whether that is the right thing to do or not and so it will be interesting to see how that sort of works out in the future okay anything you want to add I think I’m happy if I’m mad it’s like when Java switch like this release Cadence so that we had the train departing every six months everyone was like ah so this is how we shall commute now right and it was like quite a like shy Motors it’s just how you reorganize traffic in this city basically and then of course like the smaller trains like you know the minor release is happening in between and now it seems and I’m really thrilled to see this it’s it’s it’s As Americans say it’s so amazing that now every six months the train gets longer and longer because everyone wants to jump in like Muhammad said with their little time changes here because we observe this for this scenario for that server there’s like you know like like a downgrade or like another bag or something and the all these like

[53:38] People like Cloud vendors and whatnot right they also want to like add the time a little bit but this tiny little bit makes us all basically happier right as a users of not even like us as programmers but because we don’t create these systems just for ourselves right there’s eventually someone using this system hopefully for something meaningful not just cat pictures on the internet right but yes that’s why I think like after this time it was right decision to make it like six months release really I mean it made sense it got successful like we have doubts about this but every time it enhances more and becomes more stable release you know really cycle so at least we know we have pattern everything goes smoothly and even the teams get used to this release cycle and become more confident have the candidates the future and when not and what to drop and to complete what they have mentioned actually so it takes time but it proves it is really successful and more Innovative than waiting for four years or five years for something to be honest except for the

[54:54] People who have to maintain static analysis and Ides yeah they have to evolve indeed but I think that’s a very nice conclusion we invite everyone to jump on the train to pick train 21 start using it definitely in your development check the new features also maybe the preview and incubator features and what you can do with them give feedback to the community how you use them what you think is good or bad and that keeps the Java language evolving thank you for joining this podcast my guests of course the listeners keep an eye on Foojay for future articles about development and everything related to Java World there will also be other events related to the Java 21 release on Foojay so have fun reading listening watching movies all about the Java Evolutions thanks a lot of OpenJDK

Found a mistake, or something to add? Edit this page on GitHub

Written by

Frank Delporte

Frank Delporte is a Java Champion, Java Developer, Senior Technical Writer at Azul, Blogger, Author of "Java Programming for Raspberry Pi - A Hands-On Guide to Electronics and IoT Projects", and Open-Source Contributor for Pi4J, Lottie4J, Sheetmusic4J, …

Written by

Mohamed Taman

Mohamed Taman (@_tamanm) is CEO/Owner at SiriusX Innovations, Chief Architect, Java Champion, Oracle Groundbreaker Ambassador, Jakarta EE Ambassador, JCP, Technology Geek, International Speaker, and Author.

Written by

Simon Ritter

Simon is Deputy CTO at Azul.

Related posts

Join the discussion