How would I pass "`--add-exports java.base/jdk.int...
# getting-started
m
How would I pass "`--add-exports java.base/jdk.internal.misc=ALL-UNNAMED` " to compileKotlin in gradle? it's not a valid parameter but it still complains when compiling and using Unsafe
m
so what should I do for now?
e
don't use internal JDK classes, or use them in a non-modular project
m
how do I make my code non-modular then?
because afaik there's no other class that has methods like getLongUnaligned
e
compile with Java 8, and if you are on Java 9 at runtime, then the
--add-exports
flag can be added to jvm args there
what is readLongUnaligned?
m
it's a method that reads a Long (or int/short/etc depending on the method) from a given byte array with given offset and endianness
e
I see no such method in jdk.internal.misc
m
I tried setting project JDK to java 1.8 but now it doesn't recognize the Unsafe class anymore
I mean it does exist
ByteBuffer also uses that same function internally
e
why not just use ByteBuffer then?
Copy code
ByteBuffer.wrap(byteArray).apply { position(index) }.getLong()
218 Views