SE-Radio Episode 316: Nicolai Parlog on Java 9

Topics covered
Popular Clips
Episode Highlights
Default Methods
Java 9 introduces significant enhancements to default methods in interfaces, allowing for private methods. explains that this change enables code sharing between default methods without exposing them as part of the public API 1. This is a departure from Java 8, where all default methods were public, potentially cluttering the API. The ability to include private methods within interfaces allows developers to maintain cleaner and more secure codebases.
Java 9 now allows private interface methods, which is just a regular private method like in any other class.
---
This enhancement is particularly beneficial for developers looking to streamline their code while maintaining backward compatibility 2.
Language Enhancements
Java 9 also brings other language enhancements such as improvements to the try-with-resources statement and the diamond operator. highlights that these changes reduce boilerplate code, making Java more efficient and user-friendly 3. The try-with-resources enhancement allows developers to manage resources more effectively without unnecessary assignments, while the diamond operator now supports anonymous classes, simplifying code syntax.
In Java 7, I had to assign that variable. It had to be an assignment in there. There was a good reason for that.
---
These updates reflect Java's ongoing commitment to improving developer experience by minimizing repetitive coding tasks.
Encapsulation
Encapsulation in Java 9 has been enhanced to provide more robust control over code visibility across modules. discusses how these changes allow developers to define smaller, more secure interfaces between modules, reducing the risk of unintended access 4. This is achieved by projecting encapsulation principles onto the level of jars, which were previously not possible.
It gives us the freedom to declare surfaces that are smaller, particularly across jars.
---
These enhancements encourage better software design by enforcing stricter access controls, ultimately leading to more maintainable and reliable applications.
Related Episodes


Episode 171: Scala Update with Martin Odersky
Answers 383 questions

SE-Radio Episode 291: Morgan Wilde on LLVM
Answers 383 questions

SE-Radio-Episode-266:-Charles-Nutter-on-the-JVM-as-a-Language-Platform
Answers 383 questions

SE-Radio-Episode-267-Jürgen-Höller-on-Reactive-Spring-and-Spring-5.0
Answers 383 questions

SE-Radio Episode 240: The Groovy Language with Cédric Champeau
Answers 383 questions

SE-Radio Episode 320: Nate Taggart on Serverless Paradigm
Answers 383 questions

SE-Radio Episode 357: Adam Barr on Code Quality
Answers 383 questions

Episode 97: Interview Anders Hejlsberg
Answers 383 questions

SE Radio 618: Andreas Møller on No-Code Platforms
Answers 383 questions

Episode 22: Feedback
Answers 383 questions

SE Radio 638: Nick Tune and Jean-Georges Perrin on Architecture Modernization
Answers 383 questions

Episode 69: Nico Josuttis on SOA (SOA Pt. 3)
Answers 383 questions

Episode 129: F# with Luke Hoban
Answers 383 questions

Episode 140: Newspeak and Pluggable Types with Gilad Bracha
Answers 383 questions













