Commit 5557fd81 authored by Skylot's avatar Skylot

fix some code style issues

parent b1dc26ee
...@@ -19,6 +19,15 @@ public class CodeWriter { ...@@ -19,6 +19,15 @@ public class CodeWriter {
public static final String NL = System.getProperty("line.separator"); public static final String NL = System.getProperty("line.separator");
public static final String INDENT = "\t"; public static final String INDENT = "\t";
private static final String[] INDENT_CACHE = {
"",
INDENT,
INDENT + INDENT,
INDENT + INDENT + INDENT,
INDENT + INDENT + INDENT + INDENT,
INDENT + INDENT + INDENT + INDENT + INDENT,
};
private final StringBuilder buf = new StringBuilder(); private final StringBuilder buf = new StringBuilder();
private String indentStr; private String indentStr;
private int indent; private int indent;
...@@ -66,6 +75,11 @@ public class CodeWriter { ...@@ -66,6 +75,11 @@ public class CodeWriter {
return this; return this;
} }
public CodeWriter add(Object obj) {
buf.append(obj);
return this;
}
public CodeWriter add(String str) { public CodeWriter add(String str) {
buf.append(str); buf.append(str);
return this; return this;
...@@ -116,18 +130,9 @@ public class CodeWriter { ...@@ -116,18 +130,9 @@ public class CodeWriter {
return this; return this;
} }
private static final String[] INDENT_CACHE = {
"",
INDENT,
INDENT + INDENT,
INDENT + INDENT + INDENT,
INDENT + INDENT + INDENT + INDENT,
INDENT + INDENT + INDENT + INDENT + INDENT,
};
private void updateIndent() { private void updateIndent() {
int curIndent = indent; int curIndent = indent;
if (curIndent < 6) { if (curIndent < INDENT_CACHE.length) {
this.indentStr = INDENT_CACHE[curIndent]; this.indentStr = INDENT_CACHE[curIndent];
} else { } else {
StringBuilder s = new StringBuilder(curIndent * INDENT.length()); StringBuilder s = new StringBuilder(curIndent * INDENT.length());
......
...@@ -81,8 +81,7 @@ public class ConditionGen { ...@@ -81,8 +81,7 @@ public class ConditionGen {
} }
InsnNode insn = ((InsnWrapArg) arg).getWrapInsn(); InsnNode insn = ((InsnWrapArg) arg).getWrapInsn();
if (insn.getType() == InsnType.ARITH) { if (insn.getType() == InsnType.ARITH) {
ArithNode arith = ((ArithNode) insn); switch (((ArithNode) insn).getOp()) {
switch (arith.getOp()) {
case ADD: case ADD:
case SUB: case SUB:
case MUL: case MUL:
......
...@@ -255,14 +255,14 @@ public class InsnGen { ...@@ -255,14 +255,14 @@ public class InsnGen {
case CAST: { case CAST: {
boolean wrap = state.contains(IGState.BODY_ONLY); boolean wrap = state.contains(IGState.BODY_ONLY);
if (wrap) { if (wrap) {
code.add("("); code.add('(');
} }
code.add("("); code.add('(');
code.add(useType(((ArgType) ((IndexInsnNode) insn).getIndex()))); code.add(useType((ArgType) ((IndexInsnNode) insn).getIndex()));
code.add(") "); code.add(") ");
addArg(code, insn.getArg(0), true); addArg(code, insn.getArg(0), true);
if (wrap) { if (wrap) {
code.add(")"); code.add(')');
} }
break; break;
} }
...@@ -461,10 +461,11 @@ public class InsnGen { ...@@ -461,10 +461,11 @@ public class InsnGen {
code.add("switch(").add(arg(insn, 0)).add(") {"); code.add("switch(").add(arg(insn, 0)).add(") {");
code.incIndent(); code.incIndent();
for (int i = 0; i < sw.getCasesCount(); i++) { for (int i = 0; i < sw.getCasesCount(); i++) {
code.startLine("case " + sw.getKeys()[i] code.startLine("case ").add(sw.getKeys()[i]).add(": goto ");
+ ": goto " + MethodGen.getLabelName(sw.getTargets()[i]) + ";"); code.add(MethodGen.getLabelName(sw.getTargets()[i])).add(';');
} }
code.startLine("default: goto " + MethodGen.getLabelName(sw.getDefaultCaseOffset()) + ";"); code.startLine("default: goto ");
code.add(MethodGen.getLabelName(sw.getDefaultCaseOffset())).add(';');
code.decIndent(); code.decIndent();
code.startLine('}'); code.startLine('}');
state.add(IGState.NO_SEMICOLON); state.add(IGState.NO_SEMICOLON);
...@@ -719,7 +720,7 @@ public class InsnGen { ...@@ -719,7 +720,7 @@ public class InsnGen {
code.add(cond); code.add(cond);
} else { } else {
if (state.contains(IGState.BODY_ONLY)) { if (state.contains(IGState.BODY_ONLY)) {
code.add("((").add(cond).add(')').add(" ? ").add(th).add(" : ").add(els).add(")"); code.add("((").add(cond).add(')').add(" ? ").add(th).add(" : ").add(els).add(')');
} else { } else {
code.add('(').add(cond).add(')').add(" ? ").add(th).add(" : ").add(els); code.add('(').add(cond).add(')').add(" ? ").add(th).add(" : ").add(els);
} }
......
...@@ -168,18 +168,14 @@ public class MethodGen { ...@@ -168,18 +168,14 @@ public class MethodGen {
if (fallback) { if (fallback) {
if (name != null) { if (name != null) {
return base + "_" + name; return base + "_" + name;
} else {
return base;
} }
return base;
} else { } else {
if (name != null) { if (name != null) {
if (name.equals("this")) { if (Consts.DEBUG) {
return name; return base + "_" + name;
} else if (Consts.DEBUG) {
return name + "_" + base;
} else {
return name;
} }
return name;
} else { } else {
ArgType type = arg.getType(); ArgType type = arg.getType();
if (type.isPrimitive()) { if (type.isPrimitive()) {
...@@ -274,7 +270,7 @@ public class MethodGen { ...@@ -274,7 +270,7 @@ public class MethodGen {
public void addFallbackMethodCode(CodeWriter code) { public void addFallbackMethodCode(CodeWriter code) {
if (mth.getInstructions() == null) { if (mth.getInstructions() == null) {
// loadFile original instructions // load original instructions
try { try {
mth.load(); mth.load();
DepthTraverser.visit(new FallbackModeVisitor(), mth); DepthTraverser.visit(new FallbackModeVisitor(), mth);
......
...@@ -34,6 +34,10 @@ public enum AttributeType { ...@@ -34,6 +34,10 @@ public enum AttributeType {
private static final int NOT_UNIQ_COUNT; private static final int NOT_UNIQ_COUNT;
private final boolean uniq; private final boolean uniq;
private AttributeType(boolean isUniq) {
this.uniq = isUniq;
}
static { static {
// place all not unique attributes at first // place all not unique attributes at first
int last = -1; int last = -1;
...@@ -51,10 +55,6 @@ public enum AttributeType { ...@@ -51,10 +55,6 @@ public enum AttributeType {
return NOT_UNIQ_COUNT; return NOT_UNIQ_COUNT;
} }
private AttributeType(boolean isUniq) {
this.uniq = isUniq;
}
public boolean isUniq() { public boolean isUniq() {
return uniq; return uniq;
} }
......
...@@ -109,10 +109,7 @@ public final class AttributesList { ...@@ -109,10 +109,7 @@ public final class AttributesList {
public Annotation getAnnotation(String cls) { public Annotation getAnnotation(String cls) {
AnnotationsList aList = (AnnotationsList) get(AttributeType.ANNOTATION_LIST); AnnotationsList aList = (AnnotationsList) get(AttributeType.ANNOTATION_LIST);
if (aList == null || aList.size() == 0) { return aList == null ? null : aList.get(cls);
return null;
}
return aList.get(cls);
} }
public List<IAttribute> getAll(AttributeType type) { public List<IAttribute> getAll(AttributeType type) {
......
...@@ -13,6 +13,20 @@ public final class ClassInfo { ...@@ -13,6 +13,20 @@ public final class ClassInfo {
private static final Map<ArgType, ClassInfo> CLASSINFO_CACHE = new WeakHashMap<ArgType, ClassInfo>(); private static final Map<ArgType, ClassInfo> CLASSINFO_CACHE = new WeakHashMap<ArgType, ClassInfo>();
private final ArgType type;
private String pkg;
private String name;
private String fullName;
// for inner class not equals null
private ClassInfo parentClass;
private ClassInfo(ArgType type) {
assert type.isObject() : "Not class type: " + type;
this.type = type;
splitNames(true);
}
public static ClassInfo fromDex(DexNode dex, int clsIndex) { public static ClassInfo fromDex(DexNode dex, int clsIndex) {
if (clsIndex == DexNode.NO_INDEX) { if (clsIndex == DexNode.NO_INDEX) {
return null; return null;
...@@ -41,19 +55,6 @@ public final class ClassInfo { ...@@ -41,19 +55,6 @@ public final class ClassInfo {
CLASSINFO_CACHE.clear(); CLASSINFO_CACHE.clear();
} }
private final ArgType type;
private String pkg;
private String name;
private String fullName;
private ClassInfo parentClass; // not equals null if this is inner class
private ClassInfo(ArgType type) {
assert type.isObject() : "Not class type: " + type;
this.type = type;
splitNames(true);
}
private void splitNames(boolean canBeInner) { private void splitNames(boolean canBeInner) {
String fullObjectName = type.getObject(); String fullObjectName = type.getObject();
assert fullObjectName.indexOf('/') == -1 : "Raw type: " + type; assert fullObjectName.indexOf('/') == -1 : "Raw type: " + type;
......
...@@ -11,6 +11,12 @@ public class FieldInfo { ...@@ -11,6 +11,12 @@ public class FieldInfo {
private final String name; private final String name;
private final ArgType type; private final ArgType type;
public FieldInfo(ClassInfo declClass, String name, ArgType type) {
this.declClass = declClass;
this.name = name;
this.type = type;
}
public static FieldInfo fromDex(DexNode dex, int index) { public static FieldInfo fromDex(DexNode dex, int index) {
FieldId field = dex.getFieldId(index); FieldId field = dex.getFieldId(index);
return new FieldInfo( return new FieldInfo(
...@@ -19,12 +25,6 @@ public class FieldInfo { ...@@ -19,12 +25,6 @@ public class FieldInfo {
dex.getType(field.getTypeIndex())); dex.getType(field.getTypeIndex()));
} }
public FieldInfo(ClassInfo declClass, String name, ArgType type) {
this.declClass = declClass;
this.name = name;
this.type = type;
}
public static String getNameById(DexNode dex, int ind) { public static String getNameById(DexNode dex, int ind) {
return dex.getString(dex.getFieldId(ind).getNameIndex()); return dex.getString(dex.getFieldId(ind).getNameIndex());
} }
......
...@@ -18,10 +18,6 @@ public final class MethodInfo { ...@@ -18,10 +18,6 @@ public final class MethodInfo {
private final ClassInfo declClass; private final ClassInfo declClass;
private final String shortId; private final String shortId;
public static MethodInfo fromDex(DexNode dex, int mthIndex) {
return new MethodInfo(dex, mthIndex);
}
private MethodInfo(DexNode dex, int mthIndex) { private MethodInfo(DexNode dex, int mthIndex) {
MethodId mthId = dex.getMethodId(mthIndex); MethodId mthId = dex.getMethodId(mthIndex);
name = dex.getString(mthId.getNameIndex()); name = dex.getString(mthId.getNameIndex());
...@@ -43,6 +39,10 @@ public final class MethodInfo { ...@@ -43,6 +39,10 @@ public final class MethodInfo {
shortId = signature.toString(); shortId = signature.toString();
} }
public static MethodInfo fromDex(DexNode dex, int mthIndex) {
return new MethodInfo(dex, mthIndex);
}
public String getName() { public String getName() {
return name; return name;
} }
......
...@@ -15,12 +15,12 @@ public enum ArithOp { ...@@ -15,12 +15,12 @@ public enum ArithOp {
SHR(">>"), SHR(">>"),
USHR(">>>"); USHR(">>>");
private final String symbol;
private ArithOp(String symbol) { private ArithOp(String symbol) {
this.symbol = symbol; this.symbol = symbol;
} }
private final String symbol;
public String getSymbol() { public String getSymbol() {
return this.symbol; return this.symbol;
} }
......
...@@ -454,7 +454,7 @@ public abstract class ArgType { ...@@ -454,7 +454,7 @@ public abstract class ArgType {
types.add(type); types.add(type);
} }
} }
if (types.size() == 0) { if (types.isEmpty()) {
return null; return null;
} else if (types.size() == 1) { } else if (types.size() == 1) {
PrimitiveType nt = types.get(0); PrimitiveType nt = types.get(0);
...@@ -479,7 +479,7 @@ public abstract class ArgType { ...@@ -479,7 +479,7 @@ public abstract class ArgType {
String aObj = a.getObject(); String aObj = a.getObject();
String bObj = b.getObject(); String bObj = b.getObject();
if (aObj.equals(bObj)) { if (aObj.equals(bObj)) {
return (a.getGenericTypes() != null ? a : b); return a.getGenericTypes() != null ? a : b;
} else if (aObj.equals(Consts.CLASS_OBJECT)) { } else if (aObj.equals(Consts.CLASS_OBJECT)) {
return b; return b;
} else if (bObj.equals(Consts.CLASS_OBJECT)) { } else if (bObj.equals(Consts.CLASS_OBJECT)) {
...@@ -487,7 +487,7 @@ public abstract class ArgType { ...@@ -487,7 +487,7 @@ public abstract class ArgType {
} else { } else {
// different objects // different objects
String obj = clsp.getCommonAncestor(aObj, bObj); String obj = clsp.getCommonAncestor(aObj, bObj);
return (obj == null ? null : object(obj)); return obj == null ? null : object(obj);
} }
} }
if (a.isArray()) { if (a.isArray()) {
...@@ -498,7 +498,7 @@ public abstract class ArgType { ...@@ -498,7 +498,7 @@ public abstract class ArgType {
return OBJECT; return OBJECT;
} else { } else {
ArgType res = merge(ea, eb); ArgType res = merge(ea, eb);
return (res == null ? null : ArgType.array(res)); return res == null ? null : ArgType.array(res);
} }
} else if (b.equals(OBJECT)) { } else if (b.equals(OBJECT)) {
return OBJECT; return OBJECT;
......
...@@ -7,8 +7,8 @@ public final class InsnWrapArg extends InsnArg { ...@@ -7,8 +7,8 @@ public final class InsnWrapArg extends InsnArg {
private final InsnNode wrappedInsn; private final InsnNode wrappedInsn;
public InsnWrapArg(InsnNode insn) { public InsnWrapArg(InsnNode insn) {
ArgType type = (insn.getResult() == null ? ArgType.VOID : insn.getResult().getType()); RegisterArg result = insn.getResult();
this.typedVar = new TypedVar(type); this.typedVar = new TypedVar((result != null ? result.getType() : ArgType.VOID));
this.wrappedInsn = insn; this.wrappedInsn = insn;
} }
......
...@@ -87,7 +87,7 @@ public class BlockNode extends AttrNode implements IBlock { ...@@ -87,7 +87,7 @@ public class BlockNode extends AttrNode implements IBlock {
} }
} }
} }
return (nodes.size() == sucList.size() ? sucList : nodes); return nodes.size() == sucList.size() ? sucList : nodes;
} }
@Override @Override
......
...@@ -50,7 +50,7 @@ public class ClassNode extends LineAttrNode implements ILoadable { ...@@ -50,7 +50,7 @@ public class ClassNode extends LineAttrNode implements ILoadable {
private Map<Object, FieldNode> constFields = Collections.emptyMap(); private Map<Object, FieldNode> constFields = Collections.emptyMap();
private List<ClassNode> innerClasses = Collections.emptyList(); private List<ClassNode> innerClasses = Collections.emptyList();
private CodeWriter code; // generated code private CodeWriter code;
public ClassNode(DexNode dex, ClassDef cls) throws DecodeException { public ClassNode(DexNode dex, ClassDef cls) throws DecodeException {
this.dex = dex; this.dex = dex;
......
...@@ -20,6 +20,12 @@ import com.android.dx.io.DexBuffer.Section; ...@@ -20,6 +20,12 @@ import com.android.dx.io.DexBuffer.Section;
public class AnnotationsParser { public class AnnotationsParser {
private static final Annotation.Visibility[] VISIBILITIES = {
Visibility.BUILD,
Visibility.RUNTIME,
Visibility.SYSTEM
};
private final DexNode dex; private final DexNode dex;
private final ClassNode cls; private final ClassNode cls;
...@@ -76,12 +82,6 @@ public class AnnotationsParser { ...@@ -76,12 +82,6 @@ public class AnnotationsParser {
return new AnnotationsList(list); return new AnnotationsList(list);
} }
private static final Annotation.Visibility[] VISIBILITIES = {
Visibility.BUILD,
Visibility.RUNTIME,
Visibility.SYSTEM
};
public static Annotation readAnnotation(DexNode dex, Section s, boolean readVisibility) throws DecodeException { public static Annotation readAnnotation(DexNode dex, Section s, boolean readVisibility) throws DecodeException {
EncValueParser parser = new EncValueParser(dex, s); EncValueParser parser = new EncValueParser(dex, s);
Visibility visibility = null; Visibility visibility = null;
......
...@@ -17,31 +17,6 @@ import java.util.List; ...@@ -17,31 +17,6 @@ import java.util.List;
public final class IfCondition { public final class IfCondition {
public static IfCondition fromIfBlock(BlockNode header) {
if (header == null) {
return null;
}
return fromIfNode((IfNode) header.getInstructions().get(0));
}
public static IfCondition fromIfNode(IfNode insn) {
return new IfCondition(new Compare(insn));
}
public static IfCondition merge(Mode mode, IfCondition a, IfCondition b) {
if (a.getMode() == mode) {
IfCondition n = new IfCondition(a);
n.addArg(b);
return n;
} else if (b.getMode() == mode) {
IfCondition n = new IfCondition(b);
n.addArg(a);
return n;
} else {
return new IfCondition(mode, Arrays.asList(a, b));
}
}
public static enum Mode { public static enum Mode {
COMPARE, COMPARE,
NOT, NOT,
...@@ -75,6 +50,31 @@ public final class IfCondition { ...@@ -75,6 +50,31 @@ public final class IfCondition {
} }
} }
public static IfCondition fromIfBlock(BlockNode header) {
if (header == null) {
return null;
}
return fromIfNode((IfNode) header.getInstructions().get(0));
}
public static IfCondition fromIfNode(IfNode insn) {
return new IfCondition(new Compare(insn));
}
public static IfCondition merge(Mode mode, IfCondition a, IfCondition b) {
if (a.getMode() == mode) {
IfCondition n = new IfCondition(a);
n.addArg(b);
return n;
} else if (b.getMode() == mode) {
IfCondition n = new IfCondition(b);
n.addArg(a);
return n;
} else {
return new IfCondition(mode, Arrays.asList(a, b));
}
}
public Mode getMode() { public Mode getMode() {
return mode; return mode;
} }
......
...@@ -94,15 +94,15 @@ public class CodeShrinker extends AbstractVisitor { ...@@ -94,15 +94,15 @@ public class CodeShrinker extends AbstractVisitor {
private boolean canMove(int from, int to) { private boolean canMove(int from, int to) {
List<RegisterArg> movedArgs = argsList.get(from).getArgs(); List<RegisterArg> movedArgs = argsList.get(from).getArgs();
from++; int start = from + 1;
if (from == to) { if (start == to) {
// previous instruction or on edge of inline border // previous instruction or on edge of inline border
return true; return true;
} }
if (from > to) { if (start > to) {
throw new JadxRuntimeException("Invalid inline insn positions: " + from + " - " + to); throw new JadxRuntimeException("Invalid inline insn positions: " + start + " - " + to);
} }
for (int i = from; i < to; i++) { for (int i = start; i < to; i++) {
ArgsInfo argsInfo = argsList.get(i); ArgsInfo argsInfo = argsList.get(i);
if (argsInfo.getInlinedInsn() == this) { if (argsInfo.getInlinedInsn() == this) {
continue; continue;
......
...@@ -21,7 +21,7 @@ public class CheckRegions extends AbstractVisitor { ...@@ -21,7 +21,7 @@ public class CheckRegions extends AbstractVisitor {
@Override @Override
public void visit(MethodNode mth) throws JadxException { public void visit(MethodNode mth) throws JadxException {
if (mth.isNoCode() || mth.getBasicBlocks().size() == 0) { if (mth.isNoCode() || mth.getBasicBlocks().isEmpty()) {
return; return;
} }
......
...@@ -14,8 +14,11 @@ import org.slf4j.LoggerFactory; ...@@ -14,8 +14,11 @@ import org.slf4j.LoggerFactory;
public class CleanRegions { public class CleanRegions {
private static final Logger LOG = LoggerFactory.getLogger(CleanRegions.class); private static final Logger LOG = LoggerFactory.getLogger(CleanRegions.class);
private CleanRegions() {
}
public static void process(MethodNode mth) { public static void process(MethodNode mth) {
if (mth.isNoCode() || mth.getBasicBlocks().size() == 0) { if (mth.isNoCode() || mth.getBasicBlocks().isEmpty()) {
return; return;
} }
IRegionVisitor removeEmptyBlocks = new AbstractRegionVisitor() { IRegionVisitor removeEmptyBlocks = new AbstractRegionVisitor() {
......
...@@ -15,6 +15,9 @@ import java.util.Set; ...@@ -15,6 +15,9 @@ import java.util.Set;
public class BlockUtils { public class BlockUtils {
private BlockUtils() {
}
public static BlockNode getBlockByOffset(int offset, Iterable<BlockNode> casesBlocks) { public static BlockNode getBlockByOffset(int offset, Iterable<BlockNode> casesBlocks) {
for (BlockNode block : casesBlocks) { for (BlockNode block : casesBlocks) {
if (block.getStartOffset() == offset) { if (block.getStartOffset() == offset) {
......
...@@ -8,6 +8,12 @@ import java.util.List; ...@@ -8,6 +8,12 @@ import java.util.List;
public final class InsnList implements Iterable<InsnNode> { public final class InsnList implements Iterable<InsnNode> {
private final List<InsnNode> list;
public InsnList(List<InsnNode> list) {
this.list = list;
}
public static void remove(List<InsnNode> list, InsnNode insn) { public static void remove(List<InsnNode> list, InsnNode insn) {
for (Iterator<InsnNode> iterator = list.iterator(); iterator.hasNext(); ) { for (Iterator<InsnNode> iterator = list.iterator(); iterator.hasNext(); ) {
InsnNode next = iterator.next(); InsnNode next = iterator.next();
...@@ -33,12 +39,6 @@ public final class InsnList implements Iterable<InsnNode> { ...@@ -33,12 +39,6 @@ public final class InsnList implements Iterable<InsnNode> {
return -1; return -1;
} }
private final List<InsnNode> list;
public InsnList(List<InsnNode> list) {
this.list = list;
}
public int getIndex(InsnNode insn) { public int getIndex(InsnNode insn) {
return getIndex(list, insn); return getIndex(list, insn);
} }
......
...@@ -7,6 +7,9 @@ import com.android.dx.io.instructions.DecodedInstruction; ...@@ -7,6 +7,9 @@ import com.android.dx.io.instructions.DecodedInstruction;
public class InsnUtils { public class InsnUtils {
private InsnUtils() {
}
public static int getArg(DecodedInstruction insn, int arg) { public static int getArg(DecodedInstruction insn, int arg) {
switch (arg) { switch (arg) {
case 0: case 0:
......
...@@ -14,6 +14,9 @@ import java.util.List; ...@@ -14,6 +14,9 @@ import java.util.List;
public class RegionUtils { public class RegionUtils {
private RegionUtils() {
}
public static boolean hasExitEdge(IContainer container) { public static boolean hasExitEdge(IContainer container) {
if (container instanceof BlockNode) { if (container instanceof BlockNode) {
BlockNode block = (BlockNode) container; BlockNode block = (BlockNode) container;
......
...@@ -2,6 +2,9 @@ package jadx.core.utils; ...@@ -2,6 +2,9 @@ package jadx.core.utils;
public class StringUtils { public class StringUtils {
private StringUtils() {
}
public static String unescapeString(String str) { public static String unescapeString(String str) {
int len = str.length(); int len = str.length();
StringBuilder res = new StringBuilder(); StringBuilder res = new StringBuilder();
......
...@@ -8,6 +8,7 @@ import java.io.StringWriter; ...@@ -8,6 +8,7 @@ import java.io.StringWriter;
import java.util.Iterator; import java.util.Iterator;
public class Utils { public class Utils {
private Utils() { private Utils() {
} }
......
...@@ -15,7 +15,7 @@ import static org.junit.Assert.assertThat; ...@@ -15,7 +15,7 @@ import static org.junit.Assert.assertThat;
public class TestLineNumbers extends InternalJadxTest { public class TestLineNumbers extends InternalJadxTest {
public static class TestCls extends Exception { public static class TestCls {
int field; int field;
public void func() { public void func() {
......
...@@ -11,7 +11,7 @@ import static org.junit.Assert.assertThat; ...@@ -11,7 +11,7 @@ import static org.junit.Assert.assertThat;
public class TestConditions2 extends InternalJadxTest { public class TestConditions2 extends InternalJadxTest {
public static class TestCls extends Exception { public static class TestCls {
int c; int c;
String d; String d;
String f; String f;
......
...@@ -10,7 +10,7 @@ import static org.junit.Assert.assertThat; ...@@ -10,7 +10,7 @@ import static org.junit.Assert.assertThat;
public class TestInline extends InternalJadxTest { public class TestInline extends InternalJadxTest {
public static class TestCls extends Exception { public static class TestCls {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
System.out.println("Test: " + new TestCls().testRun()); System.out.println("Test: " + new TestCls().testRun());
} }
......
...@@ -10,7 +10,7 @@ import static org.junit.Assert.assertThat; ...@@ -10,7 +10,7 @@ import static org.junit.Assert.assertThat;
public class TestInline2 extends InternalJadxTest { public class TestInline2 extends InternalJadxTest {
public static class TestCls extends Exception { public static class TestCls {
public int simple_loops() throws InterruptedException { public int simple_loops() throws InterruptedException {
int[] a = new int[]{1, 2, 4, 6, 8}; int[] a = new int[]{1, 2, 4, 6, 8};
int b = 0; int b = 0;
......
...@@ -24,7 +24,6 @@ public class TestInline6 extends InternalJadxTest { ...@@ -24,7 +24,6 @@ public class TestInline6 extends InternalJadxTest {
@Test @Test
public void test() { public void test() {
setOutputCFG();
ClassNode cls = getClassNode(TestCls.class); ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString(); String code = cls.getCode().toString();
System.out.println(code); System.out.println(code);
......
...@@ -3,6 +3,9 @@ package jadx.gui.treemodel; ...@@ -3,6 +3,9 @@ package jadx.gui.treemodel;
import javax.swing.Icon; import javax.swing.Icon;
public class TextNode extends JNode { public class TextNode extends JNode {
private static final long serialVersionUID = 2342749142368352232L;
private final String label; private final String label;
public TextNode(String str) { public TextNode(String str) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment