In our organizations we've got several microservices and lots of libraries.
Some libraries define "public" classes that are not intended for public usage - only inside library in multiple packages (thus can't be package-private)
I'd like to add something similar to Kotlin's "internal" modifier - a checkstyle rule/annotation processor/test component that verifies that consumer applications don't import these classes.
for example, I will mark them as @ForInternalUsageOnly or put into package com.ourorg.mylib.internal_usage
what can be a non-copy-pasted (e.g. a jar or a gradle task) implementation that verifies that such classes are not imported? Preferably - on compilation level