it have David tonight David actually came to Singapore one year ago he was actually visiting and speaking for a conference I think it was for Rocco waltz if I'm correct yep and yeah and yeah it was pretty awesome it was really good meet up with him and we thought to invite him again and so today like will be more talking about coffee features of Java like what to expect in the future and what's be having the newest versions of Java so we're very happy to have David's eventually today and hope to have him in person again in the future thank you David thank you well in yeah in fact I was supposed to come back I think in June but yeah anyway thanks for having me so despite I'm sorry despite the hard situation I'm very happy to be able to give these remote presentations so the title of the session is Java in the 40 version the thing is that more and more I realized that given we have accelerated the currents of the Java release people are are somehow confused about what's in Java so today what I want to share with you is basically what features will be added in 2020 in the Java platform why why 40 well I'm french-speaking and I always confuse 40 and 14 so given that we have just really in a version 14 of Java this is really what I'm going to talk today having said that I will also discuss about Java 15 which is which will come later this year in 2020 so this is a standard server what is this camera from Oracle don't make any process decision based on what I will say today having said that everything is open source so we're good on that side the only thing that you should you should keep in mind is that and if anything that I say about Java 15 can in theory still change I mean Java team will be released in September so between now and then there might be change that something that you have to keep in mind about disclaimer okay May is a very important month because we are about to celebrate the 25th anniversary of Java so Java has been released the first release has been released 25 years ago so we were just about to celebrate that anniversary the thing is that Java keep evolving since 25 years based on two core principle the first one developer productivity second core principle is application performance this has been done through the last 25 years in the face of constantly evolving things such as programming programming predicts for example 25 20 years ago we're not really talking about any kind of functional programming when it was when it when were talking about Java that's something since then that has been become more and more important something else that evolved is application style in the beginning we were mainly talking about client-server application we're talking about Minnelli's application those day obviously it's more and more about micro services so this is yet another revolution that Java has to cope with deployment styles in the early days we were deploying in our own data center on large Java those day we tend to deploy using containers in the cloud so that's another big shift when it comes to to the way we deploy our application and again Java has to cope with that and last but not least obviously the other one is evolving so those day for example we have more and more course in our machines we have more and more memory we have vector support directly built into general-purpose computers we have multiple level cache when it comes to memory and so on and so on so does blas this is basically out of a divorce for the last 25 years and this is how it will continue to evolve so this is a pretty busy slide I'm not gonna spend time on this slide this slide basically lists all the features that were added in Java 9 and Java 9 was the special release in the sense that it was the latest large release of Java and there's a big issue with that so every two to three years we were releasing one Java version with a bunch of features so when it comes to adapting those features it was very difficult because the developers basically had horror of a sudden access to a bunch of features so getting a getting familiar with those features was very difficult so we decided to change the way Java is evolving so now it works this is something that we have put in place end of 2017 so every six months does there is a new Java release so it's called it's called a feature release so 11 12 13 the current Java release is 14 released in March and in September 2020 we're gonna release 15 that's a given six months later 16 and so on and so on now all those feature release are open source and are supported until the next release comes out so 9 was supported at least until 10 cans out and so on and so on so that means that today 14 will be at least supported and until 15 comes out and 115 will be released in September the current release will be 15 and that does Italy if you're in the open source aisle you should use that version because that's the that's the version that is supported now we also acknowledge that there are some user typically enterprise they are not able to move that rapidly so moving for 14 to 15 is in itself not a big work given that they are not demanding that penny features between all those beliefs but still there are people there are there are some type of user that prefer to stick to one release for many many years so that's what that's why we are tricolor I have decided to have long-term support release so basically a long-term supporter ease is nothing more than a given future release that we take and we maintain for a very long time 11 is the current LTS the next one will be 17 so those release would be supportive supported for many many years despite the fact that obvious we will still have every six months and new features release so basically it provides choice either you use the open JDK build that Oracle is providing they are free the only thing is that if you are using those bills well you'd better keep with the Java release guidance so right now ideally you want to be on 14 because this is the race that is supported and that's also the reason that is getting the security updates if you are not able to move that quickly Oracle also sells support for Java that's the Oracle JDK so when it comes to buying Oracle support there are two things that you should look at the price of that support honestly the price of the Oracle support for Java is pretty cheap but I will let you judge that the only thing that you would need to look at when you decide where you want to get your support for Java is basically the ability that the organization you are looking at is able to support you and this slide shows the number of issue that were fixed in in this particular example in GDG 14 and we see that Oracle is clearly the company that contributes the most to Java so the takeaway here Java is still free dr bean there has been a lot of countries and confusions regarding that but java is and remains free so now let's quickly discuss about how can we enable faster innovation within the platform so the first thing that we put in place two or three years ago was this new release guidance where every six months we have a new release we also have the just the jep's mechanism so chip stands for jdk enhance and enhancements proposal so it's basically a mechanism that we used to introduce in the platform new Java language features new GDK features or even we're using that process to remove things from the platform or we are also using that features for example to evolve out the open to open JDK project is manager so it's basically some kind of lightweight mechanism that clearly that is clearly documented and tell the community how things are supposed to work when it comes to doing something non-trivial non-trivial in the into the platform next to that we have also put in place multiple feedback feedback mechanism that we are using to get feedback on non final features so the thing is that whenever we put something into the platform as soon as it's final it's something that is there forever so it's basically it becomes permanent so we'd better get it right before we turn something into a permanent feature within the platform so for that we have multiple mechanism that we can use to basically give to developers non final features we encourage developer to used on those non final features and based on the feedback we can still do adjustments to those features before we make them permanent so we have the preview features mechanism which is used more for language Java language features will serve experimental features which we use mainly for odd spot VM features and then we have an additional which sorry additional mechanisms such as encoder modules early GDK access built that we use to basically give access to to prototype of new capabilities that we are thinking of adding into the platform and last but not least we have an ongoing open JDK project that his name's Karass so the the goal of SCARA is to investigate alternative to mercurial so if you are looking if you know open JDK you know that for many years open JDK when in fact since the beginning open JDK has used a mercurial as his as its source code management solution it worked for many years but honestly material is a bit tough to learn so if you want to encourage more contributions well we'd better look at alternative so that was the goal of that project look at our alternatives and the outcome is skaara selected git as the alternative so that means that all the open JDK development is moving to get SCARA has also looked at Austin get provider Gaeta has been selected but Kelly skaara and openjdk is not tied to a get up so if something goes wrong with github we can easily switch despite the size of the project where different gate providers and last but not least Kara's also looked at how we can improve the complete development lifecycle of open JDK by adding on top of it some additional tunings so a bunch of open JDK project I've already moved to github we have the list here amber Sierra GMC loom and so on and so on and all the rest obviously are planned to move in fact we plan to move GDK itself hater around I think end of GDK 15 so that would be still in 2020 or around early 16 so still in 2020 but still all the project are ridden alive read-only amuro's on the tabs so basically all those all those barrettes won't give us the ability to enable faster innovation within the platform something that we have already used and we clearly see the benefit of all of those tools sorry so delivering faster so we have enabled the ability to deliver to deliver faster and well let's look at what we have delivered recently when I say we it's really open JDK community obviously Oracle is a big player in that community but it's not just a rifle right so Java 10 delivering in March 2018 those are all the features I'm not going to spend any time on those release because we're we already have enough to cover with a 14 and 15 the only thing is that you might seem that we have two Jet's that are in kind of yellow orange color those have been delivered by someone else than Oracle so the one in blacks are coming from Oracle and yellow one are coming from other open JDK members and I believe those two are coming from reddit then we had 11 which was a pretty big release in terms of capability the thing to keep in mind is that any features release is driven by the dates so it's either March or September's they are not driven by features so if if a feature is not ready to be included in a given feature release well it's not an issue that features will just have to wait the next feature release 12 March 29 13 September 20 1913 was clearly a relatively small release but yeah anyway 14 that was released two months ago basically well cope with the fact that nothing was really modest but again the only thing that did drive those release is the due dates not the content so today we're gonna discuss us some of those jabs that have been headed in a Java 14 again we see that there are two Jet's coming from know that are not coming from Oracle non-volatile byte buffer I think is coming from Reddit and helpful pointer exception that we're gonna discuss later is coming from sa P okay so Java 14 was released in March 2020 everything is open source Sajida GD k dot java.net slash 14 you can have access to the open JDK builds of 14 you can also have access to all the technicals content for regarding that release now quickly Java 15 what do we know about Java 15 well first and foremost we know that Java 15 will be released in September 2020 we also know the schedule so we know that random phase 1 that's basically when we have the feature freeze is in 1 months from now so 1111 of of June so today based on the information that is available in the open JDK project we can already discuss about what's being planned within 15 that's what I'm gonna do today now keep in mind that things can obviously still change we can add things at the very last minute or we can even drop things at the very last minute depending on well on some stability issue or something else things can might still evolve so that those tunings basically gives you the content that is plane 414 so we clearly well it's a very interesting time for Java because we clearly have a very rich pipeline when it comes to features why because my well quite as well I wouldn't say many years ago but five to four years ago we have decided to work on very ambitious project a multiple project that where long terms are in the project and they each had a goal to basically either fundamentally improve certain aspect of the Java platform or event reeve revamp a given aspect of the platform so I'm going to discuss some of those today the GCC amber Panama Varela metropolice loom and so on so very quickly the first one that I want to discuss is the GC 0 GC so it's low latency scalable garbage collector that we started to work on few years ago it was introduced as experimental features in Java 11 and the main goal of the GC is basically gives you the lowest latency possible so it's a concurrent GC meaning that all the heavy lifting work of the GC is done basically while your Java threads are being executed so there are a few posts but they are reduced to about well to the smallest possible to the smallest time possible we claim that the post time should stay below 10 milliseconds with on with the GC but what we observe is that most of the time the poles are more around 2 milliseconds which obviously is very low it's callable in the sense that the post time will not increase as you grow your Y or your life sets so the 10 millisecond post time is something that you would get typically on a one gigabyte it but also on a one terabyte if so there's no change in that from judges in the in the early days was designed for large ships multi terabyte if but it turns out that they are used case where it also make sense to use the GC for smaller hips so one of the features that we have added recently is the support for a few megabytes it's I think that the law was that we can go is 8 megabytes so how do you use as a GC today so I mentioned that the GC was added as an experimental feature in a Java 11 so you need to unlock explicitly the GC so there is a specific hotspot flag unlock experimental a vm option to basically unlock any experimental feature of the vm so you do that and then you use the specific flag to enable the GC so basically to sell the vm to switch from g1 which is the default GC to zgc and there we go then the thing that you might want to do is tune the GC to tune the GC the thing that you need to do basically is just said the each size one of the design goal of the GC was also to provide a default behavior that avoid any tunings obviously you still have the ability to do more tuning than just setting the hip size but by default the GC should should give you a good result with just setting the website so AGC what is the history behind the GC GC was initially introduced in 11 as an experimental features on linux we have hadded additional capabilities in 12 intersted the GC support was added for arm 64 and finally in 14 so there is that we have done two months ago is hiring support for Mac OS and windows for the GC and the plan is to make the GC as a production feature so basically we are removing that experimental flag from the future in DDF 15 so this year so this is a picture that I took only earlier this year in Sweden and on stage was a Monica Beckwith from Microsoft and well that's her claim it's not my claim so zgc shine when it comes to responsiveness so I encourage you to check her presentation which is now online where she goes basically about the benefit of zgc now let's quickly talk about G 1 G C so G 1 G C is the default G C obviously we have made a lot of investment within GGC but that doesn't mean that we were not looking at improving G 1 so for example in 14 we had it support for a new ma so new must stand for non-uniform memory access so basically that means that some some memory might be well the distance between the memory and the course is not always equal so from 1 cor accessing a given memory might be more expensive because it's more distant than accesses memory in a different part of the well formed from a different course parallel GC was new more worse in C this a long time so in 14 we have had it support Numa support for G 1 and that's not all if we look at the number of an enhancement that we have done in our on G 1 since gk8 it's over 700 announcements that together greatly improve G 1 so the shafts shows for example so the shots below shows the native memory overhead caused it by the by your G 1 GC for a heap size of 6 16 mega byte and what we can see is that well if we look at g DK 8 the extra native memory was a run for megabyte in 11 it was around well it was below 3 sorry I said megabytes gigabytes so 8 need an additional 4 gigabyte 2 GC that large heap GDK 11 it was reduced to I think 2.7 gigabyte and in 14 its it has been reduced to 1.7 gigabyte so basically you see that by switching from 8 to 14 we have greatly reduced the memory footprint of g1 not only that we also improve the performance so basically when you put together all those heaven and reading enhancements that improves g1 a lot across all areas so throughput footprint latency and so on and so on so that's something that you you need to consider if obviously GC well the GC GC characteristic as you are important to you you need to think about moving to a newer version of the of the platform so this is another chart that shows some of the management that have been done to g1 so let's see this is using the standard spec gbb benchmark so this one is using a fix it fix hip so set to 4 gigabyte all the results are normalized and I her is better so we have maxed G ops and quick LG ops both are looking at the throughput the thing is that quick LG G ops is looking in addition to throughput is also looking at Latin Z's so we can see that parallel GC has been included so the performance of our LG C has been increased between 8 and 14 but we can also see that there is a huge boost in terms of latency improvement when it comes to G 1 in 14 having said that if you look sorry at this slide at the next slides we see in this particular case so this is whether with a heap of 16 GB gigabyte that there has been a regression between 8 well we I don't have the result of G 1 here but we can clearly see that there is a drop so we had a aggression basically and I don't remember the exact issue if you want to know more about the given bug it's you just need to check the blocks at the bottom of the slides but that issue has been solved so we can clearly see that G 1 in 15 will improve the latencies we see that the throughput is is while there is a slight drop in terms of throughput only 97 percent versus hundred percent well it's a small it's a small basically small trade-off but when we see the benefit that gives that it gives in terms of latency improvement I think that it's fair to say that it's ok to pay that that's more price so quickly stuffed-up time is something that we always look to improve in all the Java release and obviously 14 is not is not an exception now we can see in this case that the stuff that time for a given it's a small application it's basically a HelloWorld application there is a small improvement obviously the as faster we get the more difficult it is to find large improvement but still between 13 and 14 the startup time has been improved and I can already tell you that between 14 and 15 it we still slightly improved now this is basically the same benchmark but with different scenarios so a hello world application a hello world application that uses a lambda expression and then a hello world application that is using a conquered string I think I knew basically seen that across all the release we are improving the startup time for those different scenarios so that's something that again is useful over time whenever you switch to a larger to a newer version of Java so now let's talk so we have discussed about the GC which which is one of that those ambitious project basically having a new garbage collectors that provide low latency another one that deal with memory is project Valhalla and that that is a clearly very ambitious project so the code of general of vanilla is basically to reboot the relationship that the gvm are with the data in memory so if you know Java you know that Java is very good at optimizing code we have for example a JIT compiler that will improve over time your code as it runs so on that side we're good but the next step is we to look on how we can optimize a data in memory now there's an issue we have the jet d'eau Java type systems something that obviously is very powerful but there is a price price to pay and sometimes we miss a bit of flexibility and that's basically due to the fact that each object has an identity it's something that obviously is needed we are not going to get rid of object identity it enables mobility polymorphism and so on and so on on the other hand there are some use case where objects might not need identity but still today they have to pay the price for that features even though those object might not benefit from identity so basically project Valhalla is looking at how we can improve the density of information within memory and the thing that the team is looking at is basically how we can declaratively say that ok for that type of object I don't need that object to handle an identity it's not something that can be done automatically so that we involve some help from the developers so the developer will have to specifically say or specifically say ok for that type of object I don't need identity and then the VM will be able to improve out those object will be stored into memory and the VM will be able to increase the density to a memory density for those type of objects another pro is projecting so if you look today they are well I will simplify a little bit but there are two types of programming approach so you have a traditional blocking approach so it's very easy to program to develop with the thing is that well it's so it's very easy to develop it's also very easy to debug the thing is that that approach doesn't scale as soon as your code blocks well basically your code is waiting for something to happen so you are using while you are blocking resources that's not very effective on the other hand you can go for a model that is more geared towards a reactive approach the thing is that developing reactive application well that's on one hand a very difficult model to program with and more importantly that the code you write is very difficult to debug enhance to maintain typically if you try to debug a reactive application well you see that something you have an issue here but in fact the issue is not reopening on that well in that region of the application but it happens on for somewhere else but it's very basically it's very difficult to do correlation between an issue and where it happened within the flow of the code but still if you want to scale if you want to have efficient resource use of you you need to go to other approach that approach so a project loom is basically trying to solve that by making concurrency simple again ow right now the JVM is using native threads kernel threads loom introduced the notion of your 12 threads which are basically two threads that are managed by the JVM so those threads are some kind of well visual threads software threads that are managed and he ruled by the JVM and obviously the JVM will have to do mapping between those virtual thread and some underlying kernel carrier thread but that that isn't dulled by the JVM and the thing is that those virtual threads are very very cheap so it doesn't it's not a really an issue to write code that is blocking because the virtual thread that is blocking is not blocking an actual underlying physical threads so basically you can write application using virtual thread your code can blocks but you don't have to pay of resource and the virtualization so those that are so cheap that it well you don't have an ax you don't haven't have to pull those threads so you just block the thread and you you start a new thread it's it's it's it's not an issue because those threads are very cheap so that's basically what a loom is trying to solved now those days we have multiple early access build of loom if we look in the platform there are already a few gems that are been that have been added in the platform for loom and more specifically in GDK 14 we have we have hope we implemented the legacy socket API that was something in preparation for something that's coming in JDK 15 which is or implementing the legacy data so grew that diagram socket API which has been done in preparation of flume so another large project is Panama so the goal of Panama is basically to arrange to enrich the interaction between the Java Virtual Machine and a foreign native code historically we had gni for that Java native interface but gni has been specifically designed in the early days to be I would say not friendly to use we want to basically provide an alternative to Ginny I wear it is easy safe and efficient to use from Java nutella's to use native code from Java if we look at the deliverables of Panama there are three main deliverables the foreign memory access API which is in 14 in incubator so that's something that you can use already today it basically allowed to efficiently and safely use of memory of that is not on the Java app but you can access that memory from Java code then there is an extraction part it's basically the ability to extract from sea native header files so the extract interface and generate binders that you can use directly from Java code there are two parts for the extraction parts that there is a tool that mimic that mechanically do the extraction but there also no API that more advanced developer can use to meet more advanced scenarios and last but not least there's the vector API which allows to easily express vector computation that will compile at runtime and execute on a vector on CPU that support vector vector eyes extension such as SSE or AVX 4md your arms scalable vector extension and the vector RP I is right now in incubator candidate so we don't know yeah yet in which GD Carol is it will be headed so today what we have for loom is the foreign memory access API in incubator that's something that you can use and we also have a early access build for the extraction part and then I also put this in the Panama part even though that specific job is not really part of Panama but given that it's very close to the hardware and well I put it here so jet 3-5-2 basically had the ability to manage non-volatile memory via byte buffer that's something very specific so I'm not going to discuss about that anymore so what I'm going to do now is a very small Panama demo so it takes a bit of time switch okay so let's see so I hope that it's big enough so whatever here I have a very simple java application but first I'm going to go let's see where is it no so I'm on six this is a Linux so I sign in Linux no I don't want to do that well I fit the name and sorry let me check okay this this or sorry too small you know it's red line so this is a header file that is part of a five six so this is a real line library that basically give us read line support of something very basic so there are multiple function and what I want to do here is you use one of the one of the red line function from Java so the first thing that I need to do is use the extract tool to basically parse the red line header files to extract all the information and then generate the binder interface for that so I'm going to use this G extract tool so and I specify here that this is the past for example of the library the G the riddling library this is the path of the header file that we want to x-ray it and what I want is that I want the outcome to be in that a jar file obviously I'm not on the right version so let's see I'm on 14 and I'm I need to switch G so I'm going to switch to a specific GDK build that support panama and it's 14 I think oops ramaa yes so let's invoke jig strike G extract again okay bunch of warning but this is a early access build okay now I have this jar that has been generated so what I want to do is basically I have this small java application we can very quickly go over the code of that application so a scope is something that is provided by the foreign memory yes the foreign memory api of panama and basically scope are used to enforce lightness checks on scope resources so it's basically some sort of memory but that we were allocated on the other side so on the native side we need to enforce likeness because whenever we are locate on the other sides of the fence so on the native side obviously at some point in time what has been allocated needs to be dedicated so that's why we need scope so I create a scope then from that scope has I allocate a string I pass it I pass in the screen name so we're on the on the sea side and then I'm just invoking that function that is coming from the redline library using this pointer that is defined here so basically I'm just passing this string to the native function and what we get in return is a P object which is a pointer and then I'm just deploying displaying that object so this is a two string method invocation on the P so on the pointer object and then I use this static method to basically get the content of that pointer so let's compile that so Java C let's see class bus I specify the jar redline and then the source okay now I need to run that that guy so name so this is basically this line here where we invoke the real line so this is the CE OS six function that is invoke I pass it's something test and then the result is the following so it's a so the type is a bonding pointer so this is this line in fact to string on that P object-- which is a pointer and then so this is all the result of the two string information all the information that we get the idea to string and then the last thing is this test which is basically we asked the foreign memory API to give us the content that is pointed on the other side of the fence but by that given pointer so this is in a nutshell how panamá works so if you if you have any question you can use the chat or we can discuss at the end it's up to you so moving on another big project is a project ember so the goal of amber is basically to continue continuously improve developer productivity through the evolution of the java language so it's not something that happened through one single release it's something that we have started around a Java 10 and since Java 10 we have hadded new features which are basically emerging from project amber var is a big one so variable type inference was added in 10 in 14 we're having switch expression it becomes a standard features after to run off preview we're doing another round of preview for text blocks we are introducing records weren't sure introducing also pattern matching with instance of in preview 2 so I'm going to discuss most of those features so the first one is a record so course basically give you the ability to so they are providing a very compact syntax for declaring class which are data holder so basically a couple inimitable trouble in which you can store data and that's something that you can basically pass around I'm going to show you how it work so you will see that well it's something that is a on one hand very simple but on your hand very efficient something else that is coming from amber is a text blocks so basically text blocks are multi-line string literals so take the following example so you want to store the HTML that we have on the left side typically you would do something in your code with text blocks you can now do that so you basically keep the Descent acts as it is you don't have to escape anything this is something which is very convenient for dealing with XML JSON ml SQL and so on again that's something that we will see in a demo in a minute so then we have a pattern matching that's something that we will see in the demo it will be more clear and finally we have a new switch expression so let's go to the demo that will be a more concrete so let's see well intelligence already started so I'm going to very quickly create a new project I need to configure my compiler because I don't know why but by default generate Java c5 bytecode and then I also need to configure my project and I'm gonna increase the font for the code don't worry so here given that I'm gonna use SR it's not here it's here given that I'm going to use some preview feature I need to ask specifically tell to IntelliJ that I want to use preview features because preview features are not enabled by default and I also need to do it let's see here so again I'm going to use 14 preview features okay so a source ok so let's just run that and see if it works ok it works so the first thing that I'm going to show you is recourse so let's create a record let's say that we want to create a record for a persona and a person as a name and a person as a first name and that's it it's all we have to do now what I can do in my code is the following for example so I can create a record and today speakers is the let us say David oops oops sorry it's obviously not a record about a person okay so now I have this speaker object that I can use so for example a speaker so let's run that so this is the result so this is basically the to do to string method that is invoke ated on that speaker object so let's have a look at what has been what we are here so target class we should have two class so we have the test class and we have this person claps so this is our record so if we look at the record itself so just by this simple declaration we see that we have a few methods that have been generated so generated so the class person is final it extends java.lang records it has a few methods so it has a constructor it has a two string it has a it has a default ascot methods it has an equals and then it has two gathers last and first name so that means that I can for example invoke one of those and we use one of those method and you see that this time we have the lab assay instead of the two string so what we can do if we look at the record itself obviously this is the default behavior I haven't specified anything I can define my own constructor so person I can say for example that let's see we want to upper case all the names right so let's run that so you see that the lab assay is now in uppercase and you see that the only thing I had to do is basically I just have to specify what needs to be done with one of the the field I didn't have to specify anything for the first field so it has a default behavior but now if I'm doing something like this for example if let's see last is blank then this last equal Nemo's here the compiler will complain because last might not have been initialized so if we go through this branch of course last easy last is initialized but that means that we if we have a else it won't be so if last name is not blank it won't be initialized so to solve that basically we need two other in this case a health and so else this last fall's plus in this case we have a default for second branch and this case it it works so if I have a blanks let's run that and you see that this time oops sorry it's the the first time is an animal's because it is blank so that's basically our record works the next thing text blocks so let's see for that I'm gonna yes so this is the my the poem that has been generated so it's just some XML so it's the pump from my project and well I want a string for that so for that I'm going to use a text block so for that I'm used a triple quotes and that's all it takes now I can do so from South if I run that well you see that the text blocks has been is correctly including the ident a tion because here I'm basically copy the HTML as it was so what what I've done here is basically I kept the ident Asian but we will see we probably don't want to have all those space in front that's something that takes blog handles for us something else that we can do is for example the following with text blocks so they're not able to able to evaluate the expression but well let's just do that so how did a person has here and now I can use formatted and let's see and what I want here is the speaker first for example so let's run that yep sorry typo it's a method so if we look at the HTML you we see that here well it's not class but it's the first name but you get the idea so basically we can do some kind of cheap expression interpolation using formatted with text blocks so that's basically our texworks text blocks works now let's move on to another features of number and that's let's pattern matching so pattern matching so you see we have this speaker object which in fact is a person so that means that we can do something like speaker first right so we would get david but it might happen that the type of that object is of that yes of that speaker would be object in that case if you see we cannot directly invoke the first method so what would would typically do with something like this so if speaker instance of it's a person so if it's a person then what we do we create a new object so it's a person object X equal to a speaker but we have two specific cast it to person type and here obviously we want with the exception so that works so the thing is that here you see that if we have this type we create an object of that same type and we cast it from the other object using that same type there are a lot of repetition going on what we can do now with pattern matching instance of energy TK 14 is the following so we declare the new variable here and that's it so if you run this we'll get the exact the exact same behavior so hello Davi this is the first one and hello David this is the second one and you see that this one is more 6n so it's more obvious to use so the last one and I'm probably gonna skip that one because it takes a bit of time is this expression so it's a new type of switch expression that works like this so this is on the left side this is how we traditionally works the thing attacked for example here there's a bug in the sense that there is no break here so if I do a switch on let's say Friday well number of character will be 6 and then it would be 7 so that would be the end result 7 in this case I'm doing a switch over an enumeration so all the values are no because when numeration but still if I miss for example one of the day the compiler will not be able to tell me okay you are not evaluating windows day for example so that's why we have a default but given that we know all the value the default is a bit well it's a bit hot to have to use a default value so what we can do now there is a question we will we be able to use recorded GBA GP entities and not directly something that well you can use records with GPA but the thing that you have to keep in mind is that records are immutable so you cannot change with any fills as soon as it has been created so let's go back to these to the switch expression this is the new switch expression it basically returns the value directly so something we were not able to do in the former switch expression so that well that's why this is on the left side the switch statement and this is an expression because it returns the value so we have all the case given that again we are doing a case on enumeration the compiler will test tell us if if for example were missing a day so if we are missing a day either we had this day or we have to deal with the default value if we are dealing with all the days and if we have a default value the default will never be rich so that's something that the compiler can can also infer that the default branch will is basically a dead branch those kind of things so that's in a nutshell the switch expression so I'm going to move a little bit because I'm a bit ahead of time I'm sorry shouldn't my bad I switch the slide I should then switch moved out of the slides so the amber demo we have seen the amber demo so those are some of the project that the more ambitious long-term project that we're working on what we see is that gradually some of the features emerging from this project are headed in Java so we've seen the foreign memory coming from loom for example we've seen Alhambra has added multiple features or since Java 10 in the Java platform but obviously the Java platform is not all about huge an ambitious project in 14 we have this new elf full new pointer exception jab 3 5 8 so we have all seen seen that kind of code where we basically have a new pointers so it's not a big deal because the we know where the new point shows happened so line 6 6 6 so we just have to look at that line right the thing is that line might looks like the following so we know that it's happened here but we really have no idea where it happened exactly that's what the new pointers the helpful with pointers option gives us so that's something that you have to explicitly enable in a 14 and now you will have something like this so it cannot involve the city get district because the return value of get city is null so it basically gives us more information to help us to pinpoint the exact issue that raised that new pointers so that's something that is available as a standard feature in 14 it's not in available enabled by default and I've seen some discussion where in 15 it might be enabled by default so it's a it's a small features but it's a very convenient features GDK flight recorder is something that is available I think since Java 11 and the basic idea of JDK of flight recorder GFR it's a black box that keeps track of even that are emitted by different component within the GDK itself so it can be the JVM it can be your code so a bunch of heavens are raised and GFR will keep track of them and that's something that you can use after the fact to do some kind of analysis the thing is that GFR is very low overhead so that's something that you can use in production to basically detect and pinpoint specific issue something that we're hiring in GDK 14 is even swimming so until now the the way you were using GFR was the following so you start the recording of your application so you use your application then you stop the recording you dub the content of the event to repository and then you process those events now an application that is running as the ability to stream out event as they happen so you can basically do is you can have some some some cough some some sort of sidecar application to do analysis of the event as they happen so there is a specific API to do that in GDK 14 the thing is that obviously we're keeping we are improving a GFR through all the release so in 14 we are we had hundred and forty five different event types for GFR and in 15 I've checked in the late well it's not the latest bill because we have done at twenty to build yesterday but in the middle of last week we are we had hundred and fifty-seven GFR even type so it it keeps GFR it in itself keeps to have more matrix within the platform that you can use and not only that you can also write your own custom and even type for your application something else that is part of Gd k14 is this new packaging tool Jib Jab 343 right now it's still in an equation phase so the idea of that tool is it's a tool that gives you the ability to create native installer specific for a given platform so on Windows you will either have an MSI or an excel file on my quest you will have a big package file or a dmg and so on and so on and it has a lot of additional I would say native features such as the ability to pass parameters to the native executable that will invoke that will do the installation of your java application and obviously work with jailings and so on and so on so that's something that you can use today to basically create an activex installer for your java code now let's quickly look at java 15 so that's the schedule nothing will change on that front so this is a table that I did well I did it yesterday and I checked this morning it was still up to date so those are the multiple job that will be part of 15 I'm going to discuss specifically to Jeb's that is a learning class and where it's your the one I'll seal the silk types you'll class it's not here now I don't so yeah I miss one well anyway it's on my slide later on oh yes here sorry it see the other one is silk class so so this slide shows the jet that are either integrated so already in the early build of GDK 15 or they are targeted so then sorry targeted means that we intend to add them to 15 or we propose to target them though so that's basically the first step before we integrate them so we tell the community okay we want to add that to 15 is there any objection if not we will if we move to target it and then one the works is done it will move from targeted to integrated so basically there is a very high chance that all the jets here will be part of GDK 15 just keep in mind the small disclaimer that we might find a big issue in one of those one of the jab here and we might decide to remove it at the very last minute so that there's always a risk and then there are a few other jabs that are currently being worked on and we don't know yet if there will be part of 15 so one is silk class and well there are a bunch of jet but I just took three where clearly there are a lot of activities going on right now so maybe there will be part of 15 we will see in a few weeks and at worst by early June we will know for sure if they are part of 15 or not so silk class flow in memory access an incubator so that's part of project loom and then the vector API which is also part of Project loom so I'm going to very quickly discuss a hidden class and seal class which are often confused so a hidden class is something that is very specifically that has been specifically done for frameworks developers so if we look at frameworks they have this habit of dynamically generating classes and use those classes through reflection the thing is that those classes given that they're generated can potentially be used by Hodder slash external bytecode something that we clearly don't want so basically the ability of it edan class give now frameworks developer the ability to still generate dynamic e classes on the fly but those class are hidden for the rest of the world so only the framers that generate those tasks will be able to use those classes so it targets frameworks developers but if we look at Java C for example Java sees your show using the techniques for example for lambda expression so that's something that is also useful for Java itself and one of the thing that will be done in addition to creating this new facility is also deprecating the Sun Myshkin safe define analysis that is used exactly for doing that dynamically generating generating classes so if you look at the properties of those classes well in terms of discovery discoverability they shouldn't be basically discovered by discoverable by classes outside of the classes that has created at that classes in terms of life cycle it should those classes should be able to be aggressively unloaded to give the framers the ability to generate a lot of classes and as soon as those classes are not needed they will be automatically garbage collected now they can be garbage collected through a more traditional approach that's something that is but the behavior of the GC is configurable for hidden classes but what we know for sure is that the aggressive unloading is something that is needed and then access control that basically give us the ability forecast that creates dynamically another class to access that class but that also prevent other classes external to that classes to access that newly created class so that's basically none shall hidden classes it's not something that you're gonna use that most of the developers like you and me will use it's clearly something for frameworks developers and then they are seed blast and some people tend to confuse the two there are completely different so before we talk about seed class we need to quickly talk about inheritance so inheritance is something that encourage code reuse so we basically have a class hierarchy and all the class for example a class that X and the class can reuse features from the class that it extends for now the thing is that the class hierarchy is most of the quail is often used for code reuse but sometimes it's used for something completely different so the class hierarchy is on is sometimes also used to model different possibility of a given gap of given domains so for example we want to model the different shape that are supported by a graphic application so we would have a shape class or interface and then we are have subclasses that would extend that shape classes like a square the shapes on exactly next and shapes and so on or we we can have a class that representative type of vehicles that we sell and then we would have I don't know a CV a coupe sedan and so on that extends that super classes so that's a different something that is completely different and the problem is that right now if you have this shape superclass that is extended by triangle circle exact on and so on you cannot prevent any other class to also extend it and that's something that we would like to well read with a sealed class so C Class would basically allows to have a given class hierarchy that is bounded so it the class hierarchy can only be extended by class within that limited closed class hierarchy and not by any external classes and every cycle we use would still be possible but it would only be possible within domain within the boundary boundary of the closet class hierarchy so how does that work well let's have a look at an example that would be more obvious so I have this shape superclass and we have two new keywords so we have sealed that is used to basically say okay the class shape is sealed and then we have the permits keyword that tells which class or interface can use that superclass so sealed is sorry shape is sealed and only in this example circle circle rectangle and square are allowed to extend the shapes and then there are a few variations like the flag the fact that if you are within the same package or SM modules you can just use the class name you don't have to use the full package name if you have nested class so all the classes within a single file source you just seal the superclass and by default all the classes that are present in the same source file will be permitted by default to extend that soup superclass so that's basically how it works now it's not clear today if Silva's will be part of did he give 15 if not that's not really an issue just mean that we'll have to wait another six months and it will be for GF 16 so I think it's time to wrap up so today we've discussed about what new features will be added to Java in 2020 so GDK 14 was released two months ago and DK 15 will be raised in four months from now i've also discussed very quickly and outdoors large ambitious long-term projects are basically gradually adding capabilities into the platform with the ultimate goal goals of revamping completely the platform now I I need to quickly discuss another new project that we've just announced two weeks ago and that is Laden so laden basically tried to solve to tackle some of the pain points of Java and that is the slow startup time the slow time to performance and the locked footprint of the Bob java application and everything is relative when I say slow it's low compared to typically native applications for example footprints it's again compared to native application so basically a Laden tried to tackle those pain point by introducing the concept of a static image to Java something similar to Ralph Ian achieve image Laden aims to leverage existing component of the GDK such as hotspot G a OTC which is an alt compiler that we have an experimental form since gk9 into the platform but also C D s and gelling and clearly this is just the early days of leiden we have just started to gather interest around that project but we think that over time this is something that would be important so basically trot bring the capability that we have with native Miam then similar capabilities but directly into the Java form so this is the slides depict the content of GDK 14 I think that we have discussed most of the jobs that we have here the only thing that I need to mention and I think I've mentioned that at the beginning is that jobs are are also used to remove holger things from the platform so you see that for example 3 6 2 & 3 6 3 are duplicating things from the platform and or removing so when we remove something from the platform we first deprecated to tell the world that ok that features will be removed in the features and then later on it will be actually removed so it's abilities face removal approach and da14 is available so you should download it right now and give it a try so in terms of conclusion Java is still free we have put in place everything to deliver faster and we are delivering faster and we haven't had Rich's future pipeline for the Java platform a heifer and also keep in mind this year marks the 25th anniversary of Java and given the pipeline that we have well we can't really say that there is a bright future for Java developers and with that I'd like to thank you for your time and I don't know if we still have time for questions have time for one question someone have a question you can also ask question on Twitter so there is my Twitter handle there so if you have any question and you don't feel like asking now you can also ping me on Twitter I think stream 8 has a question yeah so regarding the project so the last thing was actually looking into is is the the problem of high pressures in high pressure in gently so that is a real that's more complicated problem in father so what is the state of it and if there is that is that is that mountain climb then so you know Brian gets the job architect so Brian is the architect of the Java platform and basically his answer is it will be so whenever someone ask about when it will be deliver his answer is is pretty easy it will be a below it will be available when it's ready and the fact that well it's not yet there means that well things are still being being worked on so I cannot give you any more precise answer than that but yeah you're right Vala lies it's really a fundamental change within the platform the nice thing is that with the new release guidance well we don't have the issue that we we had in the past where we basically add a time window to add new features in the platform every three years so if we miss that time window that basically means that we have to wait another three years to add that into the platform those days we can gradually add features every six months so we can expect in the future release to come to see some features emerging from Vdara but I can I can give you any more precise answer than that I'm sorry thank you David thank you thanks you thank you very time okay thanks everyone for joining since you next time thank you yeah bye