decompiler: generate line number matching for return and some other statements

master
Egor.Ushakov 10 years ago
parent f3af4dd681
commit 7e30facd33
  1. 3
      src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java
  2. 12
      testData/results/TestClassLoop.dec
  3. 1
      testData/results/TestClassVar.dec
  4. 9
      testData/results/TestTryCatchFinally.dec

@ -889,13 +889,16 @@ public class FinallyProcessor {
if (seqPattern.length() < seqSample.length()) { // split in two blocks
SimpleInstructionSequence seq = new SimpleInstructionSequence();
LinkedList<Integer> oldOffsets = new LinkedList<Integer>();
for (int i = seqSample.length() - 1; i >= seqPattern.length(); i--) {
seq.addInstruction(0, seqSample.getInstr(i), -1);
oldOffsets.addFirst(sample.getOldOffset(i));
seqSample.removeInstruction(i);
}
BasicBlock newblock = new BasicBlock(++graph.last_id);
newblock.setSeq(seq);
newblock.getInstrOldOffsets().addAll(oldOffsets);
List<BasicBlock> lstTemp = new ArrayList<BasicBlock>();
lstTemp.addAll(sample.getSuccs());

@ -13,7 +13,7 @@ public class TestClassLoop {
while(true) {
try {
if(!var0) {// 33
return;
return;// 34
}
} finally {
System.out.println("1");// 38
@ -37,7 +37,7 @@ public class TestClassLoop {
}
}
System.out.println("4");
System.out.println("4");// 58
}
}
}
@ -54,6 +54,7 @@ class 'pkg/TestClassLoop' {
4 10
d 10
f 14
1a 15
26 18
27 18
2a 18
@ -71,6 +72,9 @@ class 'pkg/TestClassLoop' {
2a 33
2d 33
2f 33
37 39
3a 39
3c 39
}
}
@ -78,13 +82,13 @@ Lines mapping:
23 <-> 6
29 <-> 11
33 <-> 15
34 <-> 16
38 <-> 19
45 <-> 25
49 <-> 30
52 <-> 33
53 <-> 34
58 <-> 40
Not mapped:
34
39
54
58

@ -50,6 +50,7 @@ class 'pkg/TestClassVar' {
20 11
26 12
29 12
2e 7
34 18
}

@ -36,7 +36,7 @@ public class TestTryCatchFinally {
System.out.println("Finally");// 55
}
return -1;
return -1;// 56
}
}
@ -67,13 +67,16 @@ class 'pkg/TestTryCatchFinally' {
method 'test (Ljava/lang/String;)I' {
1 30
4 30
e 31
10 33
1a 33
23 33
26 33
31 38
34 35
35 35
38 35
3f 38
}
}
@ -90,11 +93,11 @@ Lines mapping:
51 <-> 31
53 <-> 34
55 <-> 36
56 <-> 39
57 <-> 39
Not mapped:
25
28
32
35
52
56
57

Loading…
Cancel
Save