Skip to content

Commit 970c991

Browse files
authored
Merge pull request #527 from danthe1st/x11-hints
add JNI hints for classes required on X11
2 parents f14b3d1 + fac8263 commit 970c991

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/net/discordjug/javabot/RuntimeHintsConfiguration.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
6262
// caffeine
6363
hints.reflection().registerTypeIfPresent(getClass().getClassLoader(), "com.github.benmanes.caffeine.cache.SSW", MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
6464

65+
try {
66+
// These classes are necessary on X11 but may not be loaded on Wayland when generating native hints
67+
for(Class<?> cl : getClass().getClassLoader().loadClass("sun.font.FontConfigManager").getDeclaredClasses()) {
68+
hints.jni().registerType(cl, MemberCategory.ACCESS_DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
69+
}
70+
} catch (ClassNotFoundException e) {
71+
throw new RuntimeException(e);
72+
}
73+
6574
for (Class<?> cl : WebhookEmbed.class.getClasses()) {
6675
hints.reflection().registerType(cl, MemberCategory.ACCESS_DECLARED_FIELDS, MemberCategory.INVOKE_PUBLIC_METHODS);
6776
}

0 commit comments

Comments
 (0)