I've said before that every Java project ends up writing (or using) a StringUtil class: a bunch of static methods to do things to Strings that Sun's class doesn't cater for.
Today, I found myself wanting to do a pretty basic String operation that wasn't on the main class, so I sent IDEA off hunting... and there were seven classes in my Classpath called either StringUtil
or StringUtils
, all of them from different projects.
So I wrote the method myself. Finding the one I should have been using amongst that lot was just too much effort :)
Sometimes I think there should be another level of class visibility: "only visible to classes loaded from the same location (jar, file classpath base, URL codebase)". That would make it easier to navigate a library: all the glue classes, helpers, utils and impls would be safely stowed away, and you'd just be browsing the real library interface.
Then, I think how much this could be abused by overzealous information hiders to make it impossible to do anything with a library that wasn't explicitly forseen by its author, and I realise it's a bad idea after all.