940 // Warn about fall-through if lint switch fallthrough enabled. |
940 // Warn about fall-through if lint switch fallthrough enabled. |
941 if (!loopPassTwo && |
941 if (!loopPassTwo && |
942 alive && |
942 alive && |
943 lint.isEnabled(Lint.LintCategory.FALLTHROUGH) && |
943 lint.isEnabled(Lint.LintCategory.FALLTHROUGH) && |
944 c.stats.nonEmpty() && l.tail.nonEmpty()) |
944 c.stats.nonEmpty() && l.tail.nonEmpty()) |
945 log.warning(l.tail.head.pos(), |
945 log.warning(Lint.LintCategory.FALLTHROUGH, |
|
946 l.tail.head.pos(), |
946 "possible.fall-through.into.case"); |
947 "possible.fall-through.into.case"); |
947 } |
948 } |
948 if (!hasDefault) { |
949 if (!hasDefault) { |
949 inits.andSet(initsSwitch); |
950 inits.andSet(initsSwitch); |
950 alive = true; |
951 alive = true; |
1079 if (!alive) { |
1080 if (!alive) { |
1080 // discard exits and exceptions from try and finally |
1081 // discard exits and exceptions from try and finally |
1081 thrown = chk.union(thrown, thrownPrev); |
1082 thrown = chk.union(thrown, thrownPrev); |
1082 if (!loopPassTwo && |
1083 if (!loopPassTwo && |
1083 lint.isEnabled(Lint.LintCategory.FINALLY)) { |
1084 lint.isEnabled(Lint.LintCategory.FINALLY)) { |
1084 log.warning(TreeInfo.diagEndPos(tree.finalizer), |
1085 log.warning(Lint.LintCategory.FINALLY, |
1085 "finally.cannot.complete"); |
1086 TreeInfo.diagEndPos(tree.finalizer), |
|
1087 "finally.cannot.complete"); |
1086 } |
1088 } |
1087 } else { |
1089 } else { |
1088 thrown = chk.union(thrown, chk.diff(thrownInTry, caughtInTry)); |
1090 thrown = chk.union(thrown, chk.diff(thrownInTry, caughtInTry)); |
1089 thrown = chk.union(thrown, savedThrown); |
1091 thrown = chk.union(thrown, savedThrown); |
1090 uninits.andSet(uninitsEnd); |
1092 uninits.andSet(uninitsEnd); |
1351 super.visitTypeCast(tree); |
1353 super.visitTypeCast(tree); |
1352 if (!tree.type.isErroneous() |
1354 if (!tree.type.isErroneous() |
1353 && lint.isEnabled(Lint.LintCategory.CAST) |
1355 && lint.isEnabled(Lint.LintCategory.CAST) |
1354 && types.isSameType(tree.expr.type, tree.clazz.type) |
1356 && types.isSameType(tree.expr.type, tree.clazz.type) |
1355 && !(ignoreAnnotatedCasts && containsTypeAnnotation(tree.clazz))) { |
1357 && !(ignoreAnnotatedCasts && containsTypeAnnotation(tree.clazz))) { |
1356 log.warning(tree.pos(), "redundant.cast", tree.expr.type); |
1358 log.warning(Lint.LintCategory.CAST, |
|
1359 tree.pos(), "redundant.cast", tree.expr.type); |
1357 } |
1360 } |
1358 } |
1361 } |
1359 |
1362 |
1360 public void visitTopLevel(JCCompilationUnit tree) { |
1363 public void visitTopLevel(JCCompilationUnit tree) { |
1361 // Do nothing for TopLevel since each class is visited individually |
1364 // Do nothing for TopLevel since each class is visited individually |