Commit 84cb6b95 authored by Skylot's avatar Skylot

Merge branch 'master' into type-inference-wip

# Conflicts:
#	jadx-core/src/main/java/jadx/core/codegen/NameGen.java
#	jadx-core/src/main/java/jadx/core/dex/attributes/AttributeStorage.java
#	jadx-core/src/main/java/jadx/core/dex/attributes/nodes/PhiListAttr.java
#	jadx-core/src/main/java/jadx/core/dex/instructions/IndexInsnNode.java
#	jadx-core/src/main/java/jadx/core/dex/instructions/InsnDecoder.java
#	jadx-core/src/main/java/jadx/core/dex/instructions/args/ArgType.java
#	jadx-core/src/main/java/jadx/core/dex/instructions/args/RegisterArg.java
#	jadx-core/src/main/java/jadx/core/dex/instructions/args/SSAVar.java
#	jadx-core/src/main/java/jadx/core/dex/regions/conditions/IfRegion.java
#	jadx-core/src/main/java/jadx/core/dex/visitors/ModVisitor.java
#	jadx-core/src/main/java/jadx/core/dex/visitors/blocksmaker/helpers/BlocksPair.java
#	jadx-core/src/main/java/jadx/core/dex/visitors/blocksmaker/helpers/BlocksRemoveInfo.java
#	jadx-core/src/main/java/jadx/core/dex/visitors/debuginfo/LocalVar.java
#	jadx-core/src/main/java/jadx/core/dex/visitors/regions/ProcessVariables.java
#	jadx-core/src/main/java/jadx/core/dex/visitors/shrink/CodeShrinkVisitor.java
#	jadx-core/src/main/java/jadx/core/xmlgen/entry/EntryConfig.java
parents e1f49552 a848eab4
...@@ -90,7 +90,7 @@ public class JCommanderWrapper<T> { ...@@ -90,7 +90,7 @@ public class JCommanderWrapper<T> {
if (fieldType == int.class) { if (fieldType == int.class) {
try { try {
int val = f.getInt(args); int val = f.getInt(args);
opt.append(" (default: ").append(val).append(")"); opt.append(" (default: ").append(val).append(')');
} catch (Exception e) { } catch (Exception e) {
// ignore // ignore
} }
......
...@@ -57,6 +57,6 @@ public final class CodePosition { ...@@ -57,6 +57,6 @@ public final class CodePosition {
@Override @Override
public String toString() { public String toString() {
return line + ":" + offset + (node != null ? " " + node : ""); return line + ':' + offset + (node != null ? " " + node : "");
} }
} }
...@@ -499,12 +499,12 @@ public class InsnGen { ...@@ -499,12 +499,12 @@ public class InsnGen {
case PHI: case PHI:
fallbackOnlyInsn(insn); fallbackOnlyInsn(insn);
code.add(insn.getType().toString()).add("("); code.add(insn.getType().toString()).add('(');
for (InsnArg insnArg : insn.getArguments()) { for (InsnArg insnArg : insn.getArguments()) {
addArg(code, insnArg); addArg(code, insnArg);
code.add(' '); code.add(' ');
} }
code.add(")"); code.add(')');
break; break;
default: default:
......
...@@ -184,9 +184,9 @@ public class MethodGen { ...@@ -184,9 +184,9 @@ public class MethodGen {
code.startLine("throw new UnsupportedOperationException(\"Method not decompiled: ") code.startLine("throw new UnsupportedOperationException(\"Method not decompiled: ")
.add(clsAlias.makeFullClsName(clsAlias.getShortName(), true)) .add(clsAlias.makeFullClsName(clsAlias.getShortName(), true))
.add(".") .add('.')
.add(mth.getAlias()) .add(mth.getAlias())
.add("(") .add('(')
.add(Utils.listToString(mth.getMethodInfo().getArgumentsTypes())) .add(Utils.listToString(mth.getMethodInfo().getArgumentsTypes()))
.add("):") .add("):")
.add(mth.getMethodInfo().getReturnType().toString()) .add(mth.getMethodInfo().getReturnType().toString())
......
...@@ -129,7 +129,7 @@ public class TypeGen { ...@@ -129,7 +129,7 @@ public class TypeGen {
} }
String str = Long.toString(l); String str = Long.toString(l);
if (Math.abs(l) >= Integer.MAX_VALUE) { if (Math.abs(l) >= Integer.MAX_VALUE) {
str += "L"; str += 'L';
} }
return str; return str;
} }
......
...@@ -169,7 +169,7 @@ public class SignatureParser { ...@@ -169,7 +169,7 @@ public class SignatureParser {
// generic type start ('<') // generic type start ('<')
String obj = slice(); String obj = slice();
if (!incompleteType) { if (!incompleteType) {
obj += ";"; obj += ';';
} }
ArgType[] genArr = consumeGenericArgs(); ArgType[] genArr = consumeGenericArgs();
consume('>'); consume('>');
...@@ -211,7 +211,7 @@ public class SignatureParser { ...@@ -211,7 +211,7 @@ public class SignatureParser {
list.add(type); list.add(type);
} }
} while (type != null && !lookAhead('>')); } while (type != null && !lookAhead('>'));
return list.toArray(new ArgType[list.size()]); return list.toArray(new ArgType[0]);
} }
/** /**
......
...@@ -67,7 +67,7 @@ public class FileUtils { ...@@ -67,7 +67,7 @@ public class FileUtils {
public static File createTempFile(String suffix) { public static File createTempFile(String suffix) {
File temp; File temp;
try { try {
temp = File.createTempFile("jadx-tmp-", System.nanoTime() + "-" + suffix); temp = File.createTempFile("jadx-tmp-", System.nanoTime() + '-' + suffix);
temp.deleteOnExit(); temp.deleteOnExit();
} catch (IOException e) { } catch (IOException e) {
throw new JadxRuntimeException("Failed to create temp file with suffix: " + suffix); throw new JadxRuntimeException("Failed to create temp file with suffix: " + suffix);
......
...@@ -209,7 +209,7 @@ public class BinaryXMLParser extends CommonBinaryParser { ...@@ -209,7 +209,7 @@ public class BinaryXMLParser extends CommonBinaryParser {
String str = getString(strIndex); String str = getString(strIndex);
if (!isLastEnd) { if (!isLastEnd) {
isLastEnd = true; isLastEnd = true;
writer.add(">"); writer.add('>');
} }
writer.attachSourceLine(lineNumber); writer.attachSourceLine(lineNumber);
String escapedStr = StringUtils.escapeXML(str); String escapedStr = StringUtils.escapeXML(str);
...@@ -235,13 +235,13 @@ public class BinaryXMLParser extends CommonBinaryParser { ...@@ -235,13 +235,13 @@ public class BinaryXMLParser extends CommonBinaryParser {
int startNS = is.readInt32(); int startNS = is.readInt32();
int startNSName = is.readInt32(); // actually is elementName... int startNSName = is.readInt32(); // actually is elementName...
if (!isLastEnd && !"ERROR".equals(currentTag)) { if (!isLastEnd && !"ERROR".equals(currentTag)) {
writer.add(">"); writer.add('>');
} }
isOneLine = true; isOneLine = true;
isLastEnd = false; isLastEnd = false;
currentTag = deobfClassName(getString(startNSName)); currentTag = deobfClassName(getString(startNSName));
currentTag = getValidTagAttributeName(currentTag); currentTag = getValidTagAttributeName(currentTag);
writer.startLine("<").add(currentTag); writer.startLine('<').add(currentTag);
writer.attachSourceLine(elementBegLineNumber); writer.attachSourceLine(elementBegLineNumber);
int attributeStart = is.readInt16(); int attributeStart = is.readInt16();
if (attributeStart != 0x14) { if (attributeStart != 0x14) {
...@@ -263,7 +263,7 @@ public class BinaryXMLParser extends CommonBinaryParser { ...@@ -263,7 +263,7 @@ public class BinaryXMLParser extends CommonBinaryParser {
writer.add(':'); writer.add(':');
writer.add(nsValue); writer.add(nsValue);
} }
writer.add("=\"").add(StringUtils.escapeXML(entry.getKey())).add("\""); writer.add("=\"").add(StringUtils.escapeXML(entry.getKey())).add('"');
} }
} }
boolean attrNewLine = attributeCount != 1 && ATTR_NEW_LINE; boolean attrNewLine = attributeCount != 1 && ATTR_NEW_LINE;
...@@ -373,13 +373,13 @@ public class BinaryXMLParser extends CommonBinaryParser { ...@@ -373,13 +373,13 @@ public class BinaryXMLParser extends CommonBinaryParser {
// reference custom processing // reference custom processing
String name = styleMap.get(attrValData); String name = styleMap.get(attrValData);
if (name != null) { if (name != null) {
writer.add("@style/").add(name.replaceAll("_", ".")); writer.add("@style/").add(name.replace('_', '.'));
} else { } else {
String resName = resNames.get(attrValData); String resName = resNames.get(attrValData);
if (resName != null) { if (resName != null) {
writer.add("@"); writer.add('@');
if (resName.startsWith("id/")) { if (resName.startsWith("id/")) {
writer.add("+"); writer.add('+');
} }
writer.add(resName); writer.add(resName);
} else { } else {
...@@ -424,7 +424,7 @@ public class BinaryXMLParser extends CommonBinaryParser { ...@@ -424,7 +424,7 @@ public class BinaryXMLParser extends CommonBinaryParser {
// if (elementNS != -1) { // if (elementNS != -1) {
// writer.add(getString(elementNS)).add(':'); // writer.add(getString(elementNS)).add(':');
// } // }
writer.add(elemName).add(">"); writer.add(elemName).add('>');
} }
isLastEnd = true; isLastEnd = true;
if (writer.getIndent() != 0) { if (writer.getIndent() != 0) {
......
...@@ -49,7 +49,7 @@ public class ResContainer implements Comparable<ResContainer> { ...@@ -49,7 +49,7 @@ public class ResContainer implements Comparable<ResContainer> {
} }
public String getFileName() { public String getFileName() {
return name.replace("/", File.separator); return name.replace('/', File.separatorChar);
} }
public List<ResContainer> getSubFiles() { public List<ResContainer> getSubFiles() {
......
...@@ -182,9 +182,9 @@ public class ResXmlGen { ...@@ -182,9 +182,9 @@ public class ResXmlGen {
cw.add('<').add(itemTag); cw.add('<').add(itemTag);
if (attrName != null && attrValue != null) { if (attrName != null && attrValue != null) {
if (typeName.equals("attr")) { if (typeName.equals("attr")) {
cw.add(' ').add("name=\"").add(attrName.replace("id.", "")).add("\" value=\"").add(attrValue).add("\""); cw.add(' ').add("name=\"").add(attrName.replace("id.", "")).add("\" value=\"").add(attrValue).add('"');
} else if (typeName.equals("style")) { } else if (typeName.equals("style")) {
cw.add(' ').add("name=\"").add(attrName.replace("attr.", "")).add("\""); cw.add(' ').add("name=\"").add(attrName.replace("attr.", "")).add('"');
} else { } else {
cw.add(' ').add(attrName).add("=\"").add(attrValue).add('"'); cw.add(' ').add(attrName).add("=\"").add(attrValue).add('"');
} }
......
...@@ -44,8 +44,8 @@ public class JadxArgsValidatorOutDirsTest { ...@@ -44,8 +44,8 @@ public class JadxArgsValidatorOutDirsTest {
setOutDirs(null, null, null); setOutDirs(null, null, null);
String inputFileBase = args.getInputFiles().get(0).getName().replace(".apk", ""); String inputFileBase = args.getInputFiles().get(0).getName().replace(".apk", "");
checkOutDirs(inputFileBase, checkOutDirs(inputFileBase,
inputFileBase + "/" + JadxArgs.DEFAULT_SRC_DIR, inputFileBase + '/' + JadxArgs.DEFAULT_SRC_DIR,
inputFileBase + "/" + JadxArgs.DEFAULT_RES_DIR); inputFileBase + '/' + JadxArgs.DEFAULT_RES_DIR);
} }
private void setOutDirs(String outDir, String srcDir, String resDir) { private void setOutDirs(String outDir, String srcDir, String resDir) {
......
...@@ -122,7 +122,7 @@ public class TypeCompareTest { ...@@ -122,7 +122,7 @@ public class TypeCompareTest {
private void check(ArgType first, ArgType second, TypeCompareEnum expectedResult) { private void check(ArgType first, ArgType second, TypeCompareEnum expectedResult) {
TypeCompareEnum result = compare.compareTypes(first, second); TypeCompareEnum result = compare.compareTypes(first, second);
assertThat("Compare '" + first + "' vs '" + second + "'", assertThat("Compare '" + first + "' vs '" + second + '\'',
result, is(expectedResult)); result, is(expectedResult));
} }
} }
...@@ -317,7 +317,7 @@ public abstract class IntegrationTest extends TestUtils { ...@@ -317,7 +317,7 @@ public abstract class IntegrationTest extends TestUtils {
File temp = createTempFile(".jar"); File temp = createTempFile(".jar");
try (JarOutputStream jo = new JarOutputStream(new FileOutputStream(temp))) { try (JarOutputStream jo = new JarOutputStream(new FileOutputStream(temp))) {
for (File file : list) { for (File file : list) {
addFileToJar(jo, file, path + "/" + file.getName()); addFileToJar(jo, file, path + '/' + file.getName());
} }
} }
return temp; return temp;
...@@ -340,7 +340,7 @@ public abstract class IntegrationTest extends TestUtils { ...@@ -340,7 +340,7 @@ public abstract class IntegrationTest extends TestUtils {
private static File createTempDir(String prefix) throws IOException { private static File createTempDir(String prefix) throws IOException {
File baseDir = new File(System.getProperty("java.io.tmpdir")); File baseDir = new File(System.getProperty("java.io.tmpdir"));
String baseName = prefix + "-" + System.nanoTime(); String baseName = prefix + '-' + System.nanoTime();
for (int counter = 1; counter < 1000; counter++) { for (int counter = 1; counter < 1000; counter++) {
File tempDir = new File(baseDir, baseName + counter); File tempDir = new File(baseDir, baseName + counter);
if (tempDir.mkdir()) { if (tempDir.mkdir()) {
...@@ -360,7 +360,7 @@ public abstract class IntegrationTest extends TestUtils { ...@@ -360,7 +360,7 @@ public abstract class IntegrationTest extends TestUtils {
File directory = new File(pkgResource.toURI()); File directory = new File(pkgResource.toURI());
String[] files = directory.list(); String[] files = directory.list();
for (String file : files) { for (String file : files) {
String fullName = pkgName + "." + file; String fullName = pkgName + '.' + file;
if (fullName.startsWith(clsName)) { if (fullName.startsWith(clsName)) {
list.add(new File(directory, file)); list.add(new File(directory, file));
} }
......
...@@ -44,7 +44,7 @@ public abstract class SmaliTest extends IntegrationTest { ...@@ -44,7 +44,7 @@ public abstract class SmaliTest extends IntegrationTest {
protected ClassNode getClassNodeFromSmaliFiles(String pkg, String testName, String clsName) { protected ClassNode getClassNodeFromSmaliFiles(String pkg, String testName, String clsName) {
File outDex = createTempFile(".dex"); File outDex = createTempFile(".dex");
compileSmali(outDex, collectSmaliFiles(pkg, testName)); compileSmali(outDex, collectSmaliFiles(pkg, testName));
return getClassNodeFromFile(outDex, pkg + "." + clsName); return getClassNodeFromFile(outDex, pkg + '.' + clsName);
} }
protected JadxDecompiler loadSmaliFile(String pkg, String smaliFileName) { protected JadxDecompiler loadSmaliFile(String pkg, String smaliFileName) {
......
...@@ -32,7 +32,7 @@ class StringUtilsTest { ...@@ -32,7 +32,7 @@ class StringUtilsTest {
} }
private void checkStringUnescape(String input, String result) { private void checkStringUnescape(String input, String result) {
assertThat(stringUtils.unescapeString(input), is("\"" + result + "\"")); assertThat(stringUtils.unescapeString(input), is('"' + result + '"'));
} }
@Test @Test
...@@ -47,6 +47,6 @@ class StringUtilsTest { ...@@ -47,6 +47,6 @@ class StringUtilsTest {
} }
private void checkCharUnescape(char input, String result) { private void checkCharUnescape(char input, String result) {
assertThat(stringUtils.unescapeChar(input), is("'" + result + "'")); assertThat(stringUtils.unescapeChar(input), is('\'' + result + '\''));
} }
} }
...@@ -18,7 +18,7 @@ public class TestStringBuilderElimination2 extends IntegrationTest { ...@@ -18,7 +18,7 @@ public class TestStringBuilderElimination2 extends IntegrationTest {
public static class TestCls1 { public static class TestCls1 {
public String test() { public String test() {
return new StringBuilder("[init]").append("a1").append('c').append(2).append(0l).append(1.0f). return new StringBuilder("[init]").append("a1").append('c').append(2).append(0L).append(1.0f).
append(2.0d).append(true).toString(); append(2.0d).append(true).toString();
} }
} }
......
package jadx.tests.integration.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.junit.jupiter.api.Test;
import jadx.NotYetImplemented;
import jadx.core.dex.nodes.ClassNode;
import jadx.tests.api.IntegrationTest;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
public class AnnotationsRenaming extends IntegrationTest {
public static class TestCls {
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public static @interface A {
int x();
}
@A(x = 5)
void test() {
}
}
@Test
@NotYetImplemented
public void test504() {
enableDeobfuscation();
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
assertThat(code, containsString("public static @interface "));
assertThat(code, not(containsString("(x = 5)")));
}
}
...@@ -46,10 +46,10 @@ public class TestEnums extends IntegrationTest { ...@@ -46,10 +46,10 @@ public class TestEnums extends IntegrationTest {
assertThat(code, containsLines(1, "public enum EmptyEnum {", "}")); assertThat(code, containsLines(1, "public enum EmptyEnum {", "}"));
assertThat(code, containsLines(1, assertThat(code, containsLines(1,
"public enum EmptyEnum2 {", "public enum EmptyEnum2 {",
indent(1) + ";", indent(1) + ';',
"", "",
indent(1) + "public static void mth() {", indent(1) + "public static void mth() {",
indent(1) + "}", indent(1) + '}',
"}")); "}"));
assertThat(code, containsLines(1, "public enum Direction {", assertThat(code, containsLines(1, "public enum Direction {",
...@@ -64,7 +64,7 @@ public class TestEnums extends IntegrationTest { ...@@ -64,7 +64,7 @@ public class TestEnums extends IntegrationTest {
"", "",
indent(1) + "public String test() {", indent(1) + "public String test() {",
indent(2) + "return \"\";", indent(2) + "return \"\";",
indent(1) + "}", indent(1) + '}',
"}")); "}"));
} }
} }
...@@ -38,12 +38,12 @@ public class TestEnums2 extends IntegrationTest { ...@@ -38,12 +38,12 @@ public class TestEnums2 extends IntegrationTest {
indent(1) + "PLUS {", indent(1) + "PLUS {",
indent(2) + "public int apply(int x, int y) {", indent(2) + "public int apply(int x, int y) {",
indent(3) + "return x + y;", indent(3) + "return x + y;",
indent(2) + "}", indent(2) + '}',
indent(1) + "},", indent(1) + "},",
indent(1) + "MINUS {", indent(1) + "MINUS {",
indent(2) + "public int apply(int x, int y) {", indent(2) + "public int apply(int x, int y) {",
indent(3) + "return x - y;", indent(3) + "return x - y;",
indent(2) + "}", indent(2) + '}',
indent(1) + "};", indent(1) + "};",
"", "",
indent(1) + "public abstract int apply(int i, int i2);", indent(1) + "public abstract int apply(int i, int i2);",
......
...@@ -7,7 +7,7 @@ import jadx.tests.api.IntegrationTest; ...@@ -7,7 +7,7 @@ import jadx.tests.api.IntegrationTest;
import static jadx.tests.api.utils.JadxMatchers.containsOne; import static jadx.tests.api.utils.JadxMatchers.containsOne;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertEquals;
public class TestEnums3 extends IntegrationTest { public class TestEnums3 extends IntegrationTest {
...@@ -30,9 +30,9 @@ public class TestEnums3 extends IntegrationTest { ...@@ -30,9 +30,9 @@ public class TestEnums3 extends IntegrationTest {
} }
public void check() { public void check() {
assertTrue(Numbers.ONE.getNum() == 1); assertEquals(1, Numbers.ONE.getNum());
assertTrue(Numbers.THREE.getNum() == 3); assertEquals(3, Numbers.THREE.getNum());
assertTrue(Numbers.FOUR.getNum() == 4); assertEquals(4, Numbers.FOUR.getNum());
} }
} }
......
...@@ -40,13 +40,13 @@ public class TestEnumsInterface extends IntegrationTest { ...@@ -40,13 +40,13 @@ public class TestEnumsInterface extends IntegrationTest {
indent(1) + "PLUS {", indent(1) + "PLUS {",
indent(2) + "public int apply(int x, int y) {", indent(2) + "public int apply(int x, int y) {",
indent(3) + "return x + y;", indent(3) + "return x + y;",
indent(2) + "}", indent(2) + '}',
indent(1) + "},", indent(1) + "},",
indent(1) + "MINUS {", indent(1) + "MINUS {",
indent(2) + "public int apply(int x, int y) {", indent(2) + "public int apply(int x, int y) {",
indent(3) + "return x - y;", indent(3) + "return x - y;",
indent(2) + "}", indent(2) + '}',
indent(1) + "}", indent(1) + '}',
"}" "}"
)); ));
} }
......
...@@ -37,9 +37,9 @@ public class TestAnonymousClass4 extends IntegrationTest { ...@@ -37,9 +37,9 @@ public class TestAnonymousClass4 extends IntegrationTest {
String code = cls.getCode().toString(); String code = cls.getCode().toString();
assertThat(code, containsOne(indent(3) + "new Thread() {")); assertThat(code, containsOne(indent(3) + "new Thread() {"));
assertThat(code, containsOne(indent(4) + "{")); assertThat(code, containsOne(indent(4) + '{'));
assertThat(code, containsOne("f = 1;")); assertThat(code, containsOne("f = 1;"));
assertThat(code, countString(2, indent(4) + "}")); assertThat(code, countString(2, indent(4) + '}'));
assertThat(code, containsOne(indent(4) + "public void run() {")); assertThat(code, containsOne(indent(4) + "public void run() {"));
assertThat(code, containsOne("d = 7.5")); assertThat(code, containsOne("d = 7.5"));
assertThat(code, containsOne(indent(3) + "}.start();")); assertThat(code, containsOne(indent(3) + "}.start();"));
......
...@@ -35,7 +35,7 @@ public class TestArrayForEach2 extends IntegrationTest { ...@@ -35,7 +35,7 @@ public class TestArrayForEach2 extends IntegrationTest {
indent(1) + "String t = s.trim();", indent(1) + "String t = s.trim();",
indent(1) + "if (t.length() > 0) {", indent(1) + "if (t.length() > 0) {",
indent(2) + "System.out.println(t);", indent(2) + "System.out.println(t);",
indent(1) + "}", indent(1) + '}',
"}" "}"
)); ));
} }
......
...@@ -41,18 +41,18 @@ public class TestIssue13a extends IntegrationTest { ...@@ -41,18 +41,18 @@ public class TestIssue13a extends IntegrationTest {
Field f = c.getField("CREATOR"); Field f = c.getField("CREATOR");
creator = (Parcelable.Creator) f.get(null); creator = (Parcelable.Creator) f.get(null);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
Log.e(TAG, "1" + name + ", e: " + e); Log.e(TAG, '1' + name + ", e: " + e);
throw new RuntimeException("2" + name); throw new RuntimeException('2' + name);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
Log.e(TAG, "3" + name + ", e: " + e); Log.e(TAG, '3' + name + ", e: " + e);
throw new RuntimeException("4" + name); throw new RuntimeException('4' + name);
} catch (ClassCastException e) { } catch (ClassCastException e) {
throw new RuntimeException("5" + name); throw new RuntimeException('5' + name);
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException e) {
throw new RuntimeException("6" + name); throw new RuntimeException('6' + name);
} }
if (creator == null) { if (creator == null) {
throw new RuntimeException("7" + name); throw new RuntimeException('7' + name);
} }
map.put(name, creator); map.put(name, creator);
} }
...@@ -95,7 +95,7 @@ public class TestIssue13a extends IntegrationTest { ...@@ -95,7 +95,7 @@ public class TestIssue13a extends IntegrationTest {
String code = cls.getCode().toString(); String code = cls.getCode().toString();
for (int i = 1; i <= 7; i++) { for (int i = 1; i <= 7; i++) {
assertThat(code, containsOne("\"" + i + "\"")); assertThat(code, containsOne("'" + i + '\''));
} }
// TODO: add additional checks // TODO: add additional checks
......
...@@ -38,7 +38,7 @@ public class TestSynchronized extends IntegrationTest { ...@@ -38,7 +38,7 @@ public class TestSynchronized extends IntegrationTest {
assertThat(code, containsOne("return this.f")); assertThat(code, containsOne("return this.f"));
assertThat(code, containsOne("synchronized (this.o) {")); assertThat(code, containsOne("synchronized (this.o) {"));
assertThat(code, not(containsString(indent(3) + ";"))); assertThat(code, not(containsString(indent(3) + ';')));
assertThat(code, not(containsString("try {"))); assertThat(code, not(containsString("try {")));
assertThat(code, not(containsString("} catch (Throwable th) {"))); assertThat(code, not(containsString("} catch (Throwable th) {")));
assertThat(code, not(containsString("throw th;"))); assertThat(code, not(containsString("throw th;")));
......
...@@ -43,8 +43,8 @@ public class TestTryCatch7 extends IntegrationTest { ...@@ -43,8 +43,8 @@ public class TestTryCatch7 extends IntegrationTest {
private void check(String code, String excVarName, String catchExcVarName) { private void check(String code, String excVarName, String catchExcVarName) {
assertThat(code, containsOne("Exception " + excVarName + " = new Exception();")); assertThat(code, containsOne("Exception " + excVarName + " = new Exception();"));
assertThat(code, containsOne("} catch (Exception " + catchExcVarName + ") {")); assertThat(code, containsOne("} catch (Exception " + catchExcVarName + ") {"));
assertThat(code, containsOne(excVarName + " = " + catchExcVarName + ";")); assertThat(code, containsOne(excVarName + " = " + catchExcVarName + ';'));
assertThat(code, containsOne(excVarName + ".printStackTrace();")); assertThat(code, containsOne(excVarName + ".printStackTrace();"));
assertThat(code, containsOne("return " + excVarName + ";")); assertThat(code, containsOne("return " + excVarName + ';'));
} }
} }
...@@ -44,7 +44,7 @@ public class TestTryCatchFinally6 extends IntegrationTest { ...@@ -44,7 +44,7 @@ public class TestTryCatchFinally6 extends IntegrationTest {
"} finally {", "} finally {",
indent(1) + "if (is != null) {", indent(1) + "if (is != null) {",
indent(2) + "is.close();", indent(2) + "is.close();",
indent(1) + "}", indent(1) + '}',
"}" "}"
)); ));
} }
...@@ -63,7 +63,7 @@ public class TestTryCatchFinally6 extends IntegrationTest { ...@@ -63,7 +63,7 @@ public class TestTryCatchFinally6 extends IntegrationTest {
"} finally {", "} finally {",
indent() + "if (fileInputStream != null) {", indent() + "if (fileInputStream != null) {",
indent() + indent() + "fileInputStream.close();", indent() + indent() + "fileInputStream.close();",
indent() + "}", indent() + '}',
"}" "}"
)); ));
} }
......
...@@ -23,7 +23,7 @@ public class TestTryCatchInIf extends IntegrationTest { ...@@ -23,7 +23,7 @@ public class TestTryCatchInIf extends IntegrationTest {
} else { } else {
key = Integer.parseInt(value); key = Integer.parseInt(value);
} }
return name + "=" + key; return name + '=' + key;
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
return "Failed to parse number"; return "Failed to parse number";
} }
......
...@@ -37,7 +37,7 @@ public class TestVariables4 extends IntegrationTest { ...@@ -37,7 +37,7 @@ public class TestVariables4 extends IntegrationTest {
msg = "not extends AbstractTest"; msg = "not extends AbstractTest";
} }
System.err.println(">> " System.err.println(">> "
+ (pass ? "PASS" : "FAIL") + "\t" + (pass ? "PASS" : "FAIL") + '\t'
+ clsName + clsName
+ (msg == null ? "" : "\t - " + msg)); + (msg == null ? "" : "\t - " + msg));
if (exc != null) { if (exc != null) {
......
...@@ -211,7 +211,7 @@ public class JadxSettingsWindow extends JDialog { ...@@ -211,7 +211,7 @@ public class JadxSettingsWindow extends JDialog {
private String getFontLabelStr() { private String getFontLabelStr() {
Font font = settings.getFont(); Font font = settings.getFont();
String fontStyleName = Utils.getFontStyleName(font.getStyle()); String fontStyleName = Utils.getFontStyleName(font.getStyle());
return NLS.str("preferences.font") + ": " + font.getFontName() + " " + fontStyleName + " " + font.getSize(); return NLS.str("preferences.font") + ": " + font.getFontName() + ' ' + fontStyleName + ' ' + font.getSize();
} }
private SettingsGroup makeDecompilationGroup() { private SettingsGroup makeDecompilationGroup() {
......
...@@ -94,7 +94,7 @@ public class JMethod extends JNode { ...@@ -94,7 +94,7 @@ public class JMethod extends JNode {
@Override @Override
public String makeLongString() { public String makeLongString() {
String name = mth.getDeclaringClass().getFullName() + "." + makeBaseString(); String name = mth.getDeclaringClass().getFullName() + '.' + makeBaseString();
return Utils.typeFormat(name, getReturnType()); return Utils.typeFormat(name, getReturnType());
} }
......
...@@ -66,7 +66,7 @@ public class JSources extends JNode { ...@@ -66,7 +66,7 @@ public class JSources extends JNode {
pkg.getInnerPackages().clear(); pkg.getInnerPackages().clear();
pkg.getInnerPackages().addAll(innerPkg.getInnerPackages()); pkg.getInnerPackages().addAll(innerPkg.getInnerPackages());
pkg.getClasses().addAll(innerPkg.getClasses()); pkg.getClasses().addAll(innerPkg.getClasses());
pkg.setName(pkg.getName() + "." + innerPkg.getName()); pkg.setName(pkg.getName() + '.' + innerPkg.getName());
innerPkg.getInnerPackages().clear(); innerPkg.getInnerPackages().clear();
innerPkg.getClasses().clear(); innerPkg.getClasses().clear();
......
...@@ -44,7 +44,7 @@ class SearchBar extends JToolBar { ...@@ -44,7 +44,7 @@ class SearchBar extends JToolBar {
public SearchBar(RSyntaxTextArea textArea) { public SearchBar(RSyntaxTextArea textArea) {
rTextArea = textArea; rTextArea = textArea;
JLabel findLabel = new JLabel(NLS.str("search.find") + ":"); JLabel findLabel = new JLabel(NLS.str("search.find") + ':');
add(findLabel); add(findLabel);
searchField = new JTextField(30); searchField = new JTextField(30);
......
...@@ -126,13 +126,13 @@ public class CertificateManager { ...@@ -126,13 +126,13 @@ public class CertificateManager {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
if (x509cert != null) { if (x509cert != null) {
builder.append(generateHeader()); builder.append(generateHeader());
builder.append("\n"); builder.append('\n');
builder.append(generatePublicKey()); builder.append(generatePublicKey());
builder.append("\n"); builder.append('\n');
builder.append(generateSignature()); builder.append(generateSignature());
builder.append("\n"); builder.append('\n');
builder.append(generateFingerprint()); builder.append(generateFingerprint());
} }
return builder.toString(); return builder.toString();
...@@ -150,7 +150,7 @@ public class CertificateManager { ...@@ -150,7 +150,7 @@ public class CertificateManager {
} }
static void append(StringBuilder str, String name, String value) { static void append(StringBuilder str, String name, String value) {
str.append(name).append(": ").append(value).append("\n"); str.append(name).append(": ").append(value).append('\n');
} }
public static String getThumbPrint(X509Certificate cert, String type) public static String getThumbPrint(X509Certificate cert, String type)
......
...@@ -65,7 +65,7 @@ public class RunTests { ...@@ -65,7 +65,7 @@ public class RunTests {
msg = "not extends AbstractTest"; msg = "not extends AbstractTest";
} }
System.err.println(">> " System.err.println(">> "
+ (pass ? "PASS" : "FAIL") + "\t" + (pass ? "PASS" : "FAIL") + '\t'
+ clsName + clsName
+ (msg == null ? "" : "\t - " + msg)); + (msg == null ? "" : "\t - " + msg));
if (exc != null) { if (exc != null) {
......
...@@ -12,7 +12,7 @@ public class TestStringProcessing extends AbstractTest { ...@@ -12,7 +12,7 @@ public class TestStringProcessing extends AbstractTest {
public void testStringConcat() { public void testStringConcat() {
String s = "1"; String s = "1";
assertEquals("a" + s, "a1"); assertEquals('a' + s, "a1");
} }
@Override @Override
......
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