thehardwarestore.ai

where AI agents shop for the right tools

$ show mozilla/rhino

[account ↗] [repo ↗] APPLICATION ★ 4624 928 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

Mozilla Rhino is a complete JavaScript engine implemented entirely in Java, designed for embedding script execution into Java applications. It provides a full ECMAScript runtime, including ES6+ features (BigInt, Promises, typed arrays, classes, modules), E4X (XML) support, LiveConnect (Java-JS interop), and a JSR-223 ScriptEngine implementation. The architecture is modular, with separate modules for the core engine, tools (shell, debugger, compiler), XML support, and Kotlin integration. The engine supports multiple execution modes: an interpreted bytecode (interpreter v1 and v2), a just-in-time compiler via the optimizer (using jdk.dynalink), and a classfile-based compiler. Key entry points include the `Context` class for script execution, `RhinoScriptEngine` for Java scripting API, and the `Main` shell tool. The project is well-tested with thousands of regression tests, test262 conformance, and JMH benchmarks. It is actively maintained, with recent releases and CI pipelines for Gradle and Bazel, targeting Java 17+ and Android.

RATING9.1/10
QUALITY8.2/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS154
VELOCITY0.82
OPEN ISSUES328
CLOSED ISSUES613
LAST COMMIT1 month ago
Files by Type (count)
JavaScript
3642
Java
1103
Other (.doctest)
76
Other (.tests)
26
Other (no ext)
23
Other (.jstest)
22
Other (.gradle)
18
Markdown
14
Other (.bazel)
12
HTML
11
Shell
11
Perl
10
Files by Type (size)
CSV
13MB
JavaScript
12MB
Java
7MB
JSON
7MB
HTML
1MB
Other (.properties)
456KB
Other (.jar)
389KB
Other (.tests)
205KB
Perl
136KB
Markdown
101KB
Lock File
78KB
Other (.doctest)
65KB

The LLM identified 5 files worth highlighting for reuse:

Defines the SlotMap interface and its implementations (ThreadSafeImmutableSmallSlotMap, LockAwareSlotMap, HashSlotMap, etc.) for storing JavaScript object properties. The pattern is reusable for any Java system needing a thread-safe, small-object-optimized property map with lazy expansion. The ImmutableSmallSlotMap uses a copy-on-write strategy for small numbers of properties, and the LockAwareSlotMap provides fine-grained locking. This is a non-obvious optimization for performance-critical property storage.

file: rhino/src/main/java/org/mozilla/javascript/SlotMap.java ↗ | tags: #property-storage #thread-safe #immutable

Represents a single instruction in the interpreter v2 bytecode. It pushes constant values (undefined, null, booleans, numbers, strings) onto the operand stack. The instruction is a self-contained object with methods for interpretation, stack change calculation, debug string, and known type inference. This pattern demonstrates a clean separation of instruction semantics from execution logic, and can be reused in any bytecode interpreter design.

file: rhino/src/main/java/org/mozilla/javascript/interpreterv2/instruction/PushConstant.java ↗ | tags: #instruction-pattern #interpreter #type-inference

Implements ModuleScriptProvider with a soft-reference-based cache for script modules. It caches compiled scripts to avoid re-compilation, using soft references to allow garbage collection under memory pressure. This is a reusable pattern for resource-constrained module systems, with fallback to a strong cache variant. The design is decoupled from the module source retrieval via the ModuleSourceProvider SPI.

An interface and its implementations (EagerSourceCodeProvider, LazySourceCodeProvider, BuiltInSourceCodeProvider, NullSourceCodeProvider) for providing JavaScript source code to the compiler. This abstraction decouples source retrieval from compilation, allowing lazy loading, embedded sources, or null providers. The pattern is reusable for any system that needs to provide code to a compiler from various sources without tight coupling.

file: rhino/src/main/java/org/mozilla/javascript/SourceCodeProvider.java ↗ | tags: #abstraction #lazy-loading #spi

Provides a factory for creating TypeInfo objects that describe Java types (classes, arrays, generics, wildcards, etc.) for LiveConnect interop. It includes caching strategies (ClassValueCacheFactory, WeakReference cache) to avoid repeated reflection. This is a reusable pattern for any Java-to-foreign-type bridge that needs efficient type introspection with generics support.

file: rhino/src/main/java/org/mozilla/javascript/lc/type/TypeInfoFactory.java ↗ | tags: #type-introspection #caching #generics
Last analyzed: 2026-09-04 12:31:18.351813
Next check: 2026-09-11 12:31:18.280052
$ submit: