Crash when using Nest in configs
Zailer43 opened this issue · 4 comments
I was changing from Malilib to owo lib and when I add any Nest to the config the build crashes
code:
@Modmenu(modId = "fzmm")
@Config(name = "fzmm", wrapperName = "FzmmConfig")
public class FzmmConfigModel {
@Nest
public General general = new General();
public static class General {
public boolean giveClientSide = false;
public boolean disableItalic = true;
public boolean forceInvisibleItemFrame = false;
}
}
generated config:
public class FzmmConfig extends ConfigWrapper<fzmm.zailer.me.config.FzmmConfigModel> {
private final Option<java.lang.Boolean> general_giveClientSide = this.optionForKey(new Option.Key("general.giveClientSide"));
private final Option<java.lang.Boolean> general_disableItalic = this.optionForKey(new Option.Key("general.disableItalic"));
private final Option<java.lang.Boolean> general_forceInvisibleItemFrame = this.optionForKey(new Option.Key("general.forceInvisibleItemFrame"));
private FzmmConfig() {
super(fzmm.zailer.me.config.FzmmConfigModel.class);
}
public static FzmmConfig createAndLoad() {
var wrapper = new FzmmConfig();
wrapper.load();
return wrapper;
}
public final General general = new General(); // 'General' is abstract; cannot be instantiated
public class General implements General { // Interface expected here
public boolean giveClientSide() {
return general_giveClientSide.value();
}
public void giveClientSide(boolean value) {
instance.general.giveClientSide = value;
general_giveClientSide.synchronizeWithBackingField();
}
public boolean disableItalic() {
return general_disableItalic.value();
}
public void disableItalic(boolean value) {
instance.general.disableItalic = value;
general_disableItalic.synchronizeWithBackingField();
}
public boolean forceInvisibleItemFrame() {
return general_forceInvisibleItemFrame.value();
}
public void forceInvisibleItemFrame(boolean value) {
instance.general.forceInvisibleItemFrame = value;
general_forceInvisibleItemFrame.synchronizeWithBackingField();
}
}
public interface General { // Duplicate class: 'General'
boolean giveClientSide();
void giveClientSide(boolean value);
boolean disableItalic();
void disableItalic(boolean value);
boolean forceInvisibleItemFrame();
void forceInvisibleItemFrame(boolean value);
}
}
owo-lib = 0.8.2+1.19
minecraft_version = 1.19.2
and there is no crash report since it crashes directly when building the mod
/home/admin/IdeaProjects/FZMM-Mod/build/generated/sources/annotationProcessor/java/main/FzmmConfig.java:28: error: interface expected here
public class General implements General {
^
/home/admin/IdeaProjects/FZMM-Mod/build/generated/sources/annotationProcessor/java/main/FzmmConfig.java:28: error: cyclic inheritance involving General
public class General implements General {
^
/home/admin/IdeaProjects/FZMM-Mod/build/generated/sources/annotationProcessor/java/main/FzmmConfig.java:27: error: cannot find symbol
public final General general = new General();
^
symbol: class General
location: class FzmmConfig
/home/admin/IdeaProjects/FZMM-Mod/build/generated/sources/annotationProcessor/java/main/FzmmConfig.java:58: error: class General is already defined in class FzmmConfig
public interface General {
^
Hey, thanks for this report. This problem is actually already known internally, however fixing it is not completely trivial because a name collision like this isn't 100% avoidable. For now the obvious solution is to rename either your nested class or the field so this cannot occur. We'll see about getting some sort of proper solution in place soon
Cheers
I presume you are using the latest owo-version, as we did fix some issues with nesting. Could you please provide the crash report?
Fixed in 0.8.3