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
Serialising an enum throws the following edited exception:
javax.json.bind.JsonbException: Error getting value on:
sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedParameterizedTypeImpl@1f57539
...
Caused by: java.lang.IllegalAccessException:
Class org.eclipse.yasson.internal.model.GetFromGetter can not access a member of class
sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl
with modifiers "public final"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102)
at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:296)
at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:288)
at java.lang.reflect.Method.invoke(Method.java:491)
at org.eclipse.yasson.internal.model.GetFromGetter.internalGetValue(GetFromGetter.java:28)
at org.eclipse.yasson.internal.model.GetValueCommand.getValue(GetValueCommand.java:34)
The enum:
public enum Binding {
HARD_BACK {
public String toString() {
return "Hard Back";
}
}, SOFT_BACK {
public String toString() {
return "Soft Back";
}
}
}
The serialisation code: JsonbBuilder.create().toJson(Binding.HARD_BACK);
Serializers and deserializers for anonymous enum value classes are now properly resolved.
Serializer is now using value.name()
Deserializer is using Enum#valueOf()
Signed-off-by: Roman Grigoriadi <roman.grigoriadi@oracle.com>
Serializers and deserializers for anonymous enum value classes are now properly resolved.
Serializer is now using value.name()
Deserializer is using Enum#valueOf()
Signed-off-by: Roman Grigoriadi <roman.grigoriadi@oracle.com>
Serialising an enum throws the following edited exception:
The enum:
The serialisation code:
JsonbBuilder.create().toJson(Binding.HARD_BACK);
Dependecies:
org.eclipse/yasson: 1.0
javax.json.bind-api: 1.0
org.glassfish/javax.json: 1.1
javax.json/javax.json-api: 1.1
CODE: https://github.com/readlearncode/Java-EE-8-Sampler/blob/master/json-b-1-0/src/main/java/com/readlearncode/devWorks/overview/EnumExample.java
TEST: https://github.com/readlearncode/Java-EE-8-Sampler/blob/master/json-b-1-0/src/test/java/com/readlearncode/devWorks/overview/EnumExampleTest.java
The text was updated successfully, but these errors were encountered: