Skip to content

Unpick doesn't replace some extended usage of methods #49

Description

@Lulu13022002

Given the following definitions in v4 applied to the following source:

unpick v4

group int colors
    org.example.CommonColors.*

target_method org.example.Main consume (I)V
    param 0 colors
public class CommonColors {
    public static final int WHITE = -1;
    public static final int SOFT_RED = -2142128;
}
...
public static void testUnpick() {
    boolean accepted = true;
    int inviteColor;
    if (accepted) {
        inviteColor = CommonColors.SOFT_RED;
    } else {
        inviteColor = CommonColors.WHITE;
    }

    consume(inviteColor);
}

public static void consume(int color) {
}

Unpick manage to restore CommonColors.WHITE but not CommonColors.SOFT_RED. It seems the first branch is always ignored in this case, I'm not sure why it happens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions