/ JIGSAW, MODULES, JAVA 9

A hard look at the state of Java modularization

When Jigsaw was released with Java 9, it was the end of a long process - it had been postponed already - and it had to be released. With the coming of Java 11, the latest Long-Term Support, I think it’s a good time to take a snapshot of the state of modularization.

I’ll use the Top 20 Libraries and APIs Java Developer should know as a reference, and check for each of them if the latest version:

  • provides an automatic module name
  • or has a module-info

In the first case, the JAR has a stable module name. It’s still an automatic module, but it’s the first step into the module system. In the second case, the JAR is a full-fledged module as it has completely embraced the module system.

NameAnalyzed versionModule nameModularized?

SLF4J

1.8.0-beta2

org.slf4j

Jackson

2.9.8

com.fasterxml.jackson.core

GSon

2.8.5

JUnit

5.3.2

org.junit.jupiter.api

Mockito

2.23.4

org.mockito

PowerMock

2.0.0-RC.4

Commons Lang

3.8.1

org.apache.commons.lang3

Commons Math

3.6.1

Guava

27.0.1

com.google.common

Http Client

4.5.6

org.apache.httpcomponents.httpclient

Xerces 2

2.12.0

XStream

1.4.11.1

dom4j

2.1.1

JAXB

2.3.1

java.xml.bind

Apache POI

4.0.1

 Commons Pool

2.6.0

 Flexipool

2.1.1

com.vladmihalcea.flexypool.core

 HikariCP

3.2.0

com.zaxxer.hikari

 Commons DBCP

2.5.0

 iText

5.5.13

 FOP

2.3

Commons Collections

4.2

org.apache.commons.collections4

Eclipse Collections

9.2.0

org.eclipse.collections.api

Trove

3.1.0

Commons Email

1.5

JSoup

1.11.3

org.jsoup

Commons Codec

1.11

org.apache.commons.codec

P6Spy

3.8.1

ProtoBuf

3.8.1

Only two of the libraries above are actually modularized! That is understandable, since implementing modules in one’s own library is a non-trivial effort. However, a lot of libraries - about 50% - don’t have an Automatic-Module-Name, even though:

  1. It costs virtually nothing
  2. The latest version has been published in 2018 - Java 9 has been released in September 2017

Because of that, it makes it very hard for client applications/frameworks/libraries e.g. Spring to be modularized themselves. That makes me wonder what the future looks like for modules.

Interestingly enough, despite the lack of module support, a lot of the above libraries are OSGI bundles (e.g. ProtoBuf)
Nicolas Fränkel

Nicolas Fränkel

Nicolas Fränkel is a Developer Advocate with 15+ years experience consulting for many different customers, in a wide range of contexts (such as telecoms, banking, insurances, large retail and public sector). Usually working on Java/Java EE and Spring technologies, but with focused interests like Rich Internet Applications, Testing, CI/CD and DevOps. Currently working for Exoscale. Also double as a teacher in universities and higher education schools, a trainer and triples as a book author.

Read More