From 9b327098569820feece002cac38d1b6739db32de Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Wed, 14 Jan 2015 14:28:55 +0300 Subject: [PATCH] IDEA-131754 Catch and finally blocks have no line information --- .../modules/code/DeadCodeHelper.java | 3 ++- testData/results/TestClassLoop.dec | 10 ++++++++-- .../TestClassSimpleBytecodeMapping.dec | 11 +++++++++-- testData/results/TestClassVar.dec | 5 ++++- testData/results/TestSynchronizedMapping.dec | 1 + testData/results/TestTryCatchFinally.dec | 19 ++++++++++++++++--- 6 files changed, 40 insertions(+), 9 deletions(-) diff --git a/src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java b/src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java index c7dd8ca..233011d 100644 --- a/src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -416,6 +416,7 @@ public class DeadCodeHelper { if (sameRanges) { seq.addSequence(next.getSeq()); + block.getInstrOldOffsets().addAll(next.getInstrOldOffsets()); next.getSeq().clear(); removeEmptyBlock(graph, next, true); diff --git a/testData/results/TestClassLoop.dec b/testData/results/TestClassLoop.dec index 5384a98..f3bf0e0 100644 --- a/testData/results/TestClassLoop.dec +++ b/testData/results/TestClassLoop.dec @@ -16,7 +16,7 @@ public class TestClassLoop { return; } } finally { - System.out.println("1"); + System.out.println("1");// 38 } } } @@ -30,7 +30,7 @@ public class TestClassLoop { System.out.println("1");// 49 break; } finally { - if(var0) { + if(var0) {// 52 System.out.println("3");// 53 continue; } @@ -54,6 +54,9 @@ class 'pkg/TestClassLoop' { 4 10 d 10 f 14 + 26 18 + 27 18 + 2a 18 } method 'testFinallyContinue ()V' { @@ -64,6 +67,7 @@ class 'pkg/TestClassLoop' { e 29 11 29 13 29 + 26 32 2a 33 2d 33 2f 33 @@ -74,6 +78,8 @@ Lines mapping: 23 <-> 6 29 <-> 11 33 <-> 15 +38 <-> 19 45 <-> 25 49 <-> 30 +52 <-> 33 53 <-> 34 diff --git a/testData/results/TestClassSimpleBytecodeMapping.dec b/testData/results/TestClassSimpleBytecodeMapping.dec index 2911513..b6b6bba 100644 --- a/testData/results/TestClassSimpleBytecodeMapping.dec +++ b/testData/results/TestClassSimpleBytecodeMapping.dec @@ -22,9 +22,9 @@ public class TestClassSimpleBytecodeMapping { try { Integer.parseInt(var1);// 34 } catch (Exception var6) { - System.out.println(var6); + System.out.println(var6);// 36 } finally { - System.out.println("Finally"); + System.out.println("Finally");// 38 } } @@ -80,6 +80,11 @@ class 'pkg/TestClassSimpleBytecodeMapping' { method 'test2 (Ljava/lang/String;)V' { 1 22 + 11 24 + 15 24 + 23 26 + 24 26 + 27 26 } method 'run (Ljava/lang/Runnable;)V' { @@ -114,6 +119,8 @@ Lines mapping: 27 <-> 16 28 <-> 17 34 <-> 23 +36 <-> 25 +38 <-> 27 44 <-> 44 49 <-> 33 54 <-> 38 diff --git a/testData/results/TestClassVar.dec b/testData/results/TestClassVar.dec index 14d2e07..cedd9c0 100644 --- a/testData/results/TestClassVar.dec +++ b/testData/results/TestClassVar.dec @@ -9,7 +9,7 @@ public class TestClassVar { try { System.out.println();// 29 } finally { - if(this.field_boolean) { + if(this.field_boolean) {// 32 System.out.println();// 33 } @@ -46,6 +46,8 @@ class 'pkg/TestClassVar' { 3 7 8 9 b 9 + 1f 11 + 20 11 26 12 29 12 } @@ -73,6 +75,7 @@ class 'pkg/TestClassVar' { Lines mapping: 26 <-> 8 29 <-> 10 +32 <-> 12 33 <-> 13 40 <-> 22 45 <-> 26 diff --git a/testData/results/TestSynchronizedMapping.dec b/testData/results/TestSynchronizedMapping.dec index ca38d8c..6ba9f33 100644 --- a/testData/results/TestSynchronizedMapping.dec +++ b/testData/results/TestSynchronizedMapping.dec @@ -16,6 +16,7 @@ class 'pkg/TestSynchronizedMapping' { method 'test (I)I' { 3 4 5 5 + a 5 } method 'test2 (Ljava/lang/String;)V' { diff --git a/testData/results/TestTryCatchFinally.dec b/testData/results/TestTryCatchFinally.dec index 673238e..2dc71a5 100644 --- a/testData/results/TestTryCatchFinally.dec +++ b/testData/results/TestTryCatchFinally.dec @@ -11,7 +11,7 @@ public class TestTryCatchFinally { ; } } finally { - System.out.println("finally"); + System.out.println("finally");// 34 } } @@ -31,9 +31,9 @@ public class TestTryCatchFinally { int var2 = Integer.parseInt(var1);// 51 return var2; } catch (Exception var6) { - System.out.println("Error" + var6); + System.out.println("Error" + var6);// 53 } finally { - System.out.println("Finally"); + System.out.println("Finally");// 55 } return -1; @@ -48,6 +48,9 @@ class 'pkg/TestTryCatchFinally' { 14 8 17 8 19 8 + 2b 13 + 2d 13 + 30 13 } method 'foo (I)I' { @@ -63,15 +66,25 @@ class 'pkg/TestTryCatchFinally' { method 'test (Ljava/lang/String;)I' { 1 30 4 30 + 10 33 + 1a 33 + 23 33 + 26 33 + 34 35 + 35 35 + 38 35 } } Lines mapping: 24 <-> 6 27 <-> 9 +34 <-> 14 39 <-> 20 40 <-> 21 41 <-> 22 42 <-> 23 45 <-> 25 51 <-> 31 +53 <-> 34 +55 <-> 36