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

Allow enums to have more constants #2114

Open
guw opened this issue Mar 7, 2024 · 4 comments
Open

Allow enums to have more constants #2114

guw opened this issue Mar 7, 2024 · 4 comments
Labels
enhancement New feature or request javac ecj not compatible with javac

Comments

@guw
Copy link
Contributor

guw commented Mar 7, 2024

Please implement the enhancement done to javac which allows to compile enums with more constants.
https://bugs.openjdk.org/browse/JDK-8241798

A little test shows, that javac compiles ok but ecj fails with:

----------
1. ERROR in ...bazel-jdt-java-toolchain/ecj-test/src/BigEnum.java (at line 30)
	public enum BigEnum {
	            ^^^^^^^
The code for the static initializer is exceeding the 65535 bytes limit
----------
1 problem (1 error)
@szarnekow
Copy link
Contributor

Quoting the ticket:

This is similar to what ecj is already doing

What do you expect from this ticket, @guw ?

@guw
Copy link
Contributor Author

guw commented Mar 7, 2024

guw added a commit to salesforce/bazel-jdt-java-toolchain that referenced this issue Mar 7, 2024
@jukzi jukzi added the enhancement New feature or request label Mar 7, 2024
@stephan-herrmann
Copy link
Contributor

If I read the JDK bug correctly, for some time ecj supported more enum constants than javac. Now that javac has improved, the situation may have reversed. It is unclear, however, how javac could become "better" than ecj simply by doing things "similar" to ecj.

What is the number of enum constants supported by ecj, by javac?

If javac can support more enum constants than ecj, by what strategy has this been achieved?

@guw
Copy link
Contributor Author

guw commented Mar 7, 2024

Maybe the statement isn't fully correct, though?

For clarity, here is the full text:

This is similar to what ecj is already doing: instead of saving the values array to a static field that's initialized in the <clinit>, it just re-creates the array for every call to values(). That may be worth considering, although it may also have performance implications vs. initializing the values array upfront and using clone().

@jukzi jukzi added the javac ecj not compatible with javac label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request javac ecj not compatible with javac
Projects
None yet
Development

No branches or pull requests

4 participants