The Modules Project was inactive and was subsequently dissolved Oct 2023. The approach described here was superseded by Project Jigsaw.

Superpackages are a new language construct being defined by JSR 294, see the draft specification.

Declaring Superpackages

At this time support for superpackages is not yet implemented in the javac compiler. As a temporary workaround, the Modules project uses class declarations of the following form to emulate superpackage declarations. The class is compiled by javac like any other class in the module.

File [location]/

package [superpackage name];

import java.lang.reflect.Superpackage.*;

@[superpackage annotations]
class super_package {

    exports [exported types];

    uses [required superpackages];

For the list of exported types and required superpackages, replace the character '.' with '$', for example becomes java$se.

As soon as superpackages are implemented at javac, proper superpackage declarations will be used.