-
Notifications
You must be signed in to change notification settings - Fork 30
Avoid usage of reflection API in Enum deserialization #840
Copy link
Copy link
Closed
Description
Line 309 in 033afd1
| return (T) targetEnum.getMethod("forValue", String.class).invoke(null, rawValue); |
This is extremely unsafe and it works only because there is a "hidden" contract with the generator to emit the specific forValue method on the enum class.
My first reaction would be to make it more similar to a normal "class", and extend the API of ValuedEnum to cover the deserialization explicitly.
Please note that this is going to be a breaking API change for abstractions and I hope we can fix it before GA.
Do you have any prior art on the subject?
Any consideration?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done ✔️