Java
Java
  • 1 300
  • 9 440 249
Module Imports in Java 23 - Inside Java Newscast #69
To reduce the overhead of using APIs, particularly in single source files, Java 23 previews module import declarations of the form `import module $moduleName, which import all packages exported by the named module.
JEP 476: openjdk.org/jeps/476
The book: www.manning.com/books/the-java-module-system?a_aid=nipa&a_bid=869915cb
~~~ Chapters ~~~
0:00 Intro
0:57 Star Imports
Launching Single-File Source-Code Programs: dev.java/learn/single-file-program/
1:46 Module Imports
JEP 477: openjdk.org/jeps/477
3:24 Module Import Details
Qualified `exports` and `opens`: dev.java/learn/modules/qualified-exports-opens/
Implied Readability with `requires transitive`: dev.java/learn/modules/implied-readability/
4:48 More Modules?
Tags: #Java #Java23 #OpenJDK #InsideJava
Переглядів: 5 534

Відео

JavaDoc Hits the Markdown on Comments - Inside Java Newscast #68
Переглядів 7 тис.14 днів тому
JavaDoc is our source of truth when comes to understanding in depth Java's API, but also an inspiration on how we can document our own code. Creating code documentation involves writing a combination of custom JavaDoc tags and HTML elements, which can be time-consuming and error-prone due to its complexity. Hence, let's take a sneak peek at JEP 467 and how Java documentation could be easier to ...
Java 21 - Language Features and Beyond
Переглядів 12 тис.14 днів тому
Language Features and Beyond: A Roadmap of Innovations Embark on an exploration of Java 21's groundbreaking language features. From a simplified beginning with unnamed classes and instance main methods to using string templates, record patterns, and pattern matching, this session empowers you to create efficient, future-proof code. Join this talk to gain a practical understanding of the latest ...
Java in 2024 - Constant Change, Delivered | Keynote
Переглядів 7 тис.21 день тому
Six years ago we accelerated the pace of new releases in order to keep Java vibrant in an ever-changing world of competing platforms and new styles of application deployment. That worked out better than most anyone hoped or expected, enabling a rate of innovation and delivery not seen since the early days of the platform. We’ll take a look back at features delivered recently, and a brief look a...
JDK Mission Control 9 - What's New?
Переглядів 4,8 тис.21 день тому
Builds of *JDK Mission Control 9* are now available. Let's review some of the key changes included in this JMC release. *Download JMC 9* → www.oracle.com/java/technologies/javase/products-jmc9-downloads.html *Resources* - Article → inside.java/sip/096 - Eclipse 4.30 - New and Noteworthy → eclipse.dev/eclipse/news/4.30/ - Add rule to detect GC Inverted Parallelism → bugs.openjdk.org/browse/JMC-8...
Java Withers - Inside Java Newscast #67
Переглядів 11 тис.28 днів тому
Java Withers - Inside Java Newscast #67
Programmer's Guide to JDK Flight Recorder
Переглядів 7 тис.Місяць тому
Programmer's Guide to JDK Flight Recorder
Java 23: Restoring the Balance with Primitive Patterns - Inside Java Newscast #66
Переглядів 17 тис.Місяць тому
Java 23: Restoring the Balance with Primitive Patterns - Inside Java Newscast #66
A Decade of JDK Updates in OpenJDK
Переглядів 4,8 тис.Місяць тому
A Decade of JDK Updates in OpenJDK
OpenJDK Project Wakefield - The Wayland Desktop for JDK on Linux
Переглядів 11 тис.Місяць тому
OpenJDK Project Wakefield - The Wayland Desktop for JDK on Linux
What’s New in Java 22 in 2 Minutes... More or Less - Sip of Java
Переглядів 40 тис.Місяць тому
What’s New in Java 22 in 2 Minutes... More or Less - Sip of Java
Java 22 Release Notes Review - Inside Java Newscast #65
Переглядів 13 тис.2 місяці тому
Java 22 Release Notes Review - Inside Java Newscast #65
Modern Java in Action
Переглядів 32 тис.2 місяці тому
Modern Java in Action
Java 17 to 21: A Showcase of JDK Security Enhancements
Переглядів 7 тис.2 місяці тому
Java 17 to 21: A Showcase of JDK Security Enhancements
(Dirty?) Tricks in Java 22 - Inside Java Newscast #64
Переглядів 15 тис.2 місяці тому
(Dirty?) Tricks in Java 22 - Inside Java Newscast #64
Project Leyden: Capturing Lightning in a Bottle
Переглядів 6 тис.2 місяці тому
Project Leyden: Capturing Lightning in a Bottle
Java's Custom Runtime Builder - jlink
Переглядів 9 тис.2 місяці тому
Java's Custom Runtime Builder - jlink
The State of OpenJDK
Переглядів 7 тис.2 місяці тому
The State of OpenJDK
Java Language Update - Early 2024 Edition
Переглядів 15 тис.2 місяці тому
Java Language Update - Early 2024 Edition
Java's Virtual Threads - Next Steps
Переглядів 14 тис.3 місяці тому
Java's Virtual Threads - Next Steps
Does Java 22 Kill Build Tools? - Inside Java Newscast #63
Переглядів 22 тис.3 місяці тому
Does Java 22 Kill Build Tools? - Inside Java Newscast #63
Foreign Function & Memory API - A (Quick) Peek Under the Hood
Переглядів 7 тис.3 місяці тому
Foreign Function & Memory API - A (Quick) Peek Under the Hood
Data Oriented Programming in Java 21, Solving the Countdown game - JEP Cafe #22
Переглядів 20 тис.3 місяці тому
Data Oriented Programming in Java 21, Solving the Countdown game - JEP Cafe #22
Java Virtual Threads Throughput
Переглядів 7 тис.3 місяці тому
Java Virtual Threads Throughput
Java 22 Previews Statements Before `super(...)` and `this(...)` - Inside Java Newscast #62
Переглядів 13 тис.3 місяці тому
Java 22 Previews Statements Before `super(...)` and `this(...)` - Inside Java Newscast #62
Java's Plans for 2024 - Inside Java Newscast #61
Переглядів 12 тис.3 місяці тому
Java's Plans for 2024 - Inside Java Newscast #61
The Panama Effect - Inside Java Podcast 32
Переглядів 7 тис.4 місяці тому
The Panama Effect - Inside Java Podcast 32
Java Highlights of 2023 - Insight Java Newscast #60
Переглядів 10 тис.4 місяці тому
Java Highlights of 2023 - Insight Java Newscast #60
Upgrading to Java 21? You'll want avoid these features.
Переглядів 7 тис.5 місяців тому
Upgrading to Java 21? You'll want avoid these features.
HttpClient is Now AutoCloseable in Java 21
Переглядів 10 тис.5 місяців тому
HttpClient is Now AutoCloseable in Java 21

КОМЕНТАРІ

  • @ahmedjaad4940
    @ahmedjaad4940 15 годин тому

    how about this one *_new File("path").mkdir();_*

  • @mrDataStream777
    @mrDataStream777 17 годин тому

    i need this cup)

  • @TheOctolink
    @TheOctolink 19 годин тому

    What is a factory method?

    • @MarkJaeger
      @MarkJaeger 17 годин тому

      It's an API method that generally creates an object.

    • @ahmedjaad4940
      @ahmedjaad4940 15 годин тому

      It is basically an alternative to a constructor, they have a number of advantages over constructors and generally should be preferred over constructors

  • @ilkou
    @ilkou 19 годин тому

    i’m so confused

  • @Drekrosh
    @Drekrosh 21 годину тому

    Q: Differences between an interface and an abstract class? A: Just use golang instead of dino-java

  • @adilsonojr
    @adilsonojr 21 годину тому

    É muito interessante o formato de apresentação dos vídeos... 😍

  • @CraccaHacka
    @CraccaHacka 21 годину тому

    After the explanation, I still fail to understand the point of this

  • @2012mindmaster
    @2012mindmaster День тому

    Use interfaces as a communication contract, designed to decouple your code from particular implementations. This way you can switch a certain service or layer for another easily, you just have to honor the contract

    • @2012mindmaster
      @2012mindmaster День тому

      Use abstract clases as the master mold for your class hierarchy. Put there the base features and shared behaviors

    • @2012mindmaster
      @2012mindmaster День тому

      The difference between both elements relies on purpose

  • @shashankmutgi9330
    @shashankmutgi9330 День тому

    Is that Jose Paumard? This guy's course on completablefuture landed me my current job. Thanks Jose!

  • @emmanuelnsiah8036
    @emmanuelnsiah8036 День тому

    I thought they were the same thing

  • @MrKar18
    @MrKar18 День тому

    Module import will be good fro scripting and shell related usage. Just yesterday, I was showing to my kids on jshell where they wanted to calculate #days to birthday, and I had to import time, time.format, time.unit packages 😑 when I know it's all related to time. This would solve, but have to wait an year.

  • @theblackavenger72
    @theblackavenger72 День тому

    Modules aren't used because they not useful to developers. They only really make sense in the JDK. If they had formalized dependency management on the other hand... Like why write import module in a script when I still have to somehow get that module into my class path???

  • @prdoyle
    @prdoyle День тому

    Only monsters use star imports in checked-in code. Monsters!

  • @mm3200
    @mm3200 День тому

    Was really interested in that JEP once I saw it, like how it seems and will definitely try it out.

  • @wesosdequeso8360
    @wesosdequeso8360 День тому

    I've seen simple projects bloated with interfaces for the sake of abstraction. Yet they no more than 1 implementation 😅.

    • @JosePaumard
      @JosePaumard День тому

      Don't use interface to create several implementations. Most of the time you will only have one, so indeed it doesn't make any sense. If you use them to control the direction of your dependencies between modules at compile time, then having only one implementation makes total sense.

  • @billykorando6820
    @billykorando6820 День тому

    Wow Nicolai. You really promoting your own book on a IJN episode? Quite gauche.

  • @mirzahadzic8666
    @mirzahadzic8666 День тому

    In Java, there are 3 levels of mandatory granularity: 1. Project (Gradle or Maven), 2. package, 3. class/interface/record. Everything is a member of all 3. In C/C++, on the other hand, there is no mandatory granularity, so you can create one giant mess, unless you impose strict guidelines. So, what happened, in my opinion, is that Java developers just consider these 3 levels of granularity plenty, especially if they come from C/C++, which is often the case.

  • @talellamouchi8386
    @talellamouchi8386 День тому

    White theme code editor, that's blasphemy

  • @apinakapinastorba
    @apinakapinastorba День тому

    I’m not really that interested in the imports section. It’s collapsed, it’s autosorted, it’s autocleaned, it’s autogenerated. If IDE wishes to use module imports, I’ll let it. If not, no big deal.

  • @theobserver_
    @theobserver_ День тому

    Don't want to start any controversies, but to me - it looks like JDK community is doing same thing C++ community was (and still is) doing with their implementations - reinventing bike, but making it so, that it has squared wheels. I think, just like C++, JDK does not know what it wants to be and simply adds whatever features it can, which makes Java lose its identity. It's as if there was a huge leap between JDK6 and 8 and then between 8 and 17 and then from there - everything is pretty much either "syntactic sugar", or features that 99% of developers do not use, or will not use. Yes - all these things are cool and all, but like modules - not practical. For modules, in particular, I think they would end up just dissapearing in several LTS iterations as no major platforms are using them. Guy, who commented here about - "wrong time-wrong place" (aka should have been part of JDK7) was spot on, in my opinion. For imports, kind of same thing. I don't even remember the last time I have imported anything. My IDE does that for me automatically. The only thing I need to do each time I install it is to configure after how many imports it should replace each import from a same package with '*'. In coporation I have been working - many people had common opinion, that in near future Java and JDK will only be used in major corporations as startups, mid-sized companies and etc look elsewhere (Go, Rust, etc...)

  • @kotlinsky.
    @kotlinsky. День тому

    valhalla, day 3168

  • @yapet
    @yapet День тому

    Most accessors are just boilerplate that accomplishes nothing over plain public fields. When you do need to have control over mutability, synchronization, constraint checking, derived value computations, etc. - sure custom accessor logic makes sense. The pervasive norm of “prefer accessors over public fields” doctrine, comes from the issue with API evolution. If you were to evolve underlying storage, add constraint checks, do copies, etc, you can’t without breaking callers. The pervasiveness of accessors is just an archaism of the Java. It’s completely unjustifiable lack of immutable collection interfaces, and lack of computed properties. All of the things you don’t have to deal with in languages from more than two decades ago. And the pace at which java evolves isn’t giving much hope as well (project Valhalla anyone?)

  • @kevingarnett2000
    @kevingarnett2000 День тому

    Back in school I was taught to use StringBuilder if using alot of concat, learned something new

  • @Alsteraib985
    @Alsteraib985 День тому

    This can potentially lead to spaghetti code.

  • @jay_sensz
    @jay_sensz День тому

    Why not bring JEP 477 to all Java source files instead of just implicitly defined classes? It seems easy enough to make sure that code that compiled in Java 22 remains unaffected by the automatic module import, but perhaps I'm missing a corner case.

    • @nipafx
      @nipafx День тому

      For that to work, you'd either have to make star imports take priority over module imports or make import order relevant - otherwise source files using, e.g., `java.awt.List` with an `import java.awt.*` would stop compiling because an implicit `import module java.base` pulls in `java.util.List`, which makes mentions of `List` ambiguous. Even that aside, I think most developers prefer explicit, single-type imports in their production code (take a look around these comments to get an impression of that).

    • @jay_sensz
      @jay_sensz День тому

      @@nipafx Yes, I imagined that module imports, at least implicit ones, would take the lowest priority vs all other imports. But if I understand you correctly, JEP 476 module imports are essentially just expanded to a list of wildcard imports, which could then come into conflict with existing wildcard imports?

    • @nipafx
      @nipafx День тому

      @@jay_sensz Not sure how it works on a technical level but on a conceptual level, that's what happens. Just like star imports mean, "import all types from the package", does a module import mean "import all public types from exported packages". And of two of those overlap, you get ambiguous imports - that is already true today for star imports and will apply just the same to module imports.

    • @jay_sensz
      @jay_sensz День тому

      @@nipafx I see. In that case it wouldn't make sense to force this on all Java source files, and I suppose it would be easy enough to set up an IDE to automatically add `import module java.base;` at the start of a new source file should one so desire.

  • @Nick-yd3rc
    @Nick-yd3rc День тому

    That’s nice, I wish I could import more flexibly like I can in Kotlin, Scala, or Rust. Renaming imports, renaming subsets, importing subsets, with sub-namespaces.

  • @ITksh-zp1ob
    @ITksh-zp1ob День тому

    don't get or see any benefits, IDE is hiding imports, what the deal with add something by double click and choose right one? I am 14 y in backend developing, lot of projects behind and nowhere modules were applied. useless for servers.

    • @nipafx
      @nipafx День тому

      I hope you mean you don't see any benefits *to you*, which is fair. This is not aimed at developers who only write production code and only use IDEs. But that doesn't constitute all Java developers. Some learn, some experiment, some write Java scripts - all potentially outside of an IDE. And Java/programming beginners benefit from not having to deal with detailed imports up front.

    • @cosmowanda6460
      @cosmowanda6460 День тому

      This reply is one of the reasons java gets a lot of hate. IDEs hide imports, yes, but it would be better if we didn't need to write them at all. Java needs to be more ide agnostic. If I remember correctly, maybe from around java 11 or so, there's no performance hit in importing everything because it gets cleaned up. I think people who have spent their entire life in java love writing more code because it makes them feel smart lol.

    • @ITksh-zp1ob
      @ITksh-zp1ob День тому

      @@nipafx yes, sure, I am talking about sever side development as common case for me. I believe it was huge move forward for IoT development or some embedded devices.

  • @ihateidiots9484
    @ihateidiots9484 День тому

    1. Make piblic fields in the language 2. Insist you always must use private fields

  • @shadeblackwolf1508
    @shadeblackwolf1508 День тому

    Java modules got caught in a chicken and egg scenario: The demand isn't there because the major frameworks don't support it yet, but.. the major frameworkds don't support it yet cause there is no demand. We use star imports currently in production code, and honestly it's fine. your IDE knows where your types are from and will happily show you whenever it becomes relevant, we'l probably start using this

    • @nipafx
      @nipafx День тому

      Yeah, the chicken-and-egg you describe is real. Although there are dedicated actors on both sides of that problem who keep pushing and so modules are slowly becoming more common. Or less uncommon, I should say :D particularly on the library/framework front. Thanks for outing yourself as a star-importer and giving your opinion on this. 👍

  • @Anbu_Sampath
    @Anbu_Sampath День тому

    Unpopular opinion: Java module system should have released during Java 7 timeframe, so adoption would have been great. It got release at wrong time where everyone was busy with micro-services/docker/cloud.

    • @sillystuff6247
      @sillystuff6247 День тому

      not an unpopular opinion, just pointless & divorced from reality

  • @pluschlorinds446
    @pluschlorinds446 День тому

    Stream API such as map / filter / flatmap are very useful but not exist in Iterable. I think that is the usecase.

  • @dubquery
    @dubquery 2 дні тому

    Maybe I miss something here, but as you stated in the beginning, many Java developers are using explicit imports for each type they’re using within a compilation unit. I wouldn’t feel comfortable importing all of a module compared to explicitly documenting what is needed. Sure, prototyping is fine with it, but where would I benefit from the module system in production?

    • @nipafx
      @nipafx 2 дні тому

      I know for a fact that some developers use star imports in production code (and I think I clearly expressed how I feel about that 😂), so I'm curious to hear what they think about this. But, yeah, I agree, I wouldn't want to import all of a module in "regular" code either, although I'd probably still prefer that over star imports. That said, it's fine that a feature applies "only" to the learning/experimentation/scripting environment as long as it doesn't cause harm elsewhere. Regarding where you'd benefit from the module system in production: You already do day in day out because it protects your runtime's integrity every time it runs. 😉

    • @_voidpointer5447
      @_voidpointer5447 День тому

      The only thing import does is just clarify package name for all the classes that you load. It will not load any unnecessary classes, so star imports do not hurt anything expect clarity when you're reading the code outside you IDE with LSP.

  • @vinothm8726
    @vinothm8726 2 дні тому

    Power of the WORA 🔥

  • @bentels5340
    @bentels5340 2 дні тому

    I don't immediately think this will make a difference to adoption. I was enthusiastic about the module system when it was announced... until I saw it. Fine for library builders, a PITA for everybody else. I've literally never seen it used in projects anywhere, ever.

    • @nipafx
      @nipafx 2 дні тому

      You mean in application code bases? I know one example and a few more people told me that they're doing it but given the amount of people I talk to, it's a very small share.

    • @larrywest42
      @larrywest42 День тому

      It's a hard call for library authors as well, if they still need to support Java 8 users. But I should look at Parlog's book, now that I can see the light at the end of that tunnel. (I wish Stephen Colebourne would write a book on JPMS, though I suppose the financial incentive would be minimal.)

    • @ChristophS
      @ChristophS День тому

      Oh yes, we at JabRef still struggle with third-party libraries that are incompatible, split packages etc and sometimes missing open modules etc manifesting only at runtime. That is the shittiest stuff.

    • @JojOatXGME
      @JojOatXGME 17 годин тому

      In my company, we migrated almost all our repositories to Java 11 and the module system 2019 (within less than one year after release of Java 11). However we also made a few mistakes during that migration. It was also a bit tricky as we are using Gradle, which did not support the module system at that point. So, we had to build our own Gradle Plugins to deal with that. However, I can understand that most companies don't wanted to go through that trouble. 😂

  • @sabart5
    @sabart5 2 дні тому

    Too much coffee will kill you.

  • @jeffthejava1
    @jeffthejava1 2 дні тому

    💯

  • @shounak616
    @shounak616 2 дні тому

    Also default methods

  • @arnaudd.2827
    @arnaudd.2827 2 дні тому

    I learnt that interfaces where used because a class can extends only one other class, but can implements multiple interfaces.

    • @nico-s29
      @nico-s29 2 дні тому

      A better explanation would be that Interface is like a contract that says if i implement this interface i will implement those methods an abstract class is more like a blueprint that can predefine behavior

    • @andreastasoulas7939
      @andreastasoulas7939 День тому

      I had this as an actual interview question

  • @Ambusher306
    @Ambusher306 2 дні тому

    Abstract class can carry a state, as mentioned in the video; but not the interface. Also interface methods can be overridden but not abstract classes. These 2 key points are good enough to use abstract instead of interface if your case needs internal states and unmodifiable logics (final methods)

    • @JosePaumard
      @JosePaumard 2 дні тому

      Methods from abstract classes can be overriden, unless you make them final.

    • @Ambusher306
      @Ambusher306 2 дні тому

      @@JosePaumard I agree. But there is no way to make methods final for interface. So for me, this is also another indicator when to prefer one over another.

    • @JosePaumard
      @JosePaumard 2 дні тому

      @@Ambusher306 That wouldn't be possible. Because of the diamond problem (a class implementing two interfaces with the same default methods), you cannot have a final default method. And making an abstract method final wouldn't make sense neither.

  • @limpius
    @limpius 2 дні тому

    I would prefer an interface because of multiple inheritance

    • @nico-s29
      @nico-s29 2 дні тому

      You dont inherit from an interface

    • @limpius
      @limpius 2 дні тому

      @@nico-s29 but you can implement many

  • @Frank-xu2ed
    @Frank-xu2ed 2 дні тому

    That's one of the questions where you think: man that's a stupid question And then you are at complete loss for words to wring out an explanation

  • @igorshingelevich7627
    @igorshingelevich7627 2 дні тому

    Had this one once a time.

  • @mikejohnson5258
    @mikejohnson5258 3 дні тому

    TIL Java Modules in Real Life are a PITA

  • @umasingh4369
    @umasingh4369 3 дні тому

    Sir please don't use BGM..also improve the audio quality so that we can clearly grasp knowledge which is given by you..

  • @dmitrikonnov922
    @dmitrikonnov922 3 дні тому

    As for me, building custom runtimes or native images entails so much overhead which moreover infilters the operation procedures, that it makes using java in greenfield cloud-native environment look more and more unattractive compared to other languages like Golang etc. Yes, the latter one and its libraries have not been as mature nor versatile as those for Java, but easy to write, build, deploy & operate, has a small memory footprint and starts fast.

  • @mcmati87
    @mcmati87 3 дні тому

    The class diagram seems wrong. Set is not extending SequencedCollection.

  • @aliaghaaghayev7465
    @aliaghaaghayev7465 4 дні тому

    How can i look all questions?

    • @JosePaumard
      @JosePaumard 3 дні тому

      There is a playlist here: ua-cam.com/play/PLzzeuFUy_Cngn3JZEXtu6G923y5v8y-8h.html

  • @viswanathankalyanasundaram9315

    Thank you .. but could you please please please mute the background music as it is distracting and irritating. The music is unnecessary for this type of content. Content itself is great but the music makes it feel like when you are studying for an exam and you hear blast of TV noise coming from the other room.Thanks again

  • @user-fx4rt1ve5h
    @user-fx4rt1ve5h 4 дні тому

    Can we create our own marker interface?

  • @khalidelaoula5898
    @khalidelaoula5898 4 дні тому

    or just use NodeJs 😄