You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure the following should happen as it does?
I hab a problem, where some fields in my class did not appear in the json, as if they were completely ignored. It seems that JsonIgnore has priority over JsonProperty.
Im using gwt-jackson 0.14.1 and jackson 2.8.2 (but seems to happen with older versions too)
The method sequence seems to matter.
Case 0:
works
@JsonProperty("internal_html_page_identifier")
public String getInternal_html_page_identifier() {
return internal_html_page_identifier;
}
@JsonProperty("external_link_address")
public String getExternal_link_address() {
return external_link_address;
}
public boolean isExternal_link_address() {
return external_link_address != null;
}
public boolean isInternal_html_page_identifier() {
return internal_html_page_identifier != null;
}
Case 1:
internal_html_page_identifier and external_link_address are completely ignored when sending data from gwt to the server (the other way around seems fine)
@JsonProperty("internal_html_page_identifier")
public String getInternal_html_page_identifier() {
return internal_html_page_identifier;
}
@JsonProperty("external_link_address")
public String getExternal_link_address() {
return external_link_address;
}
@JsonIgnore
public boolean isExternal_link_address() {
return external_link_address != null;
}
@JsonIgnore
public boolean isInternal_html_page_identifier() {
return internal_html_page_identifier != null;
}
Case 2:
Can't be compiled
@JsonIgnore
public boolean isExternal_link_address() {
return external_link_address != null;
}
@JsonIgnore
public boolean isInternal_html_page_identifier() {
return internal_html_page_identifier != null;
}
@JsonProperty("internal_html_page_identifier")
public String getInternal_html_page_identifier() {
return internal_html_page_identifier;
}
@JsonProperty("external_link_address")
public String getExternal_link_address() {
return external_link_address;
}
Error Message:
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
Adding '2' new generated units
See snapshot: /tmp/at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl2581841548089664328.java
Ignored 1 unit with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[ERROR] Errors in '/tmp/gwt-codeserver-6413255898653602665.tmp/at.luxactive.base.base/compile-2/gen/at/luxactive/common/model/impl/MenuItemAdditionsBeanJsonDeserializerImpl.java'
[ERROR] Line 227: Cannot cast from String to Boolean
[ERROR] Line 233: Cannot cast from String to Boolean
[ERROR] Line 291: Type mismatch: cannot convert from String to boolean
[ERROR] Line 297: Type mismatch: cannot convert from String to boolean
[ERROR] Line 335: The constructor MenuItemAdditions(int, Date, int, String, int, boolean, boolean, int, String, boolean) is undefined
See snapshot: /tmp/at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl2686319644399262517.java
Tracing compile failure path for type 'at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl'
[ERROR] Errors in '/tmp/gwt-codeserver-6413255898653602665.tmp/at.luxactive.base.base/compile-2/gen/at/luxactive/common/model/impl/MenuItemAdditionsBeanJsonDeserializerImpl.java'
[ERROR] Line 233: Cannot cast from String to Boolean
[ERROR] Line 227: Cannot cast from String to Boolean
[ERROR] Line 291: Type mismatch: cannot convert from String to boolean
[ERROR] Line 335: The constructor MenuItemAdditions(int, Date, int, String, int, boolean, boolean, int, String, boolean) is undefined
[ERROR] Line 297: Type mismatch: cannot convert from String to boolean
[ERROR] Hint: Check that the type name 'at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl' is really what you meant
[ERROR] Hint: Check that your classpath includes all required source roots
Unification traversed 1927 fields and methods and 1665 types. 22 are considered part of the current module and 39 had all of their fields and methods traversed.
[WARN] Some stale types ([at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonSerializerImpl$9, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonSerializerImpl$10, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$5, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$4, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$3, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$2, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$1, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$11, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$10, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$9, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$8, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$7, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$6]) were not reprocessed as was expected. This is either a compiler bug or a Generator has legitimately stopped creating these types.
[ERROR] Compiler returned false
[WARN] recompile failed
[WARN] continuing to serve previous version
Case 3:
Can't be compiled
public boolean isExternal_link_address() {
return external_link_address != null;
}
public boolean isInternal_html_page_identifier() {
return internal_html_page_identifier != null;
}
@JsonProperty("internal_html_page_identifier")
public String getInternal_html_page_identifier() {
return internal_html_page_identifier;
}
@JsonProperty("external_link_address")
public String getExternal_link_address() {
return external_link_address;
}
Error Message:
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
Adding '7' new generated units
See snapshot: /tmp/at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl9141075960507233253.java
Ignored 1 unit with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
Adding '2' new generated units
See snapshot: /tmp/at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl1960291141095246487.java
Ignored 1 unit with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[ERROR] Errors in '/tmp/gwt-codeserver-2852235086553331873.tmp/at.luxactive.base.base/compile-2/gen/at/luxactive/common/model/impl/MenuItemAdditionsBeanJsonDeserializerImpl.java'
[ERROR] Line 227: Cannot cast from String to Boolean
[ERROR] Line 233: Cannot cast from String to Boolean
[ERROR] Line 291: Type mismatch: cannot convert from String to boolean
[ERROR] Line 297: Type mismatch: cannot convert from String to boolean
[ERROR] Line 335: The constructor MenuItemAdditions(int, Date, int, String, int, boolean, boolean, int, String, boolean) is undefined
See snapshot: /tmp/at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl3210719922381735414.java
Tracing compile failure path for type 'at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl'
[ERROR] Errors in '/tmp/gwt-codeserver-2852235086553331873.tmp/at.luxactive.base.base/compile-2/gen/at/luxactive/common/model/impl/MenuItemAdditionsBeanJsonDeserializerImpl.java'
[ERROR] Line 233: Cannot cast from String to Boolean
[ERROR] Line 227: Cannot cast from String to Boolean
[ERROR] Line 291: Type mismatch: cannot convert from String to boolean
[ERROR] Line 335: The constructor MenuItemAdditions(int, Date, int, String, int, boolean, boolean, int, String, boolean) is undefined
[ERROR] Line 297: Type mismatch: cannot convert from String to boolean
[ERROR] Hint: Check that the type name 'at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl' is really what you meant
[ERROR] Hint: Check that your classpath includes all required source roots
Unification traversed 1943 fields and methods and 1667 types. 24 are considered part of the current module and 41 had all of their fields and methods traversed.
[WARN] Some stale types ([at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$5, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$4, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$3, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$2, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$1, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$11, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$10, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$9, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$8, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$7, at.luxactive.common.model.impl.MenuItemAdditionsBeanJsonDeserializerImpl$6]) were not reprocessed as was expected. This is either a compiler bug or a Generator has legitimately stopped creating these types.
[ERROR] Compiler returned false
[WARN] recompile failed
[WARN] continuing to serve previous version
The text was updated successfully, but these errors were encountered:
I tinkered a little bit further today, it seems to be based on the existing setter method.
String GET_X();
boolean IS_X();
SET_X(boolean);
This can't be compiled in GWT. [ERROR] Line 354: The method setUsedForAllLanguages(boolean) in the type ActivityImage is not applicable for the arguments (String)
From my first cases, Case 0 works but Case 1 seems (to me) more intuitive.
So not to have the JsonIgnore overwrite the explicitly set JsonPrperty.
That way I know what I want to ignore and what I want to be parsed (upper Case 1). And leaving the IS_X not annotated to be an implicit ignore (upper Case 0). (Not sure if this would go against any previous design decisions)
Hopefully this helps, and thank you for your work!
Hi,
I am not sure the following should happen as it does?
I hab a problem, where some fields in my class did not appear in the json, as if they were completely ignored. It seems that JsonIgnore has priority over JsonProperty.
Im using gwt-jackson 0.14.1 and jackson 2.8.2 (but seems to happen with older versions too)
The method sequence seems to matter.
Case 0:
works
Case 1:
internal_html_page_identifier and external_link_address are completely ignored when sending data from gwt to the server (the other way around seems fine)
Case 2:
Can't be compiled
Error Message:
Case 3:
Can't be compiled
Error Message:
The text was updated successfully, but these errors were encountered: