Java_cn_xiaozhou233_juiceagent_api_JuiceAgent_init now checks the return
values of Agent::preload and Agent::init and returns JNI_FALSE when either
fails, instead of always reporting success to Java.
- fill EventPreLoad/EventLoaded struct members instead of leaving them
as uninitialized garbage; post PreLoad only after the agent environment
(JavaVM/JNIEnv/JVMTI) is set so listeners can query Agent state
- store (EventId, Handle) pairs in IService and add unlistenAll() to
remove registered listeners on shutdown, preventing dangling callbacks
into destroyed services; BytecodeService and JarLoaderService now call
it from onShutdown
- add JarLoaderService registered via JUICEAGENT_REGISTER_SERVICE; it
listens for EventId::Loaded, reads JuiceAgent.Modules.JarLoader config
from config.toml, serializes it and calls the Java JarLoader.loadJar
module to inject the jar into the JVM
- post EventPreLoad during Agent::preload and EventLoaded after services
initialize so services can react to agent lifecycle
- introduce thread-safe BytecodeStore singleton for pending captures,
captured bytecode cache, and pending patches; replaces ad-hoc global
mutex/map pairs
- implement BytecodeService capture/patch listeners that operate on
the store; keep JVMTI Allocate outside of store locks and put failed
patches back so they can be retried
- add JNI bindings: getClassBytes(ByName), redefineClass(ByName),
retransformClass(ByName); use JVMTI GetLoadedClasses for name-based
lookup instead of JNI FindClass, validate array length vs declared
length in redefineClass
- add ServiceRegistry and JUICEAGENT_REGISTER_SERVICE macro so each
service self-registers at static init; initializeAll() no longer
includes concrete service headers
- move BytecodeService class entirely into its .cpp (no header needed,
only accessed via IService)
- split ClassFileLoadHook handling into captureBytecodes and
patchBytecodes listeners, registered in order
- introduce EventBus singleton wrapping eventpp::EventDispatcher with
typed event ids and const void* payloads
- post EventClassFileLoadHook from ClassFileLoadHook callback
- add IService base with typed listen<>() helper that binds a member
function directly to an event, no virtual onEvent dispatch
- add ServiceManager to register, initialize and shutdown services
- add BytecodeService that subscribes to ClassFileLoadHook
- wire Services::initializeAll() into Agent::init()
- Re-add addToBootstrap/SystemClassLoaderSearch, addToClassLoader, defineClass,
getLoadedClasses, getClassByName on the new Agent singleton
- Add utils.hpp with check_env/get_class_name helpers
- Pull utils.hpp into jni_common.hpp umbrella header
- Make runtime_dir optional in JuiceAgent.init (tolerate null jstring)
- Load config.toml into Agent and expose getConfig/setConfig
- Warn instead of failing when runtime directory or config is missing
- Replace eventbus/services with Agent preload/init lifecycle
- Move JNI header to shared includes; add jni_common.hpp umbrella header
- Reduce ClassFileLoadHook to a stub for later implementation
- Add eventpp dependency
- Document custom API JAR workflow (WIP)
- Move loader logic to core/ and rename plantform/ to platform/
- Remove config.toml parsing from loader; pass runtime_dir to Bootstrap directly
- Rewrite JvmAttach: RAII detach, drop dead thread_local, merge acquire helpers
- Fix initialize() missing namespace qualification
- Make GLOB sources pick up new files with CONFIGURE_DEPENDS
- Rename JNI class from InjectorNative to Injector in libinject.c
- Add JNI header for cn.xiaozhou233.juiceagent.injector.Injector
- Add inject-via-java-api example with HowToUse.txt and 如何使用.txt
- Skip mutable event dispatch when no mutable listeners exist (hot path)
- Wire retransformClass bytecode into pendingRetransform so patches are applied
- Guard pendingRetransform with its mutex; check jvmti Allocate result
- Store global refs in captured ClassFileData and release on re-capture
- Add null/exception checks in defineClass/getLoadedClasses
- Extract shared find_class_by_internal_name helper
- Use CONFIGURE_DEPENDS for CMake globs; guard InitLogger; delete leaked jArgs