java-decompiler: post-import cleanup (test sources reformatted)

This commit is contained in:
Roman Shevchenko 2014-09-01 19:48:39 +04:00
parent e629738a46
commit c0c83126a6
8 changed files with 174 additions and 182 deletions

View File

@ -26,10 +26,10 @@ public class TestClassLambda {
public void testLambda1() { public void testLambda1() {
int var1 = (int)Math.random(); int var1 = (int)Math.random();
Runnable var2 = () -> { Runnable var2 = () -> {
System.out.println("hello" + var1); System.out.println("hello1" + var1);
}; };
Runnable var3 = () -> { Runnable var3 = () -> {
System.out.println("hello1" + var1); System.out.println("hello2" + var1);
}; };
} }

View File

@ -17,12 +17,12 @@ package pkg;
public class TestClassFields { public class TestClassFields {
private static int[] sizes; private static int[] sizes;
private static String[] names; private static String[] names;
static { static {
names = new String[]{"name1", "name2"}; names = new String[]{"name1", "name2"};
sizes = new int[names.length]; sizes = new int[names.length];
} }
} }

View File

@ -15,68 +15,63 @@
*/ */
package pkg; package pkg;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.OptionalInt;
import java.util.function.IntBinaryOperator; import java.util.function.IntBinaryOperator;
import java.util.function.Supplier; import java.util.function.Supplier;
public class TestClassLambda { public class TestClassLambda {
public int field = 0; public int field = 0;
public void testLambda() {
List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6, 7);
int b = (int)Math.random();
list.forEach(n -> {int a = 2 * n; System.out.println(a + b + field);});
}
public void testLambda1() { public void testLambda() {
List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6, 7);
int a = (int)Math.random(); int b = (int)Math.random();
Runnable r = () -> { System.out.println("hello" + a); };
Runnable r1 = () -> { System.out.println("hello1" + a); }; list.forEach(n -> {
} int a = 2 * n;
System.out.println(a + b + field);
});
}
public void testLambda2() { public void testLambda1() {
reduce((left, right) -> Math.max(left, right)); int a = (int)Math.random();
} Runnable r1 = () -> { System.out.println("hello1" + a); };
Runnable r2 = () -> { System.out.println("hello2" + a); };
}
public void testLambda3() { // IDEA-127301 public void testLambda2() {
reduce(Math::max); reduce((left, right) -> Math.max(left, right));
} }
public void testLambda4() { public void testLambda3() { // IDEA-127301
reduce(TestClassLambda::localMax); reduce(Math::max);
} }
public void testLambda5() {
String x = "abcd";
function(x::toString);
}
public void testLambda6() {
List<String> list = new ArrayList<String>();
int bottom = list.size() * 2;
int top = list.size() * 5;
list.removeIf( s -> (bottom >= s.length() && s.length() <= top) );
}
public static OptionalInt reduce(IntBinaryOperator op) {
return null;
}
public static String function(Supplier<String> supplier) {
return supplier.get();
}
public static int localMax(int first, int second) { public void testLambda4() {
return 0; reduce(TestClassLambda::localMax);
} }
public void testLambda5() {
String x = "abcd";
function(x::toString);
}
public void testLambda6() {
List<String> list = new ArrayList<String>();
int bottom = list.size() * 2;
int top = list.size() * 5;
list.removeIf(s -> (bottom >= s.length() && s.length() <= top));
}
public static OptionalInt reduce(IntBinaryOperator op) {
return null;
}
public static String function(Supplier<String> supplier) {
return supplier.get();
}
public static int localMax(int first, int second) {
return 0;
}
} }

View File

@ -17,47 +17,45 @@ package pkg;
public class TestClassLoop { public class TestClassLoop {
public static void testSimpleInfinite() { public static void testSimpleInfinite() {
while(true) { while (true) {
System.out.println(); System.out.println();
}
}
public static void testFinally() {
boolean a = (Math.random() > 0);
while (true) {
try {
if (!a) {
return;
} }
}
finally {
System.out.println("1");
}
}
}
} public static void testFinallyContinue() {
public static void testFinally() {
boolean a = (Math.random() > 0); boolean a = (Math.random() > 0);
while(true) {
try {
if(!a) {
return;
}
} finally {
System.out.println("1");
}
}
}
public static void testFinallyContinue() { for (; ; ) {
try {
System.out.println("1");
}
finally {
if (a) {
System.out.println("3");
continue;
}
}
boolean a = (Math.random() > 0); System.out.println("4");
}
for(;;) { }
try {
System.out.println("1");
} finally {
if(a) {
System.out.println("3");
continue;
}
}
System.out.println("4");
}
}
} }

View File

@ -17,15 +17,14 @@ package pkg;
public class TestClassSwitch { public class TestClassSwitch {
public void testCaseOrder(int a) { public void testCaseOrder(int a) {
switch(a) { switch (a) {
case 13: case 13:
System.out.println(13); System.out.println(13);
return; return;
case 5: case 5:
System.out.println(5); System.out.println(5);
}
} }
}
} }

View File

@ -20,50 +20,50 @@ import java.util.List;
public class TestClassTypes { public class TestClassTypes {
public void testBoolean() { public void testBoolean() {
byte var7 = 0; byte var7 = 0;
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
if(time % 2 > 0) {
var7 = 1;
} else if(time % 3 > 0) {
var7 = 2;
}
if(var7 == 1) { if (time % 2 > 0) {
System.out.println(); var7 = 1;
} }
else if (time % 3 > 0) {
var7 = 2;
} }
public boolean testBit(int var0) {
return (var0 & 1) == 1;
}
public void testSwitchConsts(int a) {
switch (a) { if (var7 == 1) {
case 88: System.out.println();
System.out.println("1"); }
break; }
case 656:
System.out.println("2"); public boolean testBit(int var0) {
break; return (var0 & 1) == 1;
case 65201: }
case 65489:
System.out.println("3"); public void testSwitchConsts(int a) {
}
} switch (a) {
case 88:
public void testAssignmentType(List list) { System.out.println("1");
break;
List a = list; case 656:
System.out.println("2");
if(a != null) { break;
(a = new ArrayList(a)).add("23"); case 65201:
} case 65489:
System.out.println("3");
System.out.println(a.size()); }
} }
public void testAssignmentType(List list) {
List a = list;
if (a != null) {
(a = new ArrayList(a)).add("23");
}
System.out.println(a.size());
}
} }

View File

@ -18,42 +18,42 @@ package pkg;
public class TestClassVar { public class TestClassVar {
private boolean field_boolean = (Math.random() > 0); private boolean field_boolean = (Math.random() > 0);
public int field_int = 0; public int field_int = 0;
public void testFieldSSAU() { public void testFieldSSAU() {
for(int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
try { try {
System.out.println(); System.out.println();
} finally { }
if (field_boolean) { finally {
System.out.println(); if (field_boolean) {
} System.out.println();
}
} }
} }
}
public Long testFieldSSAU1() { // IDEA-127466 }
return new Long(field_int++);
}
public void testComplexPropagation() {
int a = 0;
while (a < 10) { public Long testFieldSSAU1() { // IDEA-127466
return new Long(field_int++);
int b = a; }
for(; a < 10 && a == 0; a++) {} public void testComplexPropagation() {
if (b != a) { int a = 0;
System.out.println();
} while (a < 10) {
}
} int b = a;
for (; a < 10 && a == 0; a++) {
}
if (b != a) {
System.out.println();
}
}
}
} }