66 /* 20 */ " Runnable r2 = () -> System.err.println(1);\n" + |
66 /* 20 */ " Runnable r2 = () -> System.err.println(1);\n" + |
67 /* 21 */ " Runnable r3 = (Runnable & java.io.Serializable) this::foo;\n" + |
67 /* 21 */ " Runnable r3 = (Runnable & java.io.Serializable) this::foo;\n" + |
68 /* 22 */ " Runnable r4 = super :: notify;\n" + |
68 /* 22 */ " Runnable r4 = super :: notify;\n" + |
69 /* 23 */ " }\n" + |
69 /* 23 */ " }\n" + |
70 /* 24 */ " private void foo() {}\n" + |
70 /* 24 */ " private void foo() {}\n" + |
71 /* 25 */ "}"; |
71 /* 25 */ " void assignLambda() {\n" + |
|
72 /* 26 */ " Runnable r = () -> { };\n" + |
|
73 /* 27 */ " }\n" + |
|
74 /* 28 */ " void callLambda(int i, Runnable r) {\n" + |
|
75 /* 29 */ " callLambda(0,\n" + |
|
76 /* 30 */ " () -> { });\n" + |
|
77 /* 31 */ " }\n" + |
|
78 /* 32 */ "}"; |
72 |
79 |
73 static final int[][] simpleLambdaExpectedLNT = { |
80 static final int[][] simpleLambdaExpectedLNT = { |
74 // {line-number, start-pc}, |
81 // {line-number, start-pc}, |
75 {9, 0}, //number -> number / 1 |
82 {9, 0}, //number -> number / 1 |
76 }; |
83 }; |
100 static final int[][] lambdaBridgeExpectedLNT = { |
107 static final int[][] lambdaBridgeExpectedLNT = { |
101 // {line-number, start-pc}, |
108 // {line-number, start-pc}, |
102 {22, 0}, //number -> number / 1 |
109 {22, 0}, //number -> number / 1 |
103 }; |
110 }; |
104 |
111 |
|
112 static final int[][] assignmentExpectedLNT = { |
|
113 // {line-number, start-pc}, |
|
114 {26, 0}, //number -> number / 1 |
|
115 {27, 6}, //number -> number / 1 |
|
116 }; |
|
117 |
|
118 static final int[][] callExpectedLNT = { |
|
119 // {line-number, start-pc}, |
|
120 {29, 0}, //number -> number / 1 |
|
121 {31, 10}, //number -> number / 1 |
|
122 }; |
|
123 |
105 public static void main(String[] args) throws Exception { |
124 public static void main(String[] args) throws Exception { |
106 new WrongLNTForLambdaTest().run(); |
125 new WrongLNTForLambdaTest().run(); |
107 } |
126 } |
108 |
127 |
109 void run() throws Exception { |
128 void run() throws Exception { |
118 "Foo.class").toUri()), "lambda$variablesInLambdas$2", lambdaVoid2VoidExpectedLNT); |
137 "Foo.class").toUri()), "lambda$variablesInLambdas$2", lambdaVoid2VoidExpectedLNT); |
119 checkClassFile(new File(Paths.get(System.getProperty("user.dir"), |
138 checkClassFile(new File(Paths.get(System.getProperty("user.dir"), |
120 "Foo.class").toUri()), "$deserializeLambda$", deserializeExpectedLNT); |
139 "Foo.class").toUri()), "$deserializeLambda$", deserializeExpectedLNT); |
121 checkClassFile(new File(Paths.get(System.getProperty("user.dir"), |
140 checkClassFile(new File(Paths.get(System.getProperty("user.dir"), |
122 "Foo.class").toUri()), "lambda$MR$variablesInLambdas$notify$8bc4f5bd$1", lambdaBridgeExpectedLNT); |
141 "Foo.class").toUri()), "lambda$MR$variablesInLambdas$notify$8bc4f5bd$1", lambdaBridgeExpectedLNT); |
|
142 checkClassFile(new File(Paths.get(System.getProperty("user.dir"), |
|
143 "Foo.class").toUri()), "assignLambda", assignmentExpectedLNT); |
|
144 checkClassFile(new File(Paths.get(System.getProperty("user.dir"), |
|
145 "Foo.class").toUri()), "callLambda", callExpectedLNT); |
123 } |
146 } |
124 |
147 |
125 void compileTestClass() throws Exception { |
148 void compileTestClass() throws Exception { |
126 ToolBox.JavaToolArgs javacSuccessArgs = |
149 ToolBox.JavaToolArgs javacSuccessArgs = |
127 new ToolBox.JavaToolArgs().setSources(testSource); |
150 new ToolBox.JavaToolArgs().setSources(testSource); |