equal
deleted
inserted
replaced
25 * @test |
25 * @test |
26 * @bug 8019486 8026861 8027142 |
26 * @bug 8019486 8026861 8027142 |
27 * @summary javac, generates erroneous LVT for a test case with lambda code |
27 * @summary javac, generates erroneous LVT for a test case with lambda code |
28 * @library /tools/lib |
28 * @library /tools/lib |
29 * @modules jdk.compiler/com.sun.tools.javac.api |
29 * @modules jdk.compiler/com.sun.tools.javac.api |
30 * jdk.compiler/com.sun.tools.javac.file |
|
31 * jdk.compiler/com.sun.tools.javac.main |
30 * jdk.compiler/com.sun.tools.javac.main |
32 * jdk.compiler/com.sun.tools.javac.util |
31 * jdk.compiler/com.sun.tools.javac.util |
33 * jdk.jdeps/com.sun.tools.classfile |
32 * jdk.jdeps/com.sun.tools.classfile |
34 * jdk.jdeps/com.sun.tools.javap |
33 * @build toolbox.ToolBox toolbox.JavacTask |
35 * @build ToolBox |
|
36 * @run main WrongLNTForLambdaTest |
34 * @run main WrongLNTForLambdaTest |
37 */ |
35 */ |
38 |
36 |
39 import java.io.File; |
37 import java.io.File; |
40 import java.nio.file.Paths; |
38 import java.nio.file.Paths; |
42 import com.sun.tools.classfile.ClassFile; |
40 import com.sun.tools.classfile.ClassFile; |
43 import com.sun.tools.classfile.Code_attribute; |
41 import com.sun.tools.classfile.Code_attribute; |
44 import com.sun.tools.classfile.LineNumberTable_attribute; |
42 import com.sun.tools.classfile.LineNumberTable_attribute; |
45 import com.sun.tools.classfile.Method; |
43 import com.sun.tools.classfile.Method; |
46 import com.sun.tools.javac.util.Assert; |
44 import com.sun.tools.javac.util.Assert; |
|
45 |
|
46 import toolbox.JavacTask; |
|
47 import toolbox.ToolBox; |
47 |
48 |
48 public class WrongLNTForLambdaTest { |
49 public class WrongLNTForLambdaTest { |
49 |
50 |
50 static final String testSource = |
51 static final String testSource = |
51 /* 01 */ "import java.util.List;\n" + |
52 /* 01 */ "import java.util.List;\n" + |
150 checkClassFile(new File(Paths.get(System.getProperty("user.dir"), |
151 checkClassFile(new File(Paths.get(System.getProperty("user.dir"), |
151 "Foo.class").toUri()), "callLambda", callExpectedLNT); |
152 "Foo.class").toUri()), "callLambda", callExpectedLNT); |
152 } |
153 } |
153 |
154 |
154 void compileTestClass() throws Exception { |
155 void compileTestClass() throws Exception { |
155 tb.new JavacTask() |
156 new JavacTask(tb) |
156 .sources(testSource) |
157 .sources(testSource) |
157 .run(); |
158 .run(); |
158 } |
159 } |
159 |
160 |
160 void checkClassFile(final File cfile, String methodToFind, int[][] expectedLNT) throws Exception { |
161 void checkClassFile(final File cfile, String methodToFind, int[][] expectedLNT) throws Exception { |