There is a mechanism to convert regular jar into an automatic module starting from java-9, by simple placing it onto modulepath instead of classpath. An automatic module has the following properties:
An automatic module is a named module that is defined implicitly, since it does not have a module declaration. Every package in an automatic module is, therefore, considered to be exported even if it might actually be intended only for internal use.
So all packages inside an automatic module are available. But if we inspect an automatic module with --describe-module directive there is no exports section in the output.
For example an automatic module main
jar --file main.jar --describe-module
com.foo jar:file:///.../code/module/main.jar/!module-info.class
requires java.base mandated
contains com.foo
Why is there no exports section if package com.foo is considered to be exported anyway? I find this a bit confusing: --describe-module suggests that there are no exported packages, but at the same time, main is an automatic module so everything is exported implicitly.