decompiler: major line numbers fixes

master
Egor.Ushakov 10 years ago
parent 4a6a658b4c
commit 4ee8ad716d
  1. 15
      src/org/jetbrains/java/decompiler/main/ClassWriter.java
  2. 1
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java
  3. 5
      src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java
  4. 36
      test/org/jetbrains/java/decompiler/BytecodeToSourceMappingTest.java
  5. 18
      test/org/jetbrains/java/decompiler/SingleClassesTest.java
  6. BIN
      testData/classes/pkg/TestAnonymousClass$1.class
  7. BIN
      testData/classes/pkg/TestAnonymousClass$2.class
  8. BIN
      testData/classes/pkg/TestAnonymousClass$3.class
  9. BIN
      testData/classes/pkg/TestAnonymousClass$4.class
  10. BIN
      testData/classes/pkg/TestAnonymousClass$I.class
  11. BIN
      testData/classes/pkg/TestAnonymousClass$Inner$1.class
  12. BIN
      testData/classes/pkg/TestAnonymousClass$Inner.class
  13. BIN
      testData/classes/pkg/TestAnonymousClass.class
  14. BIN
      testData/classes/pkg/TestDeprecations$ByAnno.class
  15. BIN
      testData/classes/pkg/TestDeprecations$ByComment.class
  16. BIN
      testData/classes/pkg/TestDeprecations.class
  17. BIN
      testData/classes/pkg/TestLocalClass$1Local.class
  18. BIN
      testData/classes/pkg/TestLocalClass.class
  19. BIN
      testData/classes/pkg/TestThrowException$1.class
  20. BIN
      testData/classes/pkg/TestThrowException.class
  21. BIN
      testData/classes/pkg/TestTryCatchFinally.class
  22. 28
      testData/results/InvalidMethodSignature.dec
  23. 36
      testData/results/TestAmbiguousCall.dec
  24. 36
      testData/results/TestAmbiguousCallWithDebugInfo.dec
  25. 142
      testData/results/TestAnonymousClass.dec
  26. 27
      testData/results/TestClassCast.dec
  27. 13
      testData/results/TestClassFields.dec
  28. 136
      testData/results/TestClassLambda.dec
  29. 48
      testData/results/TestClassLoop.dec
  30. 24
      testData/results/TestClassNestedInitializer.dec
  31. 27
      testData/results/TestClassSwitch.dec
  32. 111
      testData/results/TestClassTypes.dec
  33. 61
      testData/results/TestClassVar.dec
  34. 20
      testData/results/TestCodeConstructs.dec
  35. 1
      testData/results/TestConstants.dec
  36. 40
      testData/results/TestDebugSymbols.dec
  37. 53
      testData/results/TestDeprecations.dec
  38. 19
      testData/results/TestEnum.dec
  39. 20
      testData/results/TestExtendsList.dec
  40. 30
      testData/results/TestInnerClassConstructor.dec
  41. 61
      testData/results/TestLocalClass.dec
  42. 1
      testData/results/TestMethodParameters.dec
  43. 39
      testData/results/TestThrowException.dec
  44. 52
      testData/results/TestTryCatchFinally.dec
  45. 71
      testData/src/pkg/TestAnonymousClass.java
  46. 32
      testData/src/pkg/TestDeprecations.java
  47. 26
      testData/src/pkg/TestLocalClass.java
  48. 19
      testData/src/pkg/TestThrowException.java
  49. 14
      testData/src/pkg/TestTryCatchFinally.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);

@ -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;

@ -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);

@ -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<String, Object> getDecompilerOptions() {
return new HashMap<String, Object>() {{
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"); }
}

@ -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<String, Object> getDecompilerOptions() {
return new HashMap<String, Object>() {{
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"); }
}

@ -13,14 +13,36 @@ class i implements bg {
i(b var1, j var2) {
this.b = var1;
this.a = var2;
this.a = var2;// 1
}
public void a(c var1, k var2, boolean var3) {
File var4 = this.a.b().a(var1);
b.a(this.b).add(var4);
File var4 = this.a.b().a(var1);// 2
b.a(this.b).add(var4);// 3
}
public void a(a.a.a.a.c.b var1) {
}
}
class 'a/a/a/a/e/f/i' {
method '<init> (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

@ -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

@ -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

@ -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

@ -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

@ -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 '<clinit> ()V' {
11 7
14 7
17 7
}
}
Lines mapping:
26 <-> 8

@ -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<String> 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

@ -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

@ -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 '<init> (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

@ -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

@ -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

@ -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

@ -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

@ -71,3 +71,4 @@ public class TestConstants {
Class<?> value();
}
}

@ -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

@ -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

@ -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 '<init> (Ljava/lang/String;I)V' {
3 20
5 20
}
method '<init> (Ljava/lang/String;ILjava/lang/String;)V' {
8 24
}
}
Lines mapping:
34 <-> 21
35 <-> 25

@ -2,10 +2,26 @@ package pkg;
public class TestExtendsList {
static <T extends Comparable<? super T>> T m1(T var0) {
return null;
return null;// 20
}
static <T extends Object & Comparable<? super T>> 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

@ -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 '<init> (Lpkg/TestInnerClassConstructor;Ljava/lang/String;)V' {
b 13
}
}
Lines mapping:
5 <-> 5
9 <-> 9
14 <-> 14

@ -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

@ -40,3 +40,4 @@ public class TestMethodParameters {
}
}
}

@ -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 '<init> (I)V' {
5 6
c 7
11 7
1b 9
}
}
Lines mapping:
9 <-> 7
10 <-> 8
12 <-> 10
15 <-> 12

@ -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

@ -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;
}
};
}
}

@ -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;
}
}
}

@ -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;
}
}

@ -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;
}
};
}
}

@ -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);

Loading…
Cancel
Save