From ae2c64a157db0779ffb4d1dd1382ee0bf0cc07f3 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Mon, 2 Mar 2015 21:00:57 +0300 Subject: [PATCH] tests for IDEA-135314 Inner classes constructors calls decompiled incorrectly --- .../java/decompiler/SingleClassesTest.java | 1 + testData/classes/pkg/TestInnerLocal.class | Bin 640 -> 795 bytes .../pkg/TestInnerLocalPkg$1Inner.class | Bin 0 -> 417 bytes .../pkg/TestInnerLocalPkg$2Inner.class | Bin 0 -> 492 bytes .../pkg/TestInnerLocalPkg$Inner1.class | Bin 0 -> 447 bytes ...erLocalPkg$Inner1Static$Inner2Static.class | Bin 0 -> 454 bytes .../pkg/TestInnerLocalPkg$Inner1Static.class | Bin 0 -> 454 bytes testData/classes/pkg/TestInnerLocalPkg.class | Bin 0 -> 847 bytes testData/results/TestInnerLocal.dec | 35 ++++-- testData/results/TestInnerLocalPkg.dec | 115 ++++++++++++++++++ testData/src/pkg/TestInnerLocal.java | 10 +- testData/src/pkg/TestInnerLocalPkg.java | 65 ++++++++++ 12 files changed, 211 insertions(+), 15 deletions(-) create mode 100644 testData/classes/pkg/TestInnerLocalPkg$1Inner.class create mode 100644 testData/classes/pkg/TestInnerLocalPkg$2Inner.class create mode 100644 testData/classes/pkg/TestInnerLocalPkg$Inner1.class create mode 100644 testData/classes/pkg/TestInnerLocalPkg$Inner1Static$Inner2Static.class create mode 100644 testData/classes/pkg/TestInnerLocalPkg$Inner1Static.class create mode 100644 testData/classes/pkg/TestInnerLocalPkg.class create mode 100644 testData/results/TestInnerLocalPkg.dec create mode 100644 testData/src/pkg/TestInnerLocalPkg.java diff --git a/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/test/org/jetbrains/java/decompiler/SingleClassesTest.java index a65ab26..d8f6bee 100644 --- a/test/org/jetbrains/java/decompiler/SingleClassesTest.java +++ b/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -58,5 +58,6 @@ public class SingleClassesTest extends SingleClassesTestBase { @Test public void testAnonymousClass() { doTest("pkg/TestAnonymousClass"); } @Test public void testThrowException() { doTest("pkg/TestThrowException"); } @Test public void testInnerLocal() { doTest("pkg/TestInnerLocal"); } + @Test public void testInnerLocalPkg() { doTest("pkg/TestInnerLocalPkg"); } @Test public void testInnerSignature() { doTest("pkg/TestInnerSignature"); } } diff --git a/testData/classes/pkg/TestInnerLocal.class b/testData/classes/pkg/TestInnerLocal.class index c939b5e2ed2b0c985c08fb8e7eefdfe64610f36d..cc89241c2027be4d769d1d5ca14edaceb3a05bdf 100644 GIT binary patch literal 795 zcmaJ<%TB^T6g>mfLIEE%GwMIwnG;71wH zw1Pp6UCe!*Ip^N#egAlU18|Izfkk9=WW(4p5Wu#M9Rr%Oy9RV+_Y6d^uOn|Ds%$~W zfk5osapa)daxK^HPQyme8V==9V8O2nXr9BwiS5|#sX)*y-3Wvl{W~eJ)U+LWIeO~I z!L`-tF|+K-q3e@gNcW+CCt#@5ENJydgRVTY6*zg#iYL(Qcdg#hqxEdXkVHx#JzvUK zzxoI%GKDD$WPV`$o~IL;|5WoHv^ItMZ!rshYS%op5;cD}=8Fm}&dc#7)HIcz<=j`U zI*+pJ@~+wZPPW{E?cCSZYZlDr{O$T*IOGuL&sJX$d_1IhrWxgE1+7*dL%h%tSmmkK z0a!r@H7>x~4Bp^%_3ca$XeWYWgl;F$Ja2)X?s?(cZ=wV#fDICEk|cv|WGS&eBW$s* z^baS9w9AUom}89k$=ILdt6Wx~z|}n9Fh%UbL>VRazQKHelFPJZqBM@bgfNkDP6f^c NBs`37bs}OlE#rnS)<}z zl}(Lf@A1{#!@l?HP#ph33e>9qA?Kaq?eN9D9*u^RoAIFkd>V$$uG@E?27=7iU)F2> zQqulH8gH661ZG0O9rOpx9I8-NeG2(vAV|^&SAq=@v=BpT-F`tlu=or{FKJE@x&II4 z370q~y@qNWBX^_{GpJrYz@i)28REF))(ra$WSId~f-z_gw2+|gu%`HS!=6z8059t< AyZ`_I diff --git a/testData/classes/pkg/TestInnerLocalPkg$1Inner.class b/testData/classes/pkg/TestInnerLocalPkg$1Inner.class new file mode 100644 index 0000000000000000000000000000000000000000..eedffa20d12fcd09587129c47507995b0a431940 GIT binary patch literal 417 zcmZutO-sW-5Pg%Tjg8UPYHJG~Ja}j$7zA&Mm!crV4@l{KlP)oB+(@z&|CR?4Jop3r zQQ{;D9x4m-wQt_Mna{8H4*(|^*f7y{{ykY-XY7U>AJ{R%z;J5cVDyvA05Sa9r^b>c8Hp{5TawAqztLZ=2h2 zE+fr5{7b}8&FTUzbQ1ljAk>DVDfan9CZCKErIIQl7PiKfCTA`Tet_-1f!xDa7%vsZ iX1mF~;7v^Q89U%?opS>YHrSi|-@*<@HglE8ZQvVdKU!n} literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestInnerLocalPkg$2Inner.class b/testData/classes/pkg/TestInnerLocalPkg$2Inner.class new file mode 100644 index 0000000000000000000000000000000000000000..5a1dcc4781e9ab6efe9d2a011613318ef7baa77a GIT binary patch literal 492 zcmZ`#%TB^j5Iw`IQY%yx@PUbmm;e%Mj601RqKQd;BoOwc+(4n;n)YJ+Ef>VZg&*KY z8K>361-O|rGk509x##oi{R6-m_VUPJLq`^yaaPt)(XdUR7edLNIM0sdJ91=oRp`ml zIU%RUUQ|CJRPCqf$m)qm-AE}yJ8&KUVVaCwc+yjsgm&YfnMLAepOEPULqRCoo)mYp z$AJiY&cNr6-VJ7jf0_v9Rs_l8CXHyfF5T#XoT8Q z;q}wxAB5~L8VPoMCyGQwF#pWBA54U+2<4?jtXHusKOzX}MzfE7_BP9gr(nh!0Mm?B zafhvDX{#I!t}LENGZtG%b5QFIsaAWA^lLJ>#<7q*AMk3O^Fyu*+)bg##NZ?AC}E2; Koe49HRp1-R18sx= literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestInnerLocalPkg$Inner1.class b/testData/classes/pkg/TestInnerLocalPkg$Inner1.class new file mode 100644 index 0000000000000000000000000000000000000000..9d548f11d7c6c7f69253492d20f9ce1f15b47aec GIT binary patch literal 447 zcmZ`#!AiqG5Ph4Zjg7I1)wU`gJoHdwF)esgyc7f>sLl<}!`X z8S3SuEP6wRZty&h{i!I*>ogU4kVQPXn^%+znac8#VbK4FvnqUi&tQzR2f^S3G8H$A zr%>cm9wyYWCfOp7#FbP#$e(9nmVkz^=eJ;YA?| z2KR66+i)hLl0ok)gYC6?IHJSV=$aZ_H5zbTWrjL*M{=}D(Wc5LhECb>PL^QaJ2Y>w hg#K0$w?f36F^0q^<@B9m*ET7}!A@_yGqFV;KMd literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestInnerLocalPkg$Inner1Static$Inner2Static.class b/testData/classes/pkg/TestInnerLocalPkg$Inner1Static$Inner2Static.class new file mode 100644 index 0000000000000000000000000000000000000000..54d59e36bd87cc1e43e3370614d4ab0386032f76 GIT binary patch literal 454 zcmaiw!AiqG5QhJ0YGYz-YqV95iib9WLGfnor634Jg_hnoaS3VTwj^8ewLFO6!3Xf6 z#7Rn3s2~fw^UeJK4l^I0Z|?xkv2UY{O$!F9Ch8`32=qj7`(yDa{6wh8ALukz(FLK> ziB+t-ghp$%+#V6iz3IIq)cUcKH}i);rb7`VoUsSfc^b;AIEUs?X8Kwwnf9llNbV-l zN#4wXiH3tUR7~s={MjV(SCmJE?{uJrj>83+J^N7=k#fu literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestInnerLocalPkg$Inner1Static.class b/testData/classes/pkg/TestInnerLocalPkg$Inner1Static.class new file mode 100644 index 0000000000000000000000000000000000000000..262b686c30da2d1cca9da82d1ee68d954ca1d39d GIT binary patch literal 454 zcmah_!AiqG5Ph4(rirnw(Nw*Oc&HH!im0G?DF{MPA;tS9E+K82NU{}w%Yz6W`~W{n zoJ68X1zFggH~Zeqn|c3ueFJca4HFuc4XChntm<$WtjjDD#eN{UOri!3Q(l&$)X{G; z2MvKeGT8o@KX5PQS?mR}NV52pp>>vIi9Ba;2J_!Lw+z}azY`2yKgq<^Y#NGU#KV*_ zW{}T{NL(Zp=#NAxYfpY2@$_aA?^Vq#EMm=q0aM31!`A&I_U4$|zh~+FxV#R>B9aW= z|GKXt-}9=2%DeNY4x6+|jW)~BtE|-#Bc~Q+mI%2}=m4hs0_N^MLwTw>9lATD1&&C6 aOxhFTbqOm}sYS0%k%|>8pbed(HjGaLyJ?94 literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestInnerLocalPkg.class b/testData/classes/pkg/TestInnerLocalPkg.class new file mode 100644 index 0000000000000000000000000000000000000000..7535849415a902d2493e0be9fb679db723b44f00 GIT binary patch literal 847 zcmah{+fKqj5Iqaj(u$%eUQt9*3mA#UH;peOCMI}EFcKdNZm^2QK=r?TGLgg&@S}`p zTfrD>+)Z~bd*dHQ(Y zklhQr(WYm@lRYmWJ(1o`=UTv2uAx!uJa(J%$Wh>#3*Pt-R69+(eSX*4zO|q11g0=8 zka@Ukm46}fJ6{>a6s>}83ao}hgCYhcmj4Ik{fON`M9`z5`A0&#evrz<`ZMVu6M=MS z4s4sMyWF$XM=2<^ z;tRwx75)vLYJ@;ojH6{>b_lO9T&-*$k*ien1+jV`ny-ye(|s*o|0YV20$3zrh9pZ^ z<`$S664rRH-Y@lGToo0g`GavZa3(^@XE@-%Cdb)gF$Juk$X#OY^YllsfC (LTestInnerLocal;Ljava/lang/String;)V' { - b 18 + b 20 } } class 'TestInnerLocal$Inner1Static' { method ' (Ljava/lang/String;)V' { - 6 29 + 6 34 } } class 'TestInnerLocal$Inner1Static$Inner2Static' { method ' (Ljava/lang/String;)V' { - 6 36 + 6 41 } } class 'TestInnerLocal$Inner1' { method ' (LTestInnerLocal;Ljava/lang/String;)V' { - b 45 + b 50 } } Lines mapping: 22 <-> 7 25 <-> 11 -34 <-> 19 -37 <-> 23 -46 <-> 46 -53 <-> 30 -59 <-> 37 +26 <-> 12 +27 <-> 13 +34 <-> 21 +37 <-> 25 +38 <-> 26 +39 <-> 27 +40 <-> 28 +46 <-> 51 +53 <-> 35 +59 <-> 42 diff --git a/testData/results/TestInnerLocalPkg.dec b/testData/results/TestInnerLocalPkg.dec new file mode 100644 index 0000000..5590d8a --- /dev/null +++ b/testData/results/TestInnerLocalPkg.dec @@ -0,0 +1,115 @@ +package pkg; + +public class TestInnerLocalPkg { + public static void testStaticMethod() { + class Inner { + final String x; + + public Inner(String var1) { + this.x = var1;// 24 + } + } + + new Inner("test");// 27 + new TestInnerLocalPkg.Inner1Static("test");// 28 + new TestInnerLocalPkg.Inner1Static.Inner2Static("test");// 29 + } + + public void testMethod() { + class Inner { + final String x; + + public Inner(String var2) { + this.x = var2;// 36 + } + } + + new Inner("test");// 39 + new TestInnerLocalPkg.Inner1Static("test");// 40 + new TestInnerLocalPkg.Inner1("test");// 41 + new TestInnerLocalPkg.Inner1Static.Inner2Static("test");// 42 + } + + static class Inner1Static { + final String x; + + public Inner1Static(String var1) { + this.x = var1;// 55 + } + + public static class Inner2Static { + final String x; + + public Inner2Static(String var1) { + this.x = var1;// 61 + } + } + } + + class Inner1 { + final String x; + + public Inner1(String var2) { + this.x = var2;// 48 + } + } +} + +class 'pkg/TestInnerLocalPkg$1Inner' { + method ' (Ljava/lang/String;)V' { + 6 8 + } +} + +class 'pkg/TestInnerLocalPkg' { + method 'testStaticMethod ()V' { + 4 12 + e 13 + 18 14 + } + + method 'testMethod ()V' { + 5 26 + f 27 + 1a 28 + 24 29 + } +} + +class 'pkg/TestInnerLocalPkg$2Inner' { + method ' (Lpkg/TestInnerLocalPkg;Ljava/lang/String;)V' { + b 22 + } +} + +class 'pkg/TestInnerLocalPkg$Inner1Static' { + method ' (Ljava/lang/String;)V' { + 6 36 + } +} + +class 'pkg/TestInnerLocalPkg$Inner1Static$Inner2Static' { + method ' (Ljava/lang/String;)V' { + 6 43 + } +} + +class 'pkg/TestInnerLocalPkg$Inner1' { + method ' (Lpkg/TestInnerLocalPkg;Ljava/lang/String;)V' { + b 52 + } +} + +Lines mapping: +24 <-> 9 +27 <-> 13 +28 <-> 14 +29 <-> 15 +36 <-> 23 +39 <-> 27 +40 <-> 28 +41 <-> 29 +42 <-> 30 +48 <-> 53 +55 <-> 37 +61 <-> 44 diff --git a/testData/src/pkg/TestInnerLocal.java b/testData/src/pkg/TestInnerLocal.java index 8eb8952..f0e9565 100644 --- a/testData/src/pkg/TestInnerLocal.java +++ b/testData/src/pkg/TestInnerLocal.java @@ -23,8 +23,8 @@ public class TestInnerLocal { } } new Inner("test"); - //new Inner1Static("test"); - //new Inner1Static.Inner2Static("test"); + new Inner1Static("test"); + new Inner1Static.Inner2Static("test"); } public void testMethod() { @@ -35,9 +35,9 @@ public class TestInnerLocal { } } new Inner("test"); - //new Inner1Static("test"); - //new Inner1("test"); - //new Inner1Static.Inner2Static("test"); + new Inner1Static("test"); + new Inner1("test"); + new Inner1Static.Inner2Static("test"); } class Inner1 { diff --git a/testData/src/pkg/TestInnerLocalPkg.java b/testData/src/pkg/TestInnerLocalPkg.java new file mode 100644 index 0000000..cc3b2b4 --- /dev/null +++ b/testData/src/pkg/TestInnerLocalPkg.java @@ -0,0 +1,65 @@ +/* + * 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 TestInnerLocalPkg { + public static void testStaticMethod() { + class Inner { + final String x; + public Inner(String x) { + this.x = x; + } + } + new Inner("test"); + new Inner1Static("test"); + new Inner1Static.Inner2Static("test"); + } + + public void testMethod() { + class Inner { + final String x; + public Inner(String x) { + this.x = x; + } + } + new Inner("test"); + new Inner1Static("test"); + new Inner1("test"); + new Inner1Static.Inner2Static("test"); + } + + class Inner1 { + final String x; + public Inner1(String x) { + this.x = x; + } + } + + static class Inner1Static { + final String x; + public Inner1Static(String x) { + this.x = x; + } + + public static class Inner2Static { + final String x; + public Inner2Static(String x) { + this.x = x; + } + } + } +} \ No newline at end of file