Cube-Space / Yamler

21 stars 33 forks source link

using underscores in inner configs #13

Closed CodeCrafter47 closed 8 years ago

CodeCrafter47 commented 9 years ago

Here is the config class:

public class UnderscoreInnerConfig extends Config{

    public class InnerConfig extends Config {
        public int lucky_number = 5;
        public String sample_text = "Hello World";
    }

    public InnerConfig config = new InnerConfig();
}

and here's what happens when calling init(...):

net.cubespace.Yamler.Config.InvalidConfigurationException: Could not save the Field
    at net.cubespace.Yamler.Config.Config.internalSave(Config.java:84)
    at net.cubespace.Yamler.Config.Config.save(Config.java:36)
    at net.cubespace.Yamler.Config.Config.init(Config.java:108)
    at net.cubespace.Yamler.Config.Config.init(Config.java:124)
    at UnderscoreInnerConfigTest.initNull(UnderscoreInnerConfigTest.java:33)
Caused by: java.lang.IllegalArgumentException: Can not set int field UnderscoreInnerConfig$InnerConfig.lucky_number to null value
    at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
    at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
    at sun.reflect.UnsafeIntegerFieldAccessorImpl.set(UnsafeIntegerFieldAccessorImpl.java:80)
    at java.lang.reflect.Field.set(Field.java:758)
    at net.cubespace.Yamler.Config.InternalConverter.fromConfig(InternalConverter.java:77)
    at net.cubespace.Yamler.Config.MapConfigMapper.loadFromMap(MapConfigMapper.java:66)
    at net.cubespace.Yamler.Config.Converter.Config.fromConfig(Config.java:33)
    at net.cubespace.Yamler.Config.InternalConverter.fromConfig(InternalConverter.java:72)
    at net.cubespace.Yamler.Config.Config.internalSave(Config.java:81)
    ... 38 more