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

Fix enum field update #444

Merged
merged 2 commits into from
Oct 11, 2022
Merged

Conversation

liuzhengyang
Copy link
Contributor

image

The name of the static field in Enum class is "$VALUES" instead of "ENUM$VALUES".

By the way, i can't run tests ClassInitTest, it throws exception throw new IllegalStateException("Plugin manager is not correctly initialized , maybe because of junit running order or other issue.
But i have tested this change by some tricky methods.

@skybber
Copy link
Contributor

skybber commented Oct 9, 2022

What java version / compiler are you using?

@liuzhengyang
Copy link
Contributor Author

What java version / compiler are you using?

Java8 and Java11

@skybber
Copy link
Contributor

skybber commented Oct 10, 2022

It looks that there is no standard for the name of enum field. I've checked output of different java compilers using javap -p CheckedEnum.class and Eclipse JDT uses ENUM$VALUES; , javac uses $VALUES;. Better solution should check both versions. Could you please modify PR?

@liuzhengyang
Copy link
Contributor Author

I have modified PR.
First check field type is array, then check field name start with $VALUES or ENUM$VALUES.
Because when that name clash with enum field name, javac append $ $$ and eclipse compiler append _0 _1

@skybber
Copy link
Contributor

skybber commented Oct 11, 2022

Looks great, thanks!

@skybber skybber merged commit 159ff08 into HotswapProjects:master Oct 11, 2022
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 this pull request may close these issues.

2 participants