You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to format the following class one runs into an IAE with Java < 15.
package org.test;
public class Test {
void test() {
String sealed = "a sealed test";
}
}
The stacktrace looks like this
java.lang.IllegalArgumentException: No enum constant javax.lang.model.element.Modifier.SEALED
at java.base/java.lang.Enum.valueOf(Enum.java:240)
at [email protected]/javax.lang.model.element.Modifier.valueOf(Modifier.java:47)
at com.google.googlejavaformat.java.ModifierOrderer.asModifier(ModifierOrderer.java:151)
at com.google.googlejavaformat.java.ModifierOrderer.reorderModifiers(ModifierOrderer.java:79)
at com.google.googlejavaformat.java.Formatter.getFormatReplacements(Formatter.java:285)
...
The reason is the unconditional call of Modifier.valueOf("sealed") in
which throws this exception on all Java versions below 15.
Although the newest version only supports Java 17 as runtime, this is an issue already with versions which are supposed to support Java 11 as runtime, e.g. < 1.24.0
The text was updated successfully, but these errors were encountered:
Although the newest version only supports Java 17 as runtime, this is an issue already with versions which are supposed to support Java 11 as runtime, e.g. < 1.24.0
I agree this is a bug, and should be handled gracefully when running on older JDK versions.
Sorry, I hadn't been thinking about the fact that the minimum supported JDK for the latest releases is JDK 17.
I agree this is a bug with < 1.24.0, but we are not doing update releases of old versions. I think the best option is to update to a newer version of the formatter.
When trying to format the following class one runs into an IAE with Java < 15.
The stacktrace looks like this
The reason is the unconditional call of
Modifier.valueOf("sealed")
ingoogle-java-format/core/src/main/java/com/google/googlejavaformat/java/ModifierOrderer.java
Line 241 in ccb56c7
Although the newest version only supports Java 17 as runtime, this is an issue already with versions which are supposed to support Java 11 as runtime, e.g. < 1.24.0
The text was updated successfully, but these errors were encountered: