This is how my custom PersistentStateComponent subclass looks like:
@State(name = "Configurations", storages = [Storage("conf.xml")])
@Service(Service.Level.PROJECT)
class CustomConfigurationService : PersistentStateComponent<CustomConfigurationService> {
var configurations = Configurations()
override fun getState() = this
override fun loadState(service: CustomConfigurationService) {
XmlSerializerUtil.copyBean(service, this)
}
// ...
}
data class Configurations(
val aBoolean: Boolean = false,
val aString: String? = null,
val anotherString: String? = null
)
This is how the configurations are stored (after being changed via the UI):
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Configurations">
<option name="configurations">
<Configurations />
</option>
</component>
</project>
If I change the super type to PersistentStateComponent<Configurations>, the file is not created at all.
Why doesn't IntelliJ serialize the Configurations object's properties as well? What can I do, other than placing Configurations's properties directly inside CustomConfigurationService?