NB6: error on “illegal reference to static field” solved
Easy solution (even though it still appears the old way is legal code): move the initializer code into a static method. Instead of:
private static Map byDBValue;
private AssetImporterTypeEnum(String dbvalue) {
this.dbValue = dbvalue;if (AssetImporterTypeEnum.byDBValue == null) {
AssetImporterTypeEnum.byDBValue = new HashMap();
}AssetImporterTypeEnum.byDBValue.put(dbvalue, this);
}
We have something more along the lines of:
private static Map byDBValue;
private AssetImporterTypeEnum(String dbvalue) {
this.dbValue = dbvalue;AssetImporterTypeEnum.init(dbvalue,this);
}private static void init(String dbvalue, AssetImporterTypeEnum i) {
if (AssetImporterTypeEnum.byDBValue == null) {
AssetImporterTypeEnum.byDBValue = new HashMap();
}AssetImporterTypeEnum.byDBValue.put(dbvalue, i);
}
The errors magically disappear.
Now, I just hope the code works properly…. ![]()
Comments(0)
