pub fn cache_dir(
class_name: &str,
java_class: &str,
javac_raw: &str,
java_raw: &str,
) -> Result<PathBuf, JavaError>Expand description
Compute the deterministic cache-dir path used to store compiled .class files.
The path is <base_cache_dir>/<class_name>_<hex_hash>/ where hex_hash is a
64-bit hash of:
java_class— the complete Java source textexpand_java_args(javac_raw)— shell-expanded javac args (env vars and~substituted); relative paths in these args are anchored by the next component belowstd::env::current_dir()— the process working directory at call time; including it ensures that two invocations with the samejavac_rawcontaining relative paths (e.g.-cp .) but from different working directories hash to different cache entriesjava_raw— hashed as a raw string (no expansion needed for cache differentiation; thejavastep always re-runs fresh)detect_java_version()— the installedjavacmajor version; ensures that upgrading the JDK produces a fresh cache entry whose.classfiles are compiled by the new compiler
The base directory is resolved by base_cache_dir.
§Errors
Returns JavaError::Io if javac -version cannot be run or its output
cannot be parsed (see detect_java_version).