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
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ Keep this in mind as you use this feature in your projects.
13
13
14
14
## Compatibility
15
15
### ✅ Java
16
-
All Java versions should be supported, as `jni` is only used for the structs and no method calls or such.<br>
16
+
The export `JVM_DefineClassWithSource` was only added in JDK1.5, therefore all Java versions starting from `Java 6` are supported (there is no JNI version for `Java 5`).<br>
17
17
Thus far only `Java 8`, `Java 20` and `Java 21` were explicitly tested.
Copy file name to clipboardExpand all lines: src/class_loader.rs
+2-3Lines changed: 2 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
use std::mem;
1
+
use std::ops::Deref;
2
2
use std::os::raw::c_char;
3
3
use std::slice::from_raw_parts_mut;
4
4
@@ -26,9 +26,8 @@ impl ClassLoader {
26
26
pubunsafefnsetup_hook(){
27
27
let handle = Library::new("jvm").expect("Could not find jvm library.");
28
28
let method = handle.get::<DefineClassCommon>(b"JVM_DefineClassWithSource").expect("Could not find exported function.");
29
-
let target:DefineClassCommon = mem::transmute(method);
30
29
31
-
let hook = DefineClassCommonHook.initialize(target,ClassLoader::hooked_define_class_common).expect("Could not initialize hook for class loading.");
30
+
let hook = DefineClassCommonHook.initialize(*method.deref(),ClassLoader::hooked_define_class_common).expect("Could not initialize hook for class loading.");
32
31
hook.enable().expect("Could not to hook into class loading.");
0 commit comments