Introducing Jextract – Foreign (Function) Memory API

163. Introducing Jextract Jextract (https://github.com/openjdk/jextract) is a very handy tool capable to consume the headers of native libraries (*.h files) and producing low-level Java native bindings. Via this tool, we ... Read MoreRead More

0 Comments

Creating an electrical panel (hierarchy of classes) – Sealed and Hidden Classes

165. Creating an electrical panel (hierarchy of classes) Let’s assume that we want to model in code lines an electrical panel. Of course, we are not electricians, so in a ... Read MoreRead More

0 Comments

Closing the electrical panel before JDK 17 2 – Sealed and Hidden Classes

Declaring classes/interfaces as non-public Going further, we can declare interfaces/classes as non-public (by skipping the public keyword from the class/interface definition it becomes non-public and is set by default in ... Read MoreRead More

0 Comments

Closing the electrical panel before JDK 17 – Sealed and Hidden Classes

166. Closing the electrical panel before JDK 17 By its nature, an electrical panel is a closed unit of work. But, our code from the previous problem is far away ... Read MoreRead More

0 Comments

Introducing JDK 17 Sealed Classes – Sealed and Hidden Classes

167. Introducing JDK 17 Sealed Classes Among the cool features of JDK 17, we have JEP 409 (Sealed Classes). This JEP provides an explicit, intuitive, crystal clear solution for nominating ... Read MoreRead More

0 Comments

Introducing the permits clause – Sealed and Hidden Classes

168. Introducing the permits clause In the previous problem, you saw how to write a closed hierarchical model in a single source file. Next, let’s use the Fuel.java source file ... Read MoreRead More

0 Comments

Closing the electrical panel after JDK 17 – Sealed and Hidden Classes

169. Closing the electrical panel after JDK 17 Do you remember our electrical panel model introduced earlier in Problems X and Y? In Problem Y, we closed this model as ... Read MoreRead More

0 Comments

Combining sealed classes and records – Sealed and Hidden Classes

170. Combining sealed classes and records As you know from Chapter 4, Java records are final classes that cannot be extended and cannot extend other classes. This means that records ... Read MoreRead More

0 Comments