Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Enum handling in CodeGenerator #49

Open
BladeWise opened this issue Feb 22, 2022 · 0 comments · May be fixed by #50
Open

Incorrect Enum handling in CodeGenerator #49

BladeWise opened this issue Feb 22, 2022 · 0 comments · May be fixed by #50

Comments

@BladeWise
Copy link

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.

@ThexXTURBOXx ThexXTURBOXx linked a pull request Mar 2, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant