use of jadx.api.JavaField in project jadx by skylot.
the class JClass method update.
public synchronized void update() {
removeAllChildren();
if (!loaded) {
add(new TextNode(NLS.str("tree.loading")));
} else {
for (JavaClass javaClass : cls.getInnerClasses()) {
JClass innerCls = new JClass(javaClass, this);
add(innerCls);
innerCls.update();
}
for (JavaField f : cls.getFields()) {
add(new JField(f, this));
}
for (JavaMethod m : cls.getMethods()) {
add(new JMethod(m, this));
}
}
}
use of jadx.api.JavaField 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.JavaField 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.JavaField in project jadx by skylot.
the class TextSearchIndex method indexNames.
public void indexNames(JavaClass cls) {
clsNamesIndex.put(cls.getFullName(), nodeCache.makeFrom(cls));
for (JavaMethod mth : cls.getMethods()) {
JNode mthNode = nodeCache.makeFrom(mth);
mthSignaturesIndex.put(mthNode.makeDescString(), mthNode);
}
for (JavaField fld : cls.getFields()) {
JNode fldNode = nodeCache.makeFrom(fld);
fldSignaturesIndex.put(fldNode.makeDescString(), fldNode);
}
for (JavaClass innerCls : cls.getInnerClasses()) {
indexNames(innerCls);
}
}
use of jadx.api.JavaField in project jadx by skylot.
the class FridaAction method generateFieldSnippet.
private String generateFieldSnippet(JField jf) {
JavaField javaField = jf.getJavaField();
String rawFieldName = javaField.getRawName();
String fieldName = javaField.getName();
List<MethodNode> methodNodes = javaField.getFieldNode().getParentClass().getMethods();
for (MethodNode methodNode : methodNodes) {
if (methodNode.getName().equals(rawFieldName)) {
rawFieldName = "_" + rawFieldName;
break;
}
}
JClass jc = jf.getRootClass();
String classSnippet = generateClassSnippet(jc);
return String.format("%s\n%s = %s.%s.value;", classSnippet, fieldName, jc.getName(), rawFieldName);
}
Aggregations