new rule: avoid Thread.getContextClassLoader()
Brought to you by:
chrismair
new rule: avoid Thread.getContextClassLoader()
There are almost always better ways to load classes than to access the context class loader:
From http://www.osgi.org/blog/2011/05/what-you-should-know-about-class.html
"for some reason they used the Thread Context Class Loader (you're in deep s**t if that one becomes necessary), and Class.forName. Completely unnecessary because they had access to the delegate object and thus its class loader... Reasoning about the context in which a class is loaded can prevent problems.