test/tools/javac/lambda/TestInvokeDynamic.java

changeset 1676
e9d986381414
parent 1520
5c956be64b9e
child 1774
37295244f534
equal deleted inserted replaced
1675:b54122b9372d 1676:e9d986381414
22 */ 22 */
23 23
24 /* 24 /*
25 * @test 25 * @test
26 * @bug 7194586 26 * @bug 7194586
27 * @bug 8003280 8006694 27 * @bug 8003280 8006694 8010404
28 * @summary Add lambda tests 28 * @summary Add lambda tests
29 * Add back-end support for invokedynamic 29 * Add back-end support for invokedynamic
30 * temporarily workaround combo tests are causing time out in several platforms 30 * temporarily workaround combo tests are causing time out in several platforms
31 * @library ../lib 31 * @library ../lib
32 * @build JavacTestingAbstractThreadedTest 32 * @build JavacTestingAbstractThreadedTest
46 import com.sun.tools.classfile.BootstrapMethods_attribute; 46 import com.sun.tools.classfile.BootstrapMethods_attribute;
47 import com.sun.tools.classfile.ClassFile; 47 import com.sun.tools.classfile.ClassFile;
48 import com.sun.tools.classfile.Code_attribute; 48 import com.sun.tools.classfile.Code_attribute;
49 import com.sun.tools.classfile.ConstantPool.*; 49 import com.sun.tools.classfile.ConstantPool.*;
50 import com.sun.tools.classfile.Instruction; 50 import com.sun.tools.classfile.Instruction;
51 import com.sun.tools.classfile.LineNumberTable_attribute;
51 import com.sun.tools.classfile.Method; 52 import com.sun.tools.classfile.Method;
52 53
53 import com.sun.tools.javac.api.JavacTaskImpl; 54 import com.sun.tools.javac.api.JavacTaskImpl;
54 import com.sun.tools.javac.code.Symbol; 55 import com.sun.tools.javac.code.Symbol;
55 import com.sun.tools.javac.code.Symbol.MethodSymbol; 56 import com.sun.tools.javac.code.Symbol.MethodSymbol;
237 238
238 public void run() { 239 public void run() {
239 int id = checkCount.incrementAndGet(); 240 int id = checkCount.incrementAndGet();
240 JavaSource source = new JavaSource(id); 241 JavaSource source = new JavaSource(id);
241 JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, fm.get(), dc, 242 JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, fm.get(), dc,
242 null, null, Arrays.asList(source)); 243 Arrays.asList("-g"), null, Arrays.asList(source));
243 Context context = ct.getContext(); 244 Context context = ct.getContext();
244 Symtab syms = Symtab.instance(context); 245 Symtab syms = Symtab.instance(context);
245 Names names = Names.instance(context); 246 Names names = Names.instance(context);
246 Types types = Types.instance(context); 247 Types types = Types.instance(context);
247 ct.addTaskListener(new Indifier(syms, names, types)); 248 ct.addTaskListener(new Indifier(syms, names, types));
347 .getType().equals(asBSMSignatureString())) { 348 .getType().equals(asBSMSignatureString())) {
348 throw new Error("Bad boostrap method type" + 349 throw new Error("Bad boostrap method type" +
349 bsm_ref.getNameAndTypeInfo().getType() + " " + 350 bsm_ref.getNameAndTypeInfo().getType() + " " +
350 asBSMSignatureString()); 351 asBSMSignatureString());
351 } 352 }
353
354 LineNumberTable_attribute lnt =
355 (LineNumberTable_attribute)ea.attributes.get(Attribute.LineNumberTable);
356
357 if (lnt == null) {
358 throw new Error("No LineNumberTable attribute");
359 }
360 if (lnt.line_number_table_length != 2) {
361 throw new Error("Wrong number of entries in LineNumberTable");
362 }
352 } catch (Exception e) { 363 } catch (Exception e) {
353 e.printStackTrace(); 364 e.printStackTrace();
354 throw new Error("error reading " + compiledTest +": " + e); 365 throw new Error("error reading " + compiledTest +": " + e);
355 } 366 }
356 } 367 }
374 " return null;\n" + 385 " return null;\n" +
375 " }\n" + 386 " }\n" +
376 "}\n" + 387 "}\n" +
377 "class Test#ID {\n" + 388 "class Test#ID {\n" +
378 " void m() { }\n" + 389 " void m() { }\n" +
379 " void test() { m(); }\n" + 390 " void test() {\n" +
391 " Object o = this; // marker statement \n" +
392 " m();\n" +
393 " }\n" +
380 "}"; 394 "}";
381 395
382 String source; 396 String source;
383 397
384 JavaSource(int id) { 398 JavaSource(int id) {

mercurial