From 6713b9c495e32b500ba5c0dc7facaec9e0bbcccb Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Tue, 17 Jan 2017 20:46:58 +0300 Subject: [PATCH] test for anonymous class with params --- .../java/decompiler/SingleClassesTest.java | 1 + .../classes/pkg/TestAnonymousParams$1.class | Bin 0 -> 771 bytes .../classes/pkg/TestAnonymousParams.class | Bin 0 -> 749 bytes testData/results/TestAnonymousParams.dec | 36 ++++++++++++++++++ testData/src/pkg/TestAnonymousParams.java | 32 ++++++++++++++++ 5 files changed, 69 insertions(+) create mode 100644 testData/classes/pkg/TestAnonymousParams$1.class create mode 100644 testData/classes/pkg/TestAnonymousParams.class create mode 100644 testData/results/TestAnonymousParams.dec create mode 100644 testData/src/pkg/TestAnonymousParams.java diff --git a/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/test/org/jetbrains/java/decompiler/SingleClassesTest.java index 7c1cc33..7a69a8e 100644 --- a/test/org/jetbrains/java/decompiler/SingleClassesTest.java +++ b/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -96,6 +96,7 @@ public class SingleClassesTest { @Test public void testAsserts() { doTest("pkg/TestAsserts"); } @Test public void testLocalsNames() { doTest("pkg/TestLocalsNames"); } @Test public void testAnonymousParamNames() { doTest("pkg/TestAnonymousParamNames"); } + @Test public void testAnonymousParams() { doTest("pkg/TestAnonymousParams"); } private void doTest(String testFile, String... companionFiles) { ConsoleDecompiler decompiler = fixture.getDecompiler(); diff --git a/testData/classes/pkg/TestAnonymousParams$1.class b/testData/classes/pkg/TestAnonymousParams$1.class new file mode 100644 index 0000000000000000000000000000000000000000..dccd219da7f3606a18053add2e5edc0c9b0e936e GIT binary patch literal 771 zcmZ`%!EVz)5Pj=7F%5>gEu|@;5U7D9AVLwhA|zB5$xP)!PLO&;Jr;{!X*hU$%WdKxpPf9l4f_+2wh zZLZDnTUDIcQGm@5F&>1tf`t$@1R?5p$TiN{V!XxL<%-y@P}zTr5?HycCGY-96j+FN=du|h6^8(5`x+&xCFR_%U;_n8+D{|K8U hVfY7dL3ooGpP4nbX_WYN+$wWT+-3_WoIjhM-)~lVs&fDU literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestAnonymousParams.class b/testData/classes/pkg/TestAnonymousParams.class new file mode 100644 index 0000000000000000000000000000000000000000..0946b63019f38000bada2e6df2089716088d128d GIT binary patch literal 749 zcmZ`%T~8B16g{(Dy1HGV3j(d6e27wNbffVNV`7LVn>1ho!T2~W0}gIyn%%9@pXG}r zn)n0!QO2`dU5V03X71dtbMLt`KYo7w4&W)aeblkyVbzC&+dl4K&BMBf4S^swMx}d+ z%rcb;)Sqdi^XCG!&d#xbyJt_7z+6uowLc#AReB`*2`%$IJCMn-Om(6EHoEycO^kML z^!_Y5Qd$1OSo3LU$JuL{%3-!k*i&m6(dnJb4>Hm=ip^-8ALgl&!`-+j>1ZRcc%@%J zNbXo5Jk?3A(o4w#D^<>`f1NDszx+5*qg-2)dDx_WXvgV5F_dgtS2X*m=rF)FTxY*i z2yHzs0`7X)3UCki1(v4-3N%Z?i8N=?LH}G0a)E_v1_xDh0#7 13 +27 <-> 11 +30 <-> 14 +31 <-> 15 diff --git a/testData/src/pkg/TestAnonymousParams.java b/testData/src/pkg/TestAnonymousParams.java new file mode 100644 index 0000000..55e58bf --- /dev/null +++ b/testData/src/pkg/TestAnonymousParams.java @@ -0,0 +1,32 @@ +/* + * Copyright 2000-2016 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.io.FilterInputStream; +import java.io.IOException; +import java.io.InputStream; + +public class TestAnonymousParams { + void foo(InputStream in, int a) throws IOException { + FilterInputStream filterInputStream = new FilterInputStream(in) { + @Override + public int read() throws IOException { + return a; + } + }; + filterInputStream.read(); + } +}