src/share/classes/com/sun/tools/javac/comp/Flow.java
Print this page
*** 739,748 ****
--- 739,802 ----
caught = caughtPrev;
lint = lintPrev;
}
}
+ public void visitLambda(JCLambda tree) {
+ List<Type> caughtPrev = caught;
+ List<Type> mthrown = List.nil(); // no checked exception can be thrown
+ Bits initsPrev = inits.dup();
+ Bits uninitsPrev = uninits.dup();
+ int nextadrPrev = nextadr;
+ int firstadrPrev = firstadr;
+ Lint lintPrev = lint;
+
+ lint = lint.augment(tree.sym.attributes_field);
+
+ assert pendingExits.isEmpty();
+
+ try {
+ firstadr = nextadr;
+ for (List<JCVariableDecl> l = tree.parameters; l.nonEmpty(); l = l.tail) {
+ JCVariableDecl def = l.head;
+ scan(def);
+ inits.incl(def.sym.adr);
+ uninits.excl(def.sym.adr);
+ }
+
+ if ((tree.sym.flags() & (BLOCK | STATIC)) != BLOCK)
+ caught = mthrown;
+ // else we are in an instance initializer block;
+ // leave caught unchanged.
+
+ alive = true;
+ if (tree.bodyOrExpr.getTag() == BLOCK) {
+ scanStat(tree.bodyOrExpr);
+ } else {
+ scanExpr(tree.bodyOrExpr);
+ }
+
+ List<PendingExit> exits = pendingExits.toList();
+ pendingExits = new ListBuffer<PendingExit>();
+ while (exits.nonEmpty()) {
+ PendingExit exit = exits.head;
+ exits = exits.tail;
+ if (exit.thrown != null) {
+ // uncaught throws will be reported later
+ pendingExits.append(exit);
+ }
+ }
+ } finally {
+ inits = initsPrev;
+ uninits = uninitsPrev;
+ nextadr = nextadrPrev;
+ firstadr = firstadrPrev;
+ caught = caughtPrev;
+ lint = lintPrev;
+ }
+ }
+
public void visitVarDef(JCVariableDecl tree) {
boolean track = trackable(tree.sym);
if (track && tree.sym.owner.kind == MTH) newVar(tree.sym);
if (tree.init != null) {
Lint lintPrev = lint;