From 4de826363f1747e03011681ada0ecf82d0c4333f Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Thu, 27 Apr 2017 15:21:44 +0300 Subject: [PATCH] (byte) type cast in constructor calls --- .../modules/decompiler/exps/NewExprent.java | 2 +- testData/classes/pkg/TestPrimitives.class | Bin 2731 -> 2825 bytes testData/results/TestPrimitives.dec | 11 +++++++++++ testData/src/pkg/TestPrimitives.java | 4 ++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java index d608be4..d43388c 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java @@ -340,7 +340,7 @@ public class NewExprent extends Exprent { buf.append(", "); } - ExprProcessor.getCastedExprent(expr, leftType, buf, indent, true, tracer); + ExprProcessor.getCastedExprent(expr, leftType, buf, indent, true, false, true, tracer); firstParam = false; } diff --git a/testData/classes/pkg/TestPrimitives.class b/testData/classes/pkg/TestPrimitives.class index a2e23ba7c71e119a3f73fa320e5092fb1e1cba65..74260de28c361a904942339b0eedadf93023d8b4 100644 GIT binary patch literal 2825 zcmaKt`&S!P5XZkuLN+W51QH%f6)GTUN=a2zDp*<`sUQLxq(XfyVS%L~i_3;e@qzF6 zqt>_9pZw9&bM%KaN00si{ullY{_b(+X0t4hZO+N=otZnIJ9qBf*}wn${VxE0_(?%M z78KlzOZ<42AJ6gQ`AV|$Z-=E9foG!2txM$67=mcg>4 z4BD&4ri9q!#^sgdtiEZ_SjM_x8(aG3fQ0adW#sJh*{lRr42MlKt7|!0CBDFmNsIJf zkWf{!Zrij@Fg`3y!x9vsPOqAl&HA*^({fU}%pT7P%eb%@WEn5RCe7RmJ52}^MIcR- zfvK#i3AdE6Et4%Jp;|09YUagmgYi*eTq5IWnK`nmSlmM zVlyPuKEfnByC4MxA0mYaokWVbMl3z0S(bT4rxmL+W^U8A@)_Ht^^~-kw=#Ol;8Te1 zPjc^?wxy})MqEV_r&TBTiYW2>0Lw2b#ve1H#C%-~5LeWc~b;6TUs`+Pg5NNamRXVo;FSx|uJsgn{s#Q^YS-O*rN3gljJ;zbHR8hKAo;6vyKN-#i zi^Wskc|yB?f92cONVm;HEUDd)#aZy((=s+^u7xh3XSQn@z;SAZ^`gZ_An~oB=LwRN z^p@ydnYab%R~l3xLC=s-25^$bYH0#`aEc@ey{>c7nYWe*7EqCh>=Y14)JswUK_OHo zVh9xwPBc^%ppZ~qKusdDP(bZ(sB4JGf1-XqkSL&`h-i8~NTXO0jp_MH8Z{NsoSqNS zsHKQI(nZ`^KY|u?P=otX2Lln$F4o*#P*0$}a0;er z7Zvnw=9rEJMNF+6(7`1YF)fNF#00Xb>hOO_qYaJSNaM%uDyV9Z#$O82QB632*)HxxDdTEpx0+ayXTN(+K&{CD6^fN1_*f zoP{OM;4EkT5(60IY)E3*!a0cu&P!atMIT0dxFj)(%RXF@7{j>41g`pUP2xJD0+aJ! zrVYE(Q&d%q5`_w^R#=0zioU-_p%xny>aba%0b3QCuw7vXb_(23xQSc#XHQ9V5B3V& zR=9(^3j45M;2w+n3avOGFva45LK_YWJY?}m;IYCJJQaAR@Ek7;c#69?^a$8o@sdTK zz%+|j0}!!Nr9-m-XSASW^qw%U8`usNEQ*&iAWS%abBu+=y=(!21}oH1JcG=6@v zV1WJ{#Q-UbR)f~`(yuV)De)jk(W_sYSVg&t6`&MlqzshDVEae{J3)zeoO_EzR8OR7mlc!=4S?NOV!fs8HubHGXEZ3TxV$PCs`lVX$ z5%Y^D;RLz_ak3&#noA~U5lv-l9juvP>CVJib`u*lEqfCG_pNiVX$h9DSe#AvElr|D mF^@Mm*ks@KxW^;XZ}FTmVNz^D22DN(%?>6v(eIF+M#n$OO@>_n diff --git a/testData/results/TestPrimitives.dec b/testData/results/TestPrimitives.dec index de8a420..03026fa 100644 --- a/testData/results/TestPrimitives.dec +++ b/testData/results/TestPrimitives.dec @@ -65,6 +65,10 @@ public class TestPrimitives { this.printByte((byte)this.getInt());// 68 this.printShort((short)this.getInt());// 69 }// 70 + + public void constructor() { + new Byte((byte)1);// 73 + }// 74 } class 'pkg/TestPrimitives' { @@ -201,6 +205,11 @@ class 'pkg/TestPrimitives' { f 65 12 66 } + + method 'constructor ()V' { + 4 69 + 9 70 + } } Lines mapping: @@ -237,3 +246,5 @@ Lines mapping: 68 <-> 65 69 <-> 66 70 <-> 67 +73 <-> 70 +74 <-> 71 diff --git a/testData/src/pkg/TestPrimitives.java b/testData/src/pkg/TestPrimitives.java index 1ecb5e7..68b6c44 100644 --- a/testData/src/pkg/TestPrimitives.java +++ b/testData/src/pkg/TestPrimitives.java @@ -68,4 +68,8 @@ public class TestPrimitives { printByte((byte)getInt()); printShort((short)getInt()); } + + public void constructor() { + new Byte((byte)1); + } }