Thu, 09 Jul 2015 23:05:33 -0700
Merge
.hgtags | file | annotate | diff | comparison | revisions |
1.1 --- a/.hgtags Mon Jul 06 12:28:15 2015 -0700 1.2 +++ b/.hgtags Thu Jul 09 23:05:33 2015 -0700 1.3 @@ -423,6 +423,7 @@ 1.4 f3a44c7deac2b23a53f0fd35b22a5d9181291616 jdk8u51-b14 1.5 f77e8d012e8d6ee3432515ad68dd4f630dd08d56 jdk8u51-b15 1.6 e27a094cb423a3bf32906969e9e454e061ce94d4 jdk8u51-b16 1.7 +57ea4856a08f0bc87f2fe56d57b3cf1497c0cb51 jdk8u51-b31 1.8 0c514d1fd006fc79d35b670de10c370c8d559db7 jdk8u60-b00 1.9 0ba07c272e33c93377a5d7ed98b9de873cc91980 jdk8u60-b01 1.10 387cf62ce7895dd5e067aaa51faa93d5c078583e jdk8u60-b02 1.11 @@ -445,6 +446,8 @@ 1.12 0366d7f1faa12ed35694571c151524e0847f05ff jdk8u60-b19 1.13 976523f1d5626bdb6dd47883e2734614b64a5e61 jdk8u60-b20 1.14 97328f3e2aa2c713931edf471270a1208980b963 jdk8u60-b21 1.15 +d1febf79ce5ea41fb4b818ffd3589cf923e6de5f jdk8u60-b22 1.16 +7f88b5dc78cebc2c5ebb716938fd9a7632b052b2 jdk8u60-b23 1.17 779397f90251ea813cb44621dc27f780e5c20449 jdk8u52-b06 1.18 e0ce6be9142ed1e2f0ce3ee13090ec01c6c44721 jdk8u52-b07 1.19 779397f90251ea813cb44621dc27f780e5c20449 jdk8u65-b00
2.1 --- a/THIRD_PARTY_README Mon Jul 06 12:28:15 2015 -0700 2.2 +++ b/THIRD_PARTY_README Thu Jul 09 23:05:33 2015 -0700 2.3 @@ -1140,37 +1140,6 @@ 2.4 2.5 -------------------------------------------------------------------------------- 2.6 2.7 -%% This notice is provided with respect to JSON, which may be included 2.8 -with JRE 8 & JDK 8. 2.9 - 2.10 ---- begin of LICENSE --- 2.11 - 2.12 -Copyright (c) 2002 JSON.org 2.13 - 2.14 -Permission is hereby granted, free of charge, to any person obtaining a copy 2.15 -of this software and associated documentation files (the "Software"), to deal 2.16 -in the Software without restriction, including without limitation the rights 2.17 -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 2.18 -copies of the Software, and to permit persons to whom the Software is 2.19 -furnished to do so, subject to the following conditions: 2.20 - 2.21 -The above copyright notice and this permission notice shall be included in all 2.22 -copies or substantial portions of the Software. 2.23 - 2.24 -The Software shall be used for Good, not Evil. 2.25 - 2.26 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2.27 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2.28 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2.29 -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2.30 -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2.31 -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 2.32 -SOFTWARE. 2.33 - 2.34 ---- end of LICENSE --- 2.35 - 2.36 -------------------------------------------------------------------------------- 2.37 - 2.38 %% This notice is provided with respect to Kerberos functionality, which 2.39 which may be included with JRE 8, JDK 8, and OpenJDK 8. 2.40 2.41 @@ -1250,7 +1219,7 @@ 2.42 2.43 ------------------------------------------------------------------------------- 2.44 2.45 -%% This notice is provided with respect to libpng 1.6.16, which may be 2.46 +%% This notice is provided with respect to libpng 1.6.16, which may be 2.47 included with JRE 8, JDK 8, and OpenJDK 8. 2.48 2.49 --- begin of LICENSE --- 2.50 @@ -1370,7 +1339,7 @@ 2.51 2.52 ------------------------------------------------------------------------------- 2.53 2.54 -%% This notice is provided with respect to libungif 4.1.3, which may be 2.55 +%% This notice is provided with respect to GIFLIB 5.1.1 & libungif 4.1.3, which may be 2.56 included with JRE 8, JDK 8, and OpenJDK 8. 2.57 2.58 --- begin of LICENSE --- 2.59 @@ -1399,13 +1368,13 @@ 2.60 2.61 ------------------------------------------------------------------------------- 2.62 2.63 -%% This notice is provided with respect to Little CMS 2.5, which may be 2.64 +%% This notice is provided with respect to Little CMS 2.7, which may be 2.65 included with JRE 8, JDK 8, and OpenJDK 8. 2.66 2.67 --- begin of LICENSE --- 2.68 2.69 Little CMS 2.70 -Copyright (c) 1998-2011 Marti Maria Saguer 2.71 +Copyright (c) 1998-2015 Marti Maria Saguer 2.72 2.73 Permission is hereby granted, free of charge, to any person obtaining a copy 2.74 of this software and associated documentation files (the "Software"), to deal
3.1 --- a/src/share/classes/com/sun/tools/javac/comp/Flow.java Mon Jul 06 12:28:15 2015 -0700 3.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java Thu Jul 09 23:05:33 2015 -0700 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 1999, 2014, 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 @@ -353,17 +353,17 @@ 3.11 this.tree = tree; 3.12 } 3.13 3.14 - void resolveJump(JCTree tree) { 3.15 + void resolveJump() { 3.16 //do nothing 3.17 } 3.18 } 3.19 3.20 - abstract void markDead(JCTree tree); 3.21 + abstract void markDead(); 3.22 3.23 /** Record an outward transfer of control. */ 3.24 - void recordExit(JCTree tree, P pe) { 3.25 + void recordExit(P pe) { 3.26 pendingExits.append(pe); 3.27 - markDead(tree); 3.28 + markDead(); 3.29 } 3.30 3.31 /** Resolve all jumps of this statement. */ 3.32 @@ -377,7 +377,7 @@ 3.33 P exit = exits.head; 3.34 if (exit.tree.hasTag(jk.treeTag) && 3.35 jk.getTarget(exit.tree) == tree) { 3.36 - exit.resolveJump(tree); 3.37 + exit.resolveJump(); 3.38 resolved = true; 3.39 } else { 3.40 pendingExits.append(exit); 3.41 @@ -420,7 +420,7 @@ 3.42 private boolean alive; 3.43 3.44 @Override 3.45 - void markDead(JCTree tree) { 3.46 + void markDead() { 3.47 alive = false; 3.48 } 3.49 3.50 @@ -464,7 +464,7 @@ 3.51 ListBuffer<PendingExit> pendingExitsPrev = pendingExits; 3.52 Lint lintPrev = lint; 3.53 3.54 - pendingExits = new ListBuffer<PendingExit>(); 3.55 + pendingExits = new ListBuffer<>(); 3.56 lint = lint.augment(tree.sym); 3.57 3.58 try { 3.59 @@ -513,7 +513,7 @@ 3.60 log.error(TreeInfo.diagEndPos(tree.body), "missing.ret.stmt"); 3.61 3.62 List<PendingExit> exits = pendingExits.toList(); 3.63 - pendingExits = new ListBuffer<PendingExit>(); 3.64 + pendingExits = new ListBuffer<>(); 3.65 while (exits.nonEmpty()) { 3.66 PendingExit exit = exits.head; 3.67 exits = exits.tail; 3.68 @@ -542,7 +542,7 @@ 3.69 3.70 public void visitDoLoop(JCDoWhileLoop tree) { 3.71 ListBuffer<PendingExit> prevPendingExits = pendingExits; 3.72 - pendingExits = new ListBuffer<PendingExit>(); 3.73 + pendingExits = new ListBuffer<>(); 3.74 scanStat(tree.body); 3.75 alive |= resolveContinues(tree); 3.76 scan(tree.cond); 3.77 @@ -552,7 +552,7 @@ 3.78 3.79 public void visitWhileLoop(JCWhileLoop tree) { 3.80 ListBuffer<PendingExit> prevPendingExits = pendingExits; 3.81 - pendingExits = new ListBuffer<PendingExit>(); 3.82 + pendingExits = new ListBuffer<>(); 3.83 scan(tree.cond); 3.84 alive = !tree.cond.type.isFalse(); 3.85 scanStat(tree.body); 3.86 @@ -564,7 +564,7 @@ 3.87 public void visitForLoop(JCForLoop tree) { 3.88 ListBuffer<PendingExit> prevPendingExits = pendingExits; 3.89 scanStats(tree.init); 3.90 - pendingExits = new ListBuffer<PendingExit>(); 3.91 + pendingExits = new ListBuffer<>(); 3.92 if (tree.cond != null) { 3.93 scan(tree.cond); 3.94 alive = !tree.cond.type.isFalse(); 3.95 @@ -582,7 +582,7 @@ 3.96 visitVarDef(tree.var); 3.97 ListBuffer<PendingExit> prevPendingExits = pendingExits; 3.98 scan(tree.expr); 3.99 - pendingExits = new ListBuffer<PendingExit>(); 3.100 + pendingExits = new ListBuffer<>(); 3.101 scanStat(tree.body); 3.102 alive |= resolveContinues(tree); 3.103 resolveBreaks(tree, prevPendingExits); 3.104 @@ -591,14 +591,14 @@ 3.105 3.106 public void visitLabelled(JCLabeledStatement tree) { 3.107 ListBuffer<PendingExit> prevPendingExits = pendingExits; 3.108 - pendingExits = new ListBuffer<PendingExit>(); 3.109 + pendingExits = new ListBuffer<>(); 3.110 scanStat(tree.body); 3.111 alive |= resolveBreaks(tree, prevPendingExits); 3.112 } 3.113 3.114 public void visitSwitch(JCSwitch tree) { 3.115 ListBuffer<PendingExit> prevPendingExits = pendingExits; 3.116 - pendingExits = new ListBuffer<PendingExit>(); 3.117 + pendingExits = new ListBuffer<>(); 3.118 scan(tree.selector); 3.119 boolean hasDefault = false; 3.120 for (List<JCCase> l = tree.cases; l.nonEmpty(); l = l.tail) { 3.121 @@ -625,7 +625,7 @@ 3.122 3.123 public void visitTry(JCTry tree) { 3.124 ListBuffer<PendingExit> prevPendingExits = pendingExits; 3.125 - pendingExits = new ListBuffer<PendingExit>(); 3.126 + pendingExits = new ListBuffer<>(); 3.127 for (JCTree resource : tree.resources) { 3.128 if (resource instanceof JCVariableDecl) { 3.129 JCVariableDecl vdecl = (JCVariableDecl) resource; 3.130 @@ -688,21 +688,21 @@ 3.131 } 3.132 3.133 public void visitBreak(JCBreak tree) { 3.134 - recordExit(tree, new PendingExit(tree)); 3.135 + recordExit(new PendingExit(tree)); 3.136 } 3.137 3.138 public void visitContinue(JCContinue tree) { 3.139 - recordExit(tree, new PendingExit(tree)); 3.140 + recordExit(new PendingExit(tree)); 3.141 } 3.142 3.143 public void visitReturn(JCReturn tree) { 3.144 scan(tree.expr); 3.145 - recordExit(tree, new PendingExit(tree)); 3.146 + recordExit(new PendingExit(tree)); 3.147 } 3.148 3.149 public void visitThrow(JCThrow tree) { 3.150 scan(tree.expr); 3.151 - markDead(tree); 3.152 + markDead(); 3.153 } 3.154 3.155 public void visitApply(JCMethodInvocation tree) { 3.156 @@ -756,7 +756,7 @@ 3.157 try { 3.158 attrEnv = env; 3.159 Flow.this.make = make; 3.160 - pendingExits = new ListBuffer<PendingExit>(); 3.161 + pendingExits = new ListBuffer<>(); 3.162 alive = true; 3.163 scan(tree); 3.164 } finally { 3.165 @@ -803,7 +803,7 @@ 3.166 } 3.167 3.168 @Override 3.169 - void markDead(JCTree tree) { 3.170 + void markDead() { 3.171 //do nothing 3.172 } 3.173 3.174 @@ -1201,16 +1201,16 @@ 3.175 } 3.176 3.177 public void visitBreak(JCBreak tree) { 3.178 - recordExit(tree, new FlowPendingExit(tree, null)); 3.179 + recordExit(new FlowPendingExit(tree, null)); 3.180 } 3.181 3.182 public void visitContinue(JCContinue tree) { 3.183 - recordExit(tree, new FlowPendingExit(tree, null)); 3.184 + recordExit(new FlowPendingExit(tree, null)); 3.185 } 3.186 3.187 public void visitReturn(JCReturn tree) { 3.188 scan(tree.expr); 3.189 - recordExit(tree, new FlowPendingExit(tree, null)); 3.190 + recordExit(new FlowPendingExit(tree, null)); 3.191 } 3.192 3.193 public void visitThrow(JCThrow tree) { 3.194 @@ -1228,7 +1228,7 @@ 3.195 else { 3.196 markThrown(tree, tree.expr.type); 3.197 } 3.198 - markDead(tree); 3.199 + markDead(); 3.200 } 3.201 3.202 public void visitApply(JCMethodInvocation tree) { 3.203 @@ -1379,12 +1379,10 @@ 3.204 * effectively-final local variables/parameters. 3.205 */ 3.206 3.207 - public abstract class AbstractAssignAnalyzer<P extends AbstractAssignAnalyzer<P>.AbstractAssignPendingExit> 3.208 - extends BaseAnalyzer<P> { 3.209 - 3.210 + public class AssignAnalyzer extends BaseAnalyzer<AssignAnalyzer.AssignPendingExit> { 3.211 /** The set of definitely assigned variables. 3.212 */ 3.213 - protected Bits inits; 3.214 + final Bits inits; 3.215 3.216 /** The set of definitely unassigned variables. 3.217 */ 3.218 @@ -1432,20 +1430,20 @@ 3.219 */ 3.220 Scope unrefdResources; 3.221 3.222 - /** Set when processing a loop body the second time for DU analysis. */ 3.223 + /** Modified when processing a loop body the second time for DU analysis. */ 3.224 FlowKind flowKind = FlowKind.NORMAL; 3.225 3.226 - /** The starting position of the analysed tree */ 3.227 + /** The starting position of the analyzed tree */ 3.228 int startPos; 3.229 3.230 - public class AbstractAssignPendingExit extends BaseAnalyzer.PendingExit { 3.231 + public class AssignPendingExit extends BaseAnalyzer.PendingExit { 3.232 3.233 final Bits inits; 3.234 final Bits uninits; 3.235 final Bits exit_inits = new Bits(true); 3.236 final Bits exit_uninits = new Bits(true); 3.237 3.238 - public AbstractAssignPendingExit(JCTree tree, final Bits inits, final Bits uninits) { 3.239 + public AssignPendingExit(JCTree tree, final Bits inits, final Bits uninits) { 3.240 super(tree); 3.241 this.inits = inits; 3.242 this.uninits = uninits; 3.243 @@ -1454,13 +1452,13 @@ 3.244 } 3.245 3.246 @Override 3.247 - public void resolveJump(JCTree tree) { 3.248 + void resolveJump() { 3.249 inits.andSet(exit_inits); 3.250 uninits.andSet(exit_uninits); 3.251 } 3.252 } 3.253 3.254 - public AbstractAssignAnalyzer() { 3.255 + public AssignAnalyzer() { 3.256 this.inits = new Bits(); 3.257 uninits = new Bits(); 3.258 uninitsTry = new Bits(); 3.259 @@ -1473,7 +1471,7 @@ 3.260 private boolean isInitialConstructor = false; 3.261 3.262 @Override 3.263 - protected void markDead(JCTree tree) { 3.264 + void markDead() { 3.265 if (!isInitialConstructor) { 3.266 inits.inclRange(returnadr, nextadr); 3.267 } else { 3.268 @@ -1520,35 +1518,41 @@ 3.269 } 3.270 sym.adr = nextadr; 3.271 vardecls[nextadr] = varDecl; 3.272 - exclVarFromInits(varDecl, nextadr); 3.273 + inits.excl(nextadr); 3.274 uninits.incl(nextadr); 3.275 nextadr++; 3.276 } 3.277 3.278 - protected void exclVarFromInits(JCTree tree, int adr) { 3.279 - inits.excl(adr); 3.280 - } 3.281 - 3.282 - protected void assignToInits(JCTree tree, Bits bits) { 3.283 - inits.assign(bits); 3.284 - } 3.285 - 3.286 - protected void andSetInits(JCTree tree, Bits bits) { 3.287 - inits.andSet(bits); 3.288 - } 3.289 - 3.290 - protected void orSetInits(JCTree tree, Bits bits) { 3.291 - inits.orSet(bits); 3.292 - } 3.293 - 3.294 /** Record an initialization of a trackable variable. 3.295 */ 3.296 void letInit(DiagnosticPosition pos, VarSymbol sym) { 3.297 if (sym.adr >= firstadr && trackable(sym)) { 3.298 - if (uninits.isMember(sym.adr)) { 3.299 - uninit(sym); 3.300 + if ((sym.flags() & EFFECTIVELY_FINAL) != 0) { 3.301 + if (!uninits.isMember(sym.adr)) { 3.302 + //assignment targeting an effectively final variable 3.303 + //makes the variable lose its status of effectively final 3.304 + //if the variable is _not_ definitively unassigned 3.305 + sym.flags_field &= ~EFFECTIVELY_FINAL; 3.306 + } else { 3.307 + uninit(sym); 3.308 + } 3.309 + } else if ((sym.flags() & FINAL) != 0) { 3.310 + if ((sym.flags() & PARAMETER) != 0) { 3.311 + if ((sym.flags() & UNION) != 0) { //multi-catch parameter 3.312 + log.error(pos, "multicatch.parameter.may.not.be.assigned", sym); 3.313 + } else { 3.314 + log.error(pos, "final.parameter.may.not.be.assigned", 3.315 + sym); 3.316 + } 3.317 + } else if (!uninits.isMember(sym.adr)) { 3.318 + log.error(pos, flowKind.errKey, sym); 3.319 + } else { 3.320 + uninit(sym); 3.321 + } 3.322 } 3.323 inits.incl(sym.adr); 3.324 + } else if ((sym.flags() & FINAL) != 0) { 3.325 + log.error(pos, "var.might.already.be.assigned", sym); 3.326 } 3.327 } 3.328 //where 3.329 @@ -1583,7 +1587,14 @@ 3.330 checkInit(pos, sym, "var.might.not.have.been.initialized"); 3.331 } 3.332 3.333 - void checkInit(DiagnosticPosition pos, VarSymbol sym, String errkey) {} 3.334 + void checkInit(DiagnosticPosition pos, VarSymbol sym, String errkey) { 3.335 + if ((sym.adr >= firstadr || sym.owner.kind != TYP) && 3.336 + trackable(sym) && 3.337 + !inits.isMember(sym.adr)) { 3.338 + log.error(pos, errkey, sym); 3.339 + inits.incl(sym.adr); 3.340 + } 3.341 + } 3.342 3.343 /** Utility method to reset several Bits instances. 3.344 */ 3.345 @@ -1607,7 +1618,7 @@ 3.346 3.347 /** Merge (intersect) inits/uninits from WhenTrue/WhenFalse sets. 3.348 */ 3.349 - protected void merge(JCTree tree) { 3.350 + protected void merge() { 3.351 inits.assign(initsWhenFalse.andSet(initsWhenTrue)); 3.352 uninits.assign(uninitsWhenFalse.andSet(uninitsWhenTrue)); 3.353 } 3.354 @@ -1623,7 +1634,7 @@ 3.355 if (tree != null) { 3.356 scan(tree); 3.357 if (inits.isReset()) { 3.358 - merge(tree); 3.359 + merge(); 3.360 } 3.361 } 3.362 } 3.363 @@ -1641,7 +1652,7 @@ 3.364 */ 3.365 void scanCond(JCTree tree) { 3.366 if (tree.type.isFalse()) { 3.367 - if (inits.isReset()) merge(tree); 3.368 + if (inits.isReset()) merge(); 3.369 initsWhenTrue.assign(inits); 3.370 initsWhenTrue.inclRange(firstadr, nextadr); 3.371 uninitsWhenTrue.assign(uninits); 3.372 @@ -1649,7 +1660,7 @@ 3.373 initsWhenFalse.assign(inits); 3.374 uninitsWhenFalse.assign(uninits); 3.375 } else if (tree.type.isTrue()) { 3.376 - if (inits.isReset()) merge(tree); 3.377 + if (inits.isReset()) merge(); 3.378 initsWhenFalse.assign(inits); 3.379 initsWhenFalse.inclRange(firstadr, nextadr); 3.380 uninitsWhenFalse.assign(uninits); 3.381 @@ -1668,173 +1679,202 @@ 3.382 3.383 /* ------------ Visitor methods for various sorts of trees -------------*/ 3.384 3.385 - @Override 3.386 public void visitClassDef(JCClassDecl tree) { 3.387 if (tree.sym == null) { 3.388 return; 3.389 } 3.390 3.391 - JCClassDecl classDefPrev = classDef; 3.392 - int firstadrPrev = firstadr; 3.393 - int nextadrPrev = nextadr; 3.394 - ListBuffer<P> pendingExitsPrev = pendingExits; 3.395 + Lint lintPrev = lint; 3.396 + lint = lint.augment(tree.sym); 3.397 + try { 3.398 + if (tree.sym == null) { 3.399 + return; 3.400 + } 3.401 3.402 - pendingExits = new ListBuffer<P>(); 3.403 - if (tree.name != names.empty) { 3.404 - firstadr = nextadr; 3.405 - } 3.406 - classDef = tree; 3.407 - try { 3.408 - // define all the static fields 3.409 - for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) { 3.410 - if (l.head.hasTag(VARDEF)) { 3.411 - JCVariableDecl def = (JCVariableDecl)l.head; 3.412 - if ((def.mods.flags & STATIC) != 0) { 3.413 - VarSymbol sym = def.sym; 3.414 - if (trackable(sym)) { 3.415 - newVar(def); 3.416 + JCClassDecl classDefPrev = classDef; 3.417 + int firstadrPrev = firstadr; 3.418 + int nextadrPrev = nextadr; 3.419 + ListBuffer<AssignPendingExit> pendingExitsPrev = pendingExits; 3.420 + 3.421 + pendingExits = new ListBuffer<>(); 3.422 + if (tree.name != names.empty) { 3.423 + firstadr = nextadr; 3.424 + } 3.425 + classDef = tree; 3.426 + try { 3.427 + // define all the static fields 3.428 + for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) { 3.429 + if (l.head.hasTag(VARDEF)) { 3.430 + JCVariableDecl def = (JCVariableDecl)l.head; 3.431 + if ((def.mods.flags & STATIC) != 0) { 3.432 + VarSymbol sym = def.sym; 3.433 + if (trackable(sym)) { 3.434 + newVar(def); 3.435 + } 3.436 } 3.437 } 3.438 } 3.439 - } 3.440 3.441 - // process all the static initializers 3.442 - for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) { 3.443 - if (!l.head.hasTag(METHODDEF) && 3.444 - (TreeInfo.flags(l.head) & STATIC) != 0) { 3.445 - scan(l.head); 3.446 + // process all the static initializers 3.447 + for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) { 3.448 + if (!l.head.hasTag(METHODDEF) && 3.449 + (TreeInfo.flags(l.head) & STATIC) != 0) { 3.450 + scan(l.head); 3.451 + } 3.452 } 3.453 - } 3.454 3.455 - // define all the instance fields 3.456 - for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) { 3.457 - if (l.head.hasTag(VARDEF)) { 3.458 - JCVariableDecl def = (JCVariableDecl)l.head; 3.459 - if ((def.mods.flags & STATIC) == 0) { 3.460 - VarSymbol sym = def.sym; 3.461 - if (trackable(sym)) { 3.462 - newVar(def); 3.463 + // define all the instance fields 3.464 + for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) { 3.465 + if (l.head.hasTag(VARDEF)) { 3.466 + JCVariableDecl def = (JCVariableDecl)l.head; 3.467 + if ((def.mods.flags & STATIC) == 0) { 3.468 + VarSymbol sym = def.sym; 3.469 + if (trackable(sym)) { 3.470 + newVar(def); 3.471 + } 3.472 } 3.473 } 3.474 } 3.475 - } 3.476 + // process all the instance initializers 3.477 + for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) { 3.478 + if (!l.head.hasTag(METHODDEF) && 3.479 + (TreeInfo.flags(l.head) & STATIC) == 0) { 3.480 + scan(l.head); 3.481 + } 3.482 + } 3.483 3.484 - // process all the instance initializers 3.485 - for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) { 3.486 - if (!l.head.hasTag(METHODDEF) && 3.487 - (TreeInfo.flags(l.head) & STATIC) == 0) { 3.488 - scan(l.head); 3.489 + // process all the methods 3.490 + for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) { 3.491 + if (l.head.hasTag(METHODDEF)) { 3.492 + scan(l.head); 3.493 + } 3.494 } 3.495 - } 3.496 - 3.497 - // process all the methods 3.498 - for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) { 3.499 - if (l.head.hasTag(METHODDEF)) { 3.500 - scan(l.head); 3.501 - } 3.502 + } finally { 3.503 + pendingExits = pendingExitsPrev; 3.504 + nextadr = nextadrPrev; 3.505 + firstadr = firstadrPrev; 3.506 + classDef = classDefPrev; 3.507 } 3.508 } finally { 3.509 - pendingExits = pendingExitsPrev; 3.510 - nextadr = nextadrPrev; 3.511 - firstadr = firstadrPrev; 3.512 - classDef = classDefPrev; 3.513 + lint = lintPrev; 3.514 } 3.515 } 3.516 3.517 - @Override 3.518 public void visitMethodDef(JCMethodDecl tree) { 3.519 if (tree.body == null) { 3.520 return; 3.521 } 3.522 - /* Ignore synthetic methods, except for translated lambda methods. 3.523 + 3.524 + /* MemberEnter can generate synthetic methods ignore them 3.525 */ 3.526 - if ((tree.sym.flags() & (SYNTHETIC | LAMBDA_METHOD)) == SYNTHETIC) { 3.527 + if ((tree.sym.flags() & SYNTHETIC) != 0) { 3.528 return; 3.529 } 3.530 3.531 - final Bits initsPrev = new Bits(inits); 3.532 - final Bits uninitsPrev = new Bits(uninits); 3.533 - int nextadrPrev = nextadr; 3.534 - int firstadrPrev = firstadr; 3.535 - int returnadrPrev = returnadr; 3.536 + Lint lintPrev = lint; 3.537 + lint = lint.augment(tree.sym); 3.538 + try { 3.539 + if (tree.body == null) { 3.540 + return; 3.541 + } 3.542 + /* Ignore synthetic methods, except for translated lambda methods. 3.543 + */ 3.544 + if ((tree.sym.flags() & (SYNTHETIC | LAMBDA_METHOD)) == SYNTHETIC) { 3.545 + return; 3.546 + } 3.547 3.548 - Assert.check(pendingExits.isEmpty()); 3.549 - boolean lastInitialConstructor = isInitialConstructor; 3.550 - try { 3.551 - isInitialConstructor = TreeInfo.isInitialConstructor(tree); 3.552 + final Bits initsPrev = new Bits(inits); 3.553 + final Bits uninitsPrev = new Bits(uninits); 3.554 + int nextadrPrev = nextadr; 3.555 + int firstadrPrev = firstadr; 3.556 + int returnadrPrev = returnadr; 3.557 3.558 - if (!isInitialConstructor) { 3.559 - firstadr = nextadr; 3.560 - } 3.561 - for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) { 3.562 - JCVariableDecl def = l.head; 3.563 - scan(def); 3.564 - Assert.check((def.sym.flags() & PARAMETER) != 0, "Method parameter without PARAMETER flag"); 3.565 - /* If we are executing the code from Gen, then there can be 3.566 - * synthetic or mandated variables, ignore them. 3.567 - */ 3.568 - initParam(def); 3.569 - } 3.570 - // else we are in an instance initializer block; 3.571 - // leave caught unchanged. 3.572 - scan(tree.body); 3.573 + Assert.check(pendingExits.isEmpty()); 3.574 + boolean lastInitialConstructor = isInitialConstructor; 3.575 + try { 3.576 + isInitialConstructor = TreeInfo.isInitialConstructor(tree); 3.577 3.578 - if (isInitialConstructor) { 3.579 - boolean isSynthesized = (tree.sym.flags() & 3.580 - GENERATEDCONSTR) != 0; 3.581 - for (int i = firstadr; i < nextadr; i++) { 3.582 - JCVariableDecl vardecl = vardecls[i]; 3.583 - VarSymbol var = vardecl.sym; 3.584 - if (var.owner == classDef.sym) { 3.585 - // choose the diagnostic position based on whether 3.586 - // the ctor is default(synthesized) or not 3.587 - if (isSynthesized) { 3.588 - checkInit(TreeInfo.diagnosticPositionFor(var, vardecl), 3.589 - var, "var.not.initialized.in.default.constructor"); 3.590 - } else { 3.591 - checkInit(TreeInfo.diagEndPos(tree.body), var); 3.592 + if (!isInitialConstructor) { 3.593 + firstadr = nextadr; 3.594 + } 3.595 + for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) { 3.596 + JCVariableDecl def = l.head; 3.597 + scan(def); 3.598 + Assert.check((def.sym.flags() & PARAMETER) != 0, "Method parameter without PARAMETER flag"); 3.599 + /* If we are executing the code from Gen, then there can be 3.600 + * synthetic or mandated variables, ignore them. 3.601 + */ 3.602 + initParam(def); 3.603 + } 3.604 + // else we are in an instance initializer block; 3.605 + // leave caught unchanged. 3.606 + scan(tree.body); 3.607 + 3.608 + if (isInitialConstructor) { 3.609 + boolean isSynthesized = (tree.sym.flags() & 3.610 + GENERATEDCONSTR) != 0; 3.611 + for (int i = firstadr; i < nextadr; i++) { 3.612 + JCVariableDecl vardecl = vardecls[i]; 3.613 + VarSymbol var = vardecl.sym; 3.614 + if (var.owner == classDef.sym) { 3.615 + // choose the diagnostic position based on whether 3.616 + // the ctor is default(synthesized) or not 3.617 + if (isSynthesized) { 3.618 + checkInit(TreeInfo.diagnosticPositionFor(var, vardecl), 3.619 + var, "var.not.initialized.in.default.constructor"); 3.620 + } else { 3.621 + checkInit(TreeInfo.diagEndPos(tree.body), var); 3.622 + } 3.623 } 3.624 } 3.625 } 3.626 - } 3.627 - List<P> exits = pendingExits.toList(); 3.628 - pendingExits = new ListBuffer<>(); 3.629 - while (exits.nonEmpty()) { 3.630 - P exit = exits.head; 3.631 - exits = exits.tail; 3.632 - Assert.check(exit.tree.hasTag(RETURN), exit.tree); 3.633 - if (isInitialConstructor) { 3.634 - assignToInits(exit.tree, exit.exit_inits); 3.635 - for (int i = firstadr; i < nextadr; i++) { 3.636 - checkInit(exit.tree.pos(), vardecls[i].sym); 3.637 + List<AssignPendingExit> exits = pendingExits.toList(); 3.638 + pendingExits = new ListBuffer<>(); 3.639 + while (exits.nonEmpty()) { 3.640 + AssignPendingExit exit = exits.head; 3.641 + exits = exits.tail; 3.642 + Assert.check(exit.tree.hasTag(RETURN), exit.tree); 3.643 + if (isInitialConstructor) { 3.644 + inits.assign(exit.exit_inits); 3.645 + for (int i = firstadr; i < nextadr; i++) { 3.646 + checkInit(exit.tree.pos(), vardecls[i].sym); 3.647 + } 3.648 } 3.649 } 3.650 + } finally { 3.651 + inits.assign(initsPrev); 3.652 + uninits.assign(uninitsPrev); 3.653 + nextadr = nextadrPrev; 3.654 + firstadr = firstadrPrev; 3.655 + returnadr = returnadrPrev; 3.656 + isInitialConstructor = lastInitialConstructor; 3.657 } 3.658 } finally { 3.659 - assignToInits(tree, initsPrev); 3.660 - uninits.assign(uninitsPrev); 3.661 - nextadr = nextadrPrev; 3.662 - firstadr = firstadrPrev; 3.663 - returnadr = returnadrPrev; 3.664 - isInitialConstructor = lastInitialConstructor; 3.665 + lint = lintPrev; 3.666 } 3.667 } 3.668 3.669 protected void initParam(JCVariableDecl def) { 3.670 inits.incl(def.sym.adr); 3.671 uninits.excl(def.sym.adr); 3.672 - } 3.673 + } 3.674 3.675 public void visitVarDef(JCVariableDecl tree) { 3.676 - boolean track = trackable(tree.sym); 3.677 - if (track && tree.sym.owner.kind == MTH) { 3.678 - newVar(tree); 3.679 - } 3.680 - if (tree.init != null) { 3.681 - scanExpr(tree.init); 3.682 - if (track) { 3.683 - letInit(tree.pos(), tree.sym); 3.684 + Lint lintPrev = lint; 3.685 + lint = lint.augment(tree.sym); 3.686 + try{ 3.687 + boolean track = trackable(tree.sym); 3.688 + if (track && tree.sym.owner.kind == MTH) { 3.689 + newVar(tree); 3.690 } 3.691 + if (tree.init != null) { 3.692 + scanExpr(tree.init); 3.693 + if (track) { 3.694 + letInit(tree.pos(), tree.sym); 3.695 + } 3.696 + } 3.697 + } finally { 3.698 + lint = lintPrev; 3.699 } 3.700 } 3.701 3.702 @@ -1844,18 +1884,14 @@ 3.703 nextadr = nextadrPrev; 3.704 } 3.705 3.706 - int getLogNumberOfErrors() { 3.707 - return 0; 3.708 - } 3.709 - 3.710 public void visitDoLoop(JCDoWhileLoop tree) { 3.711 - ListBuffer<P> prevPendingExits = pendingExits; 3.712 + ListBuffer<AssignPendingExit> prevPendingExits = pendingExits; 3.713 FlowKind prevFlowKind = flowKind; 3.714 flowKind = FlowKind.NORMAL; 3.715 final Bits initsSkip = new Bits(true); 3.716 final Bits uninitsSkip = new Bits(true); 3.717 - pendingExits = new ListBuffer<P>(); 3.718 - int prevErrors = getLogNumberOfErrors(); 3.719 + pendingExits = new ListBuffer<>(); 3.720 + int prevErrors = log.nerrors; 3.721 do { 3.722 final Bits uninitsEntry = new Bits(uninits); 3.723 uninitsEntry.excludeFrom(nextadr); 3.724 @@ -1866,28 +1902,28 @@ 3.725 initsSkip.assign(initsWhenFalse); 3.726 uninitsSkip.assign(uninitsWhenFalse); 3.727 } 3.728 - if (getLogNumberOfErrors() != prevErrors || 3.729 + if (log.nerrors != prevErrors || 3.730 flowKind.isFinal() || 3.731 new Bits(uninitsEntry).diffSet(uninitsWhenTrue).nextBit(firstadr)==-1) 3.732 break; 3.733 - assignToInits(tree.cond, initsWhenTrue); 3.734 + inits.assign(initsWhenTrue); 3.735 uninits.assign(uninitsEntry.andSet(uninitsWhenTrue)); 3.736 flowKind = FlowKind.SPECULATIVE_LOOP; 3.737 } while (true); 3.738 flowKind = prevFlowKind; 3.739 - assignToInits(tree, initsSkip); 3.740 + inits.assign(initsSkip); 3.741 uninits.assign(uninitsSkip); 3.742 resolveBreaks(tree, prevPendingExits); 3.743 } 3.744 3.745 public void visitWhileLoop(JCWhileLoop tree) { 3.746 - ListBuffer<P> prevPendingExits = pendingExits; 3.747 + ListBuffer<AssignPendingExit> prevPendingExits = pendingExits; 3.748 FlowKind prevFlowKind = flowKind; 3.749 flowKind = FlowKind.NORMAL; 3.750 final Bits initsSkip = new Bits(true); 3.751 final Bits uninitsSkip = new Bits(true); 3.752 pendingExits = new ListBuffer<>(); 3.753 - int prevErrors = getLogNumberOfErrors(); 3.754 + int prevErrors = log.nerrors; 3.755 final Bits uninitsEntry = new Bits(uninits); 3.756 uninitsEntry.excludeFrom(nextadr); 3.757 do { 3.758 @@ -1896,11 +1932,11 @@ 3.759 initsSkip.assign(initsWhenFalse) ; 3.760 uninitsSkip.assign(uninitsWhenFalse); 3.761 } 3.762 - assignToInits(tree, initsWhenTrue); 3.763 + inits.assign(initsWhenTrue); 3.764 uninits.assign(uninitsWhenTrue); 3.765 scan(tree.body); 3.766 resolveContinues(tree); 3.767 - if (getLogNumberOfErrors() != prevErrors || 3.768 + if (log.nerrors != prevErrors || 3.769 flowKind.isFinal() || 3.770 new Bits(uninitsEntry).diffSet(uninits).nextBit(firstadr) == -1) { 3.771 break; 3.772 @@ -1911,21 +1947,21 @@ 3.773 flowKind = prevFlowKind; 3.774 //a variable is DA/DU after the while statement, if it's DA/DU assuming the 3.775 //branch is not taken AND if it's DA/DU before any break statement 3.776 - assignToInits(tree.body, initsSkip); 3.777 + inits.assign(initsSkip); 3.778 uninits.assign(uninitsSkip); 3.779 resolveBreaks(tree, prevPendingExits); 3.780 } 3.781 3.782 public void visitForLoop(JCForLoop tree) { 3.783 - ListBuffer<P> prevPendingExits = pendingExits; 3.784 + ListBuffer<AssignPendingExit> prevPendingExits = pendingExits; 3.785 FlowKind prevFlowKind = flowKind; 3.786 flowKind = FlowKind.NORMAL; 3.787 int nextadrPrev = nextadr; 3.788 scan(tree.init); 3.789 final Bits initsSkip = new Bits(true); 3.790 final Bits uninitsSkip = new Bits(true); 3.791 - pendingExits = new ListBuffer<P>(); 3.792 - int prevErrors = getLogNumberOfErrors(); 3.793 + pendingExits = new ListBuffer<>(); 3.794 + int prevErrors = log.nerrors; 3.795 do { 3.796 final Bits uninitsEntry = new Bits(uninits); 3.797 uninitsEntry.excludeFrom(nextadr); 3.798 @@ -1935,7 +1971,7 @@ 3.799 initsSkip.assign(initsWhenFalse); 3.800 uninitsSkip.assign(uninitsWhenFalse); 3.801 } 3.802 - assignToInits(tree.body, initsWhenTrue); 3.803 + inits.assign(initsWhenTrue); 3.804 uninits.assign(uninitsWhenTrue); 3.805 } else if (!flowKind.isFinal()) { 3.806 initsSkip.assign(inits); 3.807 @@ -1946,7 +1982,7 @@ 3.808 scan(tree.body); 3.809 resolveContinues(tree); 3.810 scan(tree.step); 3.811 - if (getLogNumberOfErrors() != prevErrors || 3.812 + if (log.nerrors != prevErrors || 3.813 flowKind.isFinal() || 3.814 new Bits(uninitsEntry).diffSet(uninits).nextBit(firstadr) == -1) 3.815 break; 3.816 @@ -1956,7 +1992,7 @@ 3.817 flowKind = prevFlowKind; 3.818 //a variable is DA/DU after a for loop, if it's DA/DU assuming the 3.819 //branch is not taken AND if it's DA/DU before any break statement 3.820 - assignToInits(tree.body, initsSkip); 3.821 + inits.assign(initsSkip); 3.822 uninits.assign(uninitsSkip); 3.823 resolveBreaks(tree, prevPendingExits); 3.824 nextadr = nextadrPrev; 3.825 @@ -1965,7 +2001,7 @@ 3.826 public void visitForeachLoop(JCEnhancedForLoop tree) { 3.827 visitVarDef(tree.var); 3.828 3.829 - ListBuffer<P> prevPendingExits = pendingExits; 3.830 + ListBuffer<AssignPendingExit> prevPendingExits = pendingExits; 3.831 FlowKind prevFlowKind = flowKind; 3.832 flowKind = FlowKind.NORMAL; 3.833 int nextadrPrev = nextadr; 3.834 @@ -1974,14 +2010,14 @@ 3.835 final Bits uninitsStart = new Bits(uninits); 3.836 3.837 letInit(tree.pos(), tree.var.sym); 3.838 - pendingExits = new ListBuffer<P>(); 3.839 - int prevErrors = getLogNumberOfErrors(); 3.840 + pendingExits = new ListBuffer<>(); 3.841 + int prevErrors = log.nerrors; 3.842 do { 3.843 final Bits uninitsEntry = new Bits(uninits); 3.844 uninitsEntry.excludeFrom(nextadr); 3.845 scan(tree.body); 3.846 resolveContinues(tree); 3.847 - if (getLogNumberOfErrors() != prevErrors || 3.848 + if (log.nerrors != prevErrors || 3.849 flowKind.isFinal() || 3.850 new Bits(uninitsEntry).diffSet(uninits).nextBit(firstadr) == -1) 3.851 break; 3.852 @@ -1989,21 +2025,21 @@ 3.853 flowKind = FlowKind.SPECULATIVE_LOOP; 3.854 } while (true); 3.855 flowKind = prevFlowKind; 3.856 - assignToInits(tree.body, initsStart); 3.857 + inits.assign(initsStart); 3.858 uninits.assign(uninitsStart.andSet(uninits)); 3.859 resolveBreaks(tree, prevPendingExits); 3.860 nextadr = nextadrPrev; 3.861 } 3.862 3.863 public void visitLabelled(JCLabeledStatement tree) { 3.864 - ListBuffer<P> prevPendingExits = pendingExits; 3.865 - pendingExits = new ListBuffer<P>(); 3.866 + ListBuffer<AssignPendingExit> prevPendingExits = pendingExits; 3.867 + pendingExits = new ListBuffer<>(); 3.868 scan(tree.body); 3.869 resolveBreaks(tree, prevPendingExits); 3.870 } 3.871 3.872 public void visitSwitch(JCSwitch tree) { 3.873 - ListBuffer<P> prevPendingExits = pendingExits; 3.874 + ListBuffer<AssignPendingExit> prevPendingExits = pendingExits; 3.875 pendingExits = new ListBuffer<>(); 3.876 int nextadrPrev = nextadr; 3.877 scanExpr(tree.selector); 3.878 @@ -2011,7 +2047,7 @@ 3.879 final Bits uninitsSwitch = new Bits(uninits); 3.880 boolean hasDefault = false; 3.881 for (List<JCCase> l = tree.cases; l.nonEmpty(); l = l.tail) { 3.882 - assignToInits(l.head, initsSwitch); 3.883 + inits.assign(initsSwitch); 3.884 uninits.assign(uninits.andSet(uninitsSwitch)); 3.885 JCCase c = l.head; 3.886 if (c.pat == null) { 3.887 @@ -2020,19 +2056,19 @@ 3.888 scanExpr(c.pat); 3.889 } 3.890 if (hasDefault) { 3.891 - assignToInits(null, initsSwitch); 3.892 + inits.assign(initsSwitch); 3.893 uninits.assign(uninits.andSet(uninitsSwitch)); 3.894 } 3.895 scan(c.stats); 3.896 addVars(c.stats, initsSwitch, uninitsSwitch); 3.897 if (!hasDefault) { 3.898 - assignToInits(l.head.stats.last(), initsSwitch); 3.899 + inits.assign(initsSwitch); 3.900 uninits.assign(uninits.andSet(uninitsSwitch)); 3.901 } 3.902 // Warn about fall-through if lint switch fallthrough enabled. 3.903 } 3.904 if (!hasDefault) { 3.905 - andSetInits(null, initsSwitch); 3.906 + inits.andSet(initsSwitch); 3.907 } 3.908 resolveBreaks(tree, prevPendingExits); 3.909 nextadr = nextadrPrev; 3.910 @@ -2051,16 +2087,10 @@ 3.911 } 3.912 } 3.913 3.914 - boolean isEnabled(Lint.LintCategory lc) { 3.915 - return false; 3.916 - } 3.917 - 3.918 - void reportWarning(Lint.LintCategory lc, DiagnosticPosition pos, String key, Object ... args) {} 3.919 - 3.920 public void visitTry(JCTry tree) { 3.921 ListBuffer<JCVariableDecl> resourceVarDecls = new ListBuffer<>(); 3.922 final Bits uninitsTryPrev = new Bits(uninitsTry); 3.923 - ListBuffer<P> prevPendingExits = pendingExits; 3.924 + ListBuffer<AssignPendingExit> prevPendingExits = pendingExits; 3.925 pendingExits = new ListBuffer<>(); 3.926 final Bits initsTry = new Bits(inits); 3.927 uninitsTry.assign(uninits); 3.928 @@ -2083,10 +2113,10 @@ 3.929 int nextadrCatch = nextadr; 3.930 3.931 if (!resourceVarDecls.isEmpty() && 3.932 - isEnabled(Lint.LintCategory.TRY)) { 3.933 + lint.isEnabled(Lint.LintCategory.TRY)) { 3.934 for (JCVariableDecl resVar : resourceVarDecls) { 3.935 if (unrefdResources.includes(resVar.sym)) { 3.936 - reportWarning(Lint.LintCategory.TRY, resVar.pos(), 3.937 + log.warning(Lint.LintCategory.TRY, resVar.pos(), 3.938 "try.resource.not.referenced", resVar.sym); 3.939 unrefdResources.remove(resVar.sym); 3.940 } 3.941 @@ -2102,7 +2132,7 @@ 3.942 3.943 for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) { 3.944 JCVariableDecl param = l.head.param; 3.945 - assignToInits(tree.body, initsCatchPrev); 3.946 + inits.assign(initsCatchPrev); 3.947 uninits.assign(uninitsCatchPrev); 3.948 scan(param); 3.949 /* If this is a TWR and we are executing the code from Gen, 3.950 @@ -2115,9 +2145,9 @@ 3.951 nextadr = nextadrCatch; 3.952 } 3.953 if (tree.finalizer != null) { 3.954 - assignToInits(tree.finalizer, initsTry); 3.955 + inits.assign(initsTry); 3.956 uninits.assign(uninitsTry); 3.957 - ListBuffer<P> exits = pendingExits; 3.958 + ListBuffer<AssignPendingExit> exits = pendingExits; 3.959 pendingExits = prevPendingExits; 3.960 scan(tree.finalizer); 3.961 if (!tree.finallyCanCompleteNormally) { 3.962 @@ -2127,19 +2157,19 @@ 3.963 // FIX: this doesn't preserve source order of exits in catch 3.964 // versus finally! 3.965 while (exits.nonEmpty()) { 3.966 - P exit = exits.next(); 3.967 + AssignPendingExit exit = exits.next(); 3.968 if (exit.exit_inits != null) { 3.969 exit.exit_inits.orSet(inits); 3.970 exit.exit_uninits.andSet(uninits); 3.971 } 3.972 pendingExits.append(exit); 3.973 } 3.974 - orSetInits(tree, initsEnd); 3.975 + inits.orSet(initsEnd); 3.976 } 3.977 } else { 3.978 - assignToInits(tree, initsEnd); 3.979 + inits.assign(initsEnd); 3.980 uninits.assign(uninitsEnd); 3.981 - ListBuffer<P> exits = pendingExits; 3.982 + ListBuffer<AssignPendingExit> exits = pendingExits; 3.983 pendingExits = prevPendingExits; 3.984 while (exits.nonEmpty()) pendingExits.append(exits.next()); 3.985 } 3.986 @@ -2150,7 +2180,7 @@ 3.987 scanCond(tree.cond); 3.988 final Bits initsBeforeElse = new Bits(initsWhenFalse); 3.989 final Bits uninitsBeforeElse = new Bits(uninitsWhenFalse); 3.990 - assignToInits(tree.cond, initsWhenTrue); 3.991 + inits.assign(initsWhenTrue); 3.992 uninits.assign(uninitsWhenTrue); 3.993 if (tree.truepart.type.hasTag(BOOLEAN) && 3.994 tree.falsepart.type.hasTag(BOOLEAN)) { 3.995 @@ -2163,7 +2193,7 @@ 3.996 final Bits initsAfterThenWhenFalse = new Bits(initsWhenFalse); 3.997 final Bits uninitsAfterThenWhenTrue = new Bits(uninitsWhenTrue); 3.998 final Bits uninitsAfterThenWhenFalse = new Bits(uninitsWhenFalse); 3.999 - assignToInits(tree.truepart, initsBeforeElse); 3.1000 + inits.assign(initsBeforeElse); 3.1001 uninits.assign(uninitsBeforeElse); 3.1002 scanCond(tree.falsepart); 3.1003 initsWhenTrue.andSet(initsAfterThenWhenTrue); 3.1004 @@ -2174,10 +2204,10 @@ 3.1005 scanExpr(tree.truepart); 3.1006 final Bits initsAfterThen = new Bits(inits); 3.1007 final Bits uninitsAfterThen = new Bits(uninits); 3.1008 - assignToInits(tree.truepart, initsBeforeElse); 3.1009 + inits.assign(initsBeforeElse); 3.1010 uninits.assign(uninitsBeforeElse); 3.1011 scanExpr(tree.falsepart); 3.1012 - andSetInits(tree.falsepart, initsAfterThen); 3.1013 + inits.andSet(initsAfterThen); 3.1014 uninits.andSet(uninitsAfterThen); 3.1015 } 3.1016 } 3.1017 @@ -2186,46 +2216,42 @@ 3.1018 scanCond(tree.cond); 3.1019 final Bits initsBeforeElse = new Bits(initsWhenFalse); 3.1020 final Bits uninitsBeforeElse = new Bits(uninitsWhenFalse); 3.1021 - assignToInits(tree.cond, initsWhenTrue); 3.1022 + inits.assign(initsWhenTrue); 3.1023 uninits.assign(uninitsWhenTrue); 3.1024 scan(tree.thenpart); 3.1025 if (tree.elsepart != null) { 3.1026 final Bits initsAfterThen = new Bits(inits); 3.1027 final Bits uninitsAfterThen = new Bits(uninits); 3.1028 - assignToInits(tree.thenpart, initsBeforeElse); 3.1029 + inits.assign(initsBeforeElse); 3.1030 uninits.assign(uninitsBeforeElse); 3.1031 scan(tree.elsepart); 3.1032 - andSetInits(tree.elsepart, initsAfterThen); 3.1033 + inits.andSet(initsAfterThen); 3.1034 uninits.andSet(uninitsAfterThen); 3.1035 } else { 3.1036 - andSetInits(tree.thenpart, initsBeforeElse); 3.1037 + inits.andSet(initsBeforeElse); 3.1038 uninits.andSet(uninitsBeforeElse); 3.1039 } 3.1040 } 3.1041 3.1042 - protected P createNewPendingExit(JCTree tree, Bits inits, Bits uninits) { 3.1043 - return null; 3.1044 - } 3.1045 - 3.1046 @Override 3.1047 public void visitBreak(JCBreak tree) { 3.1048 - recordExit(tree, createNewPendingExit(tree, inits, uninits)); 3.1049 + recordExit(new AssignPendingExit(tree, inits, uninits)); 3.1050 } 3.1051 3.1052 @Override 3.1053 public void visitContinue(JCContinue tree) { 3.1054 - recordExit(tree, createNewPendingExit(tree, inits, uninits)); 3.1055 + recordExit(new AssignPendingExit(tree, inits, uninits)); 3.1056 } 3.1057 3.1058 @Override 3.1059 public void visitReturn(JCReturn tree) { 3.1060 scanExpr(tree.expr); 3.1061 - recordExit(tree, createNewPendingExit(tree, inits, uninits)); 3.1062 + recordExit(new AssignPendingExit(tree, inits, uninits)); 3.1063 } 3.1064 3.1065 public void visitThrow(JCThrow tree) { 3.1066 scanExpr(tree.expr); 3.1067 - markDead(tree.expr); 3.1068 + markDead(); 3.1069 } 3.1070 3.1071 public void visitApply(JCMethodInvocation tree) { 3.1072 @@ -2244,10 +2270,10 @@ 3.1073 final Bits prevUninits = new Bits(uninits); 3.1074 final Bits prevInits = new Bits(inits); 3.1075 int returnadrPrev = returnadr; 3.1076 - ListBuffer<P> prevPending = pendingExits; 3.1077 + ListBuffer<AssignPendingExit> prevPending = pendingExits; 3.1078 try { 3.1079 returnadr = nextadr; 3.1080 - pendingExits = new ListBuffer<P>(); 3.1081 + pendingExits = new ListBuffer<>(); 3.1082 for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) { 3.1083 JCVariableDecl def = l.head; 3.1084 scan(def); 3.1085 @@ -2263,7 +2289,7 @@ 3.1086 finally { 3.1087 returnadr = returnadrPrev; 3.1088 uninits.assign(prevUninits); 3.1089 - assignToInits(tree, prevInits); 3.1090 + inits.assign(prevInits); 3.1091 pendingExits = prevPending; 3.1092 } 3.1093 } 3.1094 @@ -2279,11 +2305,11 @@ 3.1095 scanCond(tree.cond); 3.1096 uninitsExit.andSet(uninitsWhenTrue); 3.1097 if (tree.detail != null) { 3.1098 - assignToInits(tree, initsWhenFalse); 3.1099 + inits.assign(initsWhenFalse); 3.1100 uninits.assign(uninitsWhenFalse); 3.1101 scanExpr(tree.detail); 3.1102 } 3.1103 - assignToInits(tree, initsExit); 3.1104 + inits.assign(initsExit); 3.1105 uninits.assign(uninitsExit); 3.1106 } 3.1107 3.1108 @@ -2351,7 +2377,7 @@ 3.1109 scanCond(tree.lhs); 3.1110 final Bits initsWhenFalseLeft = new Bits(initsWhenFalse); 3.1111 final Bits uninitsWhenFalseLeft = new Bits(uninitsWhenFalse); 3.1112 - assignToInits(tree.lhs, initsWhenTrue); 3.1113 + inits.assign(initsWhenTrue); 3.1114 uninits.assign(uninitsWhenTrue); 3.1115 scanCond(tree.rhs); 3.1116 initsWhenFalse.andSet(initsWhenFalseLeft); 3.1117 @@ -2361,7 +2387,7 @@ 3.1118 scanCond(tree.lhs); 3.1119 final Bits initsWhenTrueLeft = new Bits(initsWhenTrue); 3.1120 final Bits uninitsWhenTrueLeft = new Bits(uninitsWhenTrue); 3.1121 - assignToInits(tree.lhs, initsWhenFalse); 3.1122 + inits.assign(initsWhenFalse); 3.1123 uninits.assign(uninitsWhenFalse); 3.1124 scanCond(tree.rhs); 3.1125 initsWhenTrue.andSet(initsWhenTrueLeft); 3.1126 @@ -2436,136 +2462,6 @@ 3.1127 } 3.1128 } 3.1129 3.1130 - public class AssignAnalyzer extends AbstractAssignAnalyzer<AssignAnalyzer.AssignPendingExit> { 3.1131 - 3.1132 - public class AssignPendingExit extends AbstractAssignAnalyzer<AssignPendingExit>.AbstractAssignPendingExit { 3.1133 - 3.1134 - public AssignPendingExit(JCTree tree, final Bits inits, final Bits uninits) { 3.1135 - super(tree, inits, uninits); 3.1136 - } 3.1137 - } 3.1138 - 3.1139 - @Override 3.1140 - protected AssignPendingExit createNewPendingExit(JCTree tree, 3.1141 - Bits inits, Bits uninits) { 3.1142 - return new AssignPendingExit(tree, inits, uninits); 3.1143 - } 3.1144 - 3.1145 - /** Record an initialization of a trackable variable. 3.1146 - */ 3.1147 - @Override 3.1148 - void letInit(DiagnosticPosition pos, VarSymbol sym) { 3.1149 - if (sym.adr >= firstadr && trackable(sym)) { 3.1150 - if ((sym.flags() & EFFECTIVELY_FINAL) != 0) { 3.1151 - if (!uninits.isMember(sym.adr)) { 3.1152 - //assignment targeting an effectively final variable 3.1153 - //makes the variable lose its status of effectively final 3.1154 - //if the variable is _not_ definitively unassigned 3.1155 - sym.flags_field &= ~EFFECTIVELY_FINAL; 3.1156 - } else { 3.1157 - uninit(sym); 3.1158 - } 3.1159 - } 3.1160 - else if ((sym.flags() & FINAL) != 0) { 3.1161 - if ((sym.flags() & PARAMETER) != 0) { 3.1162 - if ((sym.flags() & UNION) != 0) { //multi-catch parameter 3.1163 - log.error(pos, "multicatch.parameter.may.not.be.assigned", sym); 3.1164 - } 3.1165 - else { 3.1166 - log.error(pos, "final.parameter.may.not.be.assigned", 3.1167 - sym); 3.1168 - } 3.1169 - } else if (!uninits.isMember(sym.adr)) { 3.1170 - log.error(pos, flowKind.errKey, sym); 3.1171 - } else { 3.1172 - uninit(sym); 3.1173 - } 3.1174 - } 3.1175 - inits.incl(sym.adr); 3.1176 - } else if ((sym.flags() & FINAL) != 0) { 3.1177 - log.error(pos, "var.might.already.be.assigned", sym); 3.1178 - } 3.1179 - } 3.1180 - 3.1181 - @Override 3.1182 - void checkInit(DiagnosticPosition pos, VarSymbol sym, String errkey) { 3.1183 - if ((sym.adr >= firstadr || sym.owner.kind != TYP) && 3.1184 - trackable(sym) && 3.1185 - !inits.isMember(sym.adr)) { 3.1186 - log.error(pos, errkey, sym); 3.1187 - inits.incl(sym.adr); 3.1188 - } 3.1189 - } 3.1190 - 3.1191 - @Override 3.1192 - void reportWarning(Lint.LintCategory lc, DiagnosticPosition pos, 3.1193 - String key, Object ... args) { 3.1194 - log.warning(lc, pos, key, args); 3.1195 - } 3.1196 - 3.1197 - @Override 3.1198 - int getLogNumberOfErrors() { 3.1199 - return log.nerrors; 3.1200 - } 3.1201 - 3.1202 - @Override 3.1203 - boolean isEnabled(Lint.LintCategory lc) { 3.1204 - return lint.isEnabled(lc); 3.1205 - } 3.1206 - 3.1207 - @Override 3.1208 - public void visitClassDef(JCClassDecl tree) { 3.1209 - if (tree.sym == null) { 3.1210 - return; 3.1211 - } 3.1212 - 3.1213 - Lint lintPrev = lint; 3.1214 - lint = lint.augment(tree.sym); 3.1215 - try { 3.1216 - super.visitClassDef(tree); 3.1217 - } finally { 3.1218 - lint = lintPrev; 3.1219 - } 3.1220 - } 3.1221 - 3.1222 - @Override 3.1223 - public void visitMethodDef(JCMethodDecl tree) { 3.1224 - if (tree.body == null) { 3.1225 - return; 3.1226 - } 3.1227 - 3.1228 - /* MemberEnter can generate synthetic methods ignore them 3.1229 - */ 3.1230 - if ((tree.sym.flags() & SYNTHETIC) != 0) { 3.1231 - return; 3.1232 - } 3.1233 - 3.1234 - Lint lintPrev = lint; 3.1235 - lint = lint.augment(tree.sym); 3.1236 - try { 3.1237 - super.visitMethodDef(tree); 3.1238 - } finally { 3.1239 - lint = lintPrev; 3.1240 - } 3.1241 - } 3.1242 - 3.1243 - @Override 3.1244 - public void visitVarDef(JCVariableDecl tree) { 3.1245 - if (tree.init == null) { 3.1246 - super.visitVarDef(tree); 3.1247 - } else { 3.1248 - Lint lintPrev = lint; 3.1249 - lint = lint.augment(tree.sym); 3.1250 - try{ 3.1251 - super.visitVarDef(tree); 3.1252 - } finally { 3.1253 - lint = lintPrev; 3.1254 - } 3.1255 - } 3.1256 - } 3.1257 - 3.1258 - } 3.1259 - 3.1260 /** 3.1261 * This pass implements the last step of the dataflow analysis, namely 3.1262 * the effectively-final analysis check. This checks that every local variable 3.1263 @@ -2578,7 +2474,7 @@ 3.1264 JCTree currentTree; //local class or lambda 3.1265 3.1266 @Override 3.1267 - void markDead(JCTree tree) { 3.1268 + void markDead() { 3.1269 //do nothing 3.1270 } 3.1271 3.1272 @@ -2715,7 +2611,7 @@ 3.1273 try { 3.1274 attrEnv = env; 3.1275 Flow.this.make = make; 3.1276 - pendingExits = new ListBuffer<PendingExit>(); 3.1277 + pendingExits = new ListBuffer<>(); 3.1278 scan(tree); 3.1279 } finally { 3.1280 pendingExits = null;
4.1 --- a/src/share/classes/com/sun/tools/javac/util/Bits.java Mon Jul 06 12:28:15 2015 -0700 4.2 +++ b/src/share/classes/com/sun/tools/javac/util/Bits.java Thu Jul 09 23:05:33 2015 -0700 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 4.6 + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. 4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 * 4.9 * This code is free software; you can redistribute it and/or modify it 4.10 @@ -84,20 +84,6 @@ 4.11 4.12 } 4.13 4.14 - public enum BitsOpKind { 4.15 - INIT, 4.16 - CLEAR, 4.17 - INCL_BIT, 4.18 - EXCL_BIT, 4.19 - ASSIGN, 4.20 - AND_SET, 4.21 - OR_SET, 4.22 - DIFF_SET, 4.23 - XOR_SET, 4.24 - INCL_RANGE, 4.25 - EXCL_RANGE, 4.26 - } 4.27 - 4.28 private final static int wordlen = 32; 4.29 private final static int wordshift = 5; 4.30 private final static int wordmask = wordlen - 1;