Skip to content

fix: avoid false removal warnings for shared StringBuilder blocks - #3040

Open
David-the-happy-piglet wants to merge 1 commit into
skylot:masterfrom
David-the-happy-piglet:fix/2904-shared-stringbuilder-warning
Open

David-the-happy-piglet wants to merge 1 commit into
skylot:masterfrom
David-the-happy-piglet:fix/2904-shared-stringbuilder-warning

Conversation

@David-the-happy-piglet

Copy link
Copy Markdown

Description

Fixes #2904.

A StringBuilder chain in a basic block shared by two regions can be simplified correctly while still producing Instruction removed from duplicated block. Use block-local cleanup only when every removed instruction is physically in the same block as the replacement toString call, so both generated occurrences receive the same replacement.

Other chains, including those spanning blocks, retain the existing cleanup path and diagnostics. The separate Code duplicated warning remains unchanged.

Add Raung regressions for the shared-block false warning, ordinary single-entry simplification, and a cross-block case that must retain the removal warning.

Validation

  • Before the fix, the new regression fails on the target warning and both controls pass. After the fix, all 3 native cases and the 19 related StringBuilder/StringConcat tests pass.
  • Full suite: 1,169 passed, 3 existing skips, no failures. Spotless and Checkstyle pass.
  • A real CLI comparison of original and recompiled classes passes 128 return-value and 128 stdout checks, covering all boolean combinations and ordinary, empty, Unicode and null strings.

Build environment

Validated on macOS arm64 with Oracle JDK 25.0.1 running Gradle 9.8.2 and JADX_BUILD_JAVA_VERSION=11 selecting Temurin 11.0.32.1+1 for compilation and tests.

The initial clean build dist attempts encountered Eclipse formatter class-loading errors and a macOS packaging failure because the selected Java 11 toolchain lacks jpackage. Rerunning without build-cache reuse and parallel projects resolved the formatter errors. Setting BADASS_RUNTIME_JAVA_HOME to the installed JDK 25 resolved runtime-image creation and packaging, while compilation and tests remained on Java 11.

All clean build checks and distribution tasks were completed across these retries. The final build dist succeeded and produced ZIP and macOS DMG artifacts. No source/build configuration was changed to address these environment issues, and no checks were excluded.

Not verified

The original APK/dex2jar flow, physical Android devices, interactive GUI behavior, Windows/Linux execution, or installer execution. The 3 existing skips are one Java 17 profile test under Java 11 and two disabled network update checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant