From 848c420977eb507e9d692cd191920ac31075f1e6 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Tue, 14 Oct 2014 13:35:00 +0200 Subject: [PATCH] java-decompiler: line numbers matching test --- .../java/decompiler/LineNumbersMatchTest.java | 33 ++++++++++++++++++ .../classes/pkg/TestLineNumbersMatch$1.class | Bin 0 -> 741 bytes .../classes/pkg/TestLineNumbersMatch.class | Bin 0 -> 783 bytes testData/results/TestLineNumbersMatch.dec | 22 ++++++++++++ testData/src/pkg/TestLineNumbersMatch.java | 22 ++++++++++++ 5 files changed, 77 insertions(+) create mode 100644 test/org/jetbrains/java/decompiler/LineNumbersMatchTest.java create mode 100644 testData/classes/pkg/TestLineNumbersMatch$1.class create mode 100644 testData/classes/pkg/TestLineNumbersMatch.class create mode 100644 testData/results/TestLineNumbersMatch.dec create mode 100644 testData/src/pkg/TestLineNumbersMatch.java diff --git a/test/org/jetbrains/java/decompiler/LineNumbersMatchTest.java b/test/org/jetbrains/java/decompiler/LineNumbersMatchTest.java new file mode 100644 index 0000000..cb19c97 --- /dev/null +++ b/test/org/jetbrains/java/decompiler/LineNumbersMatchTest.java @@ -0,0 +1,33 @@ +/* + * 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 LineNumbersMatchTest extends SingleClassesTestBase { + @Override + protected Map getDecompilerOptions() { + return new HashMap() {{ + put(IFernflowerPreferences.USE_DEBUG_LINE_NUMBERS, "1"); + }}; + } + + @Test public void testMatch1() { doTest("pkg/TestLineNumbersMatch"); } +} \ No newline at end of file diff --git a/testData/classes/pkg/TestLineNumbersMatch$1.class b/testData/classes/pkg/TestLineNumbersMatch$1.class new file mode 100644 index 0000000000000000000000000000000000000000..ad5ec9014e32fda950cc6eb8208e61f1f4fb587d GIT binary patch literal 741 zcmZ`%&2G~`7@SRlT|0(G2`+7EAwYm6ErbFRhaxT&NJuFlQswTrt7MD4uIx1xk5wc< z;=lv&P>8V`DIhgod4ERp&3rrB-+zAo0`Lrv99X#N!p4?^ZQNSHZ5M6av2oYNJsTYX z%gj{Pc_OemJpD8s9LdZKm6q@Fcp}s6Ffie4pRAWkEAvWVyStp$8w=D9l4B{by3jZZ zCJ~Y5FbRWb9Hgo^&%s(@E&u`Vt=2L@Pf$O0T-^N1^UGxO%G-#hGGi%4vM&H8@ zb{WyKggScyjlyLR1$sJoKRJ=1;hh)I$6V`+Al8?O2vp*y|LKgrWJbokXp&RSAC__| z8GJ~UHY1bDAZ8e?OJD)}v>-){$?skimaVah0qpn2dkFRq71d_#JFYAQ+)}zp f`_?}q&RnF5HI`Ly1M6IC*uW;5+_{vqxbpi8N^zrw literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestLineNumbersMatch.class b/testData/classes/pkg/TestLineNumbersMatch.class new file mode 100644 index 0000000000000000000000000000000000000000..0a96fbb25cd9a20f3938d8843fb61aa153bed8e2 GIT binary patch literal 783 zcmZ{i-%iv(6vn@4OS@ajE-o%CApS)ys5I!E7;i{SOcpg+LLzt5I#~++vuV2~K8jD^ zwO(MNi4WjI8NcanKofS7nRDjM`F?YHroaFE_yyn@0v9fBG_ir34cu~Z8+RI5c5v5) zjeC08ba3Cn0|5wlud_@Q`-v<|RSMWI;w-LS3Yh-Zk$|Ley(tv@;&28XJwE@kC`tfG@W0VCZd)<4#C5po_2EDS0cogK*0 zlw+h%1>8YCE+X|R*4M3GMcX-*AEk!{v>ZJ2;A4w8>0sN#BRpmuv&z`q)v6~RcF+>& z%}Ntk)Hei)%!a|+@Kik|{rU>58y`Gtx;( zMx8$q*0)dQI{WDtMV06rLSYI%&-8s6NXV$z9Ecy+uO)BTHLaJsj zPxKe;9wRHH_jqQ(Xgjp47sWm&O&9C^g#DfcJLhOz*6h|SP4E6ww>M=QSfkRwI&TJB J!9SRm<1ah8l>`6) literal 0 HcmV?d00001 diff --git a/testData/results/TestLineNumbersMatch.dec b/testData/results/TestLineNumbersMatch.dec new file mode 100644 index 0000000..9ab7626 --- /dev/null +++ b/testData/results/TestLineNumbersMatch.dec @@ -0,0 +1,22 @@ +package pkg; + +class TestLineNumbersMatch { + + + + void m1(boolean b) { + if(b) { + System.out.println("a"); + } else { + System.out.println("b"); + } } + + void m2() { + (new Runnable() { + + public void run() { + System.out.println("run with me"); + } + }).run(); + } +} diff --git a/testData/src/pkg/TestLineNumbersMatch.java b/testData/src/pkg/TestLineNumbersMatch.java new file mode 100644 index 0000000..d9d486a --- /dev/null +++ b/testData/src/pkg/TestLineNumbersMatch.java @@ -0,0 +1,22 @@ +/* + * Weird comment here. + */ +package pkg; + +class TestLineNumbersMatch { + void m1(boolean b) { + if (b) + System.out.println("a"); + else + System.out.println("b"); + } + + void m2() { + new Runnable() { + @Override + public void run() { + System.out.println("run with me"); + } + }.run(); + } +} \ No newline at end of file