style: enforce code style using checkstyle and spotless with eclipse formatter (PR #650)

This commit is contained in:
skylot
2019-04-30 00:04:16 +03:00
committed by GitHub
parent e1dfb4ee59
commit c7890f2468
272 changed files with 1938 additions and 1368 deletions
@@ -47,12 +47,14 @@ public class TestAnnotations extends AbstractTest {
Thread.State state() default Thread.State.TERMINATED;
}
@MyAnnotation(name = "b",
@MyAnnotation(
name = "b",
num = 7,
cls = Exception.class,
doubles = {0.0, 1.1},
doubles = { 0.0, 1.1 },
value = 9.87f,
simple = @SimpleAnnotation(false))
simple = @SimpleAnnotation(false)
)
public static Object test(String[] a) {
return Arrays.asList(a);
}
@@ -67,10 +69,12 @@ public class TestAnnotations extends AbstractTest {
Class<?>[] value();
}
@ClassesAnnotation({
int.class, int[].class, int[][][].class,
String.class, String[].class, String[][].class
})
@ClassesAnnotation(
{
int.class, int[].class, int[][][].class,
String.class, String[].class, String[][].class
}
)
public static Object test3(Object b) {
return b.toString();
}
@@ -7,7 +7,7 @@ import java.lang.annotation.Target;
public class TestAnnotationsParser extends AbstractTest {
@Target({ElementType.TYPE})
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public static @interface A {
int i();
@@ -4,7 +4,7 @@ public class TestArrays extends AbstractTest {
public int test1(int i) {
// fill-array-data
int[] a = new int[]{1, 2, 3, 5};
int[] a = new int[] { 1, 2, 3, 5 };
return a[i];
}
@@ -22,13 +22,13 @@ public class TestArrays extends AbstractTest {
private static Object test4(int type) {
if (type == 1) {
return new int[]{1, 2};
return new int[] { 1, 2 };
} else if (type == 2) {
return new float[]{1, 2};
return new float[] { 1, 2 };
} else if (type == 3) {
return new short[]{1, 2};
return new short[] { 1, 2 };
} else if (type == 4) {
return new byte[]{1, 2};
return new byte[] { 1, 2 };
} else {
return null;
}
@@ -169,11 +169,11 @@ public class TestCF extends AbstractTest {
}
}
public static void test_hello(String[] args) {
public static void testHello(String[] args) {
System.out.println("Hello world!");
}
public static void test_print(String[] args) {
public static void testPrint(String[] args) {
for (String arg : args) {
System.out.println(arg);
}
@@ -1,10 +1,10 @@
package jadx.samples;
public class TestCF2 extends AbstractTest {
private final Object ready_mutex = new Object();
private final Object readyMutex = new Object();
private boolean ready = false;
public int simple_loops() throws InterruptedException {
public int simpleLoops() throws InterruptedException {
int[] a = new int[]{1, 2, 4, 6, 8};
int b = 0;
for (int i = 0; i < a.length; i++) {
@@ -22,7 +22,7 @@ public class TestCF2 extends AbstractTest {
public void run() throws InterruptedException {
while (true) {
if (!ready) {
ready_mutex.wait();
readyMutex.wait();
}
ready = false;
func();
@@ -33,7 +33,7 @@ public class TestCF2 extends AbstractTest {
ready = true;
}
public void do_while() throws InterruptedException {
public void doWhile() throws InterruptedException {
int i = 3;
do {
func();
@@ -41,7 +41,7 @@ public class TestCF2 extends AbstractTest {
} while (i < 5);
}
public void do_while_2(long k) throws InterruptedException {
public void doWhile2(long k) throws InterruptedException {
if (k > 5) {
long i = 3;
do {
@@ -51,7 +51,7 @@ public class TestCF2 extends AbstractTest {
}
}
public void do_while_3(int k) throws InterruptedException {
public void doWhile3(int k) throws InterruptedException {
int i = 3;
do {
if (k > 9) {
@@ -61,7 +61,7 @@ public class TestCF2 extends AbstractTest {
} while (i < 5);
}
public int do_while_break(int k) throws InterruptedException {
public int doWhileBreak(int k) throws InterruptedException {
int i = 3;
do {
if (k > 9) {
@@ -74,7 +74,7 @@ public class TestCF2 extends AbstractTest {
return i;
}
public int do_while_continue(int k) throws InterruptedException {
public int doWhileContinue(int k) throws InterruptedException {
int i = 0;
do {
if (k > 9) {
@@ -86,7 +86,7 @@ public class TestCF2 extends AbstractTest {
return i;
}
public void do_while_return2(boolean k) throws InterruptedException {
public void doWhileReturn2(boolean k) throws InterruptedException {
int i = 3;
do {
if (k) {
@@ -96,7 +96,7 @@ public class TestCF2 extends AbstractTest {
} while (i < 5);
}
public void while_iterator(String[] args, int k) throws InterruptedException {
public void whileIterator(String[] args, int k) throws InterruptedException {
for (String arg : args) {
if (arg.length() > 9) {
func();
@@ -106,7 +106,7 @@ public class TestCF2 extends AbstractTest {
@Override
public boolean testRun() throws Exception {
assertEquals(simple_loops(), 252);
assertEquals(simpleLoops(), 252);
// TODO add checks
return true;
}
@@ -226,9 +226,9 @@ public class TestCF3 extends AbstractTest {
assertEquals(testReturnInLoop2(list1), "a");
// TODO this line required to omit generic information because it create List<Object>
// List<String> list2 = Arrays.asList(null, null, null);
// assertEquals(testReturnInLoop(list2), "error");
// assertEquals(testReturnInLoop2(list2), "error");
// List<String> list2 = Arrays.asList(null, null, null);
// assertEquals(testReturnInLoop(list2), "error");
// assertEquals(testReturnInLoop2(list2), "error");
// assertTrue(testLabeledBreakContinue());
@@ -242,7 +242,7 @@ public class TestCF3 extends AbstractTest {
assertEquals(testComplexIfInLoop3(6), 6);
assertEquals(testComplexIfInLoop3(8), 24);
assertEquals(testLoops(new int[]{1, 2, 3, 4, 5, 6}, 2), 19);
assertEquals(testLoops(new int[] { 1, 2, 3, 4, 5, 6 }, 2), 19);
assertTrue(testInline() > 20);
assertTrue(testInline2());
@@ -97,6 +97,7 @@ public class TestEnum extends AbstractTest {
}
}
@SuppressWarnings("NoWhitespaceBefore")
public enum EmptyEnum {
;
@@ -2,6 +2,7 @@ package jadx.samples;
import java.util.Arrays;
@SuppressWarnings("ConstantName")
public class TestFields extends AbstractTest {
public static class ConstFields {
@@ -20,7 +21,7 @@ public class TestFields extends AbstractTest {
private static final String fstr = "final string";
private static final double fd = 3.14;
private static final double[] fda = new double[]{3.14, 2.7};
private static final double[] fda = new double[] { 3.14, 2.7 };
private static int si = 5;
@@ -37,6 +37,7 @@ public class TestGenerics extends AbstractTest {
public static Box<Integer> integerBox = new Box<>();
@SuppressWarnings("InterfaceTypeParameterName")
public interface Pair<K, LongGenericType> {
K getKey();
@@ -69,8 +70,8 @@ public class TestGenerics extends AbstractTest {
public static class Util {
// Generic static method
public static <K, V> boolean compare(Pair<K, V> p1, Pair<K, V> p2) {
return p1.getKey().equals(p2.getKey()) &&
p1.getValue().equals(p2.getValue());
return p1.getKey().equals(p2.getKey())
&& p1.getValue().equals(p2.getValue());
}
}
@@ -4,7 +4,7 @@ public class TestInitializers extends AbstractTest {
private static String a;
private static int counter;
private A c_a;
private A cA;
public static class A {
public static String a;
@@ -23,19 +23,19 @@ public class TestInitializers extends AbstractTest {
private int bbb;
public B() {
if (c_a.z()) {
if (cA.z()) {
b = -1;
} else {
b = 1;
}
}
public B(int _b) {
b = _b;
public B(int pb) {
b = pb;
}
public void setB(int _b) {
b = _b;
public void setB(int pb) {
b = pb;
}
public int getB() {
@@ -57,7 +57,7 @@ public class TestInitializers extends AbstractTest {
}
{
c_a = new A();
cA = new A();
}
@Override
@@ -2,6 +2,7 @@ package jadx.samples;
public class TestInnerNames extends AbstractTest {
@SuppressWarnings("MemberName")
public int D;
public class A extends TestInner.MyThread {
@@ -49,13 +49,13 @@ public class TestInvoke extends AbstractTest {
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;
@@ -2,6 +2,7 @@ package jadx.samples;
public class TestStringProcessing extends AbstractTest {
@SuppressWarnings("AvoidEscapedUnicodeCharacters")
public void testStringEscape() {
String str = "test\tstr\n";
assertTrue(str.length() == 9);
@@ -161,7 +161,7 @@ public class TestTryCatch extends AbstractTest {
}
// TODO: remove 'synchronized(TestTryCatch.class)' block in decompiled version
private synchronized static boolean testSynchronize2(Object obj) throws InterruptedException {
private static synchronized boolean testSynchronize2(Object obj) throws InterruptedException {
return obj.toString() != null;
}
@@ -20,7 +20,7 @@ public class TestTypeResolver extends AbstractTest {
public static class TestTernaryInSuper extends TestTypeResolver {
public TestTernaryInSuper(int c) {
// super(c > 0 ? c : -c, 1);
// super(c > 0 ? c : -c, 1);
}
}
@@ -9,6 +9,7 @@ public class TestUnicode extends AbstractTest {
* Some unicode strings from:
* http://www.ltg.ed.ac.uk/~richard/unicode-sample-3-2.html
*/
@SuppressWarnings({ "LineLength", "AvoidEscapedUnicodeCharacters" })
public List<String> strings() {
List<String> list = new ArrayList<>();
list.add("! \" # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \\ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~");
@@ -21,9 +22,9 @@ public class TestUnicode extends AbstractTest {
list.add("豈 更 車 賈 滑 串 句 龜 龜 契 金 喇 奈 懶 癩 羅 蘿 螺 裸 邏 樂 洛 烙 珞 落 酪 駱 亂 卵 欄 爛 蘭 鸞 嵐 濫 藍 襤 拉 臘 蠟 廊 朗 浪 狼 郎 來 冷 勞 擄 櫓 爐 盧 老 蘆 虜 路 露 魯 鷺 碌 祿 綠 菉 錄 鹿 論 壟 弄 籠 聾 牢 磊 賂 雷 壘 屢 樓 淚 漏 累 縷 陋 勒 肋 凜 凌 稜 綾 菱 陵 讀 拏 樂 諾 丹 寧 怒 率 異 北 磻 便 復 不 泌 數 索 參 塞 省 葉 說 殺 辰 沈 拾 若 掠 略 亮 兩 凉 梁 糧 良 諒 量 勵");
list.add("ㄱ ㄲ ㄳ ㄴ ㄵ ㄶ ㄷ ㄸ ㄹ ㄺ ㄻ ㄼ ㄽ ㄾ ㄿ ㅀ ㅁ ㅂ ㅃ ㅄ ㅅ ㅆ ㅇ ㅈ ㅉ ㅊ ㅋ ㅌ ㅍ ㅎ ㅏ ㅐ ㅑ ㅒ ㅓ ㅔ ㅕ ㅖ ㅗ ㅘ ㅙ ㅚ ㅛ ㅜ ㅝ ㅞ ㅟ ㅠ ㅡ ㅢ ㅣ ㅤ ㅥ ㅦ ㅧ ㅨ ㅩ ㅪ ㅫ ㅬ ㅭ ㅮ ㅯ ㅰ ㅱ ㅲ ㅳ ㅴ ㅵ ㅶ ㅷ ㅸ ㅹ ㅺ ㅻ ㅼ ㅽ ㅾ ㅿ ㆀ ㆁ ㆂ ㆃ ㆄ ㆅ ㆆ ㆇ ㆈ ㆉ ㆊ ㆋ ㆌ");
list.add("가 각 갂 갃 간 갅 갆 갇 갈 갉 갊 갋 갌 갍 갎 갏 감 갑 값 갓 갔 강 갖 갗 갘 같 갚 갛 개 객 갞 갟 갠 갡 갢 갣 갤 갥 갦 갧 갨 갩 갪 갫 갬 갭 갮 갯 갰 갱 갲 갳 갴 갵 갶 갷 갸 갹 갺 갻 갼 갽 갾 갿 걀 걁 걂 걃 걄 걅 걆 걇 걈 걉 걊 걋 걌 걍 걎 걏 걐 걑 걒 걓 걔 걕 걖 걗 걘 걙 걚 걛 걜 걝 걞 걟 걠 걡 걢 걣 걤 걥 걦 걧 걨 걩 걪 걫 걬 걭 걮 걯 거 걱 걲 걳 건 걵 걶 걷 걸 걹 걺 걻 걼 걽 걾 걿");
list.add( "؛ ؟ ء آ أ ؤ إ ئ ا ب ة ت ث ج ح خ د ذ ر ز س ش ص ض ط ظ ع غ ـ ف ق ك ل م ن ه و ى ي ً ٌ ٍ َ ُ ِ ّ ْ ٓ ٔ ٕ ٠ ١ ٢ ٣ ٤ ٥ ٦ ٧ ٨ ٩ ٪ ٫ ٬ ٭ ٮ ٯ ٰ ٱ ٲ ٳ ٴ ٵ ٶ ٷ ٸ ٹ ٺ ٻ ټ ٽ پ ٿ ڀ ځ ڂ ڃ ڄ څ چ ڇ ڈ ډ ڊ ڋ ڌ ڍ ڎ ڏ ڐ ڑ ڒ ړ ڔ ڕ ږ ڗ ژ ڙ ښ ڛ ڜ ڝ ڞ ڟ ڠ ڡ ڢ ڣ ڤ ڥ ڦ ڧ ڨ ک ڪ ګ ڬ");
list.add( "ஃ அ ஆ இ ஈ உ ஊ எ ஏ ஐ ஒ ஓ ஔ க ங ச ஜ ஞ ட ண த ந ன ப ம ய ர ற ல ள ழ வ ஷ ஸ ஹ ா ி ீ ு ூ ெ ே ை ொ ோ ௌ ் ௗ ௧ ௨ ௩ ௪ ௫ ௬ ௭ ௮ ௯ ௰ ௱ ௲");
list.add( "\uD800\uDF00 \uD800\uDF01 \uD800\uDF02 \uD800\uDF03 \uD800\uDF04 \uD800\uDF05 \uD800\uDF06 \uD800\uDF07 \uD800\uDF08 \uD800\uDF09 \uD800\uDF0A \uD800\uDF0B \uD800\uDF0C \uD800\uDF0D \uD800\uDF0E \uD800\uDF0F \uD800\uDF10 \uD800\uDF11 \uD800\uDF12 \uD800\uDF13 \uD800\uDF14 \uD800\uDF15 \uD800\uDF16 \uD800\uDF17 \uD800\uDF18 \uD800\uDF19 \uD800\uDF1A \uD800\uDF1B \uD800\uDF1C \uD800\uDF1D \uD800\uDF1E \uD800\uDF20 \uD800\uDF21 \uD800\uDF22 \uD800\uDF23");
list.add("؛ ؟ ء آ أ ؤ إ ئ ا ب ة ت ث ج ح خ د ذ ر ز س ش ص ض ط ظ ع غ ـ ف ق ك ل م ن ه و ى ي ً ٌ ٍ َ ُ ِ ّ ْ ٓ ٔ ٕ ٠ ١ ٢ ٣ ٤ ٥ ٦ ٧ ٨ ٩ ٪ ٫ ٬ ٭ ٮ ٯ ٰ ٱ ٲ ٳ ٴ ٵ ٶ ٷ ٸ ٹ ٺ ٻ ټ ٽ پ ٿ ڀ ځ ڂ ڃ ڄ څ چ ڇ ڈ ډ ڊ ڋ ڌ ڍ ڎ ڏ ڐ ڑ ڒ ړ ڔ ڕ ږ ڗ ژ ڙ ښ ڛ ڜ ڝ ڞ ڟ ڠ ڡ ڢ ڣ ڤ ڥ ڦ ڧ ڨ ک ڪ ګ ڬ");
list.add("ஃ அ ஆ இ ஈ உ ஊ எ ஏ ஐ ஒ ஓ ஔ க ங ச ஜ ஞ ட ண த ந ன ப ம ய ர ற ல ள ழ வ ஷ ஸ ஹ ா ி ீ ு ூ ெ ே ை ொ ோ ௌ ் ௗ ௧ ௨ ௩ ௪ ௫ ௬ ௭ ௮ ௯ ௰ ௱ ௲");
list.add("\uD800\uDF00 \uD800\uDF01 \uD800\uDF02 \uD800\uDF03 \uD800\uDF04 \uD800\uDF05 \uD800\uDF06 \uD800\uDF07 \uD800\uDF08 \uD800\uDF09 \uD800\uDF0A \uD800\uDF0B \uD800\uDF0C \uD800\uDF0D \uD800\uDF0E \uD800\uDF0F \uD800\uDF10 \uD800\uDF11 \uD800\uDF12 \uD800\uDF13 \uD800\uDF14 \uD800\uDF15 \uD800\uDF16 \uD800\uDF17 \uD800\uDF18 \uD800\uDF19 \uD800\uDF1A \uD800\uDF1B \uD800\uDF1C \uD800\uDF1D \uD800\uDF1E \uD800\uDF20 \uD800\uDF21 \uD800\uDF22 \uD800\uDF23");
list.add("𐌀 𐌁 𐌂 𐌃 𐌄 𐌅 𐌆 𐌇 𐌈 𐌉 𐌊 𐌋 𐌌 𐌍 𐌎 𐌏 𐌐 𐌑 𐌒 𐌓 𐌔 𐌕 𐌖 𐌗 𐌘 𐌙 𐌚 𐌛 𐌜 𐌝 𐌞 𐌠 𐌡 𐌢 𐌣");
return list;
}