提交 c52c659b 编写于 作者: S Skylot

fix: correct inline flag for variables used in anonymous classes (#1154)

上级 6bf358fc
......@@ -463,8 +463,8 @@ public class ModVisitor extends AbstractVisitor {
SSAVar sVar = reg.getSVar();
if (sVar != null) {
sVar.getCodeVar().setFinal(true);
sVar.getAssign().add(AFlag.DONT_INLINE);
}
reg.add(AFlag.DONT_INLINE);
reg.add(AFlag.SKIP_ARG);
}
}
......
package jadx.tests.integration.inner;
import org.junit.jupiter.api.Test;
import jadx.tests.api.IntegrationTest;
import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat;
public class TestAnonymousClass17 extends IntegrationTest {
public static class TestCls {
@SuppressWarnings({ "checkstyle:InnerAssignment", "Convert2Lambda" })
public void test(boolean a, boolean b) {
String v;
if (a && (v = get(b)) != null) {
use(new Runnable() {
@Override
public void run() {
System.out.println(v);
}
});
}
}
public String get(boolean a) {
return a ? "str" : null;
}
public void use(Runnable r) {
}
}
@Test
public void test() {
assertThat(getClassNode(TestCls.class))
.code()
.containsOne("if (a && (v = get(b)) != null) {");
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册