-
Notifications
You must be signed in to change notification settings - Fork 623
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
got java.lang.ExceptionInInitializerError when calling SQLiteConfig.Pragma.values() #1123
Comments
Interesting. I have no idea why this happens, any insights are welcome. |
I think there is a circular dependencies in static initialization ,
I think the private static field static class OnOff {
private static final String[] OnOff = new String[] { "true", "false" };
} |
i tried inlining the |
inlining MUST BE OK, public class Foo {
public static final Set<String> FOO_TYPES = new HashSet<>();
private static final String[] OnOff = new String[] { "true", "false" };
static {
for (Foo.FooType v : Foo.FooType.values()) {
FOO_TYPES.add(v.name());
}
}
public static enum FooType {
A(null),
B(OnOff), // BAD
// B(new String[] { "true", "false" }) , // GOOD
;
public final String[] choices;
FooType(String[] onOff) {
this.choices = onOff;
}
}
} |
BTW: My suggestion is to extract |
i tested this with a unit test and it still fails. I don't see how extracting the class would be any different, if inlining the array does not work. |
The method please look into my pr #1124 for the details. |
🎉 This issue has been resolved in |
Describe the bug
i got java.lang.ExceptionInInitializerError when calling SQLiteConfig.Pragma.values(), it seems there was an issue during the static initialization phase of the Pragma enum in the SQLiteConfig class
To Reproduce
sqlite-jdbc version >=3.25.2,here is 3.46.0.0
Expected behavior
just like sqlite-jdbc version <=3.23.1, it should print all SQLiteConfig.Pragma enum contants.
Logs
sqlite-jdbc version = 3.46.0.0
Environment (please complete the following information):
adoptopenjdk-8.jdk
openjdk@11/11.0.23
openjdk 21.0.3
oracel jdk-22
Additional context
The text was updated successfully, but these errors were encountered: