Sealed classes are for restricted inheritance. This is not applicable here. In the RNG module a whole set of utility classes have been placed in an 'internal' package. Given that these should not be used directly I think the module exports can omit this package. The moditect plugin provides example configuration to do this for an internal package, which is what I am suggesting here.
Alex On Thu, 4 Jul 2024 at 14:25, Gary Gregory <garydgreg...@gmail.com> wrote: > Can this alternatively be solved with Java's sealed class feature? That > would require Java 17 though... > > Gary > > On Thu, Jul 4, 2024, 9:18 AM Alex Herbert <alex.d.herb...@gmail.com> > wrote: > > > The RNG component has an internal package. So to not export this in the > > module info I had to tweak the exports for moditect inherited from > commons > > parent with a profile: > > > > <profile> > > <id>java-9-up</id> > > <activation> > > <jdk>[9,)</jdk> > > </activation> > > <build> > > <plugins> > > <plugin> > > <groupId>org.moditect</groupId> > > <artifactId>moditect-maven-plugin</artifactId> > > <version>${commons.moditect-maven-plugin.version}</version> > > <configuration> > > <module> > > <moduleInfo> > > <exports> > > !${commons.module.name}*.internal*; > > *; > > </exports> > > </moduleInfo> > > </module> > > </configuration> > > </plugin> > > </plugins> > > </build> > > </profile> > > > > This could be integrated to commons parent. However it may affect binary > > compatibility on Java 9+ for any that do and have been released with the > > default export of all packages. > > > > Are there any other components that use internal packages? > > > > Alex > > >