Skip to content

Incorrect Enum handling in CodeGenerator #49

@BladeWise

Description

@BladeWise

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

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions