If it’s on your classpath, it’s available for use. If you were to remove the hibernate
StringUtils somehow from the classpath (ie deleting it from the jar) it would likely break hibernate. The nuclear option is to somehow run hibernate in another classloader but I really wouldn’t recomment it.
Unless, of course, the hibernate jars are split into interfaces/annotations and implementation jars. In which case you could put the interface jar on the compile classpath and the implementation only on the runtime classpath. I haven’t used hibernate in quite a while (I think it’s a really bad idea but that’s a conversation for another day)
If you are using eclipse, you can tell it to remove/filter some options from content assist so they are never suggested (I often remove
java.awt.* to prevent the awt list from being suggested by content assist). I’m sure intellij has a similar option
Preferences --> Java --> Editor --> Content Assist --> Type Filters
Or perhaps you could run a regex over your source code and fail the build if you detect blacklisted class usage.