作为检查静态注册表的适当使用的一种方式:
class AClass {
static final IDType = IDregistry.registerId(...);
}
class IDRegistry {
public static registerId(...)
{
if(isCalledInStaticInitializer()) {
return(new IDType(...));
}
assert false : "NO NO - can't do this !!!";
}
}