- Java 9+ modules
- Modules can be annoying because some popular 3rd party libs haven't adopted them (eg. Netty, Google, ...).
- Use a bottom-up approach
- Start with simple relatively independent (gradle) modules
- Unnamed/automatic modules can access modular code, but not the inverse
- a module contains one or more packages
- a module
exportspackages - a module depends on other modules via
requires - (unlike packages) modules have no hierarchy
- names are just names (similar to golang packages)
--add-exports: only public members accessible--add-opens:- even private members accessible thru reflection (eg.
Field::setAccessible(true)) - Runtime concern, not compile time
- even private members accessible thru reflection (eg.
--patch-module: merges all classes from an artifact into a module (helps fix split packages)
- Hiding packages from other modules
- Fine grained control over access at runtime (Reflection too)
- Granular JVM
- Faster startup
- eg. jsr305, replace with jetbrains annotations package
- Sometimes split package issues manifest with unrelated error messages
--patch-module name.of.module=path/to/my.jarmight help- also requires an
--add-modulesstep
- also requires an
--upgrade-module-pathmight help
1. eg. [google.cloud.storage](https://mvnrepository.com/artifact/com.google.cloud/google-cloud-storage)
- TODO: "legacy" jars
- TODO: classpath
- TODO: jdeps
- TODO: gradle
- TODO: modulepath
- TODO: naming (chars, length, ...)
- TODO: unused required (Intellij)
- TODO: open
- TODO: opens
- TODO: transitive
- TODO