use of jadx.api.JavaClass in project jadx by skylot.
the class CommentsIndex method getRefNode.
@Nullable
private JNode getRefNode(ICodeComment comment) {
IJavaNodeRef nodeRef = comment.getNodeRef();
JavaClass javaClass = wrapper.searchJavaClassByOrigClassName(nodeRef.getDeclaringClass());
if (javaClass == null) {
return null;
}
JNodeCache nodeCache = cacheObject.getNodeCache();
switch(nodeRef.getType()) {
case CLASS:
return nodeCache.makeFrom(javaClass);
case FIELD:
for (JavaField field : javaClass.getFields()) {
if (field.getFieldNode().getFieldInfo().getShortId().equals(nodeRef.getShortId())) {
return nodeCache.makeFrom(field);
}
}
break;
case METHOD:
for (JavaMethod mth : javaClass.getMethods()) {
if (mth.getMethodNode().getMethodInfo().getShortId().equals(nodeRef.getShortId())) {
return nodeCache.makeFrom(mth);
}
}
break;
}
return null;
}
use of jadx.api.JavaClass in project jadx by skylot.
the class TextSearchIndex method searchInSkippedClasses.
public Flowable<CodeNode> searchInSkippedClasses(final SearchSettings searchSettings) {
return Flowable.create(emitter -> {
LOG.debug("Skipped code search started: {} ...", searchSettings.getSearchString());
for (JavaClass javaClass : skippedClasses) {
String code = javaClass.getCode();
int pos = 0;
while (pos != -1) {
searchSettings.setStartPos(pos);
pos = searchNext(emitter, javaClass, code, searchSettings);
if (emitter.isCancelled()) {
LOG.debug("Skipped Code search canceled: {}", searchSettings.getSearchString());
return;
}
}
if (!UiUtils.isFreeMemoryAvailable()) {
LOG.warn("Skipped code search stopped due to memory limit: {}", UiUtils.memoryInfo());
emitter.onComplete();
return;
}
}
LOG.debug("Skipped code search complete: {}, memory usage: {}", searchSettings.getSearchString(), UiUtils.memoryInfo());
emitter.onComplete();
}, BackpressureStrategy.BUFFER);
}
use of jadx.api.JavaClass in project jadx by skylot.
the class JNodeCache method convert.
private JNode convert(JavaNode node) {
if (node == null) {
return null;
}
if (node instanceof JavaClass) {
return convert(((JavaClass) node));
}
if (node instanceof JavaMethod) {
return new JMethod((JavaMethod) node, makeFrom(node.getDeclaringClass()));
}
if (node instanceof JavaField) {
return new JField((JavaField) node, makeFrom(node.getDeclaringClass()));
}
if (node instanceof JavaVariable) {
JavaVariable javaVar = (JavaVariable) node;
JMethod jMth = (JMethod) makeFrom(javaVar.getMth());
return new JVariable(jMth, javaVar);
}
throw new JadxRuntimeException("Unknown type for JavaNode: " + node.getClass());
}
use of jadx.api.JavaClass in project jadx by skylot.
the class XposedAction method generateClassSnippet.
private String generateClassSnippet(JClass jc) {
JavaClass javaClass = jc.getCls();
String rawClassName = javaClass.getRawName();
String shortClassName = javaClass.getName();
return String.format("ClassLoader classLoader=lpparam.classLoader;\n" + "Class %sClass=classLoader.loadClass(\"%s\");", shortClassName, rawClassName);
}
use of jadx.api.JavaClass in project jadx by skylot.
the class FridaAction method generateClassSnippet.
private String generateClassSnippet(JClass jc) {
JavaClass javaClass = jc.getCls();
String rawClassName = javaClass.getRawName();
String shortClassName = javaClass.getName();
String finalFridaCode = String.format("let %s = Java.use(\"%s\");", shortClassName, rawClassName);
isInitial.put(rawClassName, false);
return finalFridaCode;
}
Aggregations