All Java 23 Features - Inside Java Newscast #70

Поділитися
Вставка
  • Опубліковано 15 вер 2024

КОМЕНТАРІ • 113

  • @nhmarujo
    @nhmarujo 3 місяці тому +20

    Hi Nicolai. Small correction, hope you don't mind - G1 isn't the real default Garbage Collector (as stated in ua-cam.com/video/kzjGp7LmW0I/v-deo.html ). SerialGC might actually be chosen depending on CPU/memory available. It is not uncommon for people using containers, for instance, to have a setup on which the virtual machine has access to a low amount of resources and therefore SerialGC is picked. While that statement is somewhat close to the truth, it can be a bit misleading 🙂Cheers and thanks for all the nice work you guys do!

    • @kamurashev
      @kamurashev 3 місяці тому

      Default means default. If you do not provide/choose any overrides it would go with g1.

    • @nipafx
      @nipafx 3 місяці тому +9

      @@kamurashev No, he's right and I forgot about that when writing that line. There's no one default GC - the runtime will pick one based on CPU and memory. On non-ancient stand-alone machines (like dev machines), this will be G1, but on a restricted cloud instance, it may well not be.

    • @Lpx288
      @Lpx288 3 місяці тому

      I was looking for this info the other day but didn't find any documentation. Do you have any link by any chance? Ty

    • @julianjupiter1995
      @julianjupiter1995 3 місяці тому

      ​@@nipafx what is the case it will choose ZGC as the default one?

    • @billykorando6820
      @billykorando6820 3 місяці тому +5

      @@Lpx288 It's not super clear, but it is covered under the ergonomics section in the GC tuning guide: docs.oracle.com/en/java/javase/22/gctuning/ergonomics.html#GUID-DA88B6A6-AF89-4423-95A6-BBCBD9FAE78, specifically the note about what the JVM considers to be a "server class machine"
      I mention it more specifically here: inside.java/2022/08/08/sip063/
      I think there was some discussion on changing those parameters to make Serial less frequently chosen... I'll need to check with the GC team on that.

  • @ingframin
    @ingframin 3 місяці тому +58

    Valhalla and vector api are really needed for physics and engineering computing. I know we are a small market but please! Finish them already!

    • @sjzara
      @sjzara 3 місяці тому +3

      I agree!

    • @lmj5994
      @lmj5994 3 місяці тому +8

      Valhalla is needed for any performance intensive processing, not just physics or engineering. I am an ex-physicist now working in information processing and I need Valhalla to reduce the number of effectively random memory lookups. I have numerous small objects that are good candidates for conversion to a value type. Being value types would avoid at least one memory access. Sometimes these are nested with the enclosing type remaining small, so two or more (random) memory accesses in that case. And I have numerous arrays and lists (of arrays) where the entries are good candidates for value types, and hash maps where the keys can be converted to value types. Valhalla will make a massive difference to almost any program with a lot of memory access or a lot of use of small types.

    • @sjzara
      @sjzara 3 місяці тому +1

      @@curio78 It’s the way I used to program Fortran in the 80s.

    • @nipafx
      @nipafx 3 місяці тому +10

      I agree, but keep in mind that progress isn't slow because of a lack of effort. It's slow because the situation and solution are very complex, which is further complicated by the goal to expose as little as possible of that complexity to us developers.

    • @sjzara
      @sjzara 3 місяці тому +5

      @@curio78 This is a huge exaggeration. Java has been used for high-performance and numerical work for a long time. The Java NAG library has been available for decades. Valhalla and universal generics aren’t showstoppers by any means. What they will allow is for very high performance numeric code to be written in a clear OOP manner that can be fully optimised by hotspot. It will make high-performance numeric code easier to write in Java than in Fortran or C/C++. Java can take its rightful place as the language that scientists and engineers and statisticians should be using to write apps and libraries. It could revolutionise the way numeric code is written and maintained.

  • @lmj5994
    @lmj5994 3 місяці тому +7

    Another excellent (informative) video thank you Nicolai

    • @nipafx
      @nipafx 3 місяці тому

      Thank you! 💙🧡

  • @iheanyichukwuaguwa6231
    @iheanyichukwuaguwa6231 Місяць тому

    Thanks guys! This is super awesome. We, the educators, asked and you listened. With the new modifications to the implicitly declared classes and the automatic imports of java.util, java.math and most importantly of the extremely handy static methods in the new IO class, it's time to revert to teaching introductory programming courses with our beloved Java.

  • @AndrewMalyhin
    @AndrewMalyhin 3 місяці тому +1

    The best informative newscast about java

  • @El-barto1
    @El-barto1 16 днів тому

    THIS ALL IS AWESOME EXCEPT FOR THE STRING TEMPLATE PART!!!

  • @jediikk
    @jediikk 3 місяці тому +22

    String templates removal is truly disappointing. A feature that is such a quality of life improvement and that is present in almost every popular language for at least a decade. Sad.

    • @Kroppeb
      @Kroppeb 3 місяці тому +7

      It's not gonna be removed forever, they just need more time to change how they are implemented into the language

    • @nikitamyazin6586
      @nikitamyazin6586 3 місяці тому +15

      @@Kroppebyep. It’s only going to take 5-10 more years, no big deal

    • @prdoyle
      @prdoyle 3 місяці тому +3

      Yeah, I'm looking forward to Nicolai's video explaining why it was removed.

    • @SLTRM
      @SLTRM 3 місяці тому

      Kotlin rulez baby!!!

    • @nikitamyazin6586
      @nikitamyazin6586 3 місяці тому

      @@IfeSunmola which part of the reasoning made sense? 🤔

  • @personalaccount1515
    @personalaccount1515 3 місяці тому

    Excellent video, THX!

  • @sblantipodi
    @sblantipodi Місяць тому

    Hi there. Is there some news on the Vector Api? When they will exit the incubation state? I put a lot of effort to use them in my program and they are devastating on some loads with CPUs that supports AVX512. My concern is that I'll need to rewrite everything for API changes when the APIs will exit the incubator state. I have some "development questions" on those APIs, are there a mailing list where to discuss about the use and the benefit of those APIs?

  • @Andre-jj6xs
    @Andre-jj6xs 3 місяці тому +2

    😂 6:08 no pressure Brian, but WHEN WILL IT COME?

  • @FABGIO1
    @FABGIO1 3 місяці тому +2

    Why String templates jep has been dropped?

  • @ram0973
    @ram0973 29 днів тому

    What about a nulls native support, like in C# and Kotlin. ?.

  • @kamurashev
    @kamurashev 3 місяці тому +7

    Omg it’s so disappointing those string templates. We need this thing

    • @squidxtv
      @squidxtv 3 місяці тому +14

      It is not really disappointing, it will most likely come back. I want a properly designed feature instead.

    • @kamurashev
      @kamurashev 3 місяці тому +1

      @@squidxtv I need it yesterday or the day before that

    • @zombi1034
      @zombi1034 3 місяці тому

      @@squidxtvYes but when… JDK 30😢?

    • @DinMamma002
      @DinMamma002 3 місяці тому +6

      I think the "STR" prefix on string template were to much bloat. I rather see a redesign.

    • @squidxtv
      @squidxtv 3 місяці тому

      @@DinMamma002 yeah exactly, imo it's not necessary to reinvent the wheel with this. Just look at other languages, how they approach this.

  • @df658f02
    @df658f02 2 місяці тому

    If you want to advance in Java from basic to intermediate and advanced subjects, what are the best courses that exist at a reasonable price? Do you have any recommendations?

  • @douglasfugazi
    @douglasfugazi 3 місяці тому

    Thanks 🎉

  • @forKotlinsky
    @forKotlinsky 3 місяці тому +4

    You gotta believe in Valhalla with Me

  • @CraccaHacka
    @CraccaHacka 2 місяці тому

    Would it be possible if anyone did the work to backport the Markdown Javadocs to JDK21?

  • @enaltogondrige
    @enaltogondrige 3 місяці тому

    Thanks

  • @CliqueSpace
    @CliqueSpace 2 місяці тому

    Hello. One feature of the new way statements can appear before a call to super in a constructor that seems a bit worrying to me is the assignment of fields.
    A great thing seems to be the capacity to validate parameters and do other checking in calls to constructors before calling super and hence before memory is allocated to the object being constructed. If one can set fields in a call before super, will this interfere with how this seems?

    • @CliqueSpace
      @CliqueSpace 2 місяці тому

      Perhaps I taking to myself, but still, perhaps assigning fields is fine because they will be made available to a presumptive "this" only after the call to super.
      I think allowing statements before a call to super has a potential to be a very good thing for Java.

  • @lapissea1190
    @lapissea1190 3 місяці тому +1

    I am really not looking forward to the memory access removal. Maybe I'm lacking some knowledge here but for example. Here is a very simple library. There is a class called FormatToString that simply takes an annotation from the class and converts it in to a toString function. Eg: "Foo{bar: #bar}" Now the user clearly intends the bar field/accessor to be used but it may not want to publicly expose as it may just be something related to string display. Without the memory access that contract can no longer be fulfilled and the user must manually allow the library to access things via reflection what defeats the purpose of something that is supposed to make things simpler and faster to write.

    • @nipafx
      @nipafx 3 місяці тому

      Using memory access to read fields can break on any minor Java update, on other JVMs, even when everything else stays the same, it could theoretically break non-deterministically when some run-time optimization lays out fields differently. This is a terrible use of that capability and that any random dependency of a dependency of a dependency can silently break an app's integrity like that is kinda bonkers. So it's good that it goes away.
      If the library used bytecode generation or reflection instead, users can unlock the capability with a simple command line flag and thus acknowledge that they accept the compatibility risk.

    • @lapissea1190
      @lapissea1190 3 місяці тому

      I mean I'm for removing unsafe when there is a suitable alternative (with the edge case of tight performance requirements)
      For example, the byte[] primitive access by offsets has a var handle alternative and it is really good. But for things such as fields, obtaining a var handle can be a large pain or just impossible without unusual permissions. I'm all for unsafe removal if it can be replaced. Currently and sadly, that is not the case and while it is much better than it used to be, it's not quite there yet.

    • @nipafx
      @nipafx 3 місяці тому +1

      @@lapissea1190 You missed (or at least didn't reply to) the central part of the rationale: It doesn't matter how useful it is, *nothing* should be able to undermine an application's integrity unless the people running it give explicit permission.

    • @lapissea1190
      @lapissea1190 3 місяці тому

      Oh apologies! Yes but it's also more than unsafe? It might just be my forte in to 3d graphics but almost all causes of crashes in my experience are not related to unsafe but loading of external code. Something that is very much allowed and requires no explicit permissions.

  • @advsaifkhan8938
    @advsaifkhan8938 3 місяці тому

    If at least something would be available for string templating in Java, say, like compact() in PHP laravel.
    Though, with String.format(), I can achieve enough which I want. but it could be probably simplified with the approach like compact(). Probably it could be achieved when project Babylon will stand and jump.

  • @redcrafterlppa303
    @redcrafterlppa303 3 місяці тому

    3:15 so import module is basically using namespace from c++... I'm not sure I like it.

  • @PeterAdiSaputro
    @PeterAdiSaputro 3 місяці тому +1

    Hi Nicolai.
    Is OpenJDK and JDK have the exact same features and source codes ? Who determines what new features will be added, what old features will be fixed, and what old features will be removed (deprecated) in newer versions of the JDK, is it the community or the internal Java team at Oracle ?

    • @tintifax8531
      @tintifax8531 3 місяці тому +1

      OpenJDK is "the JDK". This is where Java is developed.

    • @Anbu_Sampath
      @Anbu_Sampath 3 місяці тому

      OpenJDK is the place Java developed, vendors can add features and release build of OpenJDK.

    • @PeterAdiSaputro
      @PeterAdiSaputro 3 місяці тому

      @@Anbu_Sampath Vendor = Oracle ?

    • @Anbu_Sampath
      @Anbu_Sampath 3 місяці тому

      @@PeterAdiSaputro Oracle, Redhat, Amazon, Microsoft etc.

  • @KleyderReyes-bu1iv
    @KleyderReyes-bu1iv 3 місяці тому

    👍

  • @sjzara
    @sjzara 3 місяці тому +2

    String templating always seemed to be a strange addition to Java. One of Java’s great strengths is compile-time checking and code analysis, which is broken by string templating. Templating also adds new syntax to be handled by transpilers. I hope it isn’t added back. Its function can be replaced by combinations of string formatting and lambdas. Keep functionality and variable names as pure Java!

    • @askarkalykov
      @askarkalykov 3 місяці тому +1

      I always find myself trying to use them for something more than a string template, and always get reminded about inherently String-bound nature of TemplateProcessors.

    • @31redorange08
      @31redorange08 3 місяці тому

      String formatting is compile-time checked?

    • @sjzara
      @sjzara 3 місяці тому

      @@31redorange08 No, but the use of variables and expressions as parameter for the formatting is.

  • @aecbnas2112
    @aecbnas2112 3 місяці тому +2

    Valhalla’s progress toooooo slow。

  • @ahmedurmiteahmedurmite3711
    @ahmedurmiteahmedurmite3711 3 місяці тому +3

    wake me up when valhalla it will be here, 10 years is too long, the development is too slow, and java have lost a lot of ground compared to the other language

    • @lepingouindefeu
      @lepingouindefeu 2 місяці тому +2

      For real. Valhalla would be such a game changer but I feel like they're taking way too long. Yes I get that it's a nontrivial task, but they've been working on it since 2014! That's 10 whole years! More than enough time to rewrite the entire JVM itself. 😮

  • @Anbu_Sampath
    @Anbu_Sampath 3 місяці тому

    5:52 - like ir. Valhalla - every avoids except Java Developer.

  • @aleksander_2137
    @aleksander_2137 3 місяці тому +2

    String Template removal has come as shock to me being honest

    • @VuLinhAssassin
      @VuLinhAssassin 3 місяці тому

      Yeah, I am not expecting it

    • @VuLinhAssassin
      @VuLinhAssassin 3 місяці тому

      Once again, we can only dream of String interpolation from other languages

    • @lucaguadagnini8512
      @lucaguadagnini8512 3 місяці тому +2

      it's temporary, they will come back with a finer and better syntax

  • @hba6018
    @hba6018 3 місяці тому +4

    The decision to remove string templates has been extremely misguided, very very sad. I still don't understand the justification.

    • @dino130395
      @dino130395 2 місяці тому +2

      They figured out that they don’t need special syntax to achieve the optimizations they wanted. New syntax should always be avoided if at all possible to reduce bloat in the language. Since they can achieve the same performance without it, they need to completely redesign the api for that feature. It will be back, they just removed it since it makes no sense to keep it as preview knowing it will be changed completely

  • @thanosfisherman
    @thanosfisherman 3 місяці тому +5

    Give us Valhalla already wtf is wrong with you.

    • @lucaguadagnini8512
      @lucaguadagnini8512 3 місяці тому

      chill, man! 😂 don't you know how hard it is to bring such a feature?

    • @thanosfisherman
      @thanosfisherman 3 місяці тому +1

      @@lucaguadagnini8512 No I don't

    • @thanosfisherman
      @thanosfisherman 3 місяці тому

      @@lucaguadagnini8512 I mean they've been working on it for more than 10 years wtf. C# has value type from day 1

    • @lepingouindefeu
      @lepingouindefeu 2 місяці тому

      It's been 10 years. How hard can a task be? ​@@lucaguadagnini8512

    • @lepingouindefeu
      @lepingouindefeu 2 місяці тому +3

      Even Einstein's theory of relativity took him less time than Project Valhalla is taking right now. 😅

  • @Drekrosh
    @Drekrosh 3 місяці тому +3

    Lol, he’s so excited about the new JDK 23 when Java is already irrelevant in the world. You should be thinking not about the 1% of people who use the new version, but about those who can’t afford to use the new features in the older versions of the language. Enterprise is stuck on version 8 and can’t afford to use your innovations. Nobody starts new projects in Java anymore; everyone is using more reliable and modern languages like Golang for backend or Rust. When enterprise wants to get rid of legacy, they choose Golang over Java, and there are dozens of such examples. Someone please tell Oracle and the author of the video that it’s not the year 2000, good morning. Nobody needs their dinosaur with tons of junk inside that they can never get rid of. Just keep making your JVM, the only thing that can be useful. No project Valhalla or any other will save this language from falling into the abyss; Cobol will have a neighbor at the bottom.
    New logo for Oracle -> 🤡 (clown)

    • @just-me-and-code
      @just-me-and-code 3 місяці тому +11

      I use java, it's been a year now and it's great🙃

    • @JoeMwangi
      @JoeMwangi 3 місяці тому +10

      You cared so much that you had to comment. It means probably java is opposite to what you say.

    • @just-me-and-code
      @just-me-and-code 3 місяці тому +2

      @@JoeMwangi😂 good response

    • @vinterskugge907
      @vinterskugge907 3 місяці тому +6

      This 'stuck on Java 8' thing isn't as relevant anymore. I have been using Java 21 on a daily basis since November.
      If you look at the 'show of hands' the presenters are doing at conferences, fewer and fewer are still on Java 8.

    • @cosmowanda6460
      @cosmowanda6460 3 місяці тому +3

      Bro is clearly a go fan boy but he's on every java video lmao

  • @ekadet7882
    @ekadet7882 3 місяці тому +3

    Say "gatherer" 3 times in a row and you will understand why it is such a poor name. A more concise, and intuitive name like "pipe" would be much more fitting, imho.
    Stream.of(1, 2, 3).pipe(🍄=> collect(🍄)).toList();

    • @lepingouindefeu
      @lepingouindefeu 2 місяці тому

      Lol I like the Choice of variable name 😂