Constructor and factory defaults behind a conditional are recorded as the else-branch constant
Original description
By MelanX · October 23, 2026Crate: ephervex-options (generated data) and tools/minecraft-options
Commit: 2b2af1e4f8166d02e4732d19e040a53745d97a51
Behavior
field_initial_values takes the single instruction before each putfield as the field's initial value, and analyse_option_window takes the constant before the last Integer/Double.valueOf. Neither checks whether that instruction is the else-arm of a conditional, so cond ? A : B is recorded as B with default_confidence: high. A later assignment to the same field silently replaces an earlier one.
syncWrites = Util.getPlatform() == Util.OS.WINDOWScompiles toif_acmpne; iconst_1; goto; iconst_0; putfieldand is recorded asfalse. The catalog shipssync_writeswith"default": false.renderDistance = is64Bit ? 12 : 8is recorded as 8 for 1.12.2 through 1.20.4, andsimulationDistanceas 8 for 1.18 through 1.20.4. The 64-bit default is 12. The jump to 12 at 1.20.5 only reflects the code shape.
Expected behavior
A constant is accepted as a default only when its putfield or valueOf is not a branch target and no jump separates it from the start of the expression. Conditional or platform-dependent defaults are left unproven, and a field assigned more than once is not given a default from the last write.
Impact
The shipped catalog presents a platform-dependent setting with a fixed default, and older-release analyzer output claims a wrong default as proven. Catalog defaults for render and simulation distance are currently correct only because they come from the canonical release.
Locations
tools/minecraft-options/analyze_options.pyfield_initial_values(1597-1630),resolve_default(1633-1668),analyze_jar(1928-1942)tools/minecraft-options/analyze_options.pyanalyse_option_windowdefault tail scan (1336-1350)crates/options/data/minecraft-preferences.jsondescriptorsync_writes
Validation and limitations
Verified with javap on 1.12.2, 1.16.5, 1.20.1, and 26.1 Options. A scan of every cached JAR found that the putfield offsets that are branch targets with a constant predecessor are exactly these fields.