Skip to content

[core] empty synthetic class kept after method inlining #2894

Description

@obus-globus

Issue details

A synthetic class whose only method gets inlined into its caller is left in the output as an empty shell:

public final /* synthetic */ class c {
}

jadx already removes empty synthetic classes (ClassModifier.isEmptySyntheticClass), but this one survives because the check runs before the inline pipeline and looks at the raw method list.

Minimal smali repro.

Trampoline.smali:

.class public final synthetic Lhusk/Trampoline;
.super Ljava/lang/Object;
.method public static synthetic bridge a(Ljava/lang/StringBuilder;)I
    .registers 1
    invoke-virtual {p0}, Ljava/lang/StringBuilder;->length()I
    move-result v0
    return v0
.end method

Caller.smali:

.class public Lhusk/Caller;
.super Ljava/lang/Object;
.method public static check(Ljava/lang/StringBuilder;)Z
    .registers 2
    invoke-static {p0}, Lhusk/Trampoline;->a(Ljava/lang/StringBuilder;)I
    move-result v0
    const/4 v1, 0x5
    if-lt v0, v1, :cond_0
    const/4 v0, 0x1
    return v0
    :cond_0
    const/4 v0, 0x0
    return v0
.end method

Caller inlines to return sb.length() >= 5;, but husk/Trampoline.java is emitted as an empty public final /* synthetic */ class Trampoline {}.

Jadx version

master (8c28a853)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions