src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java

changeset 2222
8832b6048e65
parent 2202
4fa835472e3c
child 2251
bbbef54e3b30
equal deleted inserted replaced
2221:d80c3d6f4f05 2222:8832b6048e65
1472 } 1472 }
1473 1473
1474 private Symbol initSym(ClassSymbol csym, long flags) { 1474 private Symbol initSym(ClassSymbol csym, long flags) {
1475 boolean isStatic = (flags & STATIC) != 0; 1475 boolean isStatic = (flags & STATIC) != 0;
1476 if (isStatic) { 1476 if (isStatic) {
1477 //static clinits are generated in Gen - so we need to fake them 1477 /* static clinits are generated in Gen, so we need to use a fake
1478 Symbol clinit = clinits.get(csym); 1478 * one. Attr creates a fake clinit method while attributing
1479 * lambda expressions used as initializers of static fields, so
1480 * let's use that one.
1481 */
1482 MethodSymbol clinit = attr.removeClinit(csym);
1483 if (clinit != null) {
1484 clinits.put(csym, clinit);
1485 return clinit;
1486 }
1487
1488 /* if no clinit is found at Attr, then let's try at clinits.
1489 */
1490 clinit = (MethodSymbol)clinits.get(csym);
1479 if (clinit == null) { 1491 if (clinit == null) {
1492 /* no luck, let's create a new one
1493 */
1480 clinit = makePrivateSyntheticMethod(STATIC, 1494 clinit = makePrivateSyntheticMethod(STATIC,
1481 names.clinit, 1495 names.clinit,
1482 new MethodType(List.<Type>nil(), syms.voidType, List.<Type>nil(), syms.methodClass), 1496 new MethodType(List.<Type>nil(), syms.voidType,
1497 List.<Type>nil(), syms.methodClass),
1483 csym); 1498 csym);
1484 clinits.put(csym, clinit); 1499 clinits.put(csym, clinit);
1485 } 1500 }
1486 return clinit; 1501 return clinit;
1487 } else { 1502 } else {

mercurial