Open galacticappster04 opened 8 years ago
Add a package-private empty constructor to your class. The generated code instantiates your object with new Session()
, and then configures its fields one after the other:
@JsonObject(fieldDetectionPolicy = JsonObject.FieldDetectionPolicy.ANNOTATIONS_ONLY)
public class Session {
// Everything else...
Session() {
// Used for LoganSquare deserialization
}
}
If you don't add an empty constructor, you will be presented with this error:
Error:(16, 24) error: constructor Session in class Session cannot be applied to given types;
required: String,String
found: no arguments
reason: actual and formal argument lists differ in length
@EricKuck This error could be prevented by either adding a Lint rule that checks for empty constructors in classes annotated with @JsonObject
, or having the annotation processor check for its presence, and raising a more convenient error if absent. (Possibly both of these should be implemented together!)
I did everything, I followed everything. Here is my class, I am getting error and crash when I run my app:
I do not understand that is suppose to be simple and I almost pulled my hair out just to figure out whats wrong. Can't figure out what I missed either.