handle non-static method without this reference

This commit is contained in:
金戟 2021-04-18 09:15:03 +08:00
parent eec88f4bd9
commit 6d87653fa2

View File

@ -123,7 +123,7 @@ public class MockClassHandler extends BaseClassWithContextHandler {
}
private ImmutablePair<LabelNode, LabelNode> getStartAndEndLabel(MethodNode mn) {
if (MethodUtil.isStatic(mn)) {
if (MethodUtil.isStatic(mn) || mn.localVariables.isEmpty()) {
LabelNode startLabel = null, endLabel = null;
for (AbstractInsnNode n = mn.instructions.getFirst(); n != null; n = n.getNext()) {
if (n instanceof LabelNode) {