To limit visibility, we have a package-private mapper interface. While the compilation pass without any problems, the tests reveals that the mapper impl cannot be created:
Caused by: java.lang.IllegalAccessException: Class org.mapstruct.factory.Mappers can not access a member of class com.acme.PackagePrivateMapperImpl with modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102)
at java.lang.Class.newInstance(Class.java:436)
at org.mapstruct.factory.Mappers.doGetMapper(Mappers.java:99)
Having package-private classes (and mappers) help to expose clean interfaces outside a package without exposing the plumbing.
To limit visibility, we have a package-private mapper interface. While the compilation pass without any problems, the tests reveals that the mapper impl cannot be created:
Having package-private classes (and mappers) help to expose clean interfaces outside a package without exposing the plumbing.