-
Notifications
You must be signed in to change notification settings - Fork 102
Closed
Labels
bugSomething isn't working rightSomething isn't working right
Milestone
Description
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);
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
Metadata
Metadata
Assignees
Labels
bugSomething isn't working rightSomething isn't working right