Merge jdk8u60-b22 jdk8u66-b00

Sat, 27 Jun 2015 23:21:54 -0700

author
lana
date
Sat, 27 Jun 2015 23:21:54 -0700
changeset 2822
d1febf79ce5e
parent 2819
78465edacde9
parent 2821
1ddf51024f37
child 2823
7f88b5dc78ce

Merge

     1.1 --- a/THIRD_PARTY_README	Wed Jun 24 10:41:26 2015 -0700
     1.2 +++ b/THIRD_PARTY_README	Sat Jun 27 23:21:54 2015 -0700
     1.3 @@ -1140,37 +1140,6 @@
     1.4  
     1.5  --------------------------------------------------------------------------------
     1.6  
     1.7 -%% This notice is provided with respect to JSON, which may be included 
     1.8 -with JRE 8 & JDK 8.
     1.9 -
    1.10 ---- begin of LICENSE ---
    1.11 -
    1.12 -Copyright (c) 2002 JSON.org
    1.13 -
    1.14 -Permission is hereby granted, free of charge, to any person obtaining a copy
    1.15 -of this software and associated documentation files (the "Software"), to deal
    1.16 -in the Software without restriction, including without limitation the rights
    1.17 -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    1.18 -copies of the Software, and to permit persons to whom the Software is
    1.19 -furnished to do so, subject to the following conditions:
    1.20 -
    1.21 -The above copyright notice and this permission notice shall be included in all
    1.22 -copies or substantial portions of the Software.
    1.23 -
    1.24 -The Software shall be used for Good, not Evil.
    1.25 -
    1.26 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    1.27 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    1.28 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    1.29 -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    1.30 -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    1.31 -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    1.32 -SOFTWARE.
    1.33 -
    1.34 ---- end of LICENSE ---
    1.35 -
    1.36 --------------------------------------------------------------------------------
    1.37 -
    1.38  %% This notice is provided with respect to Kerberos functionality, which 
    1.39  which may be included with JRE 8, JDK 8, and OpenJDK 8.
    1.40  
    1.41 @@ -1250,7 +1219,7 @@
    1.42  
    1.43  -------------------------------------------------------------------------------
    1.44  
    1.45 -%% This notice is provided with respect to libpng 1.6.16, which may be
    1.46 +%% This notice is provided with respect to libpng 1.6.16, which may be 
    1.47  included with JRE 8, JDK 8, and OpenJDK 8.
    1.48  
    1.49  --- begin of LICENSE ---
    1.50 @@ -1370,7 +1339,7 @@
    1.51  
    1.52  -------------------------------------------------------------------------------
    1.53  
    1.54 -%% This notice is provided with respect to libungif 4.1.3, which may be 
    1.55 +%% This notice is provided with respect to GIFLIB 5.1.1 & libungif 4.1.3, which may be 
    1.56  included with JRE 8, JDK 8, and OpenJDK 8.
    1.57  
    1.58  --- begin of LICENSE ---
    1.59 @@ -1399,13 +1368,13 @@
    1.60  
    1.61  -------------------------------------------------------------------------------
    1.62  
    1.63 -%% This notice is provided with respect to Little CMS 2.5, which may be 
    1.64 +%% This notice is provided with respect to Little CMS 2.7, which may be 
    1.65  included with JRE 8, JDK 8, and OpenJDK 8.
    1.66  
    1.67  --- begin of LICENSE ---
    1.68  
    1.69  Little CMS
    1.70 -Copyright (c) 1998-2011 Marti Maria Saguer
    1.71 +Copyright (c) 1998-2015 Marti Maria Saguer
    1.72  
    1.73  Permission is hereby granted, free of charge, to any person obtaining a copy
    1.74  of this software and associated documentation files (the "Software"), to deal
     2.1 --- a/src/share/classes/com/sun/tools/javac/comp/Flow.java	Wed Jun 24 10:41:26 2015 -0700
     2.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java	Sat Jun 27 23:21:54 2015 -0700
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -353,17 +353,17 @@
    2.11                  this.tree = tree;
    2.12              }
    2.13  
    2.14 -            void resolveJump(JCTree tree) {
    2.15 +            void resolveJump() {
    2.16                  //do nothing
    2.17              }
    2.18          }
    2.19  
    2.20 -        abstract void markDead(JCTree tree);
    2.21 +        abstract void markDead();
    2.22  
    2.23          /** Record an outward transfer of control. */
    2.24 -        void recordExit(JCTree tree, P pe) {
    2.25 +        void recordExit(P pe) {
    2.26              pendingExits.append(pe);
    2.27 -            markDead(tree);
    2.28 +            markDead();
    2.29          }
    2.30  
    2.31          /** Resolve all jumps of this statement. */
    2.32 @@ -377,7 +377,7 @@
    2.33                  P exit = exits.head;
    2.34                  if (exit.tree.hasTag(jk.treeTag) &&
    2.35                          jk.getTarget(exit.tree) == tree) {
    2.36 -                    exit.resolveJump(tree);
    2.37 +                    exit.resolveJump();
    2.38                      resolved = true;
    2.39                  } else {
    2.40                      pendingExits.append(exit);
    2.41 @@ -420,7 +420,7 @@
    2.42          private boolean alive;
    2.43  
    2.44          @Override
    2.45 -        void markDead(JCTree tree) {
    2.46 +        void markDead() {
    2.47              alive = false;
    2.48          }
    2.49  
    2.50 @@ -464,7 +464,7 @@
    2.51              ListBuffer<PendingExit> pendingExitsPrev = pendingExits;
    2.52              Lint lintPrev = lint;
    2.53  
    2.54 -            pendingExits = new ListBuffer<PendingExit>();
    2.55 +            pendingExits = new ListBuffer<>();
    2.56              lint = lint.augment(tree.sym);
    2.57  
    2.58              try {
    2.59 @@ -513,7 +513,7 @@
    2.60                      log.error(TreeInfo.diagEndPos(tree.body), "missing.ret.stmt");
    2.61  
    2.62                  List<PendingExit> exits = pendingExits.toList();
    2.63 -                pendingExits = new ListBuffer<PendingExit>();
    2.64 +                pendingExits = new ListBuffer<>();
    2.65                  while (exits.nonEmpty()) {
    2.66                      PendingExit exit = exits.head;
    2.67                      exits = exits.tail;
    2.68 @@ -542,7 +542,7 @@
    2.69  
    2.70          public void visitDoLoop(JCDoWhileLoop tree) {
    2.71              ListBuffer<PendingExit> prevPendingExits = pendingExits;
    2.72 -            pendingExits = new ListBuffer<PendingExit>();
    2.73 +            pendingExits = new ListBuffer<>();
    2.74              scanStat(tree.body);
    2.75              alive |= resolveContinues(tree);
    2.76              scan(tree.cond);
    2.77 @@ -552,7 +552,7 @@
    2.78  
    2.79          public void visitWhileLoop(JCWhileLoop tree) {
    2.80              ListBuffer<PendingExit> prevPendingExits = pendingExits;
    2.81 -            pendingExits = new ListBuffer<PendingExit>();
    2.82 +            pendingExits = new ListBuffer<>();
    2.83              scan(tree.cond);
    2.84              alive = !tree.cond.type.isFalse();
    2.85              scanStat(tree.body);
    2.86 @@ -564,7 +564,7 @@
    2.87          public void visitForLoop(JCForLoop tree) {
    2.88              ListBuffer<PendingExit> prevPendingExits = pendingExits;
    2.89              scanStats(tree.init);
    2.90 -            pendingExits = new ListBuffer<PendingExit>();
    2.91 +            pendingExits = new ListBuffer<>();
    2.92              if (tree.cond != null) {
    2.93                  scan(tree.cond);
    2.94                  alive = !tree.cond.type.isFalse();
    2.95 @@ -582,7 +582,7 @@
    2.96              visitVarDef(tree.var);
    2.97              ListBuffer<PendingExit> prevPendingExits = pendingExits;
    2.98              scan(tree.expr);
    2.99 -            pendingExits = new ListBuffer<PendingExit>();
   2.100 +            pendingExits = new ListBuffer<>();
   2.101              scanStat(tree.body);
   2.102              alive |= resolveContinues(tree);
   2.103              resolveBreaks(tree, prevPendingExits);
   2.104 @@ -591,14 +591,14 @@
   2.105  
   2.106          public void visitLabelled(JCLabeledStatement tree) {
   2.107              ListBuffer<PendingExit> prevPendingExits = pendingExits;
   2.108 -            pendingExits = new ListBuffer<PendingExit>();
   2.109 +            pendingExits = new ListBuffer<>();
   2.110              scanStat(tree.body);
   2.111              alive |= resolveBreaks(tree, prevPendingExits);
   2.112          }
   2.113  
   2.114          public void visitSwitch(JCSwitch tree) {
   2.115              ListBuffer<PendingExit> prevPendingExits = pendingExits;
   2.116 -            pendingExits = new ListBuffer<PendingExit>();
   2.117 +            pendingExits = new ListBuffer<>();
   2.118              scan(tree.selector);
   2.119              boolean hasDefault = false;
   2.120              for (List<JCCase> l = tree.cases; l.nonEmpty(); l = l.tail) {
   2.121 @@ -625,7 +625,7 @@
   2.122  
   2.123          public void visitTry(JCTry tree) {
   2.124              ListBuffer<PendingExit> prevPendingExits = pendingExits;
   2.125 -            pendingExits = new ListBuffer<PendingExit>();
   2.126 +            pendingExits = new ListBuffer<>();
   2.127              for (JCTree resource : tree.resources) {
   2.128                  if (resource instanceof JCVariableDecl) {
   2.129                      JCVariableDecl vdecl = (JCVariableDecl) resource;
   2.130 @@ -688,21 +688,21 @@
   2.131          }
   2.132  
   2.133          public void visitBreak(JCBreak tree) {
   2.134 -            recordExit(tree, new PendingExit(tree));
   2.135 +            recordExit(new PendingExit(tree));
   2.136          }
   2.137  
   2.138          public void visitContinue(JCContinue tree) {
   2.139 -            recordExit(tree, new PendingExit(tree));
   2.140 +            recordExit(new PendingExit(tree));
   2.141          }
   2.142  
   2.143          public void visitReturn(JCReturn tree) {
   2.144              scan(tree.expr);
   2.145 -            recordExit(tree, new PendingExit(tree));
   2.146 +            recordExit(new PendingExit(tree));
   2.147          }
   2.148  
   2.149          public void visitThrow(JCThrow tree) {
   2.150              scan(tree.expr);
   2.151 -            markDead(tree);
   2.152 +            markDead();
   2.153          }
   2.154  
   2.155          public void visitApply(JCMethodInvocation tree) {
   2.156 @@ -756,7 +756,7 @@
   2.157              try {
   2.158                  attrEnv = env;
   2.159                  Flow.this.make = make;
   2.160 -                pendingExits = new ListBuffer<PendingExit>();
   2.161 +                pendingExits = new ListBuffer<>();
   2.162                  alive = true;
   2.163                  scan(tree);
   2.164              } finally {
   2.165 @@ -803,7 +803,7 @@
   2.166          }
   2.167  
   2.168          @Override
   2.169 -        void markDead(JCTree tree) {
   2.170 +        void markDead() {
   2.171              //do nothing
   2.172          }
   2.173  
   2.174 @@ -1201,16 +1201,16 @@
   2.175              }
   2.176  
   2.177          public void visitBreak(JCBreak tree) {
   2.178 -            recordExit(tree, new FlowPendingExit(tree, null));
   2.179 +            recordExit(new FlowPendingExit(tree, null));
   2.180          }
   2.181  
   2.182          public void visitContinue(JCContinue tree) {
   2.183 -            recordExit(tree, new FlowPendingExit(tree, null));
   2.184 +            recordExit(new FlowPendingExit(tree, null));
   2.185          }
   2.186  
   2.187          public void visitReturn(JCReturn tree) {
   2.188              scan(tree.expr);
   2.189 -            recordExit(tree, new FlowPendingExit(tree, null));
   2.190 +            recordExit(new FlowPendingExit(tree, null));
   2.191          }
   2.192  
   2.193          public void visitThrow(JCThrow tree) {
   2.194 @@ -1228,7 +1228,7 @@
   2.195              else {
   2.196                  markThrown(tree, tree.expr.type);
   2.197              }
   2.198 -            markDead(tree);
   2.199 +            markDead();
   2.200          }
   2.201  
   2.202          public void visitApply(JCMethodInvocation tree) {
   2.203 @@ -1379,12 +1379,10 @@
   2.204       * effectively-final local variables/parameters.
   2.205       */
   2.206  
   2.207 -    public abstract class AbstractAssignAnalyzer<P extends AbstractAssignAnalyzer<P>.AbstractAssignPendingExit>
   2.208 -        extends BaseAnalyzer<P> {
   2.209 -
   2.210 +    public class AssignAnalyzer extends BaseAnalyzer<AssignAnalyzer.AssignPendingExit> {
   2.211          /** The set of definitely assigned variables.
   2.212           */
   2.213 -        protected Bits inits;
   2.214 +        final Bits inits;
   2.215  
   2.216          /** The set of definitely unassigned variables.
   2.217           */
   2.218 @@ -1432,20 +1430,20 @@
   2.219           */
   2.220          Scope unrefdResources;
   2.221  
   2.222 -        /** Set when processing a loop body the second time for DU analysis. */
   2.223 +        /** Modified when processing a loop body the second time for DU analysis. */
   2.224          FlowKind flowKind = FlowKind.NORMAL;
   2.225  
   2.226 -        /** The starting position of the analysed tree */
   2.227 +        /** The starting position of the analyzed tree */
   2.228          int startPos;
   2.229  
   2.230 -        public class AbstractAssignPendingExit extends BaseAnalyzer.PendingExit {
   2.231 +        public class AssignPendingExit extends BaseAnalyzer.PendingExit {
   2.232  
   2.233              final Bits inits;
   2.234              final Bits uninits;
   2.235              final Bits exit_inits = new Bits(true);
   2.236              final Bits exit_uninits = new Bits(true);
   2.237  
   2.238 -            public AbstractAssignPendingExit(JCTree tree, final Bits inits, final Bits uninits) {
   2.239 +            public AssignPendingExit(JCTree tree, final Bits inits, final Bits uninits) {
   2.240                  super(tree);
   2.241                  this.inits = inits;
   2.242                  this.uninits = uninits;
   2.243 @@ -1454,13 +1452,13 @@
   2.244              }
   2.245  
   2.246              @Override
   2.247 -            public void resolveJump(JCTree tree) {
   2.248 +            void resolveJump() {
   2.249                  inits.andSet(exit_inits);
   2.250                  uninits.andSet(exit_uninits);
   2.251              }
   2.252          }
   2.253  
   2.254 -        public AbstractAssignAnalyzer() {
   2.255 +        public AssignAnalyzer() {
   2.256              this.inits = new Bits();
   2.257              uninits = new Bits();
   2.258              uninitsTry = new Bits();
   2.259 @@ -1473,7 +1471,7 @@
   2.260          private boolean isInitialConstructor = false;
   2.261  
   2.262          @Override
   2.263 -        protected void markDead(JCTree tree) {
   2.264 +         void markDead() {
   2.265              if (!isInitialConstructor) {
   2.266                  inits.inclRange(returnadr, nextadr);
   2.267              } else {
   2.268 @@ -1520,35 +1518,41 @@
   2.269              }
   2.270              sym.adr = nextadr;
   2.271              vardecls[nextadr] = varDecl;
   2.272 -            exclVarFromInits(varDecl, nextadr);
   2.273 +            inits.excl(nextadr);
   2.274              uninits.incl(nextadr);
   2.275              nextadr++;
   2.276          }
   2.277  
   2.278 -        protected void exclVarFromInits(JCTree tree, int adr) {
   2.279 -            inits.excl(adr);
   2.280 -        }
   2.281 -
   2.282 -        protected void assignToInits(JCTree tree, Bits bits) {
   2.283 -            inits.assign(bits);
   2.284 -        }
   2.285 -
   2.286 -        protected void andSetInits(JCTree tree, Bits bits) {
   2.287 -            inits.andSet(bits);
   2.288 -        }
   2.289 -
   2.290 -        protected void orSetInits(JCTree tree, Bits bits) {
   2.291 -            inits.orSet(bits);
   2.292 -        }
   2.293 -
   2.294          /** Record an initialization of a trackable variable.
   2.295           */
   2.296          void letInit(DiagnosticPosition pos, VarSymbol sym) {
   2.297              if (sym.adr >= firstadr && trackable(sym)) {
   2.298 -                if (uninits.isMember(sym.adr)) {
   2.299 -                    uninit(sym);
   2.300 +                if ((sym.flags() & EFFECTIVELY_FINAL) != 0) {
   2.301 +                    if (!uninits.isMember(sym.adr)) {
   2.302 +                        //assignment targeting an effectively final variable
   2.303 +                        //makes the variable lose its status of effectively final
   2.304 +                        //if the variable is _not_ definitively unassigned
   2.305 +                        sym.flags_field &= ~EFFECTIVELY_FINAL;
   2.306 +                    } else {
   2.307 +                        uninit(sym);
   2.308 +                    }
   2.309 +                } else if ((sym.flags() & FINAL) != 0) {
   2.310 +                    if ((sym.flags() & PARAMETER) != 0) {
   2.311 +                        if ((sym.flags() & UNION) != 0) { //multi-catch parameter
   2.312 +                            log.error(pos, "multicatch.parameter.may.not.be.assigned", sym);
   2.313 +                        } else {
   2.314 +                            log.error(pos, "final.parameter.may.not.be.assigned",
   2.315 +                                  sym);
   2.316 +                        }
   2.317 +                    } else if (!uninits.isMember(sym.adr)) {
   2.318 +                        log.error(pos, flowKind.errKey, sym);
   2.319 +                    } else {
   2.320 +                        uninit(sym);
   2.321 +                    }
   2.322                  }
   2.323                  inits.incl(sym.adr);
   2.324 +            } else if ((sym.flags() & FINAL) != 0) {
   2.325 +                log.error(pos, "var.might.already.be.assigned", sym);
   2.326              }
   2.327          }
   2.328          //where
   2.329 @@ -1583,7 +1587,14 @@
   2.330              checkInit(pos, sym, "var.might.not.have.been.initialized");
   2.331          }
   2.332  
   2.333 -        void checkInit(DiagnosticPosition pos, VarSymbol sym, String errkey) {}
   2.334 +        void checkInit(DiagnosticPosition pos, VarSymbol sym, String errkey) {
   2.335 +            if ((sym.adr >= firstadr || sym.owner.kind != TYP) &&
   2.336 +                trackable(sym) &&
   2.337 +                !inits.isMember(sym.adr)) {
   2.338 +                log.error(pos, errkey, sym);
   2.339 +                inits.incl(sym.adr);
   2.340 +            }
   2.341 +        }
   2.342  
   2.343          /** Utility method to reset several Bits instances.
   2.344           */
   2.345 @@ -1607,7 +1618,7 @@
   2.346  
   2.347          /** Merge (intersect) inits/uninits from WhenTrue/WhenFalse sets.
   2.348           */
   2.349 -        protected void merge(JCTree tree) {
   2.350 +        protected void merge() {
   2.351              inits.assign(initsWhenFalse.andSet(initsWhenTrue));
   2.352              uninits.assign(uninitsWhenFalse.andSet(uninitsWhenTrue));
   2.353          }
   2.354 @@ -1623,7 +1634,7 @@
   2.355              if (tree != null) {
   2.356                  scan(tree);
   2.357                  if (inits.isReset()) {
   2.358 -                    merge(tree);
   2.359 +                    merge();
   2.360                  }
   2.361              }
   2.362          }
   2.363 @@ -1641,7 +1652,7 @@
   2.364           */
   2.365          void scanCond(JCTree tree) {
   2.366              if (tree.type.isFalse()) {
   2.367 -                if (inits.isReset()) merge(tree);
   2.368 +                if (inits.isReset()) merge();
   2.369                  initsWhenTrue.assign(inits);
   2.370                  initsWhenTrue.inclRange(firstadr, nextadr);
   2.371                  uninitsWhenTrue.assign(uninits);
   2.372 @@ -1649,7 +1660,7 @@
   2.373                  initsWhenFalse.assign(inits);
   2.374                  uninitsWhenFalse.assign(uninits);
   2.375              } else if (tree.type.isTrue()) {
   2.376 -                if (inits.isReset()) merge(tree);
   2.377 +                if (inits.isReset()) merge();
   2.378                  initsWhenFalse.assign(inits);
   2.379                  initsWhenFalse.inclRange(firstadr, nextadr);
   2.380                  uninitsWhenFalse.assign(uninits);
   2.381 @@ -1668,173 +1679,202 @@
   2.382  
   2.383          /* ------------ Visitor methods for various sorts of trees -------------*/
   2.384  
   2.385 -        @Override
   2.386          public void visitClassDef(JCClassDecl tree) {
   2.387              if (tree.sym == null) {
   2.388                  return;
   2.389              }
   2.390  
   2.391 -            JCClassDecl classDefPrev = classDef;
   2.392 -            int firstadrPrev = firstadr;
   2.393 -            int nextadrPrev = nextadr;
   2.394 -            ListBuffer<P> pendingExitsPrev = pendingExits;
   2.395 +            Lint lintPrev = lint;
   2.396 +            lint = lint.augment(tree.sym);
   2.397 +            try {
   2.398 +                if (tree.sym == null) {
   2.399 +                    return;
   2.400 +                }
   2.401  
   2.402 -            pendingExits = new ListBuffer<P>();
   2.403 -            if (tree.name != names.empty) {
   2.404 -                firstadr = nextadr;
   2.405 -            }
   2.406 -            classDef = tree;
   2.407 -            try {
   2.408 -                // define all the static fields
   2.409 -                for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
   2.410 -                    if (l.head.hasTag(VARDEF)) {
   2.411 -                        JCVariableDecl def = (JCVariableDecl)l.head;
   2.412 -                        if ((def.mods.flags & STATIC) != 0) {
   2.413 -                            VarSymbol sym = def.sym;
   2.414 -                            if (trackable(sym)) {
   2.415 -                                newVar(def);
   2.416 +                JCClassDecl classDefPrev = classDef;
   2.417 +                int firstadrPrev = firstadr;
   2.418 +                int nextadrPrev = nextadr;
   2.419 +                ListBuffer<AssignPendingExit> pendingExitsPrev = pendingExits;
   2.420 +
   2.421 +                pendingExits = new ListBuffer<>();
   2.422 +                if (tree.name != names.empty) {
   2.423 +                    firstadr = nextadr;
   2.424 +                }
   2.425 +                classDef = tree;
   2.426 +                try {
   2.427 +                    // define all the static fields
   2.428 +                    for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
   2.429 +                        if (l.head.hasTag(VARDEF)) {
   2.430 +                            JCVariableDecl def = (JCVariableDecl)l.head;
   2.431 +                            if ((def.mods.flags & STATIC) != 0) {
   2.432 +                                VarSymbol sym = def.sym;
   2.433 +                                if (trackable(sym)) {
   2.434 +                                    newVar(def);
   2.435 +                                }
   2.436                              }
   2.437                          }
   2.438                      }
   2.439 -                }
   2.440  
   2.441 -                // process all the static initializers
   2.442 -                for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
   2.443 -                    if (!l.head.hasTag(METHODDEF) &&
   2.444 -                        (TreeInfo.flags(l.head) & STATIC) != 0) {
   2.445 -                        scan(l.head);
   2.446 +                    // process all the static initializers
   2.447 +                    for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
   2.448 +                        if (!l.head.hasTag(METHODDEF) &&
   2.449 +                            (TreeInfo.flags(l.head) & STATIC) != 0) {
   2.450 +                            scan(l.head);
   2.451 +                        }
   2.452                      }
   2.453 -                }
   2.454  
   2.455 -                // define all the instance fields
   2.456 -                for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
   2.457 -                    if (l.head.hasTag(VARDEF)) {
   2.458 -                        JCVariableDecl def = (JCVariableDecl)l.head;
   2.459 -                        if ((def.mods.flags & STATIC) == 0) {
   2.460 -                            VarSymbol sym = def.sym;
   2.461 -                            if (trackable(sym)) {
   2.462 -                                newVar(def);
   2.463 +                    // define all the instance fields
   2.464 +                    for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
   2.465 +                        if (l.head.hasTag(VARDEF)) {
   2.466 +                            JCVariableDecl def = (JCVariableDecl)l.head;
   2.467 +                            if ((def.mods.flags & STATIC) == 0) {
   2.468 +                                VarSymbol sym = def.sym;
   2.469 +                                if (trackable(sym)) {
   2.470 +                                    newVar(def);
   2.471 +                                }
   2.472                              }
   2.473                          }
   2.474                      }
   2.475 -                }
   2.476 +                    // process all the instance initializers
   2.477 +                    for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
   2.478 +                        if (!l.head.hasTag(METHODDEF) &&
   2.479 +                            (TreeInfo.flags(l.head) & STATIC) == 0) {
   2.480 +                            scan(l.head);
   2.481 +                        }
   2.482 +                    }
   2.483  
   2.484 -                // process all the instance initializers
   2.485 -                for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
   2.486 -                    if (!l.head.hasTag(METHODDEF) &&
   2.487 -                        (TreeInfo.flags(l.head) & STATIC) == 0) {
   2.488 -                        scan(l.head);
   2.489 +                    // process all the methods
   2.490 +                    for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
   2.491 +                        if (l.head.hasTag(METHODDEF)) {
   2.492 +                            scan(l.head);
   2.493 +                        }
   2.494                      }
   2.495 -                }
   2.496 -
   2.497 -                // process all the methods
   2.498 -                for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
   2.499 -                    if (l.head.hasTag(METHODDEF)) {
   2.500 -                        scan(l.head);
   2.501 -                    }
   2.502 +                } finally {
   2.503 +                    pendingExits = pendingExitsPrev;
   2.504 +                    nextadr = nextadrPrev;
   2.505 +                    firstadr = firstadrPrev;
   2.506 +                    classDef = classDefPrev;
   2.507                  }
   2.508              } finally {
   2.509 -                pendingExits = pendingExitsPrev;
   2.510 -                nextadr = nextadrPrev;
   2.511 -                firstadr = firstadrPrev;
   2.512 -                classDef = classDefPrev;
   2.513 +                lint = lintPrev;
   2.514              }
   2.515          }
   2.516  
   2.517 -        @Override
   2.518          public void visitMethodDef(JCMethodDecl tree) {
   2.519              if (tree.body == null) {
   2.520                  return;
   2.521              }
   2.522 -            /*  Ignore synthetic methods, except for translated lambda methods.
   2.523 +
   2.524 +            /*  MemberEnter can generate synthetic methods ignore them
   2.525               */
   2.526 -            if ((tree.sym.flags() & (SYNTHETIC | LAMBDA_METHOD)) == SYNTHETIC) {
   2.527 +            if ((tree.sym.flags() & SYNTHETIC) != 0) {
   2.528                  return;
   2.529              }
   2.530  
   2.531 -            final Bits initsPrev = new Bits(inits);
   2.532 -            final Bits uninitsPrev = new Bits(uninits);
   2.533 -            int nextadrPrev = nextadr;
   2.534 -            int firstadrPrev = firstadr;
   2.535 -            int returnadrPrev = returnadr;
   2.536 +            Lint lintPrev = lint;
   2.537 +            lint = lint.augment(tree.sym);
   2.538 +            try {
   2.539 +                if (tree.body == null) {
   2.540 +                    return;
   2.541 +                }
   2.542 +                /*  Ignore synthetic methods, except for translated lambda methods.
   2.543 +                 */
   2.544 +                if ((tree.sym.flags() & (SYNTHETIC | LAMBDA_METHOD)) == SYNTHETIC) {
   2.545 +                    return;
   2.546 +                }
   2.547  
   2.548 -            Assert.check(pendingExits.isEmpty());
   2.549 -            boolean lastInitialConstructor = isInitialConstructor;
   2.550 -            try {
   2.551 -                isInitialConstructor = TreeInfo.isInitialConstructor(tree);
   2.552 +                final Bits initsPrev = new Bits(inits);
   2.553 +                final Bits uninitsPrev = new Bits(uninits);
   2.554 +                int nextadrPrev = nextadr;
   2.555 +                int firstadrPrev = firstadr;
   2.556 +                int returnadrPrev = returnadr;
   2.557  
   2.558 -                if (!isInitialConstructor) {
   2.559 -                    firstadr = nextadr;
   2.560 -                }
   2.561 -                for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
   2.562 -                    JCVariableDecl def = l.head;
   2.563 -                    scan(def);
   2.564 -                    Assert.check((def.sym.flags() & PARAMETER) != 0, "Method parameter without PARAMETER flag");
   2.565 -                    /*  If we are executing the code from Gen, then there can be
   2.566 -                     *  synthetic or mandated variables, ignore them.
   2.567 -                     */
   2.568 -                    initParam(def);
   2.569 -                }
   2.570 -                // else we are in an instance initializer block;
   2.571 -                // leave caught unchanged.
   2.572 -                scan(tree.body);
   2.573 +                Assert.check(pendingExits.isEmpty());
   2.574 +                boolean lastInitialConstructor = isInitialConstructor;
   2.575 +                try {
   2.576 +                    isInitialConstructor = TreeInfo.isInitialConstructor(tree);
   2.577  
   2.578 -                if (isInitialConstructor) {
   2.579 -                    boolean isSynthesized = (tree.sym.flags() &
   2.580 -                                             GENERATEDCONSTR) != 0;
   2.581 -                    for (int i = firstadr; i < nextadr; i++) {
   2.582 -                        JCVariableDecl vardecl = vardecls[i];
   2.583 -                        VarSymbol var = vardecl.sym;
   2.584 -                        if (var.owner == classDef.sym) {
   2.585 -                            // choose the diagnostic position based on whether
   2.586 -                            // the ctor is default(synthesized) or not
   2.587 -                            if (isSynthesized) {
   2.588 -                                checkInit(TreeInfo.diagnosticPositionFor(var, vardecl),
   2.589 -                                    var, "var.not.initialized.in.default.constructor");
   2.590 -                            } else {
   2.591 -                                checkInit(TreeInfo.diagEndPos(tree.body), var);
   2.592 +                    if (!isInitialConstructor) {
   2.593 +                        firstadr = nextadr;
   2.594 +                    }
   2.595 +                    for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
   2.596 +                        JCVariableDecl def = l.head;
   2.597 +                        scan(def);
   2.598 +                        Assert.check((def.sym.flags() & PARAMETER) != 0, "Method parameter without PARAMETER flag");
   2.599 +                        /*  If we are executing the code from Gen, then there can be
   2.600 +                         *  synthetic or mandated variables, ignore them.
   2.601 +                         */
   2.602 +                        initParam(def);
   2.603 +                    }
   2.604 +                    // else we are in an instance initializer block;
   2.605 +                    // leave caught unchanged.
   2.606 +                    scan(tree.body);
   2.607 +
   2.608 +                    if (isInitialConstructor) {
   2.609 +                        boolean isSynthesized = (tree.sym.flags() &
   2.610 +                                                 GENERATEDCONSTR) != 0;
   2.611 +                        for (int i = firstadr; i < nextadr; i++) {
   2.612 +                            JCVariableDecl vardecl = vardecls[i];
   2.613 +                            VarSymbol var = vardecl.sym;
   2.614 +                            if (var.owner == classDef.sym) {
   2.615 +                                // choose the diagnostic position based on whether
   2.616 +                                // the ctor is default(synthesized) or not
   2.617 +                                if (isSynthesized) {
   2.618 +                                    checkInit(TreeInfo.diagnosticPositionFor(var, vardecl),
   2.619 +                                        var, "var.not.initialized.in.default.constructor");
   2.620 +                                } else {
   2.621 +                                    checkInit(TreeInfo.diagEndPos(tree.body), var);
   2.622 +                                }
   2.623                              }
   2.624                          }
   2.625                      }
   2.626 -                }
   2.627 -                List<P> exits = pendingExits.toList();
   2.628 -                pendingExits = new ListBuffer<>();
   2.629 -                while (exits.nonEmpty()) {
   2.630 -                    P exit = exits.head;
   2.631 -                    exits = exits.tail;
   2.632 -                    Assert.check(exit.tree.hasTag(RETURN), exit.tree);
   2.633 -                    if (isInitialConstructor) {
   2.634 -                        assignToInits(exit.tree, exit.exit_inits);
   2.635 -                        for (int i = firstadr; i < nextadr; i++) {
   2.636 -                            checkInit(exit.tree.pos(), vardecls[i].sym);
   2.637 +                    List<AssignPendingExit> exits = pendingExits.toList();
   2.638 +                    pendingExits = new ListBuffer<>();
   2.639 +                    while (exits.nonEmpty()) {
   2.640 +                        AssignPendingExit exit = exits.head;
   2.641 +                        exits = exits.tail;
   2.642 +                        Assert.check(exit.tree.hasTag(RETURN), exit.tree);
   2.643 +                        if (isInitialConstructor) {
   2.644 +                            inits.assign(exit.exit_inits);
   2.645 +                            for (int i = firstadr; i < nextadr; i++) {
   2.646 +                                checkInit(exit.tree.pos(), vardecls[i].sym);
   2.647 +                            }
   2.648                          }
   2.649                      }
   2.650 +                } finally {
   2.651 +                    inits.assign(initsPrev);
   2.652 +                    uninits.assign(uninitsPrev);
   2.653 +                    nextadr = nextadrPrev;
   2.654 +                    firstadr = firstadrPrev;
   2.655 +                    returnadr = returnadrPrev;
   2.656 +                    isInitialConstructor = lastInitialConstructor;
   2.657                  }
   2.658              } finally {
   2.659 -                assignToInits(tree, initsPrev);
   2.660 -                uninits.assign(uninitsPrev);
   2.661 -                nextadr = nextadrPrev;
   2.662 -                firstadr = firstadrPrev;
   2.663 -                returnadr = returnadrPrev;
   2.664 -                isInitialConstructor = lastInitialConstructor;
   2.665 +                lint = lintPrev;
   2.666              }
   2.667          }
   2.668  
   2.669          protected void initParam(JCVariableDecl def) {
   2.670              inits.incl(def.sym.adr);
   2.671              uninits.excl(def.sym.adr);
   2.672 -            }
   2.673 +        }
   2.674  
   2.675          public void visitVarDef(JCVariableDecl tree) {
   2.676 -            boolean track = trackable(tree.sym);
   2.677 -            if (track && tree.sym.owner.kind == MTH) {
   2.678 -                newVar(tree);
   2.679 -            }
   2.680 -            if (tree.init != null) {
   2.681 -                scanExpr(tree.init);
   2.682 -                if (track) {
   2.683 -                    letInit(tree.pos(), tree.sym);
   2.684 +            Lint lintPrev = lint;
   2.685 +            lint = lint.augment(tree.sym);
   2.686 +            try{
   2.687 +                boolean track = trackable(tree.sym);
   2.688 +                if (track && tree.sym.owner.kind == MTH) {
   2.689 +                    newVar(tree);
   2.690                  }
   2.691 +                if (tree.init != null) {
   2.692 +                    scanExpr(tree.init);
   2.693 +                    if (track) {
   2.694 +                        letInit(tree.pos(), tree.sym);
   2.695 +                    }
   2.696 +                }
   2.697 +            } finally {
   2.698 +                lint = lintPrev;
   2.699              }
   2.700          }
   2.701  
   2.702 @@ -1844,18 +1884,14 @@
   2.703              nextadr = nextadrPrev;
   2.704          }
   2.705  
   2.706 -        int getLogNumberOfErrors() {
   2.707 -            return 0;
   2.708 -        }
   2.709 -
   2.710          public void visitDoLoop(JCDoWhileLoop tree) {
   2.711 -            ListBuffer<P> prevPendingExits = pendingExits;
   2.712 +            ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
   2.713              FlowKind prevFlowKind = flowKind;
   2.714              flowKind = FlowKind.NORMAL;
   2.715              final Bits initsSkip = new Bits(true);
   2.716              final Bits uninitsSkip = new Bits(true);
   2.717 -            pendingExits = new ListBuffer<P>();
   2.718 -            int prevErrors = getLogNumberOfErrors();
   2.719 +            pendingExits = new ListBuffer<>();
   2.720 +            int prevErrors = log.nerrors;
   2.721              do {
   2.722                  final Bits uninitsEntry = new Bits(uninits);
   2.723                  uninitsEntry.excludeFrom(nextadr);
   2.724 @@ -1866,28 +1902,28 @@
   2.725                      initsSkip.assign(initsWhenFalse);
   2.726                      uninitsSkip.assign(uninitsWhenFalse);
   2.727                  }
   2.728 -                if (getLogNumberOfErrors() !=  prevErrors ||
   2.729 +                if (log.nerrors !=  prevErrors ||
   2.730                      flowKind.isFinal() ||
   2.731                      new Bits(uninitsEntry).diffSet(uninitsWhenTrue).nextBit(firstadr)==-1)
   2.732                      break;
   2.733 -                assignToInits(tree.cond, initsWhenTrue);
   2.734 +                inits.assign(initsWhenTrue);
   2.735                  uninits.assign(uninitsEntry.andSet(uninitsWhenTrue));
   2.736                  flowKind = FlowKind.SPECULATIVE_LOOP;
   2.737              } while (true);
   2.738              flowKind = prevFlowKind;
   2.739 -            assignToInits(tree, initsSkip);
   2.740 +            inits.assign(initsSkip);
   2.741              uninits.assign(uninitsSkip);
   2.742              resolveBreaks(tree, prevPendingExits);
   2.743          }
   2.744  
   2.745          public void visitWhileLoop(JCWhileLoop tree) {
   2.746 -            ListBuffer<P> prevPendingExits = pendingExits;
   2.747 +            ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
   2.748              FlowKind prevFlowKind = flowKind;
   2.749              flowKind = FlowKind.NORMAL;
   2.750              final Bits initsSkip = new Bits(true);
   2.751              final Bits uninitsSkip = new Bits(true);
   2.752              pendingExits = new ListBuffer<>();
   2.753 -            int prevErrors = getLogNumberOfErrors();
   2.754 +            int prevErrors = log.nerrors;
   2.755              final Bits uninitsEntry = new Bits(uninits);
   2.756              uninitsEntry.excludeFrom(nextadr);
   2.757              do {
   2.758 @@ -1896,11 +1932,11 @@
   2.759                      initsSkip.assign(initsWhenFalse) ;
   2.760                      uninitsSkip.assign(uninitsWhenFalse);
   2.761                  }
   2.762 -                assignToInits(tree, initsWhenTrue);
   2.763 +                inits.assign(initsWhenTrue);
   2.764                  uninits.assign(uninitsWhenTrue);
   2.765                  scan(tree.body);
   2.766                  resolveContinues(tree);
   2.767 -                if (getLogNumberOfErrors() != prevErrors ||
   2.768 +                if (log.nerrors != prevErrors ||
   2.769                      flowKind.isFinal() ||
   2.770                      new Bits(uninitsEntry).diffSet(uninits).nextBit(firstadr) == -1) {
   2.771                      break;
   2.772 @@ -1911,21 +1947,21 @@
   2.773              flowKind = prevFlowKind;
   2.774              //a variable is DA/DU after the while statement, if it's DA/DU assuming the
   2.775              //branch is not taken AND if it's DA/DU before any break statement
   2.776 -            assignToInits(tree.body, initsSkip);
   2.777 +            inits.assign(initsSkip);
   2.778              uninits.assign(uninitsSkip);
   2.779              resolveBreaks(tree, prevPendingExits);
   2.780          }
   2.781  
   2.782          public void visitForLoop(JCForLoop tree) {
   2.783 -            ListBuffer<P> prevPendingExits = pendingExits;
   2.784 +            ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
   2.785              FlowKind prevFlowKind = flowKind;
   2.786              flowKind = FlowKind.NORMAL;
   2.787              int nextadrPrev = nextadr;
   2.788              scan(tree.init);
   2.789              final Bits initsSkip = new Bits(true);
   2.790              final Bits uninitsSkip = new Bits(true);
   2.791 -            pendingExits = new ListBuffer<P>();
   2.792 -            int prevErrors = getLogNumberOfErrors();
   2.793 +            pendingExits = new ListBuffer<>();
   2.794 +            int prevErrors = log.nerrors;
   2.795              do {
   2.796                  final Bits uninitsEntry = new Bits(uninits);
   2.797                  uninitsEntry.excludeFrom(nextadr);
   2.798 @@ -1935,7 +1971,7 @@
   2.799                          initsSkip.assign(initsWhenFalse);
   2.800                          uninitsSkip.assign(uninitsWhenFalse);
   2.801                      }
   2.802 -                    assignToInits(tree.body, initsWhenTrue);
   2.803 +                    inits.assign(initsWhenTrue);
   2.804                      uninits.assign(uninitsWhenTrue);
   2.805                  } else if (!flowKind.isFinal()) {
   2.806                      initsSkip.assign(inits);
   2.807 @@ -1946,7 +1982,7 @@
   2.808                  scan(tree.body);
   2.809                  resolveContinues(tree);
   2.810                  scan(tree.step);
   2.811 -                if (getLogNumberOfErrors() != prevErrors ||
   2.812 +                if (log.nerrors != prevErrors ||
   2.813                      flowKind.isFinal() ||
   2.814                      new Bits(uninitsEntry).diffSet(uninits).nextBit(firstadr) == -1)
   2.815                      break;
   2.816 @@ -1956,7 +1992,7 @@
   2.817              flowKind = prevFlowKind;
   2.818              //a variable is DA/DU after a for loop, if it's DA/DU assuming the
   2.819              //branch is not taken AND if it's DA/DU before any break statement
   2.820 -            assignToInits(tree.body, initsSkip);
   2.821 +            inits.assign(initsSkip);
   2.822              uninits.assign(uninitsSkip);
   2.823              resolveBreaks(tree, prevPendingExits);
   2.824              nextadr = nextadrPrev;
   2.825 @@ -1965,7 +2001,7 @@
   2.826          public void visitForeachLoop(JCEnhancedForLoop tree) {
   2.827              visitVarDef(tree.var);
   2.828  
   2.829 -            ListBuffer<P> prevPendingExits = pendingExits;
   2.830 +            ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
   2.831              FlowKind prevFlowKind = flowKind;
   2.832              flowKind = FlowKind.NORMAL;
   2.833              int nextadrPrev = nextadr;
   2.834 @@ -1974,14 +2010,14 @@
   2.835              final Bits uninitsStart = new Bits(uninits);
   2.836  
   2.837              letInit(tree.pos(), tree.var.sym);
   2.838 -            pendingExits = new ListBuffer<P>();
   2.839 -            int prevErrors = getLogNumberOfErrors();
   2.840 +            pendingExits = new ListBuffer<>();
   2.841 +            int prevErrors = log.nerrors;
   2.842              do {
   2.843                  final Bits uninitsEntry = new Bits(uninits);
   2.844                  uninitsEntry.excludeFrom(nextadr);
   2.845                  scan(tree.body);
   2.846                  resolveContinues(tree);
   2.847 -                if (getLogNumberOfErrors() != prevErrors ||
   2.848 +                if (log.nerrors != prevErrors ||
   2.849                      flowKind.isFinal() ||
   2.850                      new Bits(uninitsEntry).diffSet(uninits).nextBit(firstadr) == -1)
   2.851                      break;
   2.852 @@ -1989,21 +2025,21 @@
   2.853                  flowKind = FlowKind.SPECULATIVE_LOOP;
   2.854              } while (true);
   2.855              flowKind = prevFlowKind;
   2.856 -            assignToInits(tree.body, initsStart);
   2.857 +            inits.assign(initsStart);
   2.858              uninits.assign(uninitsStart.andSet(uninits));
   2.859              resolveBreaks(tree, prevPendingExits);
   2.860              nextadr = nextadrPrev;
   2.861          }
   2.862  
   2.863          public void visitLabelled(JCLabeledStatement tree) {
   2.864 -            ListBuffer<P> prevPendingExits = pendingExits;
   2.865 -            pendingExits = new ListBuffer<P>();
   2.866 +            ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
   2.867 +            pendingExits = new ListBuffer<>();
   2.868              scan(tree.body);
   2.869              resolveBreaks(tree, prevPendingExits);
   2.870          }
   2.871  
   2.872          public void visitSwitch(JCSwitch tree) {
   2.873 -            ListBuffer<P> prevPendingExits = pendingExits;
   2.874 +            ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
   2.875              pendingExits = new ListBuffer<>();
   2.876              int nextadrPrev = nextadr;
   2.877              scanExpr(tree.selector);
   2.878 @@ -2011,7 +2047,7 @@
   2.879              final Bits uninitsSwitch = new Bits(uninits);
   2.880              boolean hasDefault = false;
   2.881              for (List<JCCase> l = tree.cases; l.nonEmpty(); l = l.tail) {
   2.882 -                assignToInits(l.head, initsSwitch);
   2.883 +                inits.assign(initsSwitch);
   2.884                  uninits.assign(uninits.andSet(uninitsSwitch));
   2.885                  JCCase c = l.head;
   2.886                  if (c.pat == null) {
   2.887 @@ -2020,19 +2056,19 @@
   2.888                      scanExpr(c.pat);
   2.889                  }
   2.890                  if (hasDefault) {
   2.891 -                    assignToInits(null, initsSwitch);
   2.892 +                    inits.assign(initsSwitch);
   2.893                      uninits.assign(uninits.andSet(uninitsSwitch));
   2.894                  }
   2.895                  scan(c.stats);
   2.896                  addVars(c.stats, initsSwitch, uninitsSwitch);
   2.897                  if (!hasDefault) {
   2.898 -                    assignToInits(l.head.stats.last(), initsSwitch);
   2.899 +                    inits.assign(initsSwitch);
   2.900                      uninits.assign(uninits.andSet(uninitsSwitch));
   2.901                  }
   2.902                  // Warn about fall-through if lint switch fallthrough enabled.
   2.903              }
   2.904              if (!hasDefault) {
   2.905 -                andSetInits(null, initsSwitch);
   2.906 +                inits.andSet(initsSwitch);
   2.907              }
   2.908              resolveBreaks(tree, prevPendingExits);
   2.909              nextadr = nextadrPrev;
   2.910 @@ -2051,16 +2087,10 @@
   2.911                  }
   2.912              }
   2.913  
   2.914 -        boolean isEnabled(Lint.LintCategory lc) {
   2.915 -            return false;
   2.916 -        }
   2.917 -
   2.918 -        void reportWarning(Lint.LintCategory lc, DiagnosticPosition pos, String key, Object ... args) {}
   2.919 -
   2.920          public void visitTry(JCTry tree) {
   2.921              ListBuffer<JCVariableDecl> resourceVarDecls = new ListBuffer<>();
   2.922              final Bits uninitsTryPrev = new Bits(uninitsTry);
   2.923 -            ListBuffer<P> prevPendingExits = pendingExits;
   2.924 +            ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
   2.925              pendingExits = new ListBuffer<>();
   2.926              final Bits initsTry = new Bits(inits);
   2.927              uninitsTry.assign(uninits);
   2.928 @@ -2083,10 +2113,10 @@
   2.929              int nextadrCatch = nextadr;
   2.930  
   2.931              if (!resourceVarDecls.isEmpty() &&
   2.932 -                    isEnabled(Lint.LintCategory.TRY)) {
   2.933 +                    lint.isEnabled(Lint.LintCategory.TRY)) {
   2.934                  for (JCVariableDecl resVar : resourceVarDecls) {
   2.935                      if (unrefdResources.includes(resVar.sym)) {
   2.936 -                        reportWarning(Lint.LintCategory.TRY, resVar.pos(),
   2.937 +                        log.warning(Lint.LintCategory.TRY, resVar.pos(),
   2.938                                      "try.resource.not.referenced", resVar.sym);
   2.939                          unrefdResources.remove(resVar.sym);
   2.940                      }
   2.941 @@ -2102,7 +2132,7 @@
   2.942  
   2.943              for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) {
   2.944                  JCVariableDecl param = l.head.param;
   2.945 -                assignToInits(tree.body, initsCatchPrev);
   2.946 +                inits.assign(initsCatchPrev);
   2.947                  uninits.assign(uninitsCatchPrev);
   2.948                  scan(param);
   2.949                  /* If this is a TWR and we are executing the code from Gen,
   2.950 @@ -2115,9 +2145,9 @@
   2.951                  nextadr = nextadrCatch;
   2.952              }
   2.953              if (tree.finalizer != null) {
   2.954 -                assignToInits(tree.finalizer, initsTry);
   2.955 +                inits.assign(initsTry);
   2.956                  uninits.assign(uninitsTry);
   2.957 -                ListBuffer<P> exits = pendingExits;
   2.958 +                ListBuffer<AssignPendingExit> exits = pendingExits;
   2.959                  pendingExits = prevPendingExits;
   2.960                  scan(tree.finalizer);
   2.961                  if (!tree.finallyCanCompleteNormally) {
   2.962 @@ -2127,19 +2157,19 @@
   2.963                      // FIX: this doesn't preserve source order of exits in catch
   2.964                      // versus finally!
   2.965                      while (exits.nonEmpty()) {
   2.966 -                        P exit = exits.next();
   2.967 +                        AssignPendingExit exit = exits.next();
   2.968                          if (exit.exit_inits != null) {
   2.969                              exit.exit_inits.orSet(inits);
   2.970                              exit.exit_uninits.andSet(uninits);
   2.971                          }
   2.972                          pendingExits.append(exit);
   2.973                      }
   2.974 -                    orSetInits(tree, initsEnd);
   2.975 +                    inits.orSet(initsEnd);
   2.976                  }
   2.977              } else {
   2.978 -                assignToInits(tree, initsEnd);
   2.979 +                inits.assign(initsEnd);
   2.980                  uninits.assign(uninitsEnd);
   2.981 -                ListBuffer<P> exits = pendingExits;
   2.982 +                ListBuffer<AssignPendingExit> exits = pendingExits;
   2.983                  pendingExits = prevPendingExits;
   2.984                  while (exits.nonEmpty()) pendingExits.append(exits.next());
   2.985              }
   2.986 @@ -2150,7 +2180,7 @@
   2.987              scanCond(tree.cond);
   2.988              final Bits initsBeforeElse = new Bits(initsWhenFalse);
   2.989              final Bits uninitsBeforeElse = new Bits(uninitsWhenFalse);
   2.990 -            assignToInits(tree.cond, initsWhenTrue);
   2.991 +            inits.assign(initsWhenTrue);
   2.992              uninits.assign(uninitsWhenTrue);
   2.993              if (tree.truepart.type.hasTag(BOOLEAN) &&
   2.994                  tree.falsepart.type.hasTag(BOOLEAN)) {
   2.995 @@ -2163,7 +2193,7 @@
   2.996                  final Bits initsAfterThenWhenFalse = new Bits(initsWhenFalse);
   2.997                  final Bits uninitsAfterThenWhenTrue = new Bits(uninitsWhenTrue);
   2.998                  final Bits uninitsAfterThenWhenFalse = new Bits(uninitsWhenFalse);
   2.999 -                assignToInits(tree.truepart, initsBeforeElse);
  2.1000 +                inits.assign(initsBeforeElse);
  2.1001                  uninits.assign(uninitsBeforeElse);
  2.1002                  scanCond(tree.falsepart);
  2.1003                  initsWhenTrue.andSet(initsAfterThenWhenTrue);
  2.1004 @@ -2174,10 +2204,10 @@
  2.1005                  scanExpr(tree.truepart);
  2.1006                  final Bits initsAfterThen = new Bits(inits);
  2.1007                  final Bits uninitsAfterThen = new Bits(uninits);
  2.1008 -                assignToInits(tree.truepart, initsBeforeElse);
  2.1009 +                inits.assign(initsBeforeElse);
  2.1010                  uninits.assign(uninitsBeforeElse);
  2.1011                  scanExpr(tree.falsepart);
  2.1012 -                andSetInits(tree.falsepart, initsAfterThen);
  2.1013 +                inits.andSet(initsAfterThen);
  2.1014                  uninits.andSet(uninitsAfterThen);
  2.1015              }
  2.1016          }
  2.1017 @@ -2186,46 +2216,42 @@
  2.1018              scanCond(tree.cond);
  2.1019              final Bits initsBeforeElse = new Bits(initsWhenFalse);
  2.1020              final Bits uninitsBeforeElse = new Bits(uninitsWhenFalse);
  2.1021 -            assignToInits(tree.cond, initsWhenTrue);
  2.1022 +            inits.assign(initsWhenTrue);
  2.1023              uninits.assign(uninitsWhenTrue);
  2.1024              scan(tree.thenpart);
  2.1025              if (tree.elsepart != null) {
  2.1026                  final Bits initsAfterThen = new Bits(inits);
  2.1027                  final Bits uninitsAfterThen = new Bits(uninits);
  2.1028 -                assignToInits(tree.thenpart, initsBeforeElse);
  2.1029 +                inits.assign(initsBeforeElse);
  2.1030                  uninits.assign(uninitsBeforeElse);
  2.1031                  scan(tree.elsepart);
  2.1032 -                andSetInits(tree.elsepart, initsAfterThen);
  2.1033 +                inits.andSet(initsAfterThen);
  2.1034                  uninits.andSet(uninitsAfterThen);
  2.1035              } else {
  2.1036 -                andSetInits(tree.thenpart, initsBeforeElse);
  2.1037 +                inits.andSet(initsBeforeElse);
  2.1038                  uninits.andSet(uninitsBeforeElse);
  2.1039              }
  2.1040          }
  2.1041  
  2.1042 -        protected P createNewPendingExit(JCTree tree, Bits inits, Bits uninits) {
  2.1043 -            return null;
  2.1044 -        }
  2.1045 -
  2.1046          @Override
  2.1047          public void visitBreak(JCBreak tree) {
  2.1048 -            recordExit(tree, createNewPendingExit(tree, inits, uninits));
  2.1049 +            recordExit(new AssignPendingExit(tree, inits, uninits));
  2.1050          }
  2.1051  
  2.1052          @Override
  2.1053          public void visitContinue(JCContinue tree) {
  2.1054 -            recordExit(tree, createNewPendingExit(tree, inits, uninits));
  2.1055 +            recordExit(new AssignPendingExit(tree, inits, uninits));
  2.1056          }
  2.1057  
  2.1058          @Override
  2.1059          public void visitReturn(JCReturn tree) {
  2.1060              scanExpr(tree.expr);
  2.1061 -            recordExit(tree, createNewPendingExit(tree, inits, uninits));
  2.1062 +            recordExit(new AssignPendingExit(tree, inits, uninits));
  2.1063          }
  2.1064  
  2.1065          public void visitThrow(JCThrow tree) {
  2.1066              scanExpr(tree.expr);
  2.1067 -            markDead(tree.expr);
  2.1068 +            markDead();
  2.1069          }
  2.1070  
  2.1071          public void visitApply(JCMethodInvocation tree) {
  2.1072 @@ -2244,10 +2270,10 @@
  2.1073              final Bits prevUninits = new Bits(uninits);
  2.1074              final Bits prevInits = new Bits(inits);
  2.1075              int returnadrPrev = returnadr;
  2.1076 -            ListBuffer<P> prevPending = pendingExits;
  2.1077 +            ListBuffer<AssignPendingExit> prevPending = pendingExits;
  2.1078              try {
  2.1079                  returnadr = nextadr;
  2.1080 -                pendingExits = new ListBuffer<P>();
  2.1081 +                pendingExits = new ListBuffer<>();
  2.1082                  for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
  2.1083                      JCVariableDecl def = l.head;
  2.1084                      scan(def);
  2.1085 @@ -2263,7 +2289,7 @@
  2.1086              finally {
  2.1087                  returnadr = returnadrPrev;
  2.1088                  uninits.assign(prevUninits);
  2.1089 -                assignToInits(tree, prevInits);
  2.1090 +                inits.assign(prevInits);
  2.1091                  pendingExits = prevPending;
  2.1092              }
  2.1093          }
  2.1094 @@ -2279,11 +2305,11 @@
  2.1095              scanCond(tree.cond);
  2.1096              uninitsExit.andSet(uninitsWhenTrue);
  2.1097              if (tree.detail != null) {
  2.1098 -                assignToInits(tree, initsWhenFalse);
  2.1099 +                inits.assign(initsWhenFalse);
  2.1100                  uninits.assign(uninitsWhenFalse);
  2.1101                  scanExpr(tree.detail);
  2.1102              }
  2.1103 -            assignToInits(tree, initsExit);
  2.1104 +            inits.assign(initsExit);
  2.1105              uninits.assign(uninitsExit);
  2.1106          }
  2.1107  
  2.1108 @@ -2351,7 +2377,7 @@
  2.1109                  scanCond(tree.lhs);
  2.1110                  final Bits initsWhenFalseLeft = new Bits(initsWhenFalse);
  2.1111                  final Bits uninitsWhenFalseLeft = new Bits(uninitsWhenFalse);
  2.1112 -                assignToInits(tree.lhs, initsWhenTrue);
  2.1113 +                inits.assign(initsWhenTrue);
  2.1114                  uninits.assign(uninitsWhenTrue);
  2.1115                  scanCond(tree.rhs);
  2.1116                  initsWhenFalse.andSet(initsWhenFalseLeft);
  2.1117 @@ -2361,7 +2387,7 @@
  2.1118                  scanCond(tree.lhs);
  2.1119                  final Bits initsWhenTrueLeft = new Bits(initsWhenTrue);
  2.1120                  final Bits uninitsWhenTrueLeft = new Bits(uninitsWhenTrue);
  2.1121 -                assignToInits(tree.lhs, initsWhenFalse);
  2.1122 +                inits.assign(initsWhenFalse);
  2.1123                  uninits.assign(uninitsWhenFalse);
  2.1124                  scanCond(tree.rhs);
  2.1125                  initsWhenTrue.andSet(initsWhenTrueLeft);
  2.1126 @@ -2436,136 +2462,6 @@
  2.1127          }
  2.1128      }
  2.1129  
  2.1130 -    public class AssignAnalyzer extends AbstractAssignAnalyzer<AssignAnalyzer.AssignPendingExit> {
  2.1131 -
  2.1132 -        public class AssignPendingExit extends AbstractAssignAnalyzer<AssignPendingExit>.AbstractAssignPendingExit {
  2.1133 -
  2.1134 -            public AssignPendingExit(JCTree tree, final Bits inits, final Bits uninits) {
  2.1135 -                super(tree, inits, uninits);
  2.1136 -            }
  2.1137 -        }
  2.1138 -
  2.1139 -        @Override
  2.1140 -        protected AssignPendingExit createNewPendingExit(JCTree tree,
  2.1141 -            Bits inits, Bits uninits) {
  2.1142 -            return new AssignPendingExit(tree, inits, uninits);
  2.1143 -        }
  2.1144 -
  2.1145 -        /** Record an initialization of a trackable variable.
  2.1146 -         */
  2.1147 -        @Override
  2.1148 -        void letInit(DiagnosticPosition pos, VarSymbol sym) {
  2.1149 -            if (sym.adr >= firstadr && trackable(sym)) {
  2.1150 -                if ((sym.flags() & EFFECTIVELY_FINAL) != 0) {
  2.1151 -                    if (!uninits.isMember(sym.adr)) {
  2.1152 -                        //assignment targeting an effectively final variable
  2.1153 -                        //makes the variable lose its status of effectively final
  2.1154 -                        //if the variable is _not_ definitively unassigned
  2.1155 -                        sym.flags_field &= ~EFFECTIVELY_FINAL;
  2.1156 -                    } else {
  2.1157 -                        uninit(sym);
  2.1158 -                    }
  2.1159 -                }
  2.1160 -                else if ((sym.flags() & FINAL) != 0) {
  2.1161 -                    if ((sym.flags() & PARAMETER) != 0) {
  2.1162 -                        if ((sym.flags() & UNION) != 0) { //multi-catch parameter
  2.1163 -                            log.error(pos, "multicatch.parameter.may.not.be.assigned", sym);
  2.1164 -                        }
  2.1165 -                        else {
  2.1166 -                            log.error(pos, "final.parameter.may.not.be.assigned",
  2.1167 -                                  sym);
  2.1168 -                        }
  2.1169 -                    } else if (!uninits.isMember(sym.adr)) {
  2.1170 -                        log.error(pos, flowKind.errKey, sym);
  2.1171 -                    } else {
  2.1172 -                        uninit(sym);
  2.1173 -                    }
  2.1174 -                }
  2.1175 -                inits.incl(sym.adr);
  2.1176 -            } else if ((sym.flags() & FINAL) != 0) {
  2.1177 -                log.error(pos, "var.might.already.be.assigned", sym);
  2.1178 -            }
  2.1179 -        }
  2.1180 -
  2.1181 -        @Override
  2.1182 -        void checkInit(DiagnosticPosition pos, VarSymbol sym, String errkey) {
  2.1183 -            if ((sym.adr >= firstadr || sym.owner.kind != TYP) &&
  2.1184 -                trackable(sym) &&
  2.1185 -                !inits.isMember(sym.adr)) {
  2.1186 -                log.error(pos, errkey, sym);
  2.1187 -                inits.incl(sym.adr);
  2.1188 -            }
  2.1189 -        }
  2.1190 -
  2.1191 -        @Override
  2.1192 -        void reportWarning(Lint.LintCategory lc, DiagnosticPosition pos,
  2.1193 -            String key, Object ... args) {
  2.1194 -            log.warning(lc, pos, key, args);
  2.1195 -        }
  2.1196 -
  2.1197 -        @Override
  2.1198 -        int getLogNumberOfErrors() {
  2.1199 -            return log.nerrors;
  2.1200 -        }
  2.1201 -
  2.1202 -        @Override
  2.1203 -        boolean isEnabled(Lint.LintCategory lc) {
  2.1204 -            return lint.isEnabled(lc);
  2.1205 -        }
  2.1206 -
  2.1207 -        @Override
  2.1208 -        public void visitClassDef(JCClassDecl tree) {
  2.1209 -            if (tree.sym == null) {
  2.1210 -                return;
  2.1211 -            }
  2.1212 -
  2.1213 -            Lint lintPrev = lint;
  2.1214 -            lint = lint.augment(tree.sym);
  2.1215 -            try {
  2.1216 -                super.visitClassDef(tree);
  2.1217 -            } finally {
  2.1218 -                lint = lintPrev;
  2.1219 -            }
  2.1220 -        }
  2.1221 -
  2.1222 -        @Override
  2.1223 -        public void visitMethodDef(JCMethodDecl tree) {
  2.1224 -            if (tree.body == null) {
  2.1225 -                return;
  2.1226 -            }
  2.1227 -
  2.1228 -            /*  MemberEnter can generate synthetic methods ignore them
  2.1229 -             */
  2.1230 -            if ((tree.sym.flags() & SYNTHETIC) != 0) {
  2.1231 -                return;
  2.1232 -            }
  2.1233 -
  2.1234 -            Lint lintPrev = lint;
  2.1235 -            lint = lint.augment(tree.sym);
  2.1236 -            try {
  2.1237 -                super.visitMethodDef(tree);
  2.1238 -            } finally {
  2.1239 -                lint = lintPrev;
  2.1240 -            }
  2.1241 -        }
  2.1242 -
  2.1243 -        @Override
  2.1244 -        public void visitVarDef(JCVariableDecl tree) {
  2.1245 -            if (tree.init == null) {
  2.1246 -                super.visitVarDef(tree);
  2.1247 -            } else {
  2.1248 -                Lint lintPrev = lint;
  2.1249 -                lint = lint.augment(tree.sym);
  2.1250 -                try{
  2.1251 -                    super.visitVarDef(tree);
  2.1252 -                } finally {
  2.1253 -                    lint = lintPrev;
  2.1254 -                }
  2.1255 -            }
  2.1256 -        }
  2.1257 -
  2.1258 -    }
  2.1259 -
  2.1260      /**
  2.1261       * This pass implements the last step of the dataflow analysis, namely
  2.1262       * the effectively-final analysis check. This checks that every local variable
  2.1263 @@ -2578,7 +2474,7 @@
  2.1264          JCTree currentTree; //local class or lambda
  2.1265  
  2.1266          @Override
  2.1267 -        void markDead(JCTree tree) {
  2.1268 +        void markDead() {
  2.1269              //do nothing
  2.1270          }
  2.1271  
  2.1272 @@ -2715,7 +2611,7 @@
  2.1273              try {
  2.1274                  attrEnv = env;
  2.1275                  Flow.this.make = make;
  2.1276 -                pendingExits = new ListBuffer<PendingExit>();
  2.1277 +                pendingExits = new ListBuffer<>();
  2.1278                  scan(tree);
  2.1279              } finally {
  2.1280                  pendingExits = null;
     3.1 --- a/src/share/classes/com/sun/tools/javac/util/Bits.java	Wed Jun 24 10:41:26 2015 -0700
     3.2 +++ b/src/share/classes/com/sun/tools/javac/util/Bits.java	Sat Jun 27 23:21:54 2015 -0700
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
     3.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8   *
     3.9   * This code is free software; you can redistribute it and/or modify it
    3.10 @@ -84,20 +84,6 @@
    3.11  
    3.12      }
    3.13  
    3.14 -    public enum BitsOpKind {
    3.15 -        INIT,
    3.16 -        CLEAR,
    3.17 -        INCL_BIT,
    3.18 -        EXCL_BIT,
    3.19 -        ASSIGN,
    3.20 -        AND_SET,
    3.21 -        OR_SET,
    3.22 -        DIFF_SET,
    3.23 -        XOR_SET,
    3.24 -        INCL_RANGE,
    3.25 -        EXCL_RANGE,
    3.26 -    }
    3.27 -
    3.28      private final static int wordlen = 32;
    3.29      private final static int wordshift = 5;
    3.30      private final static int wordmask = wordlen - 1;

mercurial