Feat: add JuiceRemapper runtime class remapping

- add JuiceRemapperService that listens for ClassFileLoadHook and calls
  the Java static Remap.remap(String, byte[]) via cached JNI declarations,
  then writes the returned bytes back to the JVMTI callback
- add JNI bindings (initNative, add/remove/clear include/exclude) with
  Remapper singleton init state and cached jclass/jmethodID stored in
  Remapper (global.hpp)
- cache static class/method declarations lazily in initNative to avoid
  repeated FindClass/GetStaticMethodID
- add generated JuiceRemapper JNI header and runtime-remap example config
This commit is contained in:
xiaozhou233 committed 2026-08-18 16:28:29 +08:00
1 parent 81905d6c3f
commit 4bed99f417
6 files changed
+375

No files matched your search

@@ -0,0 +1,69 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class cn_xiaozhou233_juiceremapper_JuiceRemapper */
#ifndef _Included_cn_xiaozhou233_juiceremapper_JuiceRemapper
#define _Included_cn_xiaozhou233_juiceremapper_JuiceRemapper
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: cn_xiaozhou233_juiceremapper_JuiceRemapper
* Method: initNative
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_cn_xiaozhou233_juiceremapper_JuiceRemapper_initNative
(JNIEnv *, jclass);
/*
* Class: cn_xiaozhou233_juiceremapper_JuiceRemapper
* Method: addInclude
* Signature: (Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_cn_xiaozhou233_juiceremapper_JuiceRemapper_addInclude
(JNIEnv *, jclass, jstring);
/*
* Class: cn_xiaozhou233_juiceremapper_JuiceRemapper
* Method: addExclude
* Signature: (Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_cn_xiaozhou233_juiceremapper_JuiceRemapper_addExclude
(JNIEnv *, jclass, jstring);
/*
* Class: cn_xiaozhou233_juiceremapper_JuiceRemapper
* Method: removeInclude
* Signature: (Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_cn_xiaozhou233_juiceremapper_JuiceRemapper_removeInclude
(JNIEnv *, jclass, jstring);
/*
* Class: cn_xiaozhou233_juiceremapper_JuiceRemapper
* Method: removeExclude
* Signature: (Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_cn_xiaozhou233_juiceremapper_JuiceRemapper_removeExclude
(JNIEnv *, jclass, jstring);
/*
* Class: cn_xiaozhou233_juiceremapper_JuiceRemapper
* Method: clearIncludes
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_cn_xiaozhou233_juiceremapper_JuiceRemapper_clearIncludes
(JNIEnv *, jclass);
/*
* Class: cn_xiaozhou233_juiceremapper_JuiceRemapper
* Method: clearExcludes
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_cn_xiaozhou233_juiceremapper_JuiceRemapper_clearExcludes
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
#endif