Skip to content

IllegalArgumentException when trying to use @Commet on a field #210

@ParadauxIO

Description

@ParadauxIO

Having an issue regarding the @comment annotation when trying to save a CommentedConfigurationNode

Using configurate-hocon 4.1.1

Exception in thread "main" org.spongepowered.configurate.serialize.SerializationException: [bot-token] of type java.lang.String: null
	at org.spongepowered.configurate.objectmapping.ObjectMapperImpl.saveSingle(ObjectMapperImpl.java:136)
	at org.spongepowered.configurate.objectmapping.ObjectMapperImpl.save(ObjectMapperImpl.java:114)
	at org.spongepowered.configurate.objectmapping.ObjectMapperFactoryImpl.serialize(ObjectMapperFactoryImpl.java:251)
	at org.spongepowered.configurate.ScopedConfigurationNode.set(ScopedConfigurationNode.java:110)
	at io.paradaux.friendlybot.config.FConfigurationLoader.saveConfig(FConfigurationLoader.java:42)
	at io.paradaux.friendlybot.FBApplication.main(FBApplication.java:29)
Caused by: java.lang.IllegalArgumentException: Can not set java.lang.String field io.paradaux.friendlybot.config.FConfiguration.botToken to org.spongepowered.configurate.CommentedConfigurationNodeImpl
	at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
	at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
	at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:58)
	at java.base/jdk.internal.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36)
	at java.base/java.lang.reflect.Field.get(Field.java:418)
	at org.spongepowered.configurate.objectmapping.ObjectMapperImpl.saveSingle(ObjectMapperImpl.java:132)
	... 5 more

Related files from the project:

FConfiguration.java - The Configuration Object
FConfigurationLoader.java - Configuration Loader/Util class

If I can be of any more assistance with this let me know!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions