diff options
Diffstat (limited to 'plugins/java-decompiler/engine/testData')
61 files changed, 1121 insertions, 0 deletions
diff --git a/plugins/java-decompiler/engine/testData/bulk.jar b/plugins/java-decompiler/engine/testData/bulk.jar Binary files differnew file mode 100644 index 000000000000..80e0dcfd5781 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/bulk.jar diff --git a/plugins/java-decompiler/engine/testData/bulk/META-INF/MANIFEST.MF b/plugins/java-decompiler/engine/testData/bulk/META-INF/MANIFEST.MF new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/bulk/META-INF/MANIFEST.MF diff --git a/plugins/java-decompiler/engine/testData/bulk/pkg/Main.java b/plugins/java-decompiler/engine/testData/bulk/pkg/Main.java new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/bulk/pkg/Main.java diff --git a/plugins/java-decompiler/engine/testData/bulk/pkg/res/Loader.java b/plugins/java-decompiler/engine/testData/bulk/pkg/res/Loader.java new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/bulk/pkg/res/Loader.java diff --git a/plugins/java-decompiler/engine/testData/bulk/pkg/res/resource.txt b/plugins/java-decompiler/engine/testData/bulk/pkg/res/resource.txt new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/bulk/pkg/res/resource.txt diff --git a/plugins/java-decompiler/engine/testData/classes/InvalidMethodSignature.class b/plugins/java-decompiler/engine/testData/classes/InvalidMethodSignature.class Binary files differnew file mode 100644 index 000000000000..3b64eb80cda2 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/InvalidMethodSignature.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestClassCast.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassCast.class Binary files differnew file mode 100644 index 000000000000..5b71ce852454 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassCast.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestClassFields.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassFields.class Binary files differnew file mode 100644 index 000000000000..c1c0c6b9717c --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassFields.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestClassLambda.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassLambda.class Binary files differnew file mode 100644 index 000000000000..b506ea80c805 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassLambda.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestClassLoop.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassLoop.class Binary files differnew file mode 100644 index 000000000000..d363692ff02b --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassLoop.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestClassNestedInitializer$1.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassNestedInitializer$1.class Binary files differnew file mode 100644 index 000000000000..42b11df32210 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassNestedInitializer$1.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestClassNestedInitializer.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassNestedInitializer.class Binary files differnew file mode 100644 index 000000000000..1aa367010cbc --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassNestedInitializer.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestClassSwitch.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassSwitch.class Binary files differnew file mode 100644 index 000000000000..2fd6b5250df7 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassSwitch.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestClassTypes.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassTypes.class Binary files differnew file mode 100644 index 000000000000..45288caf7cd1 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassTypes.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestClassVar.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassVar.class Binary files differnew file mode 100644 index 000000000000..d66170c04214 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassVar.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestCodeConstructs.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestCodeConstructs.class Binary files differnew file mode 100644 index 000000000000..5727e89464dc --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestCodeConstructs.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestConstants$A.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestConstants$A.class Binary files differnew file mode 100644 index 000000000000..1d81f91d6fde --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestConstants$A.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestConstants.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestConstants.class Binary files differnew file mode 100644 index 000000000000..00c924aae6f8 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestConstants.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestDebugSymbols.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestDebugSymbols.class Binary files differnew file mode 100644 index 000000000000..102e09b778b1 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestDebugSymbols.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestDeprecations$ByAnno.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestDeprecations$ByAnno.class Binary files differnew file mode 100644 index 000000000000..72c86eadeb48 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestDeprecations$ByAnno.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestDeprecations$ByComment.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestDeprecations$ByComment.class Binary files differnew file mode 100644 index 000000000000..e5576181f2d4 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestDeprecations$ByComment.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestDeprecations.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestDeprecations.class Binary files differnew file mode 100644 index 000000000000..f1bb2e34ab4e --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestDeprecations.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestEnum$1.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestEnum$1.class Binary files differnew file mode 100644 index 000000000000..163965a6acf0 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestEnum$1.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestEnum$2.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestEnum$2.class Binary files differnew file mode 100644 index 000000000000..25c051bd8943 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestEnum$2.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestEnum.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestEnum.class Binary files differnew file mode 100644 index 000000000000..397ff04ee01e --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestEnum.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestExtendsList.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestExtendsList.class Binary files differnew file mode 100644 index 000000000000..98b5dbb3cfd4 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestExtendsList.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestMethodParameters$1Local.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestMethodParameters$1Local.class Binary files differnew file mode 100644 index 000000000000..6ba8aed255a3 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestMethodParameters$1Local.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestMethodParameters$C1.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestMethodParameters$C1.class Binary files differnew file mode 100644 index 000000000000..843ebc4b8f0a --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestMethodParameters$C1.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestMethodParameters$C2.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestMethodParameters$C2.class Binary files differnew file mode 100644 index 000000000000..fd52d14bd5fd --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestMethodParameters$C2.class diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestMethodParameters.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestMethodParameters.class Binary files differnew file mode 100644 index 000000000000..e439d0c13edf --- /dev/null +++ b/plugins/java-decompiler/engine/testData/classes/pkg/TestMethodParameters.class diff --git a/plugins/java-decompiler/engine/testData/results/InvalidMethodSignature.dec b/plugins/java-decompiler/engine/testData/results/InvalidMethodSignature.dec new file mode 100644 index 000000000000..3b1bee4d20a9 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/results/InvalidMethodSignature.dec @@ -0,0 +1,26 @@ +package a.a.a.a.e.f; + +import a.a.a.a.a.k; +import a.a.a.a.c.c; +import a.a.a.a.c.j; +import a.a.a.a.e.bg; +import a.a.a.a.e.f.b; +import java.io.File; + +class i implements bg { + private final j a; + private final b b; + + i(b var1, j var2) { + this.b = var1; + this.a = var2; + } + + public void a(c var1, k var2, boolean var3) { + File var4 = this.a.b().a(var1); + b.a(this.b).add(var4); + } + + public void a(a.a.a.a.c.b var1) { + } +} diff --git a/plugins/java-decompiler/engine/testData/results/TestClassCast.dec b/plugins/java-decompiler/engine/testData/results/TestClassCast.dec new file mode 100644 index 000000000000..e09162ca0f5f --- /dev/null +++ b/plugins/java-decompiler/engine/testData/results/TestClassCast.dec @@ -0,0 +1,15 @@ +package pkg; + +import java.util.ArrayList; +import java.util.List; + +public class TestClassCast { + public void test(List var1) { + Object var2 = var1; + if(var1 != null) { + ((List)(var2 = new ArrayList(var1))).add("23"); + } + + System.out.println(((List)var2).size()); + } +} diff --git a/plugins/java-decompiler/engine/testData/results/TestClassFields.dec b/plugins/java-decompiler/engine/testData/results/TestClassFields.dec new file mode 100644 index 000000000000..749d828c2a71 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/results/TestClassFields.dec @@ -0,0 +1,10 @@ +package pkg; + +public class TestClassFields { + private static int[] sizes; + private static String[] names = new String[]{"name1", "name2"}; + + static { + sizes = new int[names.length]; + } +} diff --git a/plugins/java-decompiler/engine/testData/results/TestClassLambda.dec b/plugins/java-decompiler/engine/testData/results/TestClassLambda.dec new file mode 100644 index 000000000000..d0485d352461 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/results/TestClassLambda.dec @@ -0,0 +1,73 @@ +package pkg; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.OptionalInt; +import java.util.function.Consumer; +import java.util.function.IntBinaryOperator; +import java.util.function.Predicate; +import java.util.function.Supplier; + +public class TestClassLambda { + public int field = 0; + + public void testLambda() { + List var1 = Arrays.asList(new Integer[]{Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3), Integer.valueOf(4), Integer.valueOf(5), Integer.valueOf(6), Integer.valueOf(7)}); + int var2 = (int)Math.random(); + var1.forEach((var2x) -> { + int var3 = 2 * var2x.intValue(); + System.out.println(var3 + var2 + this.field); + }); + } + + public void testLambda1() { + int var1 = (int)Math.random(); + Runnable var2 = () -> { + System.out.println("hello1" + var1); + }; + Runnable var3 = () -> { + System.out.println("hello2" + var1); + }; + } + + public void testLambda2() { + reduce((var0, var1) -> { + return Math.max(var0, var1); + }); + } + + public void testLambda3() { + reduce(Math::max); + } + + public void testLambda4() { + reduce(TestClassLambda::localMax); + } + + public void testLambda5() { + String var1 = "abcd"; + function(var1::toString); + } + + public void testLambda6() { + ArrayList var1 = new ArrayList(); + int var2 = var1.size() * 2; + int var3 = var1.size() * 5; + var1.removeIf((var2x) -> { + return var2 >= var2x.length() && var2x.length() <= var3; + }); + } + + public static OptionalInt reduce(IntBinaryOperator var0) { + return null; + } + + public static String function(Supplier<String> var0) { + return (String)var0.get(); + } + + public static int localMax(int var0, int var1) { + return 0; + } +} diff --git a/plugins/java-decompiler/engine/testData/results/TestClassLoop.dec b/plugins/java-decompiler/engine/testData/results/TestClassLoop.dec new file mode 100644 index 000000000000..74b8bac5d5e7 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/results/TestClassLoop.dec @@ -0,0 +1,43 @@ +package pkg; + +public class TestClassLoop { + public static void testSimpleInfinite() { + while(true) { + System.out.println(); + } + } + + public static void testFinally() { + boolean var0 = Math.random() > 0.0D; + + while(true) { + try { + if(!var0) { + return; + } + } finally { + System.out.println("1"); + } + } + } + + public static void testFinallyContinue() { + boolean var0 = Math.random() > 0.0D; + + while(true) { + while(true) { + try { + System.out.println("1"); + break; + } finally { + if(var0) { + System.out.println("3"); + continue; + } + } + } + + System.out.println("4"); + } + } +} diff --git a/plugins/java-decompiler/engine/testData/results/TestClassNestedInitializer.dec b/plugins/java-decompiler/engine/testData/results/TestClassNestedInitializer.dec new file mode 100644 index 000000000000..585b01a0261c --- /dev/null +++ b/plugins/java-decompiler/engine/testData/results/TestClassNestedInitializer.dec @@ -0,0 +1,14 @@ +package pkg; + +public class TestClassNestedInitializer { + public String secret; + + public void test() { + TestClassNestedInitializer var1 = new TestClassNestedInitializer() { + { + this.secret = "one"; + } + }; + System.out.println(var1.secret); + } +} diff --git a/plugins/java-decompiler/engine/testData/results/TestClassSwitch.dec b/plugins/java-decompiler/engine/testData/results/TestClassSwitch.dec new file mode 100644 index 000000000000..50efbe9b16f9 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/results/TestClassSwitch.dec @@ -0,0 +1,14 @@ +package pkg; + +public class TestClassSwitch { + public void testCaseOrder(int var1) { + switch(var1) { + case 5: + System.out.println(5); + default: + return; + case 13: + System.out.println(13); + } + } +} diff --git a/plugins/java-decompiler/engine/testData/results/TestClassTypes.dec b/plugins/java-decompiler/engine/testData/results/TestClassTypes.dec new file mode 100644 index 000000000000..7a50473fc3e7 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/results/TestClassTypes.dec @@ -0,0 +1,49 @@ +package pkg; + +import java.util.ArrayList; +import java.util.List; + +public class TestClassTypes { + public void testBoolean() { + byte var1 = 0; + long var2 = System.currentTimeMillis(); + if(var2 % 2L > 0L) { + var1 = 1; + } else if(var2 % 3L > 0L) { + var1 = 2; + } + + if(var1 == 1) { + System.out.println(); + } + + } + + public boolean testBit(int var1) { + return (var1 & 1) == 1; + } + + public void testSwitchConsts(int var1) { + switch(var1) { + case 88: + System.out.println("1"); + break; + case 656: + System.out.println("2"); + break; + case 65201: + case 65489: + System.out.println("3"); + } + + } + + public void testAssignmentType(List var1) { + Object var2 = var1; + if(var1 != null) { + ((List)(var2 = new ArrayList(var1))).add("23"); + } + + System.out.println(((List)var2).size()); + } +} diff --git a/plugins/java-decompiler/engine/testData/results/TestClassVar.dec b/plugins/java-decompiler/engine/testData/results/TestClassVar.dec new file mode 100644 index 000000000000..4cfd27f7854d --- /dev/null +++ b/plugins/java-decompiler/engine/testData/results/TestClassVar.dec @@ -0,0 +1,40 @@ +package pkg; + +public class TestClassVar { + private boolean field_boolean = Math.random() > 0.0D; + public int field_int = 0; + + public void testFieldSSAU() { + for(int var1 = 0; var1 < 10; ++var1) { + try { + System.out.println(); + } finally { + if(this.field_boolean) { + System.out.println(); + } + + } + } + + } + + public Long testFieldSSAU1() { + return new Long((long)(this.field_int++)); + } + + public void testComplexPropagation() { + int var1 = 0; + + while(var1 < 10) { + int var2; + for(var2 = var1; var1 < 10 && var1 == 0; ++var1) { + ; + } + + if(var2 != var1) { + System.out.println(); + } + } + + } +} diff --git a/plugins/java-decompiler/engine/testData/results/TestCodeConstructs.dec b/plugins/java-decompiler/engine/testData/results/TestCodeConstructs.dec new file mode 100644 index 000000000000..eb9de8daa07a --- /dev/null +++ b/plugins/java-decompiler/engine/testData/results/TestCodeConstructs.dec @@ -0,0 +1,13 @@ +package pkg; + +class TestCodeConstructs { + private int count = 0; + + void expressions() { + (new String()).hashCode(); + } + + Integer fieldIncrement() { + return new Integer(this.count++); + } +} diff --git a/plugins/java-decompiler/engine/testData/results/TestConstants.dec b/plugins/java-decompiler/engine/testData/results/TestConstants.dec new file mode 100644 index 000000000000..216da8e98468 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/results/TestConstants.dec @@ -0,0 +1,73 @@ +package pkg; + +import java.util.Date; + +public class TestConstants { + static final boolean T = true; + static final boolean F = false; + static final char C0 = '\n'; + static final char C1 = 'a'; + static final char C2 = 'Ȁ'; + static final byte BMin = -128; + static final byte BMax = 127; + static final short SMin = -32768; + static final short SMax = 32767; + static final int IMin = -2147483648; + static final int IMax = 2147483647; + static final long LMin = -9223372036854775808L; + static final long LMax = 9223372036854775807L; + static final float FNan = 0.0F / 0.0; + static final float FNeg = -1.0F / 0.0; + static final float FPos = 1.0F / 0.0; + static final float FMin = 1.4E-45F; + static final float FMax = 3.4028235E38F; + static final double DNan = 0.0D / 0.0; + static final double DNeg = -1.0D / 0.0; + static final double DPos = 1.0D / 0.0; + static final double DMin = 4.9E-324D; + static final double DMax = 1.7976931348623157E308D; + + @TestConstants.A(byte.class) + void m1() { + } + + @TestConstants.A(char.class) + void m2() { + } + + @TestConstants.A(double.class) + void m3() { + } + + @TestConstants.A(float.class) + void m4() { + } + + @TestConstants.A(int.class) + void m5() { + } + + @TestConstants.A(long.class) + void m6() { + } + + @TestConstants.A(short.class) + void m7() { + } + + @TestConstants.A(boolean.class) + void m8() { + } + + @TestConstants.A(void.class) + void m9() { + } + + @TestConstants.A(Date.class) + void m10() { + } + + @interface A { + Class<?> value(); + } +} diff --git a/plugins/java-decompiler/engine/testData/results/TestDebugSymbols.dec b/plugins/java-decompiler/engine/testData/results/TestDebugSymbols.dec new file mode 100644 index 000000000000..42ae7a8c5513 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/results/TestDebugSymbols.dec @@ -0,0 +1,11 @@ +package pkg; + +class TestDebugSymbols { + private int m() { + String text = "text"; + long prolonged = 42L; + float decimated = (float)prolonged / 10.0F; + double doubled = (double)(2.0F * decimated); + return (text + ":" + prolonged + ":" + decimated + ":" + doubled).length(); + } +} diff --git a/plugins/java-decompiler/engine/testData/results/TestDeprecations.dec b/plugins/java-decompiler/engine/testData/results/TestDeprecations.dec new file mode 100644 index 000000000000..237ac9c72348 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/results/TestDeprecations.dec @@ -0,0 +1,27 @@ +package pkg; + +public class TestDeprecations { + /** @deprecated */ + public int byComment; + /** @deprecated */ + @Deprecated + public int byAnno; + + /** @deprecated */ + public void byComment() { + } + + /** @deprecated */ + @Deprecated + public void byAnno() { + } + + /** @deprecated */ + @Deprecated + public static class ByAnno { + } + + /** @deprecated */ + public static class ByComment { + } +} diff --git a/plugins/java-decompiler/engine/testData/results/TestEnum.dec b/plugins/java-decompiler/engine/testData/results/TestEnum.dec new file mode 100644 index 000000000000..b32a3d9a4f66 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/results/TestEnum.dec @@ -0,0 +1,27 @@ +package pkg; + +public enum TestEnum { + E1, + E2 { + public void m() { + } + }, + E3("-"), + E4("+") { + public void m() { + } + }; + + private String s; + + public void m() { + } + + private TestEnum() { + this((String)"?"); + } + + private TestEnum(@Deprecated String var3) { + this.s = var3; + } +} diff --git a/plugins/java-decompiler/engine/testData/results/TestExtendsList.dec b/plugins/java-decompiler/engine/testData/results/TestExtendsList.dec new file mode 100644 index 000000000000..b4aacf6e126a --- /dev/null +++ b/plugins/java-decompiler/engine/testData/results/TestExtendsList.dec @@ -0,0 +1,11 @@ +package pkg; + +public class TestExtendsList { + static <T extends Comparable<? super T>> T m1(T var0) { + return null; + } + + static <T extends Object & Comparable<? super T>> T m2(T var0) { + return null; + } +} diff --git a/plugins/java-decompiler/engine/testData/results/TestMethodParameters.dec b/plugins/java-decompiler/engine/testData/results/TestMethodParameters.dec new file mode 100644 index 000000000000..e4c4724d7a7c --- /dev/null +++ b/plugins/java-decompiler/engine/testData/results/TestMethodParameters.dec @@ -0,0 +1,42 @@ +package pkg; + +public class TestMethodParameters { + TestMethodParameters(@Deprecated int var1) { + } + + void m1(@Deprecated int var1) { + } + + static void m2(@Deprecated int var0) { + } + + void local() { + class Local { + Local(@Deprecated int var2) { + } + + void m(@Deprecated int var1) { + } + } + + } + + static class C2 { + C2(@Deprecated int var1) { + } + + void m1(@Deprecated int var1) { + } + + static void m2(@Deprecated int var0) { + } + } + + class C1 { + C1(@Deprecated int var2) { + } + + void m(@Deprecated int var1) { + } + } +} diff --git a/plugins/java-decompiler/engine/testData/src/pkg/TestClassCast.java b/plugins/java-decompiler/engine/testData/src/pkg/TestClassCast.java new file mode 100644 index 000000000000..a831e54c98c1 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/src/pkg/TestClassCast.java @@ -0,0 +1,28 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +import java.util.*; + +public class TestClassCast { + public void test(List list) { + List a = list; + if (a != null) { + (a = new ArrayList(a)).add("23"); + } + System.out.println(a.size()); + } +}
\ No newline at end of file diff --git a/plugins/java-decompiler/engine/testData/src/pkg/TestClassFields.java b/plugins/java-decompiler/engine/testData/src/pkg/TestClassFields.java new file mode 100644 index 000000000000..a1f2facaf41c --- /dev/null +++ b/plugins/java-decompiler/engine/testData/src/pkg/TestClassFields.java @@ -0,0 +1,28 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +public class TestClassFields { + + private static int[] sizes; + private static String[] names; + + static { + + names = new String[]{"name1", "name2"}; + sizes = new int[names.length]; + } +} diff --git a/plugins/java-decompiler/engine/testData/src/pkg/TestClassLambda.java b/plugins/java-decompiler/engine/testData/src/pkg/TestClassLambda.java new file mode 100644 index 000000000000..589766e36506 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/src/pkg/TestClassLambda.java @@ -0,0 +1,77 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +import java.util.*; +import java.util.function.IntBinaryOperator; +import java.util.function.Supplier; + +public class TestClassLambda { + + 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() { + int a = (int)Math.random(); + Runnable r1 = () -> { System.out.println("hello1" + a); }; + Runnable r2 = () -> { System.out.println("hello2" + a); }; + } + + public void testLambda2() { + reduce((left, right) -> Math.max(left, right)); + } + + public void testLambda3() { // IDEA-127301 + reduce(Math::max); + } + + public void testLambda4() { + 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; + } +} diff --git a/plugins/java-decompiler/engine/testData/src/pkg/TestClassLoop.java b/plugins/java-decompiler/engine/testData/src/pkg/TestClassLoop.java new file mode 100644 index 000000000000..0ecab7de08c3 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/src/pkg/TestClassLoop.java @@ -0,0 +1,61 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +public class TestClassLoop { + + public static void testSimpleInfinite() { + + while (true) { + 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() { + + boolean a = (Math.random() > 0); + + for (; ; ) { + try { + System.out.println("1"); + } + finally { + if (a) { + System.out.println("3"); + continue; + } + } + + System.out.println("4"); + } + } +} diff --git a/plugins/java-decompiler/engine/testData/src/pkg/TestClassNestedInitializer.java b/plugins/java-decompiler/engine/testData/src/pkg/TestClassNestedInitializer.java new file mode 100644 index 000000000000..ee8927aee89d --- /dev/null +++ b/plugins/java-decompiler/engine/testData/src/pkg/TestClassNestedInitializer.java @@ -0,0 +1,25 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +public class TestClassNestedInitializer { + public String secret; + + public void test() { + TestClassNestedInitializer obj = new TestClassNestedInitializer() { {secret = "one";} }; + System.out.println(obj.secret); + } +}
\ No newline at end of file diff --git a/plugins/java-decompiler/engine/testData/src/pkg/TestClassSwitch.java b/plugins/java-decompiler/engine/testData/src/pkg/TestClassSwitch.java new file mode 100644 index 000000000000..0c95d2530e3b --- /dev/null +++ b/plugins/java-decompiler/engine/testData/src/pkg/TestClassSwitch.java @@ -0,0 +1,30 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +public class TestClassSwitch { + + public void testCaseOrder(int a) { + + switch (a) { + case 13: + System.out.println(13); + return; + case 5: + System.out.println(5); + } + } +} diff --git a/plugins/java-decompiler/engine/testData/src/pkg/TestClassTypes.java b/plugins/java-decompiler/engine/testData/src/pkg/TestClassTypes.java new file mode 100644 index 000000000000..a745aebef600 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/src/pkg/TestClassTypes.java @@ -0,0 +1,69 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +import java.util.ArrayList; +import java.util.List; + +public class TestClassTypes { + + public void testBoolean() { + + byte var7 = 0; + long time = System.currentTimeMillis(); + + if (time % 2 > 0) { + var7 = 1; + } + else if (time % 3 > 0) { + var7 = 2; + } + + if (var7 == 1) { + System.out.println(); + } + } + + public boolean testBit(int var0) { + return (var0 & 1) == 1; + } + + public void testSwitchConsts(int a) { + + switch (a) { + case 88: + System.out.println("1"); + break; + case 656: + System.out.println("2"); + break; + case 65201: + case 65489: + System.out.println("3"); + } + } + + public void testAssignmentType(List list) { + + List a = list; + + if (a != null) { + (a = new ArrayList(a)).add("23"); + } + + System.out.println(a.size()); + } +} diff --git a/plugins/java-decompiler/engine/testData/src/pkg/TestClassVar.java b/plugins/java-decompiler/engine/testData/src/pkg/TestClassVar.java new file mode 100644 index 000000000000..09dcded92d66 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/src/pkg/TestClassVar.java @@ -0,0 +1,59 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + + +public class TestClassVar { + + private boolean field_boolean = (Math.random() > 0); + public int field_int = 0; + + public void testFieldSSAU() { + + for (int i = 0; i < 10; i++) { + + try { + System.out.println(); + } + finally { + 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) { + + int b = a; + + for (; a < 10 && a == 0; a++) { + } + + if (b != a) { + System.out.println(); + } + } + } +} diff --git a/plugins/java-decompiler/engine/testData/src/pkg/TestCodeConstructs.java b/plugins/java-decompiler/engine/testData/src/pkg/TestCodeConstructs.java new file mode 100644 index 000000000000..fd903e4add33 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/src/pkg/TestCodeConstructs.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +class TestCodeConstructs { + void expressions() { + new String().hashCode(); + } + + private int count = 0; + Integer fieldIncrement() { + return new Integer(count++); + } +}
\ No newline at end of file diff --git a/plugins/java-decompiler/engine/testData/src/pkg/TestConstants.java b/plugins/java-decompiler/engine/testData/src/pkg/TestConstants.java new file mode 100644 index 000000000000..09b5419fc3e4 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/src/pkg/TestConstants.java @@ -0,0 +1,64 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +public class TestConstants { + static final boolean T = true; + static final boolean F = false; + + static final char C0 = '\n'; + static final char C1 = 'a'; + static final char C2 = 512; + + static final byte BMin = Byte.MIN_VALUE; + static final byte BMax = Byte.MAX_VALUE; + + static final short SMin = Short.MIN_VALUE; + static final short SMax = Short.MAX_VALUE; + + static final int IMin = Integer.MIN_VALUE; + static final int IMax = Integer.MAX_VALUE; + + static final long LMin = Long.MIN_VALUE; + static final long LMax = Long.MAX_VALUE; + + static final float FNan = Float.NaN; + static final float FNeg = Float.NEGATIVE_INFINITY; + static final float FPos = Float.POSITIVE_INFINITY; + static final float FMin = Float.MIN_VALUE; + static final float FMax = Float.MAX_VALUE; + + static final double DNan = Double.NaN; + static final double DNeg = Double.NEGATIVE_INFINITY; + static final double DPos = Double.POSITIVE_INFINITY; + static final double DMin = Double.MIN_VALUE; + static final double DMax = Double.MAX_VALUE; + + static @interface A { + Class<?> value(); + } + + @A(byte.class) void m1() { } + @A(char.class) void m2() { } + @A(double.class) void m3() { } + @A(float.class) void m4() { } + @A(int.class) void m5() { } + @A(long.class) void m6() { } + @A(short.class) void m7() { } + @A(boolean.class) void m8() { } + @A(void.class) void m9() { } + @A(java.util.Date.class) void m10() { } +}
\ No newline at end of file diff --git a/plugins/java-decompiler/engine/testData/src/pkg/TestDebugSymbols.java b/plugins/java-decompiler/engine/testData/src/pkg/TestDebugSymbols.java new file mode 100644 index 000000000000..167351031dc8 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/src/pkg/TestDebugSymbols.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +// need to be compiled with debug info +class TestDebugSymbols { + private int m() { + String text = "text"; + long prolonged = 42L; + float decimated = prolonged / 10.0f; + double doubled = 2 * decimated; + return (text + ":" + prolonged + ":" + decimated + ":" + doubled).length(); + } +} diff --git a/plugins/java-decompiler/engine/testData/src/pkg/TestDeprecations.java b/plugins/java-decompiler/engine/testData/src/pkg/TestDeprecations.java new file mode 100644 index 000000000000..18ba0b5f10a6 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/src/pkg/TestDeprecations.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +public class TestDeprecations { + /** @deprecated */ + public int byComment; + + @Deprecated + public int byAnno; + + /** @deprecated */ + public void byComment() { } + + @Deprecated + public void byAnno() { } + + /** @deprecated */ + public static class ByComment { } + + @Deprecated + public static class ByAnno { } +}
\ No newline at end of file diff --git a/plugins/java-decompiler/engine/testData/src/pkg/TestEnum.java b/plugins/java-decompiler/engine/testData/src/pkg/TestEnum.java new file mode 100644 index 000000000000..43fab48355f2 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/src/pkg/TestEnum.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +public enum TestEnum { + E1, + E2() { + @Override + public void m() { } + }, + E3("-"), + E4("+") { + @Override + public void m() { } + }; + + public void m() { } + + private String s; + + private TestEnum() { this("?"); } + private TestEnum(@Deprecated String s) { this.s = s; } +} diff --git a/plugins/java-decompiler/engine/testData/src/pkg/TestExtendsList.java b/plugins/java-decompiler/engine/testData/src/pkg/TestExtendsList.java new file mode 100644 index 000000000000..812f83689ba6 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/src/pkg/TestExtendsList.java @@ -0,0 +1,26 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +public class TestExtendsList { + static <T extends Comparable<? super T>> T m1(T t) { + return null; + } + + static <T extends Object & Comparable<? super T>> T m2(T t) { + return null; + } +}
\ No newline at end of file diff --git a/plugins/java-decompiler/engine/testData/src/pkg/TestMethodParameters.java b/plugins/java-decompiler/engine/testData/src/pkg/TestMethodParameters.java new file mode 100644 index 000000000000..b9739e9cfda4 --- /dev/null +++ b/plugins/java-decompiler/engine/testData/src/pkg/TestMethodParameters.java @@ -0,0 +1,40 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +public class TestMethodParameters { + TestMethodParameters(@Deprecated int p01) { } + void m1(@Deprecated int p02) { } + static void m2(@Deprecated int p03) { } + + class C1 { + C1(@Deprecated int p11) { } + void m(@Deprecated int p12) { } + } + + static class C2 { + C2(@Deprecated int p21) { } + void m1(@Deprecated int p22) { } + static void m2(@Deprecated int p23) { } + } + + void local() { + class Local { + Local(@Deprecated int p31) { } + void m(@Deprecated int p32) { } + } + } +}
\ No newline at end of file |