We have fixed as part of
TRUNK-4348 the general case when one module name is a substring of another. But, as Wyclif Luyima points out, this may still fail if for modules with periods in the name. For instance, if there was a reporting.ui module, OpenmrsClassLoader would potentially match it with the reporting module classloader.
We could change it so that it takes the classname and truncates at the last dot and then do an equals comparison. Are there any cases when we think doing that wouldn't be the right thing?
int pos = className.lastIndexOf(".");
String classPackageName = className.substring(0, pos);
tryToLoad = classPackageName.equals(moduleClassLoader.getModul().getPackageName())