diff --git a/src/org/jetbrains/java/decompiler/main/ClassWriter.java b/src/org/jetbrains/java/decompiler/main/ClassWriter.java index e401dee..612255f 100644 --- a/src/org/jetbrains/java/decompiler/main/ClassWriter.java +++ b/src/org/jetbrains/java/decompiler/main/ClassWriter.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); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java index 70ea2bc..26cec62 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java @@ -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; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java index 1c028d0..4a5eb13 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java @@ -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); diff --git a/test/org/jetbrains/java/decompiler/BytecodeToSourceMappingTest.java b/test/org/jetbrains/java/decompiler/BytecodeToSourceMappingTest.java deleted file mode 100644 index d84dd99..0000000 --- a/test/org/jetbrains/java/decompiler/BytecodeToSourceMappingTest.java +++ /dev/null @@ -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 getDecompilerOptions() { - return new HashMap() {{ - 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"); } -} diff --git a/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/test/org/jetbrains/java/decompiler/SingleClassesTest.java index c1b36de..8a51c72 100644 --- a/test/org/jetbrains/java/decompiler/SingleClassesTest.java +++ b/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -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 getDecompilerOptions() { + return new HashMap() {{ + 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"); } } diff --git a/testData/classes/pkg/TestAnonymousClass$1.class b/testData/classes/pkg/TestAnonymousClass$1.class new file mode 100644 index 0000000..ff5e587 Binary files /dev/null and b/testData/classes/pkg/TestAnonymousClass$1.class differ diff --git a/testData/classes/pkg/TestAnonymousClass$2.class b/testData/classes/pkg/TestAnonymousClass$2.class new file mode 100644 index 0000000..536f320 Binary files /dev/null and b/testData/classes/pkg/TestAnonymousClass$2.class differ diff --git a/testData/classes/pkg/TestAnonymousClass$3.class b/testData/classes/pkg/TestAnonymousClass$3.class new file mode 100644 index 0000000..cc8d377 Binary files /dev/null and b/testData/classes/pkg/TestAnonymousClass$3.class differ diff --git a/testData/classes/pkg/TestAnonymousClass$4.class b/testData/classes/pkg/TestAnonymousClass$4.class new file mode 100644 index 0000000..3ee6436 Binary files /dev/null and b/testData/classes/pkg/TestAnonymousClass$4.class differ diff --git a/testData/classes/pkg/TestAnonymousClass$I.class b/testData/classes/pkg/TestAnonymousClass$I.class new file mode 100644 index 0000000..48eb4ed Binary files /dev/null and b/testData/classes/pkg/TestAnonymousClass$I.class differ diff --git a/testData/classes/pkg/TestAnonymousClass$Inner$1.class b/testData/classes/pkg/TestAnonymousClass$Inner$1.class new file mode 100644 index 0000000..798b358 Binary files /dev/null and b/testData/classes/pkg/TestAnonymousClass$Inner$1.class differ diff --git a/testData/classes/pkg/TestAnonymousClass$Inner.class b/testData/classes/pkg/TestAnonymousClass$Inner.class new file mode 100644 index 0000000..2b3d463 Binary files /dev/null and b/testData/classes/pkg/TestAnonymousClass$Inner.class differ diff --git a/testData/classes/pkg/TestAnonymousClass.class b/testData/classes/pkg/TestAnonymousClass.class new file mode 100644 index 0000000..a849cd6 Binary files /dev/null and b/testData/classes/pkg/TestAnonymousClass.class differ diff --git a/testData/classes/pkg/TestDeprecations$ByAnno.class b/testData/classes/pkg/TestDeprecations$ByAnno.class index dca1705..cb8f565 100644 Binary files a/testData/classes/pkg/TestDeprecations$ByAnno.class and b/testData/classes/pkg/TestDeprecations$ByAnno.class differ diff --git a/testData/classes/pkg/TestDeprecations$ByComment.class b/testData/classes/pkg/TestDeprecations$ByComment.class index c1da53c..d6013ce 100644 Binary files a/testData/classes/pkg/TestDeprecations$ByComment.class and b/testData/classes/pkg/TestDeprecations$ByComment.class differ diff --git a/testData/classes/pkg/TestDeprecations.class b/testData/classes/pkg/TestDeprecations.class index 29924d2..ab0eb0e 100644 Binary files a/testData/classes/pkg/TestDeprecations.class and b/testData/classes/pkg/TestDeprecations.class differ diff --git a/testData/classes/pkg/TestLocalClass$1Local.class b/testData/classes/pkg/TestLocalClass$1Local.class new file mode 100644 index 0000000..7b5cd40 Binary files /dev/null and b/testData/classes/pkg/TestLocalClass$1Local.class differ diff --git a/testData/classes/pkg/TestLocalClass.class b/testData/classes/pkg/TestLocalClass.class new file mode 100644 index 0000000..fc9073b Binary files /dev/null and b/testData/classes/pkg/TestLocalClass.class differ diff --git a/testData/classes/pkg/TestThrowException$1.class b/testData/classes/pkg/TestThrowException$1.class new file mode 100644 index 0000000..e626366 Binary files /dev/null and b/testData/classes/pkg/TestThrowException$1.class differ diff --git a/testData/classes/pkg/TestThrowException.class b/testData/classes/pkg/TestThrowException.class new file mode 100644 index 0000000..b6c514a Binary files /dev/null and b/testData/classes/pkg/TestThrowException.class differ diff --git a/testData/classes/pkg/TestTryCatchFinally.class b/testData/classes/pkg/TestTryCatchFinally.class index 244dfad..229e1b9 100644 Binary files a/testData/classes/pkg/TestTryCatchFinally.class and b/testData/classes/pkg/TestTryCatchFinally.class differ diff --git a/testData/results/InvalidMethodSignature.dec b/testData/results/InvalidMethodSignature.dec index 3b1bee4..24b7c85 100644 --- a/testData/results/InvalidMethodSignature.dec +++ b/testData/results/InvalidMethodSignature.dec @@ -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 ' (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 diff --git a/testData/results/TestAmbiguousCall.dec b/testData/results/TestAmbiguousCall.dec index b335867..caeb41d 100644 --- a/testData/results/TestAmbiguousCall.dec +++ b/testData/results/TestAmbiguousCall.dec @@ -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 diff --git a/testData/results/TestAmbiguousCallWithDebugInfo.dec b/testData/results/TestAmbiguousCallWithDebugInfo.dec index da3baa9..6380d6d 100644 --- a/testData/results/TestAmbiguousCallWithDebugInfo.dec +++ b/testData/results/TestAmbiguousCallWithDebugInfo.dec @@ -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 diff --git a/testData/results/TestAnonymousClass.dec b/testData/results/TestAnonymousClass.dec new file mode 100644 index 0000000..18cfaef --- /dev/null +++ b/testData/results/TestAnonymousClass.dec @@ -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 diff --git a/testData/results/TestClassCast.dec b/testData/results/TestClassCast.dec index e09162c..7593d6d 100644 --- a/testData/results/TestClassCast.dec +++ b/testData/results/TestClassCast.dec @@ -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 diff --git a/testData/results/TestClassFields.dec b/testData/results/TestClassFields.dec index 749d828..1415306 100644 --- a/testData/results/TestClassFields.dec +++ b/testData/results/TestClassFields.dec @@ -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 ' ()V' { + 11 7 + 14 7 + 17 7 + } +} + +Lines mapping: +26 <-> 8 diff --git a/testData/results/TestClassLambda.dec b/testData/results/TestClassLambda.dec index d0485d3..5dadaf7 100644 --- a/testData/results/TestClassLambda.dec +++ b/testData/results/TestClassLambda.dec @@ -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 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 diff --git a/testData/results/TestClassLoop.dec b/testData/results/TestClassLoop.dec index 74b8bac..5384a98 100644 --- a/testData/results/TestClassLoop.dec +++ b/testData/results/TestClassLoop.dec @@ -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 diff --git a/testData/results/TestClassNestedInitializer.dec b/testData/results/TestClassNestedInitializer.dec index 585b01a..b9fa69c 100644 --- a/testData/results/TestClassNestedInitializer.dec +++ b/testData/results/TestClassNestedInitializer.dec @@ -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 ' (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 diff --git a/testData/results/TestClassSwitch.dec b/testData/results/TestClassSwitch.dec index 50efbe9..695350f 100644 --- a/testData/results/TestClassSwitch.dec +++ b/testData/results/TestClassSwitch.dec @@ -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 diff --git a/testData/results/TestClassTypes.dec b/testData/results/TestClassTypes.dec index 7a50473..f2a3fdb 100644 --- a/testData/results/TestClassTypes.dec +++ b/testData/results/TestClassTypes.dec @@ -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 diff --git a/testData/results/TestClassVar.dec b/testData/results/TestClassVar.dec index 4cfd27f..e2395b1 100644 --- a/testData/results/TestClassVar.dec +++ b/testData/results/TestClassVar.dec @@ -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 diff --git a/testData/results/TestCodeConstructs.dec b/testData/results/TestCodeConstructs.dec index eb9de8d..eeb9c19 100644 --- a/testData/results/TestCodeConstructs.dec +++ b/testData/results/TestCodeConstructs.dec @@ -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 diff --git a/testData/results/TestConstants.dec b/testData/results/TestConstants.dec index 216da8e..47f4c1d 100644 --- a/testData/results/TestConstants.dec +++ b/testData/results/TestConstants.dec @@ -71,3 +71,4 @@ public class TestConstants { Class value(); } } + diff --git a/testData/results/TestDebugSymbols.dec b/testData/results/TestDebugSymbols.dec index 42ae7a8..e96eb33 100644 --- a/testData/results/TestDebugSymbols.dec +++ b/testData/results/TestDebugSymbols.dec @@ -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 diff --git a/testData/results/TestDeprecations.dec b/testData/results/TestDeprecations.dec index 237ac9c..e423854 100644 --- a/testData/results/TestDeprecations.dec +++ b/testData/results/TestDeprecations.dec @@ -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 diff --git a/testData/results/TestEnum.dec b/testData/results/TestEnum.dec index 3184741..e08f341 100644 --- a/testData/results/TestEnum.dec +++ b/testData/results/TestEnum.dec @@ -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 ' (Ljava/lang/String;I)V' { + 3 20 + 5 20 + } + + method ' (Ljava/lang/String;ILjava/lang/String;)V' { + 8 24 + } +} + +Lines mapping: +34 <-> 21 +35 <-> 25 diff --git a/testData/results/TestExtendsList.dec b/testData/results/TestExtendsList.dec index b4aacf6..6f116db 100644 --- a/testData/results/TestExtendsList.dec +++ b/testData/results/TestExtendsList.dec @@ -2,10 +2,26 @@ package pkg; public class TestExtendsList { static > T m1(T var0) { - return null; + return null;// 20 } static > 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 diff --git a/testData/results/TestInnerClassConstructor.dec b/testData/results/TestInnerClassConstructor.dec index 9b63154..3db6203 100644 --- a/testData/results/TestInnerClassConstructor.dec +++ b/testData/results/TestInnerClassConstructor.dec @@ -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 ' (Lpkg/TestInnerClassConstructor;Ljava/lang/String;)V' { + b 13 + } +} + +Lines mapping: +5 <-> 5 +9 <-> 9 +14 <-> 14 diff --git a/testData/results/TestLocalClass.dec b/testData/results/TestLocalClass.dec new file mode 100644 index 0000000..8e51167 --- /dev/null +++ b/testData/results/TestLocalClass.dec @@ -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 diff --git a/testData/results/TestMethodParameters.dec b/testData/results/TestMethodParameters.dec index e4c4724..a458192 100644 --- a/testData/results/TestMethodParameters.dec +++ b/testData/results/TestMethodParameters.dec @@ -40,3 +40,4 @@ public class TestMethodParameters { } } } + diff --git a/testData/results/TestThrowException.dec b/testData/results/TestThrowException.dec new file mode 100644 index 0000000..7bc460e --- /dev/null +++ b/testData/results/TestThrowException.dec @@ -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 ' (I)V' { + 5 6 + c 7 + 11 7 + 1b 9 + } +} + +Lines mapping: +9 <-> 7 +10 <-> 8 +12 <-> 10 +15 <-> 12 diff --git a/testData/results/TestTryCatchFinally.dec b/testData/results/TestTryCatchFinally.dec index 9840bfc..673238e 100644 --- a/testData/results/TestTryCatchFinally.dec +++ b/testData/results/TestTryCatchFinally.dec @@ -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 diff --git a/testData/src/pkg/TestAnonymousClass.java b/testData/src/pkg/TestAnonymousClass.java new file mode 100644 index 0000000..3c2e3b0 --- /dev/null +++ b/testData/src/pkg/TestAnonymousClass.java @@ -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; + } + }; + } +} diff --git a/testData/src/pkg/TestDeprecations.java b/testData/src/pkg/TestDeprecations.java index 18ba0b5..0f6baad 100644 --- a/testData/src/pkg/TestDeprecations.java +++ b/testData/src/pkg/TestDeprecations.java @@ -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() { } - - @Deprecated - public void byAnno() { } + public void byComment() { + int a =5; + } /** @deprecated */ - public static class ByComment { } + public abstract void byCommentAbstract(); @Deprecated - public static class ByAnno { } + public void byAnno() { + int a =5; + } + + @Deprecated + public abstract void byAnnoAbstract(); + + /** @deprecated */ + public static class ByComment { + int a =5; + + void foo() { + int x = 5; + } + } + + @Deprecated + public static class ByAnno { + int a =5; + + void foo() { + int x = 5; + } + } } \ No newline at end of file diff --git a/testData/src/pkg/TestLocalClass.java b/testData/src/pkg/TestLocalClass.java new file mode 100644 index 0000000..3667a94 --- /dev/null +++ b/testData/src/pkg/TestLocalClass.java @@ -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; + } +} diff --git a/testData/src/pkg/TestThrowException.java b/testData/src/pkg/TestThrowException.java new file mode 100644 index 0000000..76d571a --- /dev/null +++ b/testData/src/pkg/TestThrowException.java @@ -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; + } + }; + } +} diff --git a/testData/src/pkg/TestTryCatchFinally.java b/testData/src/pkg/TestTryCatchFinally.java index da3588a..2c49800 100644 --- a/testData/src/pkg/TestTryCatchFinally.java +++ b/testData/src/pkg/TestTryCatchFinally.java @@ -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);