From 4ee8ad716d227fc2bd1abc756f20c888e1695759 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Thu, 25 Dec 2014 21:36:19 +0300 Subject: [PATCH] decompiler: major line numbers fixes --- .../java/decompiler/main/ClassWriter.java | 15 +- .../modules/decompiler/exps/VarExprent.java | 1 + .../modules/decompiler/stats/IfStatement.java | 5 +- .../BytecodeToSourceMappingTest.java | 36 ----- .../java/decompiler/SingleClassesTest.java | 18 +++ .../classes/pkg/TestAnonymousClass$1.class | Bin 0 -> 553 bytes .../classes/pkg/TestAnonymousClass$2.class | Bin 0 -> 386 bytes .../classes/pkg/TestAnonymousClass$3.class | Bin 0 -> 386 bytes .../classes/pkg/TestAnonymousClass$4.class | Bin 0 -> 386 bytes .../classes/pkg/TestAnonymousClass$I.class | Bin 0 -> 254 bytes .../pkg/TestAnonymousClass$Inner$1.class | Bin 0 -> 442 bytes .../pkg/TestAnonymousClass$Inner.class | Bin 0 -> 443 bytes testData/classes/pkg/TestAnonymousClass.class | Bin 0 -> 1113 bytes .../classes/pkg/TestDeprecations$ByAnno.class | Bin 367 -> 453 bytes .../pkg/TestDeprecations$ByComment.class | Bin 308 -> 394 bytes testData/classes/pkg/TestDeprecations.class | Bin 576 -> 665 bytes .../classes/pkg/TestLocalClass$1Local.class | Bin 0 -> 447 bytes testData/classes/pkg/TestLocalClass.class | Bin 0 -> 496 bytes .../classes/pkg/TestThrowException$1.class | Bin 0 -> 481 bytes testData/classes/pkg/TestThrowException.class | Bin 0 -> 530 bytes .../classes/pkg/TestTryCatchFinally.class | Bin 1172 -> 1342 bytes testData/results/InvalidMethodSignature.dec | 28 +++- testData/results/TestAmbiguousCall.dec | 36 ++++- .../TestAmbiguousCallWithDebugInfo.dec | 36 ++++- testData/results/TestAnonymousClass.dec | 142 ++++++++++++++++++ testData/results/TestClassCast.dec | 27 +++- testData/results/TestClassFields.dec | 13 +- testData/results/TestClassLambda.dec | 136 ++++++++++++++--- testData/results/TestClassLoop.dec | 48 +++++- .../results/TestClassNestedInitializer.dec | 24 ++- testData/results/TestClassSwitch.dec | 27 +++- testData/results/TestClassTypes.dec | 111 +++++++++++--- testData/results/TestClassVar.dec | 61 ++++++-- testData/results/TestCodeConstructs.dec | 20 ++- testData/results/TestConstants.dec | 1 + testData/results/TestDebugSymbols.dec | 40 ++++- testData/results/TestDeprecations.dec | 53 ++++++- testData/results/TestEnum.dec | 19 ++- testData/results/TestExtendsList.dec | 20 ++- .../results/TestInnerClassConstructor.dec | 30 +++- testData/results/TestLocalClass.dec | 61 ++++++++ testData/results/TestMethodParameters.dec | 1 + testData/results/TestThrowException.dec | 39 +++++ testData/results/TestTryCatchFinally.dec | 52 ++++++- testData/src/pkg/TestAnonymousClass.java | 71 +++++++++ testData/src/pkg/TestDeprecations.java | 32 +++- testData/src/pkg/TestLocalClass.java | 26 ++++ testData/src/pkg/TestThrowException.java | 19 +++ testData/src/pkg/TestTryCatchFinally.java | 14 ++ 49 files changed, 1122 insertions(+), 140 deletions(-) delete mode 100644 test/org/jetbrains/java/decompiler/BytecodeToSourceMappingTest.java create mode 100644 testData/classes/pkg/TestAnonymousClass$1.class create mode 100644 testData/classes/pkg/TestAnonymousClass$2.class create mode 100644 testData/classes/pkg/TestAnonymousClass$3.class create mode 100644 testData/classes/pkg/TestAnonymousClass$4.class create mode 100644 testData/classes/pkg/TestAnonymousClass$I.class create mode 100644 testData/classes/pkg/TestAnonymousClass$Inner$1.class create mode 100644 testData/classes/pkg/TestAnonymousClass$Inner.class create mode 100644 testData/classes/pkg/TestAnonymousClass.class create mode 100644 testData/classes/pkg/TestLocalClass$1Local.class create mode 100644 testData/classes/pkg/TestLocalClass.class create mode 100644 testData/classes/pkg/TestThrowException$1.class create mode 100644 testData/classes/pkg/TestThrowException.class create mode 100644 testData/results/TestAnonymousClass.dec create mode 100644 testData/results/TestLocalClass.dec create mode 100644 testData/results/TestThrowException.dec create mode 100644 testData/src/pkg/TestAnonymousClass.java create mode 100644 testData/src/pkg/TestLocalClass.java create mode 100644 testData/src/pkg/TestThrowException.java diff --git a/src/org/jetbrains/java/decompiler/main/ClassWriter.java b/src/org/jetbrains/java/decompiler/main/ClassWriter.java index e401dee..612255f 100644 --- a/src/org/jetbrains/java/decompiler/main/ClassWriter.java +++ b/src/org/jetbrains/java/decompiler/main/ClassWriter.java @@ -161,7 +161,7 @@ public class ClassWriter { DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASS_NODE, node); int startLine = tracer != null ? tracer.getCurrentSourceLine() : 0; - BytecodeMappingTracer dummy_tracer = new BytecodeMappingTracer(); + BytecodeMappingTracer dummy_tracer = new BytecodeMappingTracer(startLine); try { // last minute processing @@ -184,6 +184,8 @@ public class ClassWriter { // fields boolean enumFields = false; + dummy_tracer.incrementCurrentSourceLine(buffer.countLines(start_class_def)); + for (StructField fd : cl.getFields()) { boolean hide = fd.isSynthetic() && DecompilerContext.getOption(IFernflowerPreferences.REMOVE_SYNTHETIC) || wrapper.getHiddenMembers().contains(InterpreterUtil.makeUniqueKey(fd.getName(), fd.getDescriptor())); @@ -193,6 +195,7 @@ public class ClassWriter { if (isEnum) { if (enumFields) { buffer.append(',').appendLineSeparator(); + dummy_tracer.incrementCurrentSourceLine(); } enumFields = true; } @@ -200,6 +203,7 @@ public class ClassWriter { buffer.append(';'); buffer.appendLineSeparator(); buffer.appendLineSeparator(); + dummy_tracer.incrementCurrentSourceLine(2); enumFields = false; } @@ -210,6 +214,7 @@ public class ClassWriter { if (enumFields) { buffer.append(';').appendLineSeparator(); + dummy_tracer.incrementCurrentSourceLine(); } // FIXME: fields don't matter at the moment @@ -383,6 +388,7 @@ public class ClassWriter { } private void fieldToJava(ClassWrapper wrapper, StructClass cl, StructField fd, TextBuffer buffer, int indent, BytecodeMappingTracer tracer) { + int start = buffer.length(); boolean isInterface = cl.hasModifier(CodeConstants.ACC_INTERFACE); boolean isDeprecated = fd.getAttributes().containsKey("Deprecated"); boolean isEnum = fd.hasModifier(CodeConstants.ACC_ENUM) && DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_ENUM); @@ -430,6 +436,8 @@ public class ClassWriter { buffer.append(fd.getName()); + tracer.incrementCurrentSourceLine(buffer.countLines(start)); + Exprent initializer; if (fd.hasModifier(CodeConstants.ACC_STATIC)) { initializer = wrapper.getStaticFieldInitializers().getWithKey(InterpreterUtil.makeUniqueKey(fd.getName(), fd.getDescriptor())); @@ -461,6 +469,7 @@ public class ClassWriter { if (!isEnum) { buffer.append(";").appendLineSeparator(); + tracer.incrementCurrentSourceLine(); } } @@ -771,6 +780,8 @@ public class ClassWriter { } } + tracer.incrementCurrentSourceLine(buffer.countLines(start_index_method)); + if ((flags & (CodeConstants.ACC_ABSTRACT | CodeConstants.ACC_NATIVE)) != 0) { // native or abstract method (explicit or interface) if (isAnnotation) { StructAnnDefaultAttribute attr = (StructAnnDefaultAttribute)mt.getAttributes().getWithKey("AnnotationDefault"); @@ -794,12 +805,12 @@ public class ClassWriter { buffer.setCurrentLine(lineNumberTable.getFirstLine() - 1); } buffer.append('{').appendLineSeparator(); + tracer.incrementCurrentSourceLine(); RootStatement root = wrapper.getMethodWrapper(mt.getName(), mt.getDescriptor()).root; if (root != null && !methodWrapper.decompiledWithErrors) { // check for existence try { - tracer.incrementCurrentSourceLine(buffer.countLines(start_index_method)); int startLine = tracer.getCurrentSourceLine(); TextBuffer code = root.toJava(indent + 1, tracer); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java index 70ea2bc..26cec62 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java @@ -85,6 +85,7 @@ public class VarExprent extends Exprent { if (classDef) { ClassNode child = DecompilerContext.getClassProcessor().getMapRootClasses().get(varType.value); new ClassWriter().classToJava(child, buffer, indent, tracer); + tracer.incrementCurrentSourceLine(buffer.countLines()); } else { String name = null; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java index 1c028d0..4a5eb13 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java @@ -256,14 +256,13 @@ public class IfStatement extends Statement { elseif = true; } else { - BytecodeMappingTracer else_tracer = new BytecodeMappingTracer(tracer.getCurrentSourceLine()); + BytecodeMappingTracer else_tracer = new BytecodeMappingTracer(tracer.getCurrentSourceLine() + 1); TextBuffer content = ExprProcessor.jmpWrapper(elsestat, indent + 1, false, else_tracer); if (content.length() > 0) { buf.appendIndent(indent).append("} else {").appendLineSeparator(); - else_tracer.shiftSourceLines(1); - tracer.setCurrentSourceLine(else_tracer.getCurrentSourceLine() + 1); + tracer.setCurrentSourceLine(else_tracer.getCurrentSourceLine()); tracer.addTracer(else_tracer); buf.append(content); diff --git a/test/org/jetbrains/java/decompiler/BytecodeToSourceMappingTest.java b/test/org/jetbrains/java/decompiler/BytecodeToSourceMappingTest.java deleted file mode 100644 index d84dd99..0000000 --- a/test/org/jetbrains/java/decompiler/BytecodeToSourceMappingTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 org.jetbrains.java.decompiler; - -import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences; -import org.junit.Test; - -import java.util.HashMap; -import java.util.Map; - -public class BytecodeToSourceMappingTest extends SingleClassesTestBase { - @Override - protected Map getDecompilerOptions() { - return new HashMap() {{ - put(IFernflowerPreferences.BYTECODE_SOURCE_MAPPING, "1"); - put(IFernflowerPreferences.DUMP_ORIGINAL_LINES, "1"); - }}; - } - - @Test public void testSimpleBytecodeMapping() { doTest("pkg/TestClassSimpleBytecodeMapping"); } - @Test public void testSynchronizedMapping() { doTest("pkg/TestSynchronizedMapping"); } - @Test public void testAbstractMethods() { doTest("pkg/TestAbstractMethods"); } -} diff --git a/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/test/org/jetbrains/java/decompiler/SingleClassesTest.java index c1b36de..8a51c72 100644 --- a/test/org/jetbrains/java/decompiler/SingleClassesTest.java +++ b/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -15,9 +15,21 @@ */ package org.jetbrains.java.decompiler; +import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences; import org.junit.Test; +import java.util.HashMap; +import java.util.Map; + public class SingleClassesTest extends SingleClassesTestBase { + @Override + protected Map getDecompilerOptions() { + return new HashMap() {{ + put(IFernflowerPreferences.BYTECODE_SOURCE_MAPPING, "1"); + put(IFernflowerPreferences.DUMP_ORIGINAL_LINES, "1"); + }}; + } + @Test public void testClassFields() { doTest("pkg/TestClassFields"); } @Test public void testClassLambda() { doTest("pkg/TestClassLambda"); } @Test public void testClassLoop() { doTest("pkg/TestClassLoop"); } @@ -39,4 +51,10 @@ public class SingleClassesTest extends SingleClassesTestBase { @Test public void testTryCatchFinally() { doTest("pkg/TestTryCatchFinally"); } @Test public void testAmbiguousCall() { doTest("pkg/TestAmbiguousCall"); } @Test public void testAmbiguousCallWithDebugInfo() { doTest("pkg/TestAmbiguousCallWithDebugInfo"); } + @Test public void testSimpleBytecodeMapping() { doTest("pkg/TestClassSimpleBytecodeMapping"); } + @Test public void testSynchronizedMapping() { doTest("pkg/TestSynchronizedMapping"); } + @Test public void testAbstractMethods() { doTest("pkg/TestAbstractMethods"); } + @Test public void testLocalClass() { doTest("pkg/TestLocalClass"); } + @Test public void testAnonymousClass() { doTest("pkg/TestAnonymousClass"); } + @Test public void testThrowException() { doTest("pkg/TestThrowException"); } } diff --git a/testData/classes/pkg/TestAnonymousClass$1.class b/testData/classes/pkg/TestAnonymousClass$1.class new file mode 100644 index 0000000000000000000000000000000000000000..ff5e5878409dfb1560c1189b83c88e8f8a9a9b3a GIT binary patch literal 553 zcmZ`$+e!jK82-l7uG^}cmRfcq4AdYCy32wP1HtMd@qS$=U0Y|wU85eWiwL^t0eYzD zpS{S7bl^XIeE)I2e?GqeoMS(UC^ikmkk?Squ%%&}ArXvRzkJG2>`b4A^)B~=Yazw! zM9%%DXZ!vIaT>00gDZwoWfiH~V~927fHPz|uHbj`NuSTUcHbi;`Y0voiXs`U7l%&+ zR|;Rl4#f|0K6ChutB8gF?N7$`vrR=?!ttc4Hsfg*WX!c-yk;>e+t(0>6t>vGos literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestAnonymousClass$2.class b/testData/classes/pkg/TestAnonymousClass$2.class new file mode 100644 index 0000000000000000000000000000000000000000..536f320ed1c99148e04611a543b9d0d1a36e4fd9 GIT binary patch literal 386 zcmZus%SyvQ6g{`8O^mUvReXSTrJyd1h|4NSQ4oB97WYXy#I)%h$s~fG)R-O`^-Mt4wy|0Ig(7MW4-BgoU z6@w_w1#yas3I4sVibP#x7Fru9Q=YNrmx-=SKaY$#7)8&K$j>>+waGZWR^_7}x>yb{ zhX!H&X`F_Cb=yaT;F4JtQyXOnZEF?g5vSp8JW@$X=**zIiuvbbtN%OV5H&efE|R-z z60%+CdSy-D(c0Xf);E9Jyt=Ag5U>e@t&khOigDcn+X0aPl5-3fImu{ ztzZv&n6J0*z1jKvdj9}$gtY)JS{~XSRy=eG%|Xt2bwY4=_wEUep&lzj`!Z*BT~8BL zj^d;c#4T$k1b4bFQ+1wOXk(;Ib;_Dwrn)x6A~vQ!iJxPUpK)4flXG^Zss}yxuo_|k zO~U5WV;23@Z66ZC3uaZ$Y?L8%tW{LRoJBXuM5Ps>JBMy-=AVzP|L=$cIC837BzHR! zvR)=nx-F?>k=`5VRT_dX***h3$&0_#9hqE9^#}g(oZ6a!`{LUd|461lNDh_|N^M|S Maz`Q%x!n!;-~04S&Hw-a literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestAnonymousClass$4.class b/testData/classes/pkg/TestAnonymousClass$4.class new file mode 100644 index 0000000000000000000000000000000000000000..3ee643664627e41e22f17695a16b6ba282af9a95 GIT binary patch literal 386 zcmZusO-sW-5Pj3sCdSy-D(c0Xf_g9_RWDVLq9FJITD&Le64R!$l1&7EmM6i3KfoU) z&Q`DoJ)R-O`^?VSfgy|0Ig(7MW4-BgoU z6@w_w1#yas3I4sVibP#x7Fru9Q=YNrmx-=SKaY&r8%58N$j>>+waGZWR^_7}x>yb{ zhX!H&X`F_Cb(>v6aLKHSsf{v(wzUfLh|};k9;u`xbY{?9#r*TJ)&Cu_kD8n+7s=f< z30W_bE8T`vvdHcm=v5kmC)qv&2a@N1sarBRmg@DqlNq%+1rNpdNc@jw@`Y5x0s^UZ OEJ|)m_#(Hv0q+|Fd`s^D literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestAnonymousClass$I.class b/testData/classes/pkg/TestAnonymousClass$I.class new file mode 100644 index 0000000000000000000000000000000000000000..48eb4edc1bd25699fea92f1e9e8703cabaee6d8b GIT binary patch literal 254 zcmZusK@P!C5Pd`SR~1bpIDiEk-MD}VNmmxczM4-|{V#qiT+PA(97;?rSg@FR^JeBv z-aMYSJAe^<0au_-C~vgp+#jq6?(`DNW46=E2sD^4bbgBEY?n$xXDLlKR$5&TIyaLv zGG>@W=SZMQ=pOgm;CG=H5{SbKm6E5oMjC=&=z=s-+hD#EF d2cyO2VKJ{TE70bN;JO3{9;3@WLKQXJc>%7~JbC~C literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestAnonymousClass$Inner$1.class b/testData/classes/pkg/TestAnonymousClass$Inner$1.class new file mode 100644 index 0000000000000000000000000000000000000000..798b358a7b36c69737608faba112448d0f330246 GIT binary patch literal 442 zcmaJ-%Syvg5IvK$O^oTosO?5wRnRW1g3GFCR1kcC7WYYdiK*$ml84}Dxe{FX0e+M? zHw(K^T+HjtnKQ$De!YJH*hkNSiI#=71<%4Vp)pEiQXCS@t?he4%~umaXkR8$T$i&@ zWaA)A88Nd`5}Z3#W|25gG}If5yf~IhzRXma`)QEpJJaAf;PEpVr7BNkd?ktpHLx3LR@U&9~ZKN)O%E>{+3>l{fVgE!DCCj^_lZUaZ`7k;RlT$!3`kL-gvwN-&9 gtn0J>DOV1Y3@pOsSVNQj5}U_Z6D#O&U*7=O-}oq7z5oCK literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestAnonymousClass$Inner.class b/testData/classes/pkg/TestAnonymousClass$Inner.class new file mode 100644 index 0000000000000000000000000000000000000000..2b3d4639c26b5f597bf6a7def53c5cc4736b7c80 GIT binary patch literal 443 zcmaKo-Acni5QWdA%}>*4Ypkt`ieN9)3xnXDr6L8PP!wtrypkj?B{khhegq#&yeKI6 z06vsBiK3w5F6@~dzB4n->)X={fCH?U&|vFWG@-z*Kt)4GQ%8%S_N5dt!78*Dx=A7u zLTPx_Co~2V_s(@fSB{-wCZ+3z;*g+q0vV)TrnYx32<2XMEeN$iAjN4m^+Y_%L4wio z!%xyYkFwYoCqbTXjYN_j%Shf&qbwMER%Th>A30JHMZYtQAVsYf5*$cY&fo8@*B2Q&ob!zsSOVLn-njbZC( zO{f+H$W{=0Kut(;o#HM<6zVj43h{}Cz%*C&%)vJu=A6Kp&2q2Y_ZV0sPA5Jf)<$Tb z*R-9*uLui#gz*_Y`WHl0oKO&F5)s-4N|niMnA2A6AYeb t9SDk^U?EvVQQ-A?W>;aO!~%;PVc$o|$B6NW&SKT4^Q42ai>e@gzW^1k)Ykw2 literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestDeprecations$ByAnno.class b/testData/classes/pkg/TestDeprecations$ByAnno.class index dca17055a9f323eeea9ec0a155e5d7feaf6bc5dc..cb8f565061daca6ec6be5864b44f911aa75c1086 100644 GIT binary patch delta 225 zcmZ9DxedZl5JaE-jgN10V~)rY0fAF2K>!6%20}t2atYMnK1c`<5&; zxvQ)fd8BPt?_l#QP99!x&-J&JTXirOUuecZCKLN@Ot|`gUZ_|KNL0HtX^|<>mV8ki M&7owK4SiCg4`)OYGynhq delta 146 zcmX@g{GLhl)W2Q(7#J8#7(}=jm>GE48Ti>5geEF!O$P5{ux4PyWR diff --git a/testData/classes/pkg/TestDeprecations$ByComment.class b/testData/classes/pkg/TestDeprecations$ByComment.class index c1da53c08db1766930790cb9874b2794b05d612a..d6013ce5aa3d3f1cb4c43712408ee40ee1fd1054 100644 GIT binary patch delta 213 zcmZ9GEe^s!6okLsEo{3j{}dz%0#On$m2d!#fgwRvBJsE$g#HNj;^Qg$qi;JZR)&;+^(wXb(wnNj0R25s6OnEP6!xDH@VfU ziagOa`|c2m8>Wb_*z>m?8CWcZF<>={< FyaCff$?3=9k=3_@HC%naP@47}_N0uzUU6}dxY{}(V}z|)`Qk|`dI-Di__YYLcboWHnY;m%;6%U~A^4xh`y IitHo!0Xlyq+5i9m delta 206 zcmbQqdVt0F)W2Q(7#J8#7^Juum>ERb8N}Eb#Mv1n7#Y}{DjoCk@);R;JoEBWi=1;3 zi;Gi>*%>4!8c&?~av~$c;!bo!G%=~Vkhm{pEQ58%(Bgl&FeWbi06)rj z+cYr-7jw^joH_UL_5JY)-~`9Yh1TCT zhl}7PAb|@N#yXKIx)$kN&unaSRKYpQusCdRhVJ^1z2kgfhH`=YN-43-7Z3@9m#Giq zKt;pb=|Y4lLvvjPJ9HY8uEabq>qlORo(%^K74mi|&NA-c;0j?ybdv=~{75IKv+ rE%YB39RI`o5x8S_3#h(V6eg6>VSNXPm-lPM}c>jWv_y+aD37>#i%#$KudCrB}g~<+hPVWQ8Ed}P~(JQQ_ zszP(X;k%Zp@Q7PnZ~i*$(aB)Obb3pXd;?IE&tNS7huk2!$>C98u!h4ZrxYU__yHvG BP8$FK literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestThrowException$1.class b/testData/classes/pkg/TestThrowException$1.class new file mode 100644 index 0000000000000000000000000000000000000000..e626366787d3c6ab1ea93f0fc0f19d7872adcc1e GIT binary patch literal 481 zcmZ`#O;5r=5PjPsg<7Pd0?I*SH~=Q1i8qNCf(Z#~qJ(=}Htj;)l76Uv%Y!lT;1BRe z8E4gmgSg4gym|9>W_CV4-`)Y7p;3g6EfYCx8`v>WGf-#9r-4YCCk*w`V(xdxJW0nv z96b)6JibUpB+p6H6H=rX42{-*qV|L#*N>*0p*#|jUuX9&kH?N15~IhNB->IV^DfF_ zk6#LvsQqnsJaZl#Dl(8>7$rjbS3C`(sexS!1?*YK!%(P16R#e)dCFi7rQ~rxbdrQ8 z47MuT4ISxsZ`>L8QijTsy3M5g8ML~(B7LnjY)^1N3(SFG4a~OHAhcJFZUIGNO+tqh zE5_^`y?}LIp*>T?uue8l9MnaLY%{xfg^)!;<1^Jm?6w zJ=5=A?seN1 zreUAC=6E2a_e&=PCX21v&Mc_rNr7-jL zLS5n1K0Mob+um(8_YP0$$v8urMVBR(71myBzdfV5>#{mc9;wkDx z62*vM&|i!TUM3+p+=&I=9e6t>!h$2>Lz*ZV2Bc$!#f3k@Y2?~=7*`BJ5aJrEGnShu9E0f;|FMh>{xn0cE@us9b zA~K{e*54&M)#Xx`nEd9yrZ4nu`FW>gW>-C1(qahA3W*B+@{Xd+3zdpIlB!e{mRax# Ti31Ns_j3{L2#*OlWN_^-D=AW^ delta 473 zcmXw$OD{uF6otQ|t#f-^uXR$HV^b3oBqbz9Mt*_c zVt{p(nbZ^2pdT=0U;GA+4_!W71B#r0tc1 z(CKB+$(*K{8zt*EIpQlP8i8IY*~`N zuIQyNxJcu-Vhqbmxfi_RBXzN8m2mPtx2^n!JA9@g=2vMPuhLYdSGOdRw$k#<0FbZu~K*yqS;z+4fNB (La/a/a/a/e/f/b;La/a/a/a/c/j;)V' { + 2 14 + 7 15 + } + + method 'a (La/a/a/a/c/c;La/a/a/a/a/k;Z)V' { + 1 19 + 4 19 + a 19 + f 19 + 12 20 + 15 20 + 1a 20 + } +} + +Lines mapping: +1 <-> 16 +2 <-> 20 +3 <-> 21 diff --git a/testData/results/TestAmbiguousCall.dec b/testData/results/TestAmbiguousCall.dec index b335867..caeb41d 100644 --- a/testData/results/TestAmbiguousCall.dec +++ b/testData/results/TestAmbiguousCall.dec @@ -8,11 +8,35 @@ class TestAmbiguousCall { } void test() { - IllegalArgumentException var1 = new IllegalArgumentException(); - this.m1((RuntimeException)var1, "RE"); - this.m1(var1, "IAE"); - IllegalArgumentException var2 = new IllegalArgumentException(); - this.m1((RuntimeException)var2, "RE"); - this.m1((IllegalArgumentException)var2, "IAE"); + IllegalArgumentException var1 = new IllegalArgumentException();// 8 + this.m1((RuntimeException)var1, "RE");// 9 + this.m1(var1, "IAE");// 10 + IllegalArgumentException var2 = new IllegalArgumentException();// 12 + this.m1((RuntimeException)var2, "RE");// 13 + this.m1((IllegalArgumentException)var2, "IAE");// 14 } } + +class 'pkg/TestAmbiguousCall' { + method 'test ()V' { + 7 10 + a 11 + c 11 + 11 12 + 13 12 + 1d 13 + 20 14 + 22 14 + 27 15 + 2a 15 + 2c 15 + } +} + +Lines mapping: +8 <-> 11 +9 <-> 12 +10 <-> 13 +12 <-> 14 +13 <-> 15 +14 <-> 16 diff --git a/testData/results/TestAmbiguousCallWithDebugInfo.dec b/testData/results/TestAmbiguousCallWithDebugInfo.dec index da3baa9..6380d6d 100644 --- a/testData/results/TestAmbiguousCallWithDebugInfo.dec +++ b/testData/results/TestAmbiguousCallWithDebugInfo.dec @@ -8,11 +8,35 @@ class TestAmbiguousCall { } void test() { - IllegalArgumentException iae = new IllegalArgumentException(); - this.m1((RuntimeException)iae, "RE"); - this.m1(iae, "IAE"); - IllegalArgumentException re = new IllegalArgumentException(); - this.m1((RuntimeException)re, "RE"); - this.m1((IllegalArgumentException)re, "IAE"); + IllegalArgumentException iae = new IllegalArgumentException();// 8 + this.m1((RuntimeException)iae, "RE");// 9 + this.m1(iae, "IAE");// 10 + IllegalArgumentException re = new IllegalArgumentException();// 12 + this.m1((RuntimeException)re, "RE");// 13 + this.m1((IllegalArgumentException)re, "IAE");// 14 } } + +class 'pkg/TestAmbiguousCall' { + method 'test ()V' { + 7 10 + a 11 + c 11 + 11 12 + 13 12 + 1d 13 + 20 14 + 22 14 + 27 15 + 2a 15 + 2c 15 + } +} + +Lines mapping: +8 <-> 11 +9 <-> 12 +10 <-> 13 +12 <-> 14 +13 <-> 15 +14 <-> 16 diff --git a/testData/results/TestAnonymousClass.dec b/testData/results/TestAnonymousClass.dec new file mode 100644 index 0000000..18cfaef --- /dev/null +++ b/testData/results/TestAnonymousClass.dec @@ -0,0 +1,142 @@ +package pkg; + +public abstract class TestAnonymousClass { + public static final Runnable R3 = new Runnable() { + public void run() { + boolean var1 = true;// 28 + boolean var2 = true;// 29 + } + }; + public static final Runnable R = new Runnable() { + public void run() { + boolean var1 = true;// 45 + boolean var2 = true;// 46 + } + }; + public static final Runnable R1 = new Runnable() { + public void run() { + boolean var1 = true;// 53 + boolean var2 = true;// 54 + } + }; + + void foo(int var1) throws Exception { + if(var1 > 0) {// 10 + TestAnonymousClass.I var2 = new TestAnonymousClass.I() { + public void foo() throws Exception { + boolean var1 = true;// 13 + boolean var2 = true;// 14 + } + };// 11 + var2.foo();// 17 + } else { + System.out.println(5);// 21 + } + + } + + void boo() { + boolean var1 = true;// 35 + } + + void zoo() { + boolean var1 = true;// 39 + } + + private static class Inner { + private static final Runnable R_I = new Runnable() { + public void run() { + boolean var1 = true;// 66 + boolean var2 = true;// 67 + } + }; + } + + interface I { + void foo() throws Exception; + } +} + +class 'pkg/TestAnonymousClass$2' { + method 'run ()V' { + 0 5 + 1 5 + 2 6 + 3 6 + } +} + +class 'pkg/TestAnonymousClass$3' { + method 'run ()V' { + 0 11 + 1 11 + 2 12 + 3 12 + } +} + +class 'pkg/TestAnonymousClass$4' { + method 'run ()V' { + 0 17 + 1 17 + 2 18 + 3 18 + } +} + +class 'pkg/TestAnonymousClass$1' { + method 'foo ()V' { + 0 26 + 1 26 + 2 27 + 3 27 + } +} + +class 'pkg/TestAnonymousClass' { + method 'foo (I)V' { + 1 23 + c 29 + e 30 + 16 32 + 19 32 + 1a 32 + } + + method 'boo ()V' { + 0 38 + 1 38 + } + + method 'zoo ()V' { + 0 42 + 1 42 + } +} + +class 'pkg/TestAnonymousClass$Inner$1' { + method 'run ()V' { + 0 48 + 1 48 + 2 49 + 3 49 + } +} + +Lines mapping: +10 <-> 24 +11 <-> 30 +13 <-> 27 +14 <-> 28 +17 <-> 31 +21 <-> 33 +28 <-> 6 +29 <-> 7 +35 <-> 39 +39 <-> 43 +45 <-> 12 +46 <-> 13 +53 <-> 18 +54 <-> 19 +66 <-> 49 +67 <-> 50 diff --git a/testData/results/TestClassCast.dec b/testData/results/TestClassCast.dec index e09162c..7593d6d 100644 --- a/testData/results/TestClassCast.dec +++ b/testData/results/TestClassCast.dec @@ -5,11 +5,30 @@ 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"); + Object var2 = var1;// 22 + if(var1 != null) {// 23 + ((List)(var2 = new ArrayList(var1))).add("23");// 24 } - System.out.println(((List)var2).size()); + System.out.println(((List)var2).size());// 26 } } + +class 'pkg/TestClassCast' { + method 'test (Ljava/util/List;)V' { + 1 7 + 3 8 + f 9 + 10 9 + 12 9 + 18 12 + 1c 12 + 21 12 + } +} + +Lines mapping: +22 <-> 8 +23 <-> 9 +24 <-> 10 +26 <-> 13 diff --git a/testData/results/TestClassFields.dec b/testData/results/TestClassFields.dec index 749d828..1415306 100644 --- a/testData/results/TestClassFields.dec +++ b/testData/results/TestClassFields.dec @@ -5,6 +5,17 @@ public class TestClassFields { private static String[] names = new String[]{"name1", "name2"}; static { - sizes = new int[names.length]; + sizes = new int[names.length];// 26 } } + +class 'pkg/TestClassFields' { + method ' ()V' { + 11 7 + 14 7 + 17 7 + } +} + +Lines mapping: +26 <-> 8 diff --git a/testData/results/TestClassLambda.dec b/testData/results/TestClassLambda.dec index d0485d3..5dadaf7 100644 --- a/testData/results/TestClassLambda.dec +++ b/testData/results/TestClassLambda.dec @@ -13,61 +13,161 @@ 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) -> { + 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)});// 27 + int var2 = (int)Math.random();// 28 + var1.forEach((var2x) -> {// 30 int var3 = 2 * var2x.intValue(); System.out.println(var3 + var2 + this.field); }); } public void testLambda1() { - int var1 = (int)Math.random(); + int var1 = (int)Math.random();// 37 Runnable var2 = () -> { System.out.println("hello1" + var1); - }; + };// 38 Runnable var3 = () -> { System.out.println("hello2" + var1); - }; + };// 39 } public void testLambda2() { - reduce((var0, var1) -> { + reduce((var0, var1) -> {// 43 return Math.max(var0, var1); }); } public void testLambda3() { - reduce(Math::max); + reduce(Math::max);// 47 } public void testLambda4() { - reduce(TestClassLambda::localMax); + reduce(TestClassLambda::localMax);// 51 } public void testLambda5() { - String var1 = "abcd"; - function(var1::toString); + String var1 = "abcd";// 55 + function(var1::toString);// 56 } public void testLambda6() { - ArrayList var1 = new ArrayList(); - int var2 = var1.size() * 2; - int var3 = var1.size() * 5; - var1.removeIf((var2x) -> { + ArrayList var1 = new ArrayList();// 60 + int var2 = var1.size() * 2;// 61 + int var3 = var1.size() * 5;// 62 + var1.removeIf((var2x) -> {// 63 return var2 >= var2x.length() && var2x.length() <= var3; }); } public static OptionalInt reduce(IntBinaryOperator var0) { - return null; + return null;// 67 } public static String function(Supplier var0) { - return (String)var0.get(); + return (String)var0.get();// 71 } public static int localMax(int var0, int var1) { - return 0; + return 0;// 75 } } + +class 'pkg/TestClassLambda' { + method 'testLambda ()V' { + 7 15 + 8 15 + e 15 + f 15 + 15 15 + 16 15 + 1c 15 + 1d 15 + 23 15 + 24 15 + 2a 15 + 2c 15 + 33 15 + 35 15 + 39 15 + 3c 15 + 3d 16 + 40 16 + 41 16 + 4a 17 + } + + method 'testLambda1 ()V' { + 0 24 + 3 24 + 4 24 + b 27 + 12 30 + } + + method 'testLambda2 ()V' { + 5 34 + } + + method 'testLambda3 ()V' { + 5 40 + } + + method 'testLambda4 ()V' { + 5 44 + } + + method 'testLambda5 ()V' { + 0 48 + 2 48 + e 49 + } + + method 'testLambda6 ()V' { + 7 53 + 9 54 + e 54 + f 54 + 10 54 + 12 55 + 17 55 + 18 55 + 19 55 + 22 56 + } + + method 'reduce (Ljava/util/function/IntBinaryOperator;)Ljava/util/OptionalInt;' { + 0 62 + 1 62 + } + + method 'function (Ljava/util/function/Supplier;)Ljava/lang/String;' { + 1 66 + 6 66 + 9 66 + } + + method 'localMax (II)I' { + 0 70 + 1 70 + } +} + +Lines mapping: +27 <-> 16 +28 <-> 17 +30 <-> 18 +37 <-> 25 +38 <-> 28 +39 <-> 31 +43 <-> 35 +47 <-> 41 +51 <-> 45 +55 <-> 49 +56 <-> 50 +60 <-> 54 +61 <-> 55 +62 <-> 56 +63 <-> 57 +67 <-> 63 +71 <-> 67 +75 <-> 71 diff --git a/testData/results/TestClassLoop.dec b/testData/results/TestClassLoop.dec index 74b8bac..5384a98 100644 --- a/testData/results/TestClassLoop.dec +++ b/testData/results/TestClassLoop.dec @@ -3,16 +3,16 @@ package pkg; public class TestClassLoop { public static void testSimpleInfinite() { while(true) { - System.out.println(); + System.out.println();// 23 } } public static void testFinally() { - boolean var0 = Math.random() > 0.0D; + boolean var0 = Math.random() > 0.0D;// 29 while(true) { try { - if(!var0) { + if(!var0) {// 33 return; } } finally { @@ -22,16 +22,16 @@ public class TestClassLoop { } public static void testFinallyContinue() { - boolean var0 = Math.random() > 0.0D; + boolean var0 = Math.random() > 0.0D;// 45 while(true) { while(true) { try { - System.out.println("1"); + System.out.println("1");// 49 break; } finally { if(var0) { - System.out.println("3"); + System.out.println("3");// 53 continue; } } @@ -41,3 +41,39 @@ public class TestClassLoop { } } } + +class 'pkg/TestClassLoop' { + method 'testSimpleInfinite ()V' { + 0 5 + 3 5 + } + + method 'testFinally ()V' { + 0 10 + 3 10 + 4 10 + d 10 + f 14 + } + + method 'testFinallyContinue ()V' { + 0 24 + 3 24 + 4 24 + d 24 + e 29 + 11 29 + 13 29 + 2a 33 + 2d 33 + 2f 33 + } +} + +Lines mapping: +23 <-> 6 +29 <-> 11 +33 <-> 15 +45 <-> 25 +49 <-> 30 +53 <-> 34 diff --git a/testData/results/TestClassNestedInitializer.dec b/testData/results/TestClassNestedInitializer.dec index 585b01a..b9fa69c 100644 --- a/testData/results/TestClassNestedInitializer.dec +++ b/testData/results/TestClassNestedInitializer.dec @@ -8,7 +8,27 @@ public class TestClassNestedInitializer { { this.secret = "one"; } - }; - System.out.println(var1.secret); + };// 22 + System.out.println(var1.secret);// 23 } } + +class 'pkg/TestClassNestedInitializer$1' { + method ' (Lpkg/TestClassNestedInitializer;)V' { + a 8 + c 8 + } +} + +class 'pkg/TestClassNestedInitializer' { + method 'test ()V' { + 8 10 + 9 11 + d 11 + 10 11 + } +} + +Lines mapping: +22 <-> 11 +23 <-> 12 diff --git a/testData/results/TestClassSwitch.dec b/testData/results/TestClassSwitch.dec index 50efbe9..695350f 100644 --- a/testData/results/TestClassSwitch.dec +++ b/testData/results/TestClassSwitch.dec @@ -2,13 +2,32 @@ package pkg; public class TestClassSwitch { public void testCaseOrder(int var1) { - switch(var1) { + switch(var1) {// 22 case 5: - System.out.println(5); + System.out.println(5);// 27 default: - return; + return;// 29 case 13: - System.out.println(13); + System.out.println(13);// 24 } } } + +class 'pkg/TestClassSwitch' { + method 'testCaseOrder (I)V' { + 1 4 + 1c 10 + 1f 10 + 21 10 + 25 6 + 28 6 + 29 6 + 2c 8 + } +} + +Lines mapping: +22 <-> 5 +24 <-> 11 +27 <-> 7 +29 <-> 9 diff --git a/testData/results/TestClassTypes.dec b/testData/results/TestClassTypes.dec index 7a50473..f2a3fdb 100644 --- a/testData/results/TestClassTypes.dec +++ b/testData/results/TestClassTypes.dec @@ -5,45 +5,122 @@ 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; + byte var1 = 0;// 25 + long var2 = System.currentTimeMillis();// 26 + if(var2 % 2L > 0L) {// 28 + var1 = 1;// 29 + } else if(var2 % 3L > 0L) {// 31 + var1 = 2;// 32 } - if(var1 == 1) { - System.out.println(); + if(var1 == 1) {// 35 + System.out.println();// 36 } } public boolean testBit(int var1) { - return (var1 & 1) == 1; + return (var1 & 1) == 1;// 41 } public void testSwitchConsts(int var1) { - switch(var1) { + switch(var1) {// 46 case 88: - System.out.println("1"); + System.out.println("1");// 48 break; case 656: - System.out.println("2"); + System.out.println("2");// 51 break; case 65201: case 65489: - System.out.println("3"); + System.out.println("3");// 55 } } public void testAssignmentType(List var1) { - Object var2 = var1; - if(var1 != null) { - ((List)(var2 = new ArrayList(var1))).add("23"); + Object var2 = var1;// 61 + if(var1 != null) {// 63 + ((List)(var2 = new ArrayList(var1))).add("23");// 64 } - System.out.println(((List)var2).size()); + System.out.println(((List)var2).size());// 67 } } + +class 'pkg/TestClassTypes' { + method 'testBoolean ()V' { + 0 7 + 1 7 + 2 8 + 5 8 + 7 9 + a 9 + b 9 + c 9 + d 9 + 10 10 + 11 10 + 16 11 + 19 11 + 1a 11 + 1b 11 + 1c 11 + 1f 12 + 20 12 + 22 15 + 23 15 + 26 16 + 29 16 + } + + method 'testBit (I)Z' { + 1 22 + 2 22 + 3 22 + c 22 + } + + method 'testSwitchConsts (I)V' { + 1 26 + 2c 28 + 2f 28 + 31 28 + 37 31 + 3a 31 + 3c 31 + 42 35 + 45 35 + 47 35 + } + + method 'testAssignmentType (Ljava/util/List;)V' { + 1 41 + 3 42 + f 43 + 10 43 + 12 43 + 18 46 + 1c 46 + 21 46 + } +} + +Lines mapping: +25 <-> 8 +26 <-> 9 +28 <-> 10 +29 <-> 11 +31 <-> 12 +32 <-> 13 +35 <-> 16 +36 <-> 17 +41 <-> 23 +46 <-> 27 +48 <-> 29 +51 <-> 32 +55 <-> 36 +61 <-> 42 +63 <-> 43 +64 <-> 44 +67 <-> 47 diff --git a/testData/results/TestClassVar.dec b/testData/results/TestClassVar.dec index 4cfd27f..e2395b1 100644 --- a/testData/results/TestClassVar.dec +++ b/testData/results/TestClassVar.dec @@ -5,12 +5,12 @@ public class TestClassVar { public int field_int = 0; public void testFieldSSAU() { - for(int var1 = 0; var1 < 10; ++var1) { + for(int var1 = 0; var1 < 10; ++var1) {// 26 try { - System.out.println(); + System.out.println();// 29 } finally { if(this.field_boolean) { - System.out.println(); + System.out.println();// 33 } } @@ -19,22 +19,65 @@ public class TestClassVar { } public Long testFieldSSAU1() { - return new Long((long)(this.field_int++)); + return new Long((long)(this.field_int++));// 40 } public void testComplexPropagation() { - int var1 = 0; + int var1 = 0;// 45 - while(var1 < 10) { + while(var1 < 10) {// 47 int var2; - for(var2 = var1; var1 < 10 && var1 == 0; ++var1) { + for(var2 = var1; var1 < 10 && var1 == 0; ++var1) {// 51 ; } - if(var2 != var1) { - System.out.println(); + if(var2 != var1) {// 54 + System.out.println();// 55 } } } } + +class 'pkg/TestClassVar' { + method 'testFieldSSAU ()V' { + 0 7 + 1 7 + 3 7 + 8 9 + b 9 + 26 12 + 29 12 + } + + method 'testFieldSSAU1 ()Ljava/lang/Long;' { + 6 21 + b 21 + f 21 + 13 21 + } + + method 'testComplexPropagation ()V' { + 0 25 + 1 25 + 3 27 + 9 29 + b 29 + 14 29 + 1c 33 + 1f 34 + 22 34 + } +} + +Lines mapping: +26 <-> 8 +29 <-> 10 +33 <-> 13 +40 <-> 22 +45 <-> 26 +47 <-> 28 +49 <-> 30 +51 <-> 30 +54 <-> 34 +55 <-> 35 diff --git a/testData/results/TestCodeConstructs.dec b/testData/results/TestCodeConstructs.dec index eb9de8d..eeb9c19 100644 --- a/testData/results/TestCodeConstructs.dec +++ b/testData/results/TestCodeConstructs.dec @@ -4,10 +4,26 @@ class TestCodeConstructs { private int count = 0; void expressions() { - (new String()).hashCode(); + (new String()).hashCode();// 20 } Integer fieldIncrement() { - return new Integer(this.count++); + return new Integer(this.count++);// 25 } } + +class 'pkg/TestCodeConstructs' { + method 'expressions ()V' { + 7 6 + } + + method 'fieldIncrement ()Ljava/lang/Integer;' { + 6 10 + b 10 + 12 10 + } +} + +Lines mapping: +20 <-> 7 +25 <-> 11 diff --git a/testData/results/TestConstants.dec b/testData/results/TestConstants.dec index 216da8e..47f4c1d 100644 --- a/testData/results/TestConstants.dec +++ b/testData/results/TestConstants.dec @@ -71,3 +71,4 @@ public class TestConstants { Class value(); } } + diff --git a/testData/results/TestDebugSymbols.dec b/testData/results/TestDebugSymbols.dec index 42ae7a8..e96eb33 100644 --- a/testData/results/TestDebugSymbols.dec +++ b/testData/results/TestDebugSymbols.dec @@ -2,10 +2,40 @@ 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(); + String text = "text";// 21 + long prolonged = 42L;// 22 + float decimated = (float)prolonged / 10.0F;// 23 + double doubled = (double)(2.0F * decimated);// 24 + return (text + ":" + prolonged + ":" + decimated + ":" + doubled).length();// 25 } } + +class 'pkg/TestDebugSymbols' { + method 'm ()I' { + 0 4 + 2 4 + 3 5 + 6 5 + 8 6 + 9 6 + b 6 + c 6 + e 7 + 11 7 + 12 7 + 13 7 + 20 8 + 29 8 + 33 8 + 3d 8 + 40 8 + 43 8 + } +} + +Lines mapping: +21 <-> 5 +22 <-> 6 +23 <-> 7 +24 <-> 8 +25 <-> 9 diff --git a/testData/results/TestDeprecations.dec b/testData/results/TestDeprecations.dec index 237ac9c..e423854 100644 --- a/testData/results/TestDeprecations.dec +++ b/testData/results/TestDeprecations.dec @@ -1,6 +1,6 @@ package pkg; -public class TestDeprecations { +public abstract class TestDeprecations { /** @deprecated */ public int byComment; /** @deprecated */ @@ -9,19 +9,70 @@ public class TestDeprecations { /** @deprecated */ public void byComment() { + boolean var1 = true;// 27 } + /** @deprecated */ + public abstract void byCommentAbstract(); + /** @deprecated */ @Deprecated public void byAnno() { + boolean var1 = true;// 35 } + /** @deprecated */ + @Deprecated + public abstract void byAnnoAbstract(); + /** @deprecated */ @Deprecated public static class ByAnno { + int a = 5; + + void foo() { + boolean var1 = true;// 55 + } } /** @deprecated */ public static class ByComment { + int a = 5; + + void foo() { + boolean var1 = true;// 46 + } } } + +class 'pkg/TestDeprecations' { + method 'byComment ()V' { + 0 11 + 1 11 + } + + method 'byAnno ()V' { + 0 20 + 1 20 + } +} + +class 'pkg/TestDeprecations$ByAnno' { + method 'foo ()V' { + 0 33 + 1 33 + } +} + +class 'pkg/TestDeprecations$ByComment' { + method 'foo ()V' { + 0 42 + 1 42 + } +} + +Lines mapping: +27 <-> 12 +35 <-> 21 +46 <-> 43 +55 <-> 34 diff --git a/testData/results/TestEnum.dec b/testData/results/TestEnum.dec index 3184741..e08f341 100644 --- a/testData/results/TestEnum.dec +++ b/testData/results/TestEnum.dec @@ -18,10 +18,25 @@ public enum TestEnum { } private TestEnum() { - this("?"); + this("?");// 34 } private TestEnum(@Deprecated String var3) { - this.s = var3; + this.s = var3;// 35 } } + +class 'pkg/TestEnum' { + method ' (Ljava/lang/String;I)V' { + 3 20 + 5 20 + } + + method ' (Ljava/lang/String;ILjava/lang/String;)V' { + 8 24 + } +} + +Lines mapping: +34 <-> 21 +35 <-> 25 diff --git a/testData/results/TestExtendsList.dec b/testData/results/TestExtendsList.dec index b4aacf6..6f116db 100644 --- a/testData/results/TestExtendsList.dec +++ b/testData/results/TestExtendsList.dec @@ -2,10 +2,26 @@ package pkg; public class TestExtendsList { static > T m1(T var0) { - return null; + return null;// 20 } static > T m2(T var0) { - return null; + return null;// 24 } } + +class 'pkg/TestExtendsList' { + method 'm1 (Ljava/lang/Comparable;)Ljava/lang/Comparable;' { + 0 4 + 1 4 + } + + method 'm2 (Ljava/lang/Object;)Ljava/lang/Object;' { + 0 8 + 1 8 + } +} + +Lines mapping: +20 <-> 5 +24 <-> 9 diff --git a/testData/results/TestInnerClassConstructor.dec b/testData/results/TestInnerClassConstructor.dec index 9b63154..3db6203 100644 --- a/testData/results/TestInnerClassConstructor.dec +++ b/testData/results/TestInnerClassConstructor.dec @@ -2,16 +2,40 @@ package pkg; class TestInnerClassConstructor { void m() { - new TestInnerClassConstructor.Inner("text"); + new TestInnerClassConstructor.Inner("text");// 5 } void n(String var1) { - System.out.println("n(): " + var1); + System.out.println("n(): " + var1);// 9 } final class Inner { private Inner(String var2) { - TestInnerClassConstructor.this.n(var2); + TestInnerClassConstructor.this.n(var2);// 14 } } } + +class 'pkg/TestInnerClassConstructor' { + method 'm ()V' { + 5 4 + } + + method 'n (Ljava/lang/String;)V' { + 0 8 + a 8 + 13 8 + 16 8 + } +} + +class 'pkg/TestInnerClassConstructor$Inner' { + method ' (Lpkg/TestInnerClassConstructor;Ljava/lang/String;)V' { + b 13 + } +} + +Lines mapping: +5 <-> 5 +9 <-> 9 +14 <-> 14 diff --git a/testData/results/TestLocalClass.dec b/testData/results/TestLocalClass.dec new file mode 100644 index 0000000..8e51167 --- /dev/null +++ b/testData/results/TestLocalClass.dec @@ -0,0 +1,61 @@ +package pkg; + +public abstract class TestLocalClass { + void foo() { + boolean var1 = true;// 8 + class Local { + void foo() { + boolean var1 = true;// 11 + boolean var2 = true;// 12 + } + } + + Local var2 = new Local();// 15 + var2.foo();// 16 + } + + void boo() { + boolean var1 = true;// 20 + } + + void zoo() { + boolean var1 = true;// 24 + } +} + +class 'pkg/TestLocalClass$1Local' { + method 'foo ()V' { + 0 7 + 1 7 + 2 8 + 3 8 + } +} + +class 'pkg/TestLocalClass' { + method 'foo ()V' { + 0 4 + 1 4 + a 12 + c 13 + } + + method 'boo ()V' { + 0 17 + 1 17 + } + + method 'zoo ()V' { + 0 21 + 1 21 + } +} + +Lines mapping: +8 <-> 5 +11 <-> 8 +12 <-> 9 +15 <-> 13 +16 <-> 14 +20 <-> 18 +24 <-> 22 diff --git a/testData/results/TestMethodParameters.dec b/testData/results/TestMethodParameters.dec index e4c4724..a458192 100644 --- a/testData/results/TestMethodParameters.dec +++ b/testData/results/TestMethodParameters.dec @@ -40,3 +40,4 @@ public class TestMethodParameters { } } } + diff --git a/testData/results/TestThrowException.dec b/testData/results/TestThrowException.dec new file mode 100644 index 0000000..7bc460e --- /dev/null +++ b/testData/results/TestThrowException.dec @@ -0,0 +1,39 @@ +package pkg; + +public class TestThrowException { + Runnable r; + + public TestThrowException(int var1) { + if(var1 > 0) {// 9 + throw new IllegalArgumentException("xxx");// 10 + } else { + this.r = new Runnable() {// 12 + public void run() { + boolean var1 = true;// 15 + } + }; + } + } +} + +class 'pkg/TestThrowException$1' { + method 'run ()V' { + 0 11 + 1 11 + } +} + +class 'pkg/TestThrowException' { + method ' (I)V' { + 5 6 + c 7 + 11 7 + 1b 9 + } +} + +Lines mapping: +9 <-> 7 +10 <-> 8 +12 <-> 10 +15 <-> 12 diff --git a/testData/results/TestTryCatchFinally.dec b/testData/results/TestTryCatchFinally.dec index 9840bfc..673238e 100644 --- a/testData/results/TestTryCatchFinally.dec +++ b/testData/results/TestTryCatchFinally.dec @@ -3,10 +3,10 @@ package pkg; public class TestTryCatchFinally { public void test1(String var1) { try { - System.out.println("sout1"); + System.out.println("sout1");// 24 } catch (Exception var9) { try { - System.out.println("sout2"); + System.out.println("sout2");// 27 } catch (Exception var8) { ; } @@ -16,9 +16,19 @@ public class TestTryCatchFinally { } + int foo(int var1) throws Exception { + if(var1 < 1) {// 39 + throw new RuntimeException();// 40 + } else if(var1 < 5) {// 41 + return var1;// 42 + } else { + throw new Exception();// 45 + } + } + public int test(String var1) { try { - int var2 = Integer.parseInt(var1); + int var2 = Integer.parseInt(var1);// 51 return var2; } catch (Exception var6) { System.out.println("Error" + var6); @@ -29,3 +39,39 @@ public class TestTryCatchFinally { return -1; } } + +class 'pkg/TestTryCatchFinally' { + method 'test1 (Ljava/lang/String;)V' { + 0 5 + 3 5 + 5 5 + 14 8 + 17 8 + 19 8 + } + + method 'foo (I)I' { + 1 19 + 2 19 + c 20 + e 21 + f 21 + 13 22 + 1b 24 + } + + method 'test (Ljava/lang/String;)I' { + 1 30 + 4 30 + } +} + +Lines mapping: +24 <-> 6 +27 <-> 9 +39 <-> 20 +40 <-> 21 +41 <-> 22 +42 <-> 23 +45 <-> 25 +51 <-> 31 diff --git a/testData/src/pkg/TestAnonymousClass.java b/testData/src/pkg/TestAnonymousClass.java new file mode 100644 index 0000000..3c2e3b0 --- /dev/null +++ b/testData/src/pkg/TestAnonymousClass.java @@ -0,0 +1,71 @@ +package pkg; + +import java.lang.Exception; +import java.lang.Override; +import java.lang.Runnable; + +public abstract class TestAnonymousClass { + void foo(int i) + throws Exception { + if (i > 0) { + I r = new I() { + public void foo() throws Exception { + int a = 5; + int b = 5; + } + }; + r.foo(); + } + else { + final int x =5; + System.out.println(x); + } + } + + public static final Runnable R3 = new Runnable() { + @Override + public void run() { + int a =5; + int b =5; + } + }; + + + void boo() { + int a =5; + } + + void zoo() { + int a =5; + } + + public static final Runnable R = new Runnable() { + @Override + public void run() { + int a =5; + int b =5; + } + }; + + public static final Runnable R1 = new Runnable() { + @Override + public void run() { + int a =5; + int b =5; + } + }; + + interface I { + void foo() throws Exception; + } + + private static class Inner { + private static Runnable R_I = new Runnable() { + @Override + public void run() { + int a =5; + int b =5; + } + }; + } +} diff --git a/testData/src/pkg/TestDeprecations.java b/testData/src/pkg/TestDeprecations.java index 18ba0b5..0f6baad 100644 --- a/testData/src/pkg/TestDeprecations.java +++ b/testData/src/pkg/TestDeprecations.java @@ -15,7 +15,7 @@ */ package pkg; -public class TestDeprecations { +public abstract class TestDeprecations { /** @deprecated */ public int byComment; @@ -23,14 +23,36 @@ public class TestDeprecations { public int byAnno; /** @deprecated */ - public void byComment() { } + public void byComment() { + int a =5; + } + + /** @deprecated */ + public abstract void byCommentAbstract(); + + @Deprecated + public void byAnno() { + int a =5; + } @Deprecated - public void byAnno() { } + public abstract void byAnnoAbstract(); /** @deprecated */ - public static class ByComment { } + public static class ByComment { + int a =5; + + void foo() { + int x = 5; + } + } @Deprecated - public static class ByAnno { } + public static class ByAnno { + int a =5; + + void foo() { + int x = 5; + } + } } \ No newline at end of file diff --git a/testData/src/pkg/TestLocalClass.java b/testData/src/pkg/TestLocalClass.java new file mode 100644 index 0000000..3667a94 --- /dev/null +++ b/testData/src/pkg/TestLocalClass.java @@ -0,0 +1,26 @@ +package pkg; + +import java.lang.Override; +import java.lang.Runnable; + +public abstract class TestLocalClass { + void foo() { + int a =5; + class Local{ + void foo() { + int b = 5; + int v = 5; + } + }; + Local l = new Local(); + l.foo(); + } + + void boo() { + int a =5; + } + + void zoo() { + int a =5; + } +} diff --git a/testData/src/pkg/TestThrowException.java b/testData/src/pkg/TestThrowException.java new file mode 100644 index 0000000..76d571a --- /dev/null +++ b/testData/src/pkg/TestThrowException.java @@ -0,0 +1,19 @@ +package pkg; + +import java.lang.Override; +import java.lang.Runnable; + +public class TestThrowException { + Runnable r; + public TestThrowException(int a) { + if (a > 0) { + throw new IllegalArgumentException("xxx"); + } + r = new Runnable() { + @Override + public void run() { + int a = 5; + } + }; + } +} diff --git a/testData/src/pkg/TestTryCatchFinally.java b/testData/src/pkg/TestTryCatchFinally.java index da3588a..2c49800 100644 --- a/testData/src/pkg/TestTryCatchFinally.java +++ b/testData/src/pkg/TestTryCatchFinally.java @@ -15,6 +15,9 @@ */ package pkg; +import java.lang.Exception; +import java.lang.RuntimeException; + public class TestTryCatchFinally { public void test1(String x) { try { @@ -32,6 +35,17 @@ public class TestTryCatchFinally { } } + int foo(int a) throws Exception { + if (a < 1) { + throw new RuntimeException(); + } else if ( a <5) { + return a; + } + else { + throw new Exception(); + } + } + public int test(String a) { try { return Integer.parseInt(a);