-
Notifications
You must be signed in to change notification settings - Fork 131
Open
Description
The CodeGenerator tries to identify an Enum field using toString.
This can fail if the toString method of the field has been customized (e.g. ChronoUnit).
I suppose that the following code
procyon/Procyon.Reflection/src/main/java/com/strobel/reflection/emit/CodeGenerator.java
Lines 1505 to 1507 in 88a95fa
| if (unboxedType.isEnum()) { | |
| getField(unboxedType.getField(value.toString())); | |
| return true; |
should be changed to
if (unboxedType.isEnum()) {
getField(unboxedType.getField(((Enum<?>)value).name()));
return true;
}considering that name() is the value expected by Enum.valueOf too.
Metadata
Metadata
Assignees
Labels
No labels