fix: improve usage search, refactor java nodes creation (#1489)
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package jadx.api;
|
||||
|
||||
import jadx.core.dex.nodes.ClassNode;
|
||||
import jadx.core.dex.nodes.FieldNode;
|
||||
import jadx.core.dex.nodes.MethodNode;
|
||||
import jadx.core.dex.nodes.RootNode;
|
||||
|
||||
public class JadxInternalAccess {
|
||||
@@ -7,4 +10,16 @@ public class JadxInternalAccess {
|
||||
public static RootNode getRoot(JadxDecompiler d) {
|
||||
return d.getRoot();
|
||||
}
|
||||
|
||||
public static JavaClass convertClassNode(JadxDecompiler d, ClassNode clsNode) {
|
||||
return d.convertClassNode(clsNode);
|
||||
}
|
||||
|
||||
public static JavaMethod convertMethodNode(JadxDecompiler d, MethodNode mthNode) {
|
||||
return d.convertMethodNode(mthNode);
|
||||
}
|
||||
|
||||
public static JavaField convertFieldNode(JadxDecompiler d, FieldNode fldNode) {
|
||||
return d.convertFieldNode(fldNode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package jadx.tests.integration.others;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import jadx.api.JadxInternalAccess;
|
||||
import jadx.api.JavaClass;
|
||||
import jadx.api.JavaMethod;
|
||||
import jadx.api.metadata.ICodeAnnotation;
|
||||
@@ -46,8 +46,8 @@ public class TestCodeMetadata extends IntegrationTest {
|
||||
int callDefPos = callMth.getDefPosition();
|
||||
assertThat(callDefPos).isNotZero();
|
||||
|
||||
JavaClass javaClass = Objects.requireNonNull(jadxDecompiler.getJavaClassByNode(cls));
|
||||
JavaMethod callJavaMethod = Objects.requireNonNull(jadxDecompiler.getJavaMethodByNode(callMth));
|
||||
JavaClass javaClass = JadxInternalAccess.convertClassNode(jadxDecompiler, cls);
|
||||
JavaMethod callJavaMethod = JadxInternalAccess.convertMethodNode(jadxDecompiler, callMth);
|
||||
List<Integer> callUsePlaces = javaClass.getUsePlacesFor(javaClass.getCodeInfo(), callJavaMethod);
|
||||
assertThat(callUsePlaces).hasSize(1);
|
||||
int callUse = callUsePlaces.get(0);
|
||||
|
||||
Reference in New Issue
Block a user