Skip to content

fix(decompiler): Signature-attribute throws recovery + catch merge + throw typevar cast + try-break-return#6

Merged
VillanCh merged 3 commits into
mainfrom
fix/commons-lang3-clearout
Jul 15, 2026
Merged

fix(decompiler): Signature-attribute throws recovery + catch merge + throw typevar cast + try-break-return#6
VillanCh merged 3 commits into
mainfrom
fix/commons-lang3-clearout

Conversation

@VillanCh

Copy link
Copy Markdown
Contributor

Summary

Four fixes clearing commons-lang3 tree errors, all zero-regression across 8 jars (provenClean codec/gson/fastjson2/snakeyaml/jsoup all stay 0; spring 28 same; guava 26 same).

Fixes

  1. Signature-attribute throws-type-variable recovery (JDEC_THROWS_SIG_RECOVERY_OFF):
    ParseMethodSignature/ParseMethodSignatureFull now parse the ^-prefixed throws types from the method Signature attribute. When a throws type IS a type variable (e.g. throws T where T extends Throwable), the ExceptionsAttribute's erasure (throws Throwable) is overridden with throws T. Clears commons-lang3 ObjectUtils.wait.

  2. Catch merge for wrapping rethrow (JDEC_NO_CATCH_MERGE enhancement):
    mergeNestedSameTypeCatches now handles wrapping rethrows (throw Failable.rethrow(t)). The first catch's throw is PRESERVED and the cleanup code inserted before it. Clears commons-lang3 LockingVisitors.LockVisitor (latent).

  3. Throw type-variable cast recovery (JDEC_FIX_THROW_TYPEVAR_CAST_OFF):
    Re-emits throw (T) var; when the method declares throws T and the thrown variable is Throwable. Clears commons-lang3 ExceptionUtils.typeErasure (latent).

  4. Try-break-return fix (JDEC_FIX_TRY_BREAK_RETURN_OFF):
    Moves hoisted return expr; back into try { break; } inside do-while(true) loops. Clears commons-lang3 Memoizer.compute (latent).

Results

  • commons-lang3: 3→2 (ObjectUtils.wait fixed; RandomStringUtils + MethodUtils remain as masked latent errors)
  • All provenClean jars: 0 (no regression)
  • spring: 28 (no change)
  • guava: 26 (no change)

Tests

4 load-bearing tests with regression seeds: throws_typevar_test.go, catch_merge_test.go, throw_typevar_cast_test.go, try_break_return_test.go.

VillanCh added 3 commits July 14, 2026 18:40
… method arg cast

Two fixes in sameClassMethodParamType + resolvedParameterizedArgCast, both
zero-regression (8-JAR A/B delta >= 0):

1. sameClassMethodParamType: accept a parameterized formal `Class<L>` (L a
   class-scope type variable), not just bare type variables. The old code
   checked `params[i].RawType().(*types.JavaClass)` which rejects
   `*JavaParameterizedType` (Class<L>'s RawType), so the resolver returned nil
   for any parameterized formal and no cast was emitted. Now also checks
   `*JavaParameterizedType` with RawClassName "java.lang.Class" and a single
   class-scope type-var argument.

2. resolvedParameterizedArgCast same-erasure branch: a raw `Class` argument
   fed to a `Class<L>` formal (L a class-scope type variable) cannot convert
   without an unchecked `(Class<L>)` cast ("Class<CAP#1> cannot be converted
   to Class<L>"; commons-lang3 EventListenerSupport.readObject
   `this.initializeTransientFields(var2.getClass().getComponentType(), ...)`
   where the formal is `Class<L>`). Re-emit the cast.

Also: fix funcCtx.ClassName empty fallback in sameClassMethodParamType for
private method calls where ClassName isn't set in the rendering context.

Fixes commons-lang3 EventListenerSupport.readObject (tree 3->2). Load-bearing
test: class_typevar_param_test.go (ClassTypeVarParamSeed).

Status: commons-lang3 2, guava 26, spring 28. Total 56 (was 57).
…atch merge + throw typevar cast + try-break-return

Four fixes clearing commons-lang3 tree errors, all zero-regression across 8 jars
(provenClean codec/gson/fastjson2/snakeyaml/jsoup all stay 0; spring 28 same; guava 26 same):

1. Signature-attribute throws-type-variable recovery (JDEC_THROWS_SIG_RECOVERY_OFF):
   ParseMethodSignature/ParseMethodSignatureFull now parse the -prefixed throws
   types from the method Signature attribute. When a throws type IS a type variable
   (e.g.  where ), the ExceptionsAttribute's erasure
   () is overridden with the Signature-derived . Without
   this, a call site like  fails unreported
@VillanCh VillanCh merged commit 0cf3a03 into main Jul 15, 2026
13 checks passed
@VillanCh VillanCh deleted the fix/commons-lang3-clearout branch July 15, 2026 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant