(Curated public API contract. scripts/public_api_report.sh writes a separate
all-feature symbol-name inventory under target/ for comparison.)
This report summarizes the intended public surface of jvmti-bindings.
Agenttraitexport_agent!macroget_default_callbacksjnire-export (crate::sys::jni)describe_jni_resultGlobalAgentAlreadySetandset_global_agent- Modules:
agent,callbacks,env,mutf8,version,sys,classfile,prelude,embed(feature-gated),advanced(feature-gated)
Callback-scoped lifecycle types:
AgentLoadContextAgentUnloadContextJavaVmRef
CallbackContext,JvmtiRef, andJniEnvRef- Complete, crate-constructed payloads for all 34 standard JVM TI events
- Callback-scoped JIT map and compiler-record views
- Mutable class-file and native-method-bind outputs with checked ownership transfer
Public types:
JvmtiJniEnvLocalRefGlobalRefWeakGlobalRefJvmtiAllocationJniFunctionTableJniVersionErrorThreadInfoThreadGroupInfoMonitorUsageStackInfoExtensionParamInfoExtensionFunctionInfoExtensionEventInfoLocalVariableEntryRawMonitorRawMonitorGuardPrimitiveArrayElementsPrimitiveArrayCriticalStringCriticalLocalFrameJavaMonitorGuard
Common Jvmti helper methods:
set_default_agent_callbacksadd_class_file_load_hook_capabilitiesadd_method_trace_capabilitiesadd_exception_capabilitiesadd_heap_sampling_capabilitiesenable_class_file_load_hook_eventsenable_method_entry_exit_eventsenable_exception_eventsenable_heap_sampling_eventsenable_vm_lifecycle_eventsconfigure_class_file_load_hook_agentconfigure_method_trace_agentconfigure_exception_agentconfigure_heap_sampling_agentget_error_name_string
Allocation-free JniEnv input methods:
find_class_cstrdefine_class_cstrthrow_new_cstrnew_string_utf_cstrget_method_id_cstrget_static_method_id_cstrget_field_id_cstrget_static_field_id_cstrnew_string_utf16
Each method accepts borrowed &CStr input. The existing &str convenience
methods remain public and perform temporary conversion where required.
JniEnv covers every fixed-signature JNI native operation and uses typed
jvalue (A) invocation families. The C variadic and va_list slots remain
raw-only in sys::jni. Native primitive-array and critical-region leases are
represented by allocation-free RAII guards and cannot be accidentally exposed
as unmatched high-level acquire/release pairs.
Local-reference frames and entered Java monitors use the same owning pattern.
encode,encode_utf16, andencode_cstringvalidate,decode,decode_utf16, anddecode_cowdecode_cstr,decode_cstr_cow, and explicit lossy variantsMutf8ErrorandMutf8ErrorKind
This is Java Modified UTF-8, not ordinary UTF-8. Exact UTF-16 conversion is available for Java strings containing unpaired surrogate code units.
sys::jni- Raw JNI types, constants, and function tables.sys::jvmti- Raw JVMTI types, constants, and function tables.- Diagnostics:
jni::result_name,jni::describe_result,jvmti::error_name. - Capability presets:
jvmtiCapabilities::for_class_file_load_hook,for_method_trace,for_exceptions,for_heap_sampling.
Note: sys mirrors JNI/JVMTI headers and may grow with new JDK versions.
RELEASE_PROFILES,ReleaseProfile, andrelease_profileReleaseDeltaandrelease_deltaJniFeature,JvmtiFeature, andFeatureMaturityJvmtiSemanticChange,JvmtiErrorAddition,NativeSourceChange, andNativePolicyChangeRuntimeChange,RuntimeSupport, and interface-version helpers
ClassFileand supporting structs/enums for typed JVMS-standard attributes through Java 28, with opaque preservation of unknown and VM-specific attributes.ClassFile::parse(bytes)entry point.JavaStringfor exact Java Modified UTF-8 values, including unpaired UTF-16 surrogates.ClassFileParseLimitsandClassFile::parse_with_limitsfor explicit input-size, cumulative-allocation, recursive-attribute, and recursive-annotation bounds.
Recommended imports for agent authors:
Agent,export_agent!,get_default_callbacksagentlifecycle contexts and completecallbackspayloadsenv::{Jvmti, JniEnv, LocalRef, GlobalRef, WeakGlobalRef, JvmtiAllocation, JniFunctionTable, PrimitiveArrayElements, PrimitiveArrayCritical, StringCritical, LocalFrame, JavaMonitorGuard, RawMonitor, RawMonitorGuard}versionrelease profiles, deltas, feature gates, and compatibility metadatasys::{jni, jvmti}embed::{JavaVmBuilder, JavaVm, AttachedThread}when theembedfeature is enabledmutf8::{Mutf8Error, Mutf8ErrorKind}
Feature-gated JVM embedding helpers (embed feature):
JavaVmBuilderJavaVmAttachedThreadfind_libjvmfind_libjvm_verboseEmbedError
The implementation uses an in-tree Unix/Windows dynamic-library loader and
adds no feature dependency. JavaVm owns the dynamic-library handle, JVM
option strings, and native option table until after JVM destruction.
Safe worker-thread access uses AttachedThread guards or scoped closure
helpers; manual get_env, attach, and detach operations are unsafe.
Feature-gated helpers (disabled by default):
advanced::heap_graph(heap-graphfeature)
envand top-level exports are intended to be stable.sysis a low-level mirror of JNI/JVMTI C headers.advancedis explicitly allowed to change more rapidly.- Normal, optional, build, and development dependency counts are all zero.
- The complete 2.x-to-3.0 source migration is documented in Migrating From 2.x to 3.0.
- Crate-produced event and metadata records are non-exhaustive so additive JDK data does not force a 4.0 release.