test/tools/javac/T8019486/WrongLNTForLambdaTest.java

changeset 2186
6e0f31d61e56
parent 2165
864dafc5ab7a
child 2525
2eb010b6cb22
child 2607
10e9228e77b0
     1.1 --- a/test/tools/javac/T8019486/WrongLNTForLambdaTest.java	Fri Nov 08 17:39:33 2013 -0800
     1.2 +++ b/test/tools/javac/T8019486/WrongLNTForLambdaTest.java	Sat Nov 09 15:24:38 2013 +0100
     1.3 @@ -25,7 +25,7 @@
     1.4  
     1.5  /*
     1.6   * @test
     1.7 - * @bug 8019486 8026861
     1.8 + * @bug 8019486 8026861 8027142
     1.9   * @summary javac, generates erroneous LVT for a test case with lambda code
    1.10   * @library /tools/javac/lib
    1.11   * @build ToolBox
    1.12 @@ -68,7 +68,14 @@
    1.13      /* 22 */        "        Runnable r4 = super :: notify;\n" +
    1.14      /* 23 */        "    }\n" +
    1.15      /* 24 */        "    private void foo() {}\n" +
    1.16 -    /* 25 */        "}";
    1.17 +    /* 25 */        "    void assignLambda() {\n" +
    1.18 +    /* 26 */        "        Runnable r = () -> { };\n" +
    1.19 +    /* 27 */        "    }\n" +
    1.20 +    /* 28 */        "    void callLambda(int i, Runnable r) {\n" +
    1.21 +    /* 29 */        "        callLambda(0,\n" +
    1.22 +    /* 30 */        "                   () -> { });\n" +
    1.23 +    /* 31 */        "    }\n" +
    1.24 +    /* 32 */        "}";
    1.25  
    1.26      static final int[][] simpleLambdaExpectedLNT = {
    1.27      //  {line-number, start-pc},
    1.28 @@ -102,6 +109,18 @@
    1.29          {22,           0},       //number -> number / 1
    1.30      };
    1.31  
    1.32 +    static final int[][] assignmentExpectedLNT = {
    1.33 +    //  {line-number, start-pc},
    1.34 +        {26,           0},       //number -> number / 1
    1.35 +        {27,           6},       //number -> number / 1
    1.36 +    };
    1.37 +
    1.38 +    static final int[][] callExpectedLNT = {
    1.39 +    //  {line-number, start-pc},
    1.40 +        {29,           0},       //number -> number / 1
    1.41 +        {31,           10},       //number -> number / 1
    1.42 +    };
    1.43 +
    1.44      public static void main(String[] args) throws Exception {
    1.45          new WrongLNTForLambdaTest().run();
    1.46      }
    1.47 @@ -120,6 +139,10 @@
    1.48                  "Foo.class").toUri()), "$deserializeLambda$", deserializeExpectedLNT);
    1.49          checkClassFile(new File(Paths.get(System.getProperty("user.dir"),
    1.50                  "Foo.class").toUri()), "lambda$MR$variablesInLambdas$notify$8bc4f5bd$1", lambdaBridgeExpectedLNT);
    1.51 +        checkClassFile(new File(Paths.get(System.getProperty("user.dir"),
    1.52 +                "Foo.class").toUri()), "assignLambda", assignmentExpectedLNT);
    1.53 +        checkClassFile(new File(Paths.get(System.getProperty("user.dir"),
    1.54 +                "Foo.class").toUri()), "callLambda", callExpectedLNT);
    1.55      }
    1.56  
    1.57      void compileTestClass() throws Exception {

mercurial