core: make better variables naming
This commit is contained in:
@@ -36,8 +36,9 @@ public abstract class AbstractTest {
|
||||
|
||||
public static void assertEquals(Object a1, Object a2) {
|
||||
if (a1 == null) {
|
||||
if (a2 != null)
|
||||
if (a2 != null) {
|
||||
throw new AssertionError(a1 + " != " + a2);
|
||||
}
|
||||
} else if (!a1.equals(a2)) {
|
||||
throw new AssertionError(a1 + " != " + a2);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class TestAnnotations extends AbstractTest {
|
||||
@MyAnnotation(name = "b",
|
||||
num = 7,
|
||||
cls = Exception.class,
|
||||
doubles = { 0.0, 1.1 },
|
||||
doubles = {0.0, 1.1},
|
||||
value = 9.87f,
|
||||
simple = @SimpleAnnotation(false))
|
||||
public static Object test(String[] a) {
|
||||
|
||||
@@ -22,10 +22,11 @@ public class TestCF extends AbstractTest {
|
||||
|
||||
public int test1b(int a) {
|
||||
if (a > 0) {
|
||||
if (a < 5)
|
||||
if (a < 5) {
|
||||
a++;
|
||||
else
|
||||
} else {
|
||||
a -= 2;
|
||||
}
|
||||
}
|
||||
a *= 2;
|
||||
return a + 3;
|
||||
@@ -134,16 +135,17 @@ public class TestCF extends AbstractTest {
|
||||
|
||||
public int testIfElse(String str) {
|
||||
int r;
|
||||
if (str.equals("a"))
|
||||
if (str.equals("a")) {
|
||||
r = 1;
|
||||
else if (str.equals("b"))
|
||||
} else if (str.equals("b")) {
|
||||
r = 2;
|
||||
else if (str.equals("3"))
|
||||
} else if (str.equals("3")) {
|
||||
r = 3;
|
||||
else if (str.equals("$"))
|
||||
} else if (str.equals("$")) {
|
||||
r = 4;
|
||||
else
|
||||
} else {
|
||||
r = -1;
|
||||
}
|
||||
|
||||
r = r * 10;
|
||||
return Math.abs(r);
|
||||
|
||||
@@ -5,7 +5,7 @@ public class TestCF2 extends AbstractTest {
|
||||
private boolean ready = false;
|
||||
|
||||
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;
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
b += a[i];
|
||||
@@ -21,8 +21,9 @@ public class TestCF2 extends AbstractTest {
|
||||
*/
|
||||
public void run() throws InterruptedException {
|
||||
while (true) {
|
||||
if (!ready)
|
||||
if (!ready) {
|
||||
ready_mutex.wait();
|
||||
}
|
||||
ready = false;
|
||||
func();
|
||||
}
|
||||
@@ -88,8 +89,9 @@ public class TestCF2 extends AbstractTest {
|
||||
public void do_while_return2(boolean k) throws InterruptedException {
|
||||
int i = 3;
|
||||
do {
|
||||
if (k)
|
||||
if (k) {
|
||||
return;
|
||||
}
|
||||
i++;
|
||||
} while (i < 5);
|
||||
}
|
||||
|
||||
@@ -3,8 +3,9 @@ package jadx.samples;
|
||||
public class TestDeadCode extends AbstractTest {
|
||||
|
||||
private void test1(int i) {
|
||||
if (i == 0)
|
||||
if (i == 0) {
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public class TestGenerics extends AbstractTest {
|
||||
public static boolean use() {
|
||||
Pair<Integer, String> p1 = new OrderedPair<Integer, String>(1, "str1");
|
||||
Pair<Integer, String> p2 = new OrderedPair<Integer, String>(2, "str2");
|
||||
boolean same = Util.<Integer, String> compare(p1, p2);
|
||||
boolean same = Util.<Integer, String>compare(p1, p2);
|
||||
return same;
|
||||
}
|
||||
|
||||
@@ -107,9 +107,11 @@ public class TestGenerics extends AbstractTest {
|
||||
|
||||
public static <T extends Comparable<T>> int countGreaterThan(T[] anArray, T elem) {
|
||||
int count = 0;
|
||||
for (T e : anArray)
|
||||
if (e.compareTo(elem) > 0)
|
||||
for (T e : anArray) {
|
||||
if (e.compareTo(elem) > 0) {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -117,8 +119,9 @@ public class TestGenerics extends AbstractTest {
|
||||
}
|
||||
|
||||
public static void printList(List<?> list) {
|
||||
for (Object elem : list)
|
||||
for (Object elem : list) {
|
||||
System.out.print(elem + " ");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ public class TestInner extends AbstractTest {
|
||||
{
|
||||
count += 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
count += 6;
|
||||
@@ -68,6 +69,7 @@ public class TestInner extends AbstractTest {
|
||||
{
|
||||
count += 7;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
count += 8;
|
||||
|
||||
@@ -73,7 +73,7 @@ public class TestInner2 extends AbstractTest {
|
||||
|
||||
Method[] mths = TestInner2.class.getDeclaredMethods();
|
||||
for (Method mth : mths) {
|
||||
if(mth.getName().startsWith("access$")) {
|
||||
if (mth.getName().startsWith("access$")) {
|
||||
int modifiers = mth.getModifiers();
|
||||
assertTrue((modifiers & SYNTHETIC) != 0, "Synthetic methods must be removed");
|
||||
}
|
||||
|
||||
@@ -14,10 +14,11 @@ public class TestInvoke extends AbstractTest {
|
||||
}
|
||||
|
||||
private void parse(String[] args) {
|
||||
if (args.length > 0)
|
||||
if (args.length > 0) {
|
||||
f = Integer.parseInt(args[0]);
|
||||
else
|
||||
} else {
|
||||
f = 20;
|
||||
}
|
||||
}
|
||||
|
||||
public int getF() {
|
||||
@@ -37,18 +38,26 @@ public class TestInvoke extends AbstractTest {
|
||||
return s;
|
||||
}
|
||||
|
||||
private String testSameArgTypes(String s1, String s2) {
|
||||
if (s1.equals(s2)) {
|
||||
return null;
|
||||
}
|
||||
return s1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testRun() throws Exception {
|
||||
TestInvoke inv = new TestInvoke();
|
||||
|
||||
inv.parse(new String[] { "12", "35" });
|
||||
inv.parse(new String[]{"12", "35"});
|
||||
assertTrue(inv.getF() == 12);
|
||||
inv.parse(new String[0]);
|
||||
assertTrue(inv.getF() == 20);
|
||||
|
||||
assertTrue(inv.testVarArgs("a", "2", "III"));
|
||||
assertTrue(inv.testVarArgs2("a".toCharArray(), new char[] { '1', '2' }).equals("a12"));
|
||||
assertTrue(inv.testVarArgs2("a".toCharArray(), new char[]{'1', '2'}).equals("a12"));
|
||||
|
||||
assertEquals(testSameArgTypes("a", "b"), "a");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,10 +43,11 @@ public class TestSwitch extends AbstractTest {
|
||||
int k = i;
|
||||
switch (k) {
|
||||
case 1:
|
||||
if (j == 0)
|
||||
if (j == 0) {
|
||||
return 0;
|
||||
else
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
case 2:
|
||||
return 1;
|
||||
}
|
||||
@@ -69,8 +70,9 @@ public class TestSwitch extends AbstractTest {
|
||||
int k = i;
|
||||
switch (k) {
|
||||
case 1:
|
||||
if (b == 0)
|
||||
if (b == 0) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
case 2:
|
||||
b++;
|
||||
|
||||
@@ -5,14 +5,16 @@ import java.io.IOException;
|
||||
public class TestTryCatch extends AbstractTest {
|
||||
|
||||
private static boolean exc(Object obj) throws Exception {
|
||||
if (obj == null)
|
||||
if (obj == null) {
|
||||
throw new Exception("test");
|
||||
}
|
||||
return (obj instanceof Object);
|
||||
}
|
||||
|
||||
private static boolean exc2(Object obj) throws IOException {
|
||||
if (obj == null)
|
||||
if (obj == null) {
|
||||
throw new IOException();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -41,10 +43,11 @@ public class TestTryCatch extends AbstractTest {
|
||||
try {
|
||||
return exc(obj);
|
||||
} catch (Exception e) {
|
||||
if (obj != null)
|
||||
if (obj != null) {
|
||||
return true;
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,8 +81,9 @@ public class TestTryCatch extends AbstractTest {
|
||||
try {
|
||||
res = "" + exc(obj);
|
||||
boolean f = exc2("a");
|
||||
if (!f)
|
||||
if (!f) {
|
||||
res = "f == false";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
res = "exc";
|
||||
}
|
||||
@@ -95,8 +99,9 @@ public class TestTryCatch extends AbstractTest {
|
||||
} catch (IOException e) {
|
||||
res = true;
|
||||
} catch (Throwable e) {
|
||||
if (obj == null)
|
||||
if (obj == null) {
|
||||
obj = new Object();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,8 +117,9 @@ public class TestTryCatch extends AbstractTest {
|
||||
res = true;
|
||||
obj = new Object();
|
||||
} catch (Throwable e) {
|
||||
if (obj == null)
|
||||
if (obj == null) {
|
||||
res = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,16 +143,18 @@ public class TestTryCatch extends AbstractTest {
|
||||
} catch (Exception e) {
|
||||
e.toString();
|
||||
} finally {
|
||||
if (!mDiscovering)
|
||||
if (!mDiscovering) {
|
||||
mDiscovering = true;
|
||||
}
|
||||
}
|
||||
return mDiscovering;
|
||||
}
|
||||
|
||||
private static boolean testSynchronize(Object obj) throws InterruptedException {
|
||||
synchronized (obj) {
|
||||
if (obj instanceof String)
|
||||
if (obj instanceof String) {
|
||||
return false;
|
||||
}
|
||||
obj.wait(5);
|
||||
}
|
||||
return true;
|
||||
@@ -171,8 +179,9 @@ public class TestTryCatch extends AbstractTest {
|
||||
public int catchInLoop(int i, int j) {
|
||||
while (true) {
|
||||
try {
|
||||
while (i < j)
|
||||
while (i < j) {
|
||||
i = j++ / i;
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
i = 10;
|
||||
continue;
|
||||
|
||||
@@ -7,7 +7,7 @@ package jadx.samples;
|
||||
*/
|
||||
public class TestTypeResolver2 extends AbstractTest {
|
||||
|
||||
private static String result = "";
|
||||
private static String result = "";
|
||||
|
||||
public void testOverloadedMethods() {
|
||||
Object s1 = "The";
|
||||
|
||||
Reference in New Issue
Block a user