private PackageRegistry newPackage(final PackageDescr packageDescr) {
Package pkg;
if (this.ruleBase == null || (pkg = this.ruleBase.getPackage(packageDescr.getName())) == null) {
// there is no rulebase or it does not define this package so define it
pkg = new Package(packageDescr.getName());
pkg.setClassFieldAccessorCache(new ClassFieldAccessorCache(this.rootClassLoader));
// if there is a rulebase then add the package.
if (this.ruleBase != null) {
// Must lock here, otherwise the assumption about addPackage/getPackage behavior below might be violated
this.ruleBase.lock();