When running Corda contract tests in IntelliJ, tests written in Java sometimes fail with the following exception:
[ERROR] 17:02:51,821 [main] (Schema.kt:437) amqp.Schema.fingerprintForType - Constructor parameter arg0 doesn't refer to a property of class 'class mypackage.MyState' -> class mypackage.MyState {} java.io.NotSerializableException: Constructor parameter arg0 doesn't refer to a property of class 'class mypackage.MyState' at net.corda.nodeapi.internal.serialization.amqp.SerializationHelperKt.propertiesForSerializationFromConstructor(SerializationHelper.kt:249) ~[corda-node-api-corda-3.0.jar:?]
How can I fix this?