decompiler: fixed anonymous class line numbers

This commit is contained in:
Egor.Ushakov
2015-01-21 21:21:43 +03:00
parent 0bba28eded
commit a74f586e34
10 changed files with 148 additions and 33 deletions

View File

@@ -252,12 +252,16 @@ public class NewExprent extends Exprent {
buf.setLength(0); // remove the usual 'new <class>()', it will be replaced with lambda style '() ->'
}
Exprent methodObject = constructor == null ? null : constructor.getInstance();
new ClassWriter().classLambdaToJava(child, buf, methodObject, indent);
tracer.incrementCurrentSourceLine(buf.countLines());
TextBuffer clsBuf = new TextBuffer();
new ClassWriter().classLambdaToJava(child, clsBuf, methodObject, indent);
buf.append(clsBuf);
tracer.incrementCurrentSourceLine(clsBuf.countLines());
}
else {
new ClassWriter().classToJava(child, buf, indent, tracer);
tracer.incrementCurrentSourceLine(buf.countLines());
TextBuffer clsBuf = new TextBuffer();
new ClassWriter().classToJava(child, clsBuf, indent, tracer);
buf.append(clsBuf);
tracer.incrementCurrentSourceLine(clsBuf.countLines());
}
}
else if (directArrayInit) {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -19,6 +19,30 @@ public abstract class TestAnonymousClass {
boolean var2 = true;// 54
}
};
private final TestAnonymousClass.InnerRecursive y = new TestAnonymousClass.InnerRecursive(new TestAnonymousClass.InnerRecursive((TestAnonymousClass.InnerRecursive)null) {
void foo() {
boolean var1 = true;// 75
boolean var2 = true;// 76
boolean var3 = true;// 77
}
}) {
int v = 5;
int t = 5;
int j = 5;
int o = 5;
};
private final TestAnonymousClass.InnerRecursive x = new TestAnonymousClass.InnerRecursive(new TestAnonymousClass.InnerRecursive((TestAnonymousClass.InnerRecursive)null) {
void foo() {
boolean var1 = true;// 90
boolean var2 = true;// 91
boolean var3 = true;// 92
}
}) {
int v = 5;
int t = 5;
int j = 5;
int o = 5;
};
void foo(int var1) throws Exception {
if(var1 > 0) {// 10
@@ -43,8 +67,19 @@ public abstract class TestAnonymousClass {
boolean var1 = true;// 39
}
static class InnerRecursive {
TestAnonymousClass.InnerRecursive r;
public InnerRecursive(TestAnonymousClass.InnerRecursive var1) {
this.r = var1;// 105
}
void foo() {
}
}
private static class Inner {
private static final Runnable R_I = new Runnable() {
private static Runnable R_I = new Runnable() {
public void run() {
boolean var1 = true;// 66
boolean var2 = true;// 67
@@ -84,59 +119,94 @@ class 'pkg/TestAnonymousClass$4' {
}
}
class 'pkg/TestAnonymousClass$5' {
method 'foo ()V' {
0 23
1 23
2 24
3 24
4 25
5 25
}
}
class 'pkg/TestAnonymousClass$7' {
method 'foo ()V' {
0 35
1 35
2 36
3 36
4 37
5 37
}
}
class 'pkg/TestAnonymousClass$1' {
method 'foo ()V' {
0 26
1 26
2 27
3 27
0 50
1 50
2 51
3 51
}
}
class 'pkg/TestAnonymousClass' {
method 'foo (I)V' {
1 23
c 29
e 30
16 32
19 32
1a 32
1 47
c 53
e 54
16 56
19 56
1a 56
}
method 'boo ()V' {
0 38
1 38
0 62
1 62
}
method 'zoo ()V' {
0 42
1 42
0 66
1 66
}
}
class 'pkg/TestAnonymousClass$InnerRecursive' {
method '<init> (Lpkg/TestAnonymousClass$InnerRecursive;)V' {
6 73
}
}
class 'pkg/TestAnonymousClass$Inner$1' {
method 'run ()V' {
0 48
1 48
2 49
3 49
0 83
1 83
2 84
3 84
}
}
Lines mapping:
10 <-> 24
11 <-> 30
13 <-> 27
14 <-> 28
17 <-> 31
21 <-> 33
10 <-> 48
11 <-> 54
13 <-> 51
14 <-> 52
17 <-> 55
21 <-> 57
28 <-> 6
29 <-> 7
35 <-> 39
39 <-> 43
35 <-> 63
39 <-> 67
45 <-> 12
46 <-> 13
53 <-> 18
54 <-> 19
66 <-> 49
67 <-> 50
66 <-> 84
67 <-> 85
75 <-> 24
76 <-> 25
77 <-> 26
90 <-> 36
91 <-> 37
92 <-> 38
105 <-> 74

View File

@@ -68,4 +68,45 @@ public abstract class TestAnonymousClass {
}
};
}
private final InnerRecursive y = new InnerRecursive(new InnerRecursive(null) {
@Override
void foo() {
int a =5;
int b =5;
int g =5;
}
}) {
int v =5;
int t =5;
int j =5;
int o =5;
};
private final InnerRecursive x = new InnerRecursive(new InnerRecursive(null) {
@Override
void foo() {
int a =5;
int b =5;
int g =5;
}
}) {
int v =5;
int t =5;
int j =5;
int o =5;
};
static class InnerRecursive {
InnerRecursive r;
public InnerRecursive(InnerRecursive r) {
this.r = r;
}
void foo() {
}
}
}