< prev index next >
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java
Print this page
@@ -198,14 +198,11 @@
private TreeMaker make;
private final Resolve rs;
private final JCDiagnostic.Factory diags;
private Env<AttrContext> attrEnv;
private Lint lint;
- private final boolean allowImprovedRethrowAnalysis;
- private final boolean allowImprovedCatchAnalysis;
private final boolean allowEffectivelyFinalInInnerClasses;
- private final boolean enforceThisDotInit;
public static Flow instance(Context context) {
Flow instance = context.get(flowKey);
if (instance == null)
instance = new Flow(context);
@@ -292,14 +289,11 @@
chk = Check.instance(context);
lint = Lint.instance(context);
rs = Resolve.instance(context);
diags = JCDiagnostic.Factory.instance(context);
Source source = Source.instance(context);
- allowImprovedRethrowAnalysis = Feature.IMPROVED_RETHROW_ANALYSIS.allowedInSource(source);
- allowImprovedCatchAnalysis = Feature.IMPROVED_CATCH_ANALYSIS.allowedInSource(source);
allowEffectivelyFinalInInnerClasses = Feature.EFFECTIVELY_FINAL_IN_INNER_CLASSES.allowedInSource(source);
- enforceThisDotInit = Feature.ENFORCE_THIS_DOT_INIT.allowedInSource(source);
}
/**
* Base visitor class for all visitors implementing dataflow analysis logic.
* This class define the shared logic for handling jumps (break/continue statements).
@@ -1104,13 +1098,11 @@
}
}
}
}
scan(tree.body);
- List<Type> thrownInTry = allowImprovedCatchAnalysis ?
- chk.union(thrown, List.of(syms.runtimeExceptionType, syms.errorType)) :
- thrown;
+ List<Type> thrownInTry = chk.union(thrown, List.of(syms.runtimeExceptionType, syms.errorType));
thrown = thrownPrev;
caught = caughtPrev;
List<Type> caughtInTry = List.nil();
for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) {
@@ -1175,11 +1167,11 @@
log.error(pos, Errors.ExceptAlreadyCaught(exc));
} else if (!chk.isUnchecked(pos, exc) &&
!isExceptionOrThrowable(exc) &&
!chk.intersects(exc, thrownInTry)) {
log.error(pos, Errors.ExceptNeverThrownInTry(exc));
- } else if (allowImprovedCatchAnalysis) {
+ } else {
List<Type> catchableThrownTypes = chk.intersect(List.of(exc), thrownInTry);
// 'catchableThrownTypes' cannnot possibly be empty - if 'exc' was an
// unchecked exception, the result list would not be empty, as the augmented
// thrown set includes { RuntimeException, Error }; if 'exc' was a checked
// exception, that would have been covered in the branch above
@@ -1215,12 +1207,11 @@
scan(tree.expr);
Symbol sym = TreeInfo.symbol(tree.expr);
if (sym != null &&
sym.kind == VAR &&
(sym.flags() & (FINAL | EFFECTIVELY_FINAL)) != 0 &&
- preciseRethrowTypes.get(sym) != null &&
- allowImprovedRethrowAnalysis) {
+ preciseRethrowTypes.get(sym) != null) {
for (Type t : preciseRethrowTypes.get(sym)) {
markThrown(tree, t);
}
}
else {
@@ -2399,12 +2390,11 @@
// check fields accessed through this.<field> are definitely
// assigned before reading their value
public void visitSelect(JCFieldAccess tree) {
super.visitSelect(tree);
- if (enforceThisDotInit &&
- TreeInfo.isThisQualifier(tree.selected) &&
+ if (TreeInfo.isThisQualifier(tree.selected) &&
tree.sym.kind == VAR) {
checkInit(tree.pos(), (VarSymbol)tree.sym);
}
}
< prev index next >