Skip to content

Missing some tests for identifiers obfuscating #22

Description

@Fanyhsiao

In Java 8 or better, see jls. We can construct a lambda based instance for interfaces.

packagetech.skidonion.identifiersobfuscating;
importjava.util.ArrayList;
importjava.util.List;
publicclassLambdaTest {
interfaceSAMInterfaceA {
Objectsam();
}
interfaceSAMInterfaceB {
List<?> sam();
}
interfaceSAMInterfaceC {
List<String> sam();
}
interfaceSAMInterfaceD {
ArrayList<String> sam();
}
publicstaticvoidmain(String[] args) {
System.out.println(((SAMInterfaceC & SAMInterfaceD & SAMInterfaceB & SAMInterfaceA) () -> newArrayList<String>() {{
add("hello");
}}).sam());
}
}

In this case, SAMInterfaceASAMInterfaceBSAMInterfaceCSAMInterfaceD don't point to the same single abstract method statically but dynamically.

When obfuscating, we should statically parse the generated invokedynamic bytecode to generate the correct mapping for all interfaces.

Therefore, it is necessary to add a test to test if that the mapping is correct.

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