Difference between compact strings and compressed strings in Java 9

Compressed strings (Java 6) and compact strings (Java 9) both have the same motivation (strings are often effectively Latin-1, so half the space is wasted) and goal (make those strings small) but the implementations differ a lot. Compressed Strings In an interview Aleksey Shipilëv (who was in charge of implementing the Java 9 feature) had … Read more

Why did Java 9 introduce the JMOD file format?

The purpose of JMODs are not well documented and existing documentation is rather sparse. Here is an in-depth explanation of system, from my understanding. Parts of this answer are rather long, verbose, partially redundant, and a tough read. Constructive, structural, or grammatical edits are more than welcome to improve readability for future readers. Short(er) Answer … Read more

Java 9 + maven + junit: does test code need module-info.java of its own and where to put it?

The module system does not distinguish between production code and test code, so if you choose to modularize test code, the prod.module and the test.module cannot share the same package com.acme.project, as described in the specs: Non-interference — The Java compiler, virtual machine, and run-time system must ensure that modules that contain packages of the … Read more

How to hide warning “Illegal reflective access” in java 9 without JVM argument?

There are ways to disable illegal access warning, though I do not recommend doing this. 1. Simple approach Since the warning is printed to the default error stream, you can simply close this stream and redirect stderr to stdout. public static void disableWarning() { System.err.close(); System.setErr(System.out); } Notes: This approach merges error and output streams. … Read more