PorkStudios / PorkLib

Fast, lightweight libraries for Java. Note: this is very much a work-in-progress, documentation is spotty and the API is changing constantly!
https://daporkchop.net
Other
31 stars 5 forks source link

[BUG] PorkUtil getOurStackTrace reflection errors on JDK 11 #51

Closed geNAZt closed 4 years ago

geNAZt commented 4 years ago

Hi, i currently plan to use the leveldb-mcpe-jni which uses this common library.

I have the problem that this project is for java 8 and thus doesn't include a module list. This leads to the reflection of the stacktrace method to fail.

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make private synchronized java.lang.StackTraceElement[] java.lang.Throwable.getOurStackTrace() accessible: module java.base does not "opens java.lang" to module common
        at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:340) ~[?:?]
        at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280) ~[?:?]
        at java.lang.reflect.Method.checkCanSetAccessible(Method.java:198) ~[?:?]
        at java.lang.reflect.Method.setAccessible(Method.java:192) ~[?:?]
        at net.daporkchop.lib.common.util.PorkUtil.<clinit>(PorkUtil.java:84) ~[common-0.5.5-20200817.112419-24.jar:?]

Is there a workaround for this?

DaMatrix commented 4 years ago

Hmm, it should be falling back to the pure-java leveldb. Is this just a stack trace that's being printed out, or is it causing the entire program not to work?

I'll start working on a hotfix momentarily.

DaMatrix commented 4 years ago

Once Jenkins finishes building the commit you can do a full dependency refresh, it should work.

This is particularly strange because I've tested other projects using PorkLib on Java 9 and they ran flawlessly :thonk:

geNAZt commented 4 years ago

It works now, the problem was that the reflection call did throw a runtime exception, i don't catch them and nobody else seems todo so :D