use of jadx.api.data.impl.JadxCodeComment in project jadx by skylot.
the class TestCodeComments2a method test.
@Test
public void test() {
printOffsets();
String baseClsId = TestCls.class.getName();
JadxNodeRef mthRef = new JadxNodeRef(RefType.METHOD, baseClsId, "test(Z)I");
IJavaCodeRef insnRef = JadxCodeRef.forInsn(isJavaInput() ? 22 : 18);
ICodeComment insnComment = new JadxCodeComment(mthRef, insnRef, "return comment");
IJavaCodeRef insnRef2 = JadxCodeRef.forInsn(isJavaInput() ? 27 : 19);
ICodeComment insnComment2 = new JadxCodeComment(mthRef, insnRef2, "another return comment");
JadxCodeData codeData = new JadxCodeData();
codeData.setComments(Arrays.asList(insnComment, insnComment2));
getArgs().setCodeData(codeData);
assertThat(getClassNode(TestCls.class)).decompile().checkCodeOffsets().code().containsOne("// " + insnComment.getComment()).containsOne("// " + insnComment2.getComment());
}
use of jadx.api.data.impl.JadxCodeComment in project jadx by skylot.
the class TestCodeComments2 method test.
@Test
public void test() {
printOffsets();
String baseClsId = TestCls.class.getName();
JadxNodeRef mthRef = new JadxNodeRef(RefType.METHOD, baseClsId, "test(Z)I");
IJavaCodeRef insnRef = JadxCodeRef.forInsn(isJavaInput() ? 13 : 10);
ICodeComment insnComment = new JadxCodeComment(mthRef, insnRef, "return comment");
IJavaCodeRef insnRef2 = JadxCodeRef.forInsn(isJavaInput() ? 15 : 11);
ICodeComment insnComment2 = new JadxCodeComment(mthRef, insnRef2, "another return comment");
JadxCodeData codeData = new JadxCodeData();
codeData.setComments(Arrays.asList(insnComment, insnComment2));
getArgs().setCodeData(codeData);
assertThat(getClassNode(TestCls.class)).decompile().checkCodeOffsets().code().containsOne("return 1; // " + insnComment.getComment()).containsOne("return 3; // " + insnComment2.getComment());
}
Aggregations