# HG changeset patch # User andrew # Date 1345796961 -3600 # Node ID 2aaad794fdd168afb8255ba14b6f49263e5d7d15 # Parent 45a1817f956b016d5045d10a63572ec4092c9eee# Parent d3d0b9cd76e04bf9e381b402630ac3cfe464bb38 Merge jdk8-b52 diff -r 45a1817f956b -r 2aaad794fdd1 .hgtags --- a/.hgtags Fri Aug 03 20:23:20 2012 +0100 +++ b/.hgtags Fri Aug 24 09:29:21 2012 +0100 @@ -175,3 +175,5 @@ afb0a523155727d42b1c773f783ff3a7cfab8e86 jdk8-b48 c72c164ced676d3c360d99b1c52cc80940fc3122 jdk8-b49 b2d8a270f5f2144e14a1fe97fbda9e4391a5332e jdk8-b50 +c4cd4cab2220817c88c8c139c9bfc91c36b48826 jdk8-b51 +1d2db0e5eabc2eaf865986f7b7ffbf7b14b00232 jdk8-b52 diff -r 45a1817f956b -r 2aaad794fdd1 src/share/classes/com/sun/tools/javac/code/Source.java --- a/src/share/classes/com/sun/tools/javac/code/Source.java Fri Aug 03 20:23:20 2012 +0100 +++ b/src/share/classes/com/sun/tools/javac/code/Source.java Fri Aug 24 09:29:21 2012 +0100 @@ -200,6 +200,9 @@ public boolean allowMethodReferences() { return compareTo(JDK1_8) >= 0; } + public boolean allowEffectivelyFinalInInnerClasses() { + return compareTo(JDK1_8) >= 0; + } public static SourceVersion toSourceVersion(Source source) { switch(source) { case JDK1_2: diff -r 45a1817f956b -r 2aaad794fdd1 src/share/classes/com/sun/tools/javac/comp/Attr.java --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri Aug 03 20:23:20 2012 +0100 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri Aug 24 09:29:21 2012 +0100 @@ -228,7 +228,7 @@ * @param env The current environment. */ boolean isAssignableAsBlankFinal(VarSymbol v, Env env) { - Symbol owner = env.info.scope.owner; + Symbol owner = owner(env); // owner refers to the innermost variable, method or // initializer block declaration at this point. return @@ -243,6 +243,41 @@ ((v.flags() & STATIC) != 0) == Resolve.isStatic(env)); } + /** + * Return the innermost enclosing owner symbol in a given attribution context + */ + Symbol owner(Env env) { + while (true) { + switch (env.tree.getTag()) { + case VARDEF: + //a field can be owner + VarSymbol vsym = ((JCVariableDecl)env.tree).sym; + if (vsym.owner.kind == TYP) { + return vsym; + } + break; + case METHODDEF: + //method def is always an owner + return ((JCMethodDecl)env.tree).sym; + case CLASSDEF: + //class def is always an owner + return ((JCClassDecl)env.tree).sym; + case BLOCK: + //static/instance init blocks are owner + Symbol blockSym = env.info.scope.owner; + if ((blockSym.flags() & BLOCK) != 0) { + return blockSym; + } + break; + case TOPLEVEL: + //toplevel is always an owner (for pkge decls) + return env.info.scope.owner; + } + Assert.checkNonNull(env.next); + env = env.next; + } + } + /** Check that variable can be assigned to. * @param pos The current source code position. * @param v The assigned varaible @@ -883,7 +918,6 @@ memberEnter.memberEnter(tree, env); annotate.flush(); } - tree.sym.flags_field |= EFFECTIVELY_FINAL; } VarSymbol v = tree.sym; @@ -1131,8 +1165,8 @@ for (JCTree resource : tree.resources) { CheckContext twrContext = new Check.NestedCheckContext(resultInfo.checkContext) { @Override - public void report(DiagnosticPosition pos, Type found, Type req, JCDiagnostic details) { - chk.basicHandler.report(pos, found, req, diags.fragment("try.not.applicable.to.type", found)); + public void report(DiagnosticPosition pos, JCDiagnostic details) { + chk.basicHandler.report(pos, diags.fragment("try.not.applicable.to.type", details)); } }; ResultInfo twrResult = new ResultInfo(VAL, syms.autoCloseableType, twrContext); @@ -1865,7 +1899,7 @@ Type attribDiamond(Env env, final JCNewClass tree, - Type clazztype, + final Type clazztype, List argtypes, List typeargtypes) { if (clazztype.isErroneous() || @@ -1892,27 +1926,26 @@ argtypes, typeargtypes); + Type owntype = types.createErrorType(clazztype); if (constructor.kind == MTH) { - try { - clazztype = rawCheckMethod(site, - constructor, - resultInfo, - localEnv, - tree.args, - argtypes, - typeargtypes, - localEnv.info.varArgs).getReturnType(); - } catch (Resolve.InapplicableMethodException ex) { - //an error occurred while inferring uninstantiated type-variables - resultInfo.checkContext.report(tree.clazz.pos(), clazztype, resultInfo.pt, - diags.fragment("cant.apply.diamond.1", diags.fragment("diamond", clazztype.tsym), ex.diagnostic)); - clazztype = syms.errType; - } - } else { - clazztype = syms.errType; + ResultInfo diamondResult = new ResultInfo(VAL, resultInfo.pt, new Check.NestedCheckContext(resultInfo.checkContext) { + @Override + public void report(DiagnosticPosition pos, JCDiagnostic details) { + enclosingContext.report(tree.clazz.pos(), + diags.fragment("cant.apply.diamond.1", diags.fragment("diamond", clazztype.tsym), details)); + } + }); + owntype = checkMethod(site, + constructor, + diamondResult, + localEnv, + tree.args, + argtypes, + typeargtypes, + localEnv.info.varArgs).getReturnType(); } - return chk.checkClassType(tree.clazz.pos(), clazztype, true); + return chk.checkClassType(tree.clazz.pos(), owntype, true); } /** Make an attributed null check tree. @@ -2188,16 +2221,6 @@ // illegal forward reference. checkInit(tree, env, v, false); - // If symbol is a local variable accessed from an embedded - // inner class check that it is final. - if (v.owner.kind == MTH && - v.owner != env.info.scope.owner && - (v.flags_field & FINAL) == 0) { - log.error(tree.pos(), - "local.var.accessed.from.icls.needs.final", - v); - } - // If we are expecting a variable (as opposed to a value), check // that the variable is assignable in the current environment. if (pkind() == VAR) @@ -2591,7 +2614,7 @@ // and are subject to definite assignment checking. if ((env.info.enclVar == v || v.pos > tree.pos) && v.owner.kind == TYP && - canOwnInitializer(env.info.scope.owner) && + canOwnInitializer(owner(env)) && v.owner == env.info.scope.owner.enclClass() && ((v.flags() & STATIC) != 0) == Resolve.isStatic(env) && (!env.tree.hasTag(ASSIGN) || @@ -2687,32 +2710,6 @@ List argtypes, List typeargtypes, boolean useVarargs) { - try { - return rawCheckMethod(site, sym, resultInfo, env, argtrees, argtypes, typeargtypes, useVarargs); - } catch (Resolve.InapplicableMethodException ex) { - String key = ex.getDiagnostic() == null ? - "cant.apply.symbol" : - "cant.apply.symbol.1"; - log.error(env.tree.pos, key, - Kinds.kindName(sym), - sym.name == names.init ? sym.owner.name : sym.name, - rs.methodArguments(sym.type.getParameterTypes()), - rs.methodArguments(argtypes), - Kinds.kindName(sym.owner), - sym.owner.type, - ex.getDiagnostic()); - return types.createErrorType(site); - } - } - - private Type rawCheckMethod(Type site, - Symbol sym, - ResultInfo resultInfo, - Env env, - final List argtrees, - List argtypes, - List typeargtypes, - boolean useVarargs) { // Test (5): if symbol is an instance method of a raw type, issue // an unchecked warning if its argument types change under erasure. if (allowGenerics && @@ -2733,19 +2730,29 @@ // Resolve.instantiate from the symbol's type as well as // any type arguments and value arguments. noteWarner.clear(); - Type owntype = rs.rawInstantiate(env, - site, - sym, - resultInfo, - argtypes, - typeargtypes, - true, - useVarargs, - noteWarner); - - boolean unchecked = noteWarner.hasNonSilentLint(LintCategory.UNCHECKED); - - return chk.checkMethod(owntype, sym, env, argtrees, argtypes, useVarargs, unchecked); + try { + Type owntype = rs.rawInstantiate( + env, + site, + sym, + resultInfo, + argtypes, + typeargtypes, + allowBoxing, + useVarargs, + noteWarner); + + return chk.checkMethod(owntype, sym, env, argtrees, argtypes, useVarargs, + noteWarner.hasNonSilentLint(LintCategory.UNCHECKED)); + } catch (Infer.InferenceException ex) { + //invalid target type - propagate exception outwards or report error + //depending on the current check context + resultInfo.checkContext.report(env.tree.pos(), ex.getDiagnostic()); + return types.createErrorType(site); + } catch (Resolve.InapplicableMethodException ex) { + Assert.error(); + return null; + } } /** diff -r 45a1817f956b -r 2aaad794fdd1 src/share/classes/com/sun/tools/javac/comp/Check.java --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Fri Aug 03 20:23:20 2012 +0100 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Fri Aug 24 09:29:21 2012 +0100 @@ -426,7 +426,7 @@ /** * Report a check error */ - void report(DiagnosticPosition pos, Type found, Type req, JCDiagnostic details); + void report(DiagnosticPosition pos, JCDiagnostic details); /** * Obtain a warner for this check context */ @@ -450,8 +450,8 @@ return enclosingContext.compatible(found, req, warn); } - public void report(DiagnosticPosition pos, Type found, Type req, JCDiagnostic details) { - enclosingContext.report(pos, found, req, details); + public void report(DiagnosticPosition pos, JCDiagnostic details) { + enclosingContext.report(pos, details); } public Warner checkWarner(DiagnosticPosition pos, Type found, Type req) { @@ -463,12 +463,8 @@ * Check context to be used when evaluating assignment/return statements */ CheckContext basicHandler = new CheckContext() { - public void report(DiagnosticPosition pos, Type found, Type req, JCDiagnostic details) { - if (details == null) { - log.error(pos, "prob.found.req", found, req); - } else { - log.error(pos, "prob.found.req.1", details); - } + public void report(DiagnosticPosition pos, JCDiagnostic details) { + log.error(pos, "prob.found.req", details); } public boolean compatible(Type found, Type req, Warner warn) { return types.isAssignable(found, req, warn); @@ -498,10 +494,10 @@ return found; } else { if (found.tag <= DOUBLE && req.tag <= DOUBLE) { - checkContext.report(pos, found, req, diags.fragment("possible.loss.of.precision")); + checkContext.report(pos, diags.fragment("possible.loss.of.precision", found, req)); return types.createErrorType(found); } - checkContext.report(pos, found, req, null); + checkContext.report(pos, diags.fragment("inconvertible.types", found, req)); return types.createErrorType(found); } } @@ -519,7 +515,7 @@ if (types.isCastable(found, req, castWarner(pos, found, req))) { return req; } else { - checkContext.report(pos, found, req, diags.fragment("inconvertible.types", found, req)); + checkContext.report(pos, diags.fragment("inconvertible.types", found, req)); return types.createErrorType(found); } } diff -r 45a1817f956b -r 2aaad794fdd1 src/share/classes/com/sun/tools/javac/comp/Flow.java --- a/src/share/classes/com/sun/tools/javac/comp/Flow.java Fri Aug 03 20:23:20 2012 +0100 +++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java Fri Aug 24 09:29:21 2012 +0100 @@ -43,13 +43,15 @@ import static com.sun.tools.javac.code.TypeTags.*; import static com.sun.tools.javac.tree.JCTree.Tag.*; -/** This pass implements dataflow analysis for Java programs. - * Liveness analysis checks that every statement is reachable. - * Exception analysis ensures that every checked exception that is - * thrown is declared or caught. Definite assignment analysis - * ensures that each variable is assigned when used. Definite - * unassignment analysis ensures that no final variable is assigned - * more than once. +/** This pass implements dataflow analysis for Java programs though + * different AST visitor steps. Liveness analysis (see AliveAlanyzer) checks that + * every statement is reachable. Exception analysis (see FlowAnalyzer) ensures that + * every checked exception that is thrown is declared or caught. Definite assignment analysis + * (see AssignAnalyzer) ensures that each variable is assigned when used. Definite + * unassignment analysis (see AssignAnalyzer) in ensures that no final variable + * is assigned more than once. Finally, local variable capture analysis (see CaptureAnalyzer) + * determines that local variables accessed within the scope of an inner class are + * either final or effectively-final. * *

The JLS has a number of problems in the * specification of these flow analysis problems. This implementation @@ -188,10 +190,12 @@ private final Check chk; private TreeMaker make; private final Resolve rs; + private final JCDiagnostic.Factory diags; private Env attrEnv; private Lint lint; private final boolean allowImprovedRethrowAnalysis; private final boolean allowImprovedCatchAnalysis; + private final boolean allowEffectivelyFinalInInnerClasses; public static Flow instance(Context context) { Flow instance = context.get(flowKey); @@ -201,8 +205,37 @@ } public void analyzeTree(Env env, TreeMaker make) { + new AliveAnalyzer().analyzeTree(env, make); + new AssignAnalyzer().analyzeTree(env, make); new FlowAnalyzer().analyzeTree(env, make); - new AssignAnalyzer().analyzeTree(env, make); + new CaptureAnalyzer().analyzeTree(env, make); + } + + /** + * Definite assignment scan mode + */ + enum FlowKind { + /** + * This is the normal DA/DU analysis mode + */ + NORMAL("var.might.already.be.assigned", false), + /** + * This is the speculative DA/DU analysis mode used to speculatively + * derive assertions within loop bodies + */ + SPECULATIVE_LOOP("var.might.be.assigned.in.loop", true); + + String errKey; + boolean isFinal; + + FlowKind(String errKey, boolean isFinal) { + this.errKey = errKey; + this.isFinal = isFinal; + } + + boolean isFinal() { + return isFinal; + } } protected Flow(Context context) { @@ -214,9 +247,13 @@ chk = Check.instance(context); lint = Lint.instance(context); rs = Resolve.instance(context); + diags = JCDiagnostic.Factory.instance(context); Source source = Source.instance(context); allowImprovedRethrowAnalysis = source.allowImprovedRethrowAnalysis(); allowImprovedCatchAnalysis = source.allowImprovedCatchAnalysis(); + Options options = Options.instance(context); + allowEffectivelyFinalInInnerClasses = source.allowEffectivelyFinalInInnerClasses() && + options.isSet("allowEffectivelyFinalInInnerClasses"); //pre-lambda guard } /** @@ -259,14 +296,16 @@ * will typically result in an error unless it is within a * try-finally whose finally block cannot complete normally. */ - abstract static class PendingExit { + static class PendingExit { JCTree tree; PendingExit(JCTree tree) { this.tree = tree; } - abstract void resolveJump(); + void resolveJump() { + //do nothing + } } abstract void markDead(); @@ -309,18 +348,352 @@ } /** - * This pass implements the first two steps of the dataflow analysis: - * (i) liveness analysis checks that every statement is reachable and (ii) - * exception analysis to ensure that every checked exception that is - * thrown is declared or caught. + * This pass implements the first step of the dataflow analysis, namely + * the liveness analysis check. This checks that every statement is reachable. + * The output of this analysis pass are used by other analyzers. This analyzer + * sets the 'finallyCanCompleteNormally' field in the JCTry class. + */ + class AliveAnalyzer extends BaseAnalyzer { + + /** A flag that indicates whether the last statement could + * complete normally. + */ + private boolean alive; + + @Override + void markDead() { + alive = false; + } + + /************************************************************************* + * Visitor methods for statements and definitions + *************************************************************************/ + + /** Analyze a definition. + */ + void scanDef(JCTree tree) { + scanStat(tree); + if (tree != null && tree.hasTag(JCTree.Tag.BLOCK) && !alive) { + log.error(tree.pos(), + "initializer.must.be.able.to.complete.normally"); + } + } + + /** Analyze a statement. Check that statement is reachable. + */ + void scanStat(JCTree tree) { + if (!alive && tree != null) { + log.error(tree.pos(), "unreachable.stmt"); + if (!tree.hasTag(SKIP)) alive = true; + } + scan(tree); + } + + /** Analyze list of statements. + */ + void scanStats(List trees) { + if (trees != null) + for (List l = trees; l.nonEmpty(); l = l.tail) + scanStat(l.head); + } + + /* ------------ Visitor methods for various sorts of trees -------------*/ + + public void visitClassDef(JCClassDecl tree) { + if (tree.sym == null) return; + boolean alivePrev = alive; + ListBuffer pendingExitsPrev = pendingExits; + Lint lintPrev = lint; + + pendingExits = new ListBuffer(); + lint = lint.augment(tree.sym.attributes_field); + + try { + // process all the static initializers + for (List l = tree.defs; l.nonEmpty(); l = l.tail) { + if (!l.head.hasTag(METHODDEF) && + (TreeInfo.flags(l.head) & STATIC) != 0) { + scanDef(l.head); + } + } + + // process all the instance initializers + for (List l = tree.defs; l.nonEmpty(); l = l.tail) { + if (!l.head.hasTag(METHODDEF) && + (TreeInfo.flags(l.head) & STATIC) == 0) { + scanDef(l.head); + } + } + + // process all the methods + for (List l = tree.defs; l.nonEmpty(); l = l.tail) { + if (l.head.hasTag(METHODDEF)) { + scan(l.head); + } + } + } finally { + pendingExits = pendingExitsPrev; + alive = alivePrev; + lint = lintPrev; + } + } + + public void visitMethodDef(JCMethodDecl tree) { + if (tree.body == null) return; + Lint lintPrev = lint; + + lint = lint.augment(tree.sym.attributes_field); + + Assert.check(pendingExits.isEmpty()); + + try { + alive = true; + scanStat(tree.body); + + if (alive && tree.sym.type.getReturnType().tag != VOID) + log.error(TreeInfo.diagEndPos(tree.body), "missing.ret.stmt"); + + List exits = pendingExits.toList(); + pendingExits = new ListBuffer(); + while (exits.nonEmpty()) { + PendingExit exit = exits.head; + exits = exits.tail; + Assert.check(exit.tree.hasTag(RETURN)); + } + } finally { + lint = lintPrev; + } + } + + public void visitVarDef(JCVariableDecl tree) { + if (tree.init != null) { + Lint lintPrev = lint; + lint = lint.augment(tree.sym.attributes_field); + try{ + scan(tree.init); + } finally { + lint = lintPrev; + } + } + } + + public void visitBlock(JCBlock tree) { + scanStats(tree.stats); + } + + public void visitDoLoop(JCDoWhileLoop tree) { + ListBuffer prevPendingExits = pendingExits; + pendingExits = new ListBuffer(); + scanStat(tree.body); + alive |= resolveContinues(tree); + scan(tree.cond); + alive = alive && !tree.cond.type.isTrue(); + alive |= resolveBreaks(tree, prevPendingExits); + } + + public void visitWhileLoop(JCWhileLoop tree) { + ListBuffer prevPendingExits = pendingExits; + pendingExits = new ListBuffer(); + scan(tree.cond); + alive = !tree.cond.type.isFalse(); + scanStat(tree.body); + alive |= resolveContinues(tree); + alive = resolveBreaks(tree, prevPendingExits) || + !tree.cond.type.isTrue(); + } + + public void visitForLoop(JCForLoop tree) { + ListBuffer prevPendingExits = pendingExits; + scanStats(tree.init); + pendingExits = new ListBuffer(); + if (tree.cond != null) { + scan(tree.cond); + alive = !tree.cond.type.isFalse(); + } else { + alive = true; + } + scanStat(tree.body); + alive |= resolveContinues(tree); + scan(tree.step); + alive = resolveBreaks(tree, prevPendingExits) || + tree.cond != null && !tree.cond.type.isTrue(); + } + + public void visitForeachLoop(JCEnhancedForLoop tree) { + visitVarDef(tree.var); + ListBuffer prevPendingExits = pendingExits; + scan(tree.expr); + pendingExits = new ListBuffer(); + scanStat(tree.body); + alive |= resolveContinues(tree); + resolveBreaks(tree, prevPendingExits); + alive = true; + } + + public void visitLabelled(JCLabeledStatement tree) { + ListBuffer prevPendingExits = pendingExits; + pendingExits = new ListBuffer(); + scanStat(tree.body); + alive |= resolveBreaks(tree, prevPendingExits); + } + + public void visitSwitch(JCSwitch tree) { + ListBuffer prevPendingExits = pendingExits; + pendingExits = new ListBuffer(); + scan(tree.selector); + boolean hasDefault = false; + for (List l = tree.cases; l.nonEmpty(); l = l.tail) { + alive = true; + JCCase c = l.head; + if (c.pat == null) + hasDefault = true; + else + scan(c.pat); + scanStats(c.stats); + // Warn about fall-through if lint switch fallthrough enabled. + if (alive && + lint.isEnabled(Lint.LintCategory.FALLTHROUGH) && + c.stats.nonEmpty() && l.tail.nonEmpty()) + log.warning(Lint.LintCategory.FALLTHROUGH, + l.tail.head.pos(), + "possible.fall-through.into.case"); + } + if (!hasDefault) { + alive = true; + } + alive |= resolveBreaks(tree, prevPendingExits); + } + + public void visitTry(JCTry tree) { + ListBuffer prevPendingExits = pendingExits; + pendingExits = new ListBuffer(); + for (JCTree resource : tree.resources) { + if (resource instanceof JCVariableDecl) { + JCVariableDecl vdecl = (JCVariableDecl) resource; + visitVarDef(vdecl); + } else if (resource instanceof JCExpression) { + scan((JCExpression) resource); + } else { + throw new AssertionError(tree); // parser error + } + } + + scanStat(tree.body); + boolean aliveEnd = alive; + + for (List l = tree.catchers; l.nonEmpty(); l = l.tail) { + alive = true; + JCVariableDecl param = l.head.param; + scan(param); + scanStat(l.head.body); + aliveEnd |= alive; + } + if (tree.finalizer != null) { + ListBuffer exits = pendingExits; + pendingExits = prevPendingExits; + alive = true; + scanStat(tree.finalizer); + tree.finallyCanCompleteNormally = alive; + if (!alive) { + if (lint.isEnabled(Lint.LintCategory.FINALLY)) { + log.warning(Lint.LintCategory.FINALLY, + TreeInfo.diagEndPos(tree.finalizer), + "finally.cannot.complete"); + } + } else { + while (exits.nonEmpty()) { + pendingExits.append(exits.next()); + } + alive = aliveEnd; + } + } else { + alive = aliveEnd; + ListBuffer exits = pendingExits; + pendingExits = prevPendingExits; + while (exits.nonEmpty()) pendingExits.append(exits.next()); + } + } + + @Override + public void visitIf(JCIf tree) { + scan(tree.cond); + scanStat(tree.thenpart); + if (tree.elsepart != null) { + boolean aliveAfterThen = alive; + alive = true; + scanStat(tree.elsepart); + alive = alive | aliveAfterThen; + } else { + alive = true; + } + } + + public void visitBreak(JCBreak tree) { + recordExit(tree, new PendingExit(tree)); + } + + public void visitContinue(JCContinue tree) { + recordExit(tree, new PendingExit(tree)); + } + + public void visitReturn(JCReturn tree) { + scan(tree.expr); + recordExit(tree, new PendingExit(tree)); + } + + public void visitThrow(JCThrow tree) { + scan(tree.expr); + markDead(); + } + + public void visitApply(JCMethodInvocation tree) { + scan(tree.meth); + scan(tree.args); + } + + public void visitNewClass(JCNewClass tree) { + scan(tree.encl); + scan(tree.args); + if (tree.def != null) { + scan(tree.def); + } + } + + public void visitTopLevel(JCCompilationUnit tree) { + // Do nothing for TopLevel since each class is visited individually + } + + /************************************************************************** + * main method + *************************************************************************/ + + /** Perform definite assignment/unassignment analysis on a tree. + */ + public void analyzeTree(Env env, TreeMaker make) { + try { + attrEnv = env; + Flow.this.make = make; + pendingExits = new ListBuffer(); + alive = true; + scan(env.tree); + } finally { + pendingExits = null; + Flow.this.make = null; + } + } + } + + /** + * This pass implements the second step of the dataflow analysis, namely + * the exception analysis. This is to ensure that every checked exception that is + * thrown is declared or caught. The analyzer uses some info that has been set by + * the liveliness analyzer. */ class FlowAnalyzer extends BaseAnalyzer { /** A flag that indicates whether the last statement could * complete normally. */ - private boolean alive; - HashMap> preciseRethrowTypes; /** The current class being defined. @@ -344,13 +717,11 @@ super(tree); this.thrown = thrown; } - - void resolveJump() { /*do nothing*/ } } @Override void markDead() { - alive = false; + //do nothing } /*-------------------- Exceptions ----------------------*/ @@ -395,34 +766,6 @@ * Visitor methods for statements and definitions *************************************************************************/ - /** Analyze a definition. - */ - void scanDef(JCTree tree) { - scanStat(tree); - if (tree != null && tree.hasTag(JCTree.Tag.BLOCK) && !alive) { - log.error(tree.pos(), - "initializer.must.be.able.to.complete.normally"); - } - } - - /** Analyze a statement. Check that statement is reachable. - */ - void scanStat(JCTree tree) { - if (!alive && tree != null) { - log.error(tree.pos(), "unreachable.stmt"); - if (!tree.hasTag(SKIP)) alive = true; - } - scan(tree); - } - - /** Analyze list of statements. - */ - void scanStats(List trees) { - if (trees != null) - for (List l = trees; l.nonEmpty(); l = l.tail) - scanStat(l.head); - } - /* ------------ Visitor methods for various sorts of trees -------------*/ public void visitClassDef(JCClassDecl tree) { @@ -431,7 +774,6 @@ JCClassDecl classDefPrev = classDef; List thrownPrev = thrown; List caughtPrev = caught; - boolean alivePrev = alive; ListBuffer pendingExitsPrev = pendingExits; Lint lintPrev = lint; @@ -448,7 +790,7 @@ for (List l = tree.defs; l.nonEmpty(); l = l.tail) { if (!l.head.hasTag(METHODDEF) && (TreeInfo.flags(l.head) & STATIC) != 0) { - scanDef(l.head); + scan(l.head); errorUncaught(); } } @@ -475,7 +817,7 @@ for (List l = tree.defs; l.nonEmpty(); l = l.tail) { if (!l.head.hasTag(METHODDEF) && (TreeInfo.flags(l.head) & STATIC) == 0) { - scanDef(l.head); + scan(l.head); errorUncaught(); } } @@ -508,7 +850,6 @@ thrown = thrownPrev; } finally { pendingExits = pendingExitsPrev; - alive = alivePrev; caught = caughtPrev; classDef = classDefPrev; lint = lintPrev; @@ -538,11 +879,7 @@ // else we are in an instance initializer block; // leave caught unchanged. - alive = true; - scanStat(tree.body); - - if (alive && tree.sym.type.getReturnType().tag != VOID) - log.error(TreeInfo.diagEndPos(tree.body), "missing.ret.stmt"); + scan(tree.body); List exits = pendingExits.toList(); pendingExits = new ListBuffer(); @@ -575,45 +912,38 @@ } public void visitBlock(JCBlock tree) { - scanStats(tree.stats); + scan(tree.stats); } public void visitDoLoop(JCDoWhileLoop tree) { ListBuffer prevPendingExits = pendingExits; pendingExits = new ListBuffer(); - scanStat(tree.body); - alive |= resolveContinues(tree); + scan(tree.body); + resolveContinues(tree); scan(tree.cond); - alive = alive && !tree.cond.type.isTrue(); - alive |= resolveBreaks(tree, prevPendingExits); + resolveBreaks(tree, prevPendingExits); } public void visitWhileLoop(JCWhileLoop tree) { ListBuffer prevPendingExits = pendingExits; pendingExits = new ListBuffer(); scan(tree.cond); - alive = !tree.cond.type.isFalse(); - scanStat(tree.body); - alive |= resolveContinues(tree); - alive = resolveBreaks(tree, prevPendingExits) || - !tree.cond.type.isTrue(); + scan(tree.body); + resolveContinues(tree); + resolveBreaks(tree, prevPendingExits); } public void visitForLoop(JCForLoop tree) { ListBuffer prevPendingExits = pendingExits; - scanStats(tree.init); + scan(tree.init); pendingExits = new ListBuffer(); if (tree.cond != null) { scan(tree.cond); - alive = !tree.cond.type.isFalse(); - } else { - alive = true; } - scanStat(tree.body); - alive |= resolveContinues(tree); + scan(tree.body); + resolveContinues(tree); scan(tree.step); - alive = resolveBreaks(tree, prevPendingExits) || - tree.cond != null && !tree.cond.type.isTrue(); + resolveBreaks(tree, prevPendingExits); } public void visitForeachLoop(JCEnhancedForLoop tree) { @@ -621,44 +951,30 @@ ListBuffer prevPendingExits = pendingExits; scan(tree.expr); pendingExits = new ListBuffer(); - scanStat(tree.body); - alive |= resolveContinues(tree); + scan(tree.body); + resolveContinues(tree); resolveBreaks(tree, prevPendingExits); - alive = true; } public void visitLabelled(JCLabeledStatement tree) { ListBuffer prevPendingExits = pendingExits; pendingExits = new ListBuffer(); - scanStat(tree.body); - alive |= resolveBreaks(tree, prevPendingExits); + scan(tree.body); + resolveBreaks(tree, prevPendingExits); } public void visitSwitch(JCSwitch tree) { ListBuffer prevPendingExits = pendingExits; pendingExits = new ListBuffer(); scan(tree.selector); - boolean hasDefault = false; for (List l = tree.cases; l.nonEmpty(); l = l.tail) { - alive = true; JCCase c = l.head; - if (c.pat == null) - hasDefault = true; - else + if (c.pat != null) { scan(c.pat); - scanStats(c.stats); - // Warn about fall-through if lint switch fallthrough enabled. - if (alive && - lint.isEnabled(Lint.LintCategory.FALLTHROUGH) && - c.stats.nonEmpty() && l.tail.nonEmpty()) - log.warning(Lint.LintCategory.FALLTHROUGH, - l.tail.head.pos(), - "possible.fall-through.into.case"); + } + scan(c.stats); } - if (!hasDefault) { - alive = true; - } - alive |= resolveBreaks(tree, prevPendingExits); + resolveBreaks(tree, prevPendingExits); } public void visitTry(JCTry tree) { @@ -706,17 +1022,15 @@ } } } - scanStat(tree.body); + scan(tree.body); List thrownInTry = allowImprovedCatchAnalysis ? chk.union(thrown, List.of(syms.runtimeExceptionType, syms.errorType)) : thrown; thrown = thrownPrev; caught = caughtPrev; - boolean aliveEnd = alive; List caughtInTry = List.nil(); for (List l = tree.catchers; l.nonEmpty(); l = l.tail) { - alive = true; JCVariableDecl param = l.head.param; List subClauses = TreeInfo.isMultiCatch(l.head) ? ((JCTypeUnion)l.head.param.vartype).alternatives : @@ -735,26 +1049,18 @@ } scan(param); preciseRethrowTypes.put(param.sym, chk.intersect(ctypes, rethrownTypes)); - scanStat(l.head.body); + scan(l.head.body); preciseRethrowTypes.remove(param.sym); - aliveEnd |= alive; } if (tree.finalizer != null) { List savedThrown = thrown; thrown = List.nil(); ListBuffer exits = pendingExits; pendingExits = prevPendingExits; - alive = true; - scanStat(tree.finalizer); - tree.finallyCanCompleteNormally = alive; - if (!alive) { + scan(tree.finalizer); + if (!tree.finallyCanCompleteNormally) { // discard exits and exceptions from try and finally thrown = chk.union(thrown, thrownPrev); - if (lint.isEnabled(Lint.LintCategory.FINALLY)) { - log.warning(Lint.LintCategory.FINALLY, - TreeInfo.diagEndPos(tree.finalizer), - "finally.cannot.complete"); - } } else { thrown = chk.union(thrown, chk.diff(thrownInTry, caughtInTry)); thrown = chk.union(thrown, savedThrown); @@ -763,11 +1069,9 @@ while (exits.nonEmpty()) { pendingExits.append(exits.next()); } - alive = aliveEnd; } } else { thrown = chk.union(thrown, chk.diff(thrownInTry, caughtInTry)); - alive = aliveEnd; ListBuffer exits = pendingExits; pendingExits = prevPendingExits; while (exits.nonEmpty()) pendingExits.append(exits.next()); @@ -777,14 +1081,9 @@ @Override public void visitIf(JCIf tree) { scan(tree.cond); - scanStat(tree.thenpart); + scan(tree.thenpart); if (tree.elsepart != null) { - boolean aliveAfterThen = alive; - alive = true; - scanStat(tree.elsepart); - alive = alive | aliveAfterThen; - } else { - alive = true; + scan(tree.elsepart); } } @@ -826,7 +1125,6 @@ public void visitReturn(JCReturn tree) { scan(tree.expr); - // if not initial constructor, should markDead instead of recordExit recordExit(tree, new FlowPendingExit(tree, null)); } @@ -898,13 +1196,14 @@ /** Perform definite assignment/unassignment analysis on a tree. */ public void analyzeTree(Env env, TreeMaker make) { + analyzeTree(env, env.tree, make); + } + public void analyzeTree(Env env, JCTree tree, TreeMaker make) { try { attrEnv = env; - JCTree tree = env.tree; Flow.this.make = make; pendingExits = new ListBuffer(); preciseRethrowTypes = new HashMap>(); - alive = true; this.thrown = this.caught = null; this.classDef = null; scan(tree); @@ -921,7 +1220,8 @@ * This pass implements (i) definite assignment analysis, which ensures that * each variable is assigned when used and (ii) definite unassignment analysis, * which ensures that no final variable is assigned more than once. This visitor - * depends on the results of the liveliness analyzer. + * depends on the results of the liveliness analyzer. This pass is also used to mark + * effectively-final local variables/parameters. */ class AssignAnalyzer extends BaseAnalyzer { @@ -972,7 +1272,10 @@ Scope unrefdResources; /** Set when processing a loop body the second time for DU analysis. */ - boolean loopPassTwo = false; + FlowKind flowKind = FlowKind.NORMAL; + + /** The starting position of the analysed tree */ + int startPos; class AssignPendingExit extends BaseAnalyzer.PendingExit { @@ -1004,9 +1307,10 @@ */ boolean trackable(VarSymbol sym) { return - (sym.owner.kind == MTH || + sym.pos >= startPos && + ((sym.owner.kind == MTH || ((sym.flags() & (FINAL | HASINIT | PARAMETER)) == FINAL && - classDef.sym.isEnclosedBy((ClassSymbol)sym.owner))); + classDef.sym.isEnclosedBy((ClassSymbol)sym.owner)))); } /** Initialize new trackable variable by setting its address field @@ -1019,6 +1323,9 @@ System.arraycopy(vars, 0, newvars, 0, nextadr); vars = newvars; } + if ((sym.flags() & FINAL) == 0) { + sym.flags_field |= EFFECTIVELY_FINAL; + } sym.adr = nextadr; vars[nextadr] = sym; inits.excl(nextadr); @@ -1030,7 +1337,17 @@ */ void letInit(DiagnosticPosition pos, VarSymbol sym) { if (sym.adr >= firstadr && trackable(sym)) { - if ((sym.flags() & FINAL) != 0) { + if ((sym.flags() & EFFECTIVELY_FINAL) != 0) { + if (!uninits.isMember(sym.adr)) { + //assignment targeting an effectively final variable + //makes the variable lose its status of effectively final + //if the variable is _not_ definitively unassigned + sym.flags_field &= ~EFFECTIVELY_FINAL; + } else { + uninit(sym); + } + } + else if ((sym.flags() & FINAL) != 0) { if ((sym.flags() & PARAMETER) != 0) { if ((sym.flags() & UNION) != 0) { //multi-catch parameter log.error(pos, "multicatch.parameter.may.not.be.assigned", @@ -1041,18 +1358,9 @@ sym); } } else if (!uninits.isMember(sym.adr)) { - log.error(pos, - loopPassTwo - ? "var.might.be.assigned.in.loop" - : "var.might.already.be.assigned", - sym); - } else if (!inits.isMember(sym.adr)) { - // reachable assignment - uninits.excl(sym.adr); - uninitsTry.excl(sym.adr); + log.error(pos, flowKind.errKey, sym); } else { - //log.rawWarning(pos, "unreachable assignment");//DEBUG - uninits.excl(sym.adr); + uninit(sym); } } inits.incl(sym.adr); @@ -1060,6 +1368,17 @@ log.error(pos, "var.might.already.be.assigned", sym); } } + //where + void uninit(VarSymbol sym) { + if (!inits.isMember(sym.adr)) { + // reachable assignment + uninits.excl(sym.adr); + uninitsTry.excl(sym.adr); + } else { + //log.rawWarning(pos, "unreachable assignment");//DEBUG + uninits.excl(sym.adr); + } + } /** If tree is either a simple name or of the form this.name or * C.this.name, and tree represents a trackable variable, @@ -1308,66 +1627,79 @@ public void visitDoLoop(JCDoWhileLoop tree) { ListBuffer prevPendingExits = pendingExits; - boolean prevLoopPassTwo = loopPassTwo; + FlowKind prevFlowKind = flowKind; + flowKind = FlowKind.NORMAL; + Bits initsSkip = null; + Bits uninitsSkip = null; pendingExits = new ListBuffer(); int prevErrors = log.nerrors; do { Bits uninitsEntry = uninits.dup(); uninitsEntry.excludeFrom(nextadr); - scan(tree.body); - resolveContinues(tree); + scan(tree.body); + resolveContinues(tree); scanCond(tree.cond); + if (!flowKind.isFinal()) { + initsSkip = initsWhenFalse; + uninitsSkip = uninitsWhenFalse; + } if (log.nerrors != prevErrors || - loopPassTwo || + flowKind.isFinal() || uninitsEntry.dup().diffSet(uninitsWhenTrue).nextBit(firstadr)==-1) break; inits = initsWhenTrue; uninits = uninitsEntry.andSet(uninitsWhenTrue); - loopPassTwo = true; + flowKind = FlowKind.SPECULATIVE_LOOP; } while (true); - loopPassTwo = prevLoopPassTwo; - inits = initsWhenFalse; - uninits = uninitsWhenFalse; + flowKind = prevFlowKind; + inits = initsSkip; + uninits = uninitsSkip; resolveBreaks(tree, prevPendingExits); } public void visitWhileLoop(JCWhileLoop tree) { ListBuffer prevPendingExits = pendingExits; - boolean prevLoopPassTwo = loopPassTwo; - Bits initsCond; - Bits uninitsCond; + FlowKind prevFlowKind = flowKind; + flowKind = FlowKind.NORMAL; + Bits initsSkip = null; + Bits uninitsSkip = null; pendingExits = new ListBuffer(); int prevErrors = log.nerrors; + Bits uninitsEntry = uninits.dup(); + uninitsEntry.excludeFrom(nextadr); do { - Bits uninitsEntry = uninits.dup(); - uninitsEntry.excludeFrom(nextadr); scanCond(tree.cond); - initsCond = initsWhenFalse; - uninitsCond = uninitsWhenFalse; + if (!flowKind.isFinal()) { + initsSkip = initsWhenFalse; + uninitsSkip = uninitsWhenFalse; + } inits = initsWhenTrue; uninits = uninitsWhenTrue; scan(tree.body); resolveContinues(tree); if (log.nerrors != prevErrors || - loopPassTwo || + flowKind.isFinal() || uninitsEntry.dup().diffSet(uninits).nextBit(firstadr) == -1) break; uninits = uninitsEntry.andSet(uninits); - loopPassTwo = true; + flowKind = FlowKind.SPECULATIVE_LOOP; } while (true); - loopPassTwo = prevLoopPassTwo; - inits = initsCond; - uninits = uninitsCond; + flowKind = prevFlowKind; + //a variable is DA/DU after the while statement, if it's DA/DU assuming the + //branch is not taken AND if it's DA/DU before any break statement + inits = initsSkip; + uninits = uninitsSkip; resolveBreaks(tree, prevPendingExits); } public void visitForLoop(JCForLoop tree) { ListBuffer prevPendingExits = pendingExits; - boolean prevLoopPassTwo = loopPassTwo; + FlowKind prevFlowKind = flowKind; + flowKind = FlowKind.NORMAL; int nextadrPrev = nextadr; scan(tree.init); - Bits initsCond; - Bits uninitsCond; + Bits initsSkip = null; + Bits uninitsSkip = null; pendingExits = new ListBuffer(); int prevErrors = log.nerrors; do { @@ -1375,29 +1707,33 @@ uninitsEntry.excludeFrom(nextadr); if (tree.cond != null) { scanCond(tree.cond); - initsCond = initsWhenFalse; - uninitsCond = uninitsWhenFalse; + if (!flowKind.isFinal()) { + initsSkip = initsWhenFalse; + uninitsSkip = uninitsWhenFalse; + } inits = initsWhenTrue; uninits = uninitsWhenTrue; - } else { - initsCond = inits.dup(); - initsCond.inclRange(firstadr, nextadr); - uninitsCond = uninits.dup(); - uninitsCond.inclRange(firstadr, nextadr); + } else if (!flowKind.isFinal()) { + initsSkip = inits.dup(); + initsSkip.inclRange(firstadr, nextadr); + uninitsSkip = uninits.dup(); + uninitsSkip.inclRange(firstadr, nextadr); } scan(tree.body); resolveContinues(tree); scan(tree.step); if (log.nerrors != prevErrors || - loopPassTwo || + flowKind.isFinal() || uninitsEntry.dup().diffSet(uninits).nextBit(firstadr) == -1) break; uninits = uninitsEntry.andSet(uninits); - loopPassTwo = true; + flowKind = FlowKind.SPECULATIVE_LOOP; } while (true); - loopPassTwo = prevLoopPassTwo; - inits = initsCond; - uninits = uninitsCond; + flowKind = prevFlowKind; + //a variable is DA/DU after a for loop, if it's DA/DU assuming the + //branch is not taken AND if it's DA/DU before any break statement + inits = initsSkip; + uninits = uninitsSkip; resolveBreaks(tree, prevPendingExits); nextadr = nextadrPrev; } @@ -1406,7 +1742,8 @@ visitVarDef(tree.var); ListBuffer prevPendingExits = pendingExits; - boolean prevLoopPassTwo = loopPassTwo; + FlowKind prevFlowKind = flowKind; + flowKind = FlowKind.NORMAL; int nextadrPrev = nextadr; scan(tree.expr); Bits initsStart = inits.dup(); @@ -1421,13 +1758,13 @@ scan(tree.body); resolveContinues(tree); if (log.nerrors != prevErrors || - loopPassTwo || + flowKind.isFinal() || uninitsEntry.dup().diffSet(uninits).nextBit(firstadr) == -1) break; uninits = uninitsEntry.andSet(uninits); - loopPassTwo = true; + flowKind = FlowKind.SPECULATIVE_LOOP; } while (true); - loopPassTwo = prevLoopPassTwo; + flowKind = prevFlowKind; inits = initsStart; uninits = uninitsStart.andSet(uninits); resolveBreaks(tree, prevPendingExits); @@ -1628,7 +1965,6 @@ public void visitReturn(JCReturn tree) { scanExpr(tree.expr); - // if not initial constructor, should markDead instead of recordExit recordExit(tree, new AssignPendingExit(tree, inits, uninits)); } @@ -1669,7 +2005,9 @@ public void visitAssign(JCAssign tree) { JCTree lhs = TreeInfo.skipParens(tree.lhs); - if (!(lhs instanceof JCIdent)) scanExpr(lhs); + if (!(lhs instanceof JCIdent)) { + scanExpr(lhs); + } scanExpr(tree.rhs); letInit(lhs); } @@ -1751,10 +2089,14 @@ /** Perform definite assignment/unassignment analysis on a tree. */ public void analyzeTree(Env env, TreeMaker make) { + analyzeTree(env, env.tree, make); + } + + public void analyzeTree(Env env, JCTree tree, TreeMaker make) { try { attrEnv = env; - JCTree tree = env.tree; Flow.this.make = make; + startPos = tree.pos().getStartPosition(); inits = new Bits(); uninits = new Bits(); uninitsTry = new Bits(); @@ -1773,6 +2115,7 @@ scan(tree); } finally { // note that recursive invocations of this method fail hard + startPos = -1; inits = uninits = uninitsTry = null; initsWhenTrue = initsWhenFalse = uninitsWhenTrue = uninitsWhenFalse = null; @@ -1787,4 +2130,162 @@ } } } + + /** + * This pass implements the last step of the dataflow analysis, namely + * the effectively-final analysis check. This checks that every local variable + * reference from a lambda body/local inner class is either final or effectively final. + * As effectively final variables are marked as such during DA/DU, this pass must run after + * AssignAnalyzer. + */ + class CaptureAnalyzer extends BaseAnalyzer { + + JCTree currentTree; //local class or lambda + + @Override + void markDead() { + //do nothing + } + + @SuppressWarnings("fallthrough") + void checkEffectivelyFinal(DiagnosticPosition pos, VarSymbol sym) { + if (currentTree != null && + sym.owner.kind == MTH && + sym.pos < currentTree.getStartPosition()) { + switch (currentTree.getTag()) { + case CLASSDEF: + if (!allowEffectivelyFinalInInnerClasses) { + if ((sym.flags() & FINAL) == 0) { + reportInnerClsNeedsFinalError(pos, sym); + } + break; + } + case LAMBDA: + if ((sym.flags() & (EFFECTIVELY_FINAL | FINAL)) == 0) { + reportEffectivelyFinalError(pos, sym); + } + } + } + } + + @SuppressWarnings("fallthrough") + void letInit(JCTree tree) { + tree = TreeInfo.skipParens(tree); + if (tree.hasTag(IDENT) || tree.hasTag(SELECT)) { + Symbol sym = TreeInfo.symbol(tree); + if (currentTree != null && + sym.kind == VAR && + sym.owner.kind == MTH && + ((VarSymbol)sym).pos < currentTree.getStartPosition()) { + switch (currentTree.getTag()) { + case CLASSDEF: + if (!allowEffectivelyFinalInInnerClasses) { + reportInnerClsNeedsFinalError(tree, sym); + break; + } + case LAMBDA: + reportEffectivelyFinalError(tree, sym); + } + } + } + } + + void reportEffectivelyFinalError(DiagnosticPosition pos, Symbol sym) { + String subKey = currentTree.hasTag(LAMBDA) ? + "lambda" : "inner.cls"; + log.error(pos, "cant.ref.non.effectively.final.var", sym, diags.fragment(subKey)); + } + + void reportInnerClsNeedsFinalError(DiagnosticPosition pos, Symbol sym) { + log.error(pos, + "local.var.accessed.from.icls.needs.final", + sym); + } + + /************************************************************************* + * Visitor methods for statements and definitions + *************************************************************************/ + + /* ------------ Visitor methods for various sorts of trees -------------*/ + + public void visitClassDef(JCClassDecl tree) { + JCTree prevTree = currentTree; + try { + currentTree = tree.sym.isLocal() ? tree : null; + super.visitClassDef(tree); + } finally { + currentTree = prevTree; + } + } + + @Override + public void visitLambda(JCLambda tree) { + JCTree prevTree = currentTree; + try { + currentTree = tree; + super.visitLambda(tree); + } finally { + currentTree = prevTree; + } + } + + @Override + public void visitIdent(JCIdent tree) { + if (tree.sym.kind == VAR) { + checkEffectivelyFinal(tree, (VarSymbol)tree.sym); + } + } + + public void visitAssign(JCAssign tree) { + JCTree lhs = TreeInfo.skipParens(tree.lhs); + if (!(lhs instanceof JCIdent)) { + scan(lhs); + } + scan(tree.rhs); + letInit(lhs); + } + + public void visitAssignop(JCAssignOp tree) { + scan(tree.lhs); + scan(tree.rhs); + letInit(tree.lhs); + } + + public void visitUnary(JCUnary tree) { + switch (tree.getTag()) { + case PREINC: case POSTINC: + case PREDEC: case POSTDEC: + scan(tree.arg); + letInit(tree.arg); + break; + default: + scan(tree.arg); + } + } + + public void visitTopLevel(JCCompilationUnit tree) { + // Do nothing for TopLevel since each class is visited individually + } + + /************************************************************************** + * main method + *************************************************************************/ + + /** Perform definite assignment/unassignment analysis on a tree. + */ + public void analyzeTree(Env env, TreeMaker make) { + analyzeTree(env, env.tree, make); + } + public void analyzeTree(Env env, JCTree tree, TreeMaker make) { + try { + attrEnv = env; + Flow.this.make = make; + pendingExits = new ListBuffer(); + scan(tree); + } finally { + pendingExits = null; + Flow.this.make = null; + } + } + } } diff -r 45a1817f956b -r 2aaad794fdd1 src/share/classes/com/sun/tools/javac/comp/Infer.java --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java Fri Aug 03 20:23:20 2012 +0100 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java Fri Aug 24 09:29:21 2012 +0100 @@ -75,12 +75,7 @@ log = Log.instance(context); chk = Check.instance(context); diags = JCDiagnostic.Factory.instance(context); - ambiguousNoInstanceException = - new NoInstanceException(true, diags); - unambiguousNoInstanceException = - new NoInstanceException(false, diags); - invalidInstanceException = - new InvalidInstanceException(diags); + inferenceException = new InferenceException(diags); } @@ -92,28 +87,7 @@ } } - public static class NoInstanceException extends InferenceException { - private static final long serialVersionUID = 1; - - boolean isAmbiguous; // exist several incomparable best instances? - - NoInstanceException(boolean isAmbiguous, JCDiagnostic.Factory diags) { - super(diags); - this.isAmbiguous = isAmbiguous; - } - } - - public static class InvalidInstanceException extends InferenceException { - private static final long serialVersionUID = 2; - - InvalidInstanceException(JCDiagnostic.Factory diags) { - super(diags); - } - } - - private final NoInstanceException ambiguousNoInstanceException; - private final NoInstanceException unambiguousNoInstanceException; - private final InvalidInstanceException invalidInstanceException; + private final InferenceException inferenceException; /*************************************************************************** * Auxiliary type values and classes @@ -144,7 +118,7 @@ /** Instantiate undetermined type variable to its minimal upper bound. * Throw a NoInstanceException if this not possible. */ - void maximizeInst(UndetVar that, Warner warn) throws NoInstanceException { + void maximizeInst(UndetVar that, Warner warn) throws InferenceException { List hibounds = Type.filter(that.hibounds, errorFilter); if (that.eq.isEmpty()) { if (hibounds.isEmpty()) @@ -158,7 +132,7 @@ } if (that.inst == null || that.inst.isErroneous()) - throw ambiguousNoInstanceException + throw inferenceException .setMessage("no.unique.maximal.instance.exists", that.qtype, hibounds); } @@ -173,7 +147,7 @@ /** Instantiate undetermined type variable to the lub of all its lower bounds. * Throw a NoInstanceException if this not possible. */ - void minimizeInst(UndetVar that, Warner warn) throws NoInstanceException { + void minimizeInst(UndetVar that, Warner warn) throws InferenceException { List lobounds = Type.filter(that.lobounds, errorFilter); if (that.eq.isEmpty()) { if (lobounds.isEmpty()) @@ -184,7 +158,7 @@ that.inst = types.lub(lobounds); } if (that.inst == null || that.inst.tag == ERROR) - throw ambiguousNoInstanceException + throw inferenceException .setMessage("no.unique.minimal.instance.exists", that.qtype, lobounds); } else { @@ -228,7 +202,7 @@ Type qtype1 = types.subst(mtype.getReturnType(), tvars, undetvars); if (!types.isSubtype(qtype1, qtype1.tag == UNDETVAR ? types.boxedTypeOrType(to) : to)) { - throw unambiguousNoInstanceException + throw inferenceException .setMessage("infer.no.conforming.instance.exists", tvars, mtype.getReturnType(), to); } @@ -382,17 +356,17 @@ } public InapplicableMethodException arityMismatch() { - return unambiguousNoInstanceException.setMessage("infer.arg.length.mismatch"); + return inferenceException.setMessage("infer.arg.length.mismatch", inferenceVars(undetvars)); } - public InapplicableMethodException argumentMismatch(boolean varargs, Type found, Type expected) { + public InapplicableMethodException argumentMismatch(boolean varargs, JCDiagnostic details) { String key = varargs ? - "infer.varargs.argument.mismatch" : - "infer.no.conforming.assignment.exists"; - return unambiguousNoInstanceException.setMessage(key, - inferenceVars(undetvars), found, expected); + "infer.varargs.argument.mismatch" : + "infer.no.conforming.assignment.exists"; + return inferenceException.setMessage(key, + inferenceVars(undetvars), details); } public InapplicableMethodException inaccessibleVarargs(Symbol location, Type expected) { - return unambiguousNoInstanceException.setMessage("inaccessible.varargs.type", + return inferenceException.setMessage("inaccessible.varargs.type", expected, Kinds.kindName(location), location); } } @@ -405,7 +379,7 @@ } catch (InapplicableMethodException ex) { // inferred method is not applicable - throw invalidInstanceException.setMessage(ex.getDiagnostic()); + throw inferenceException.setMessage(ex.getDiagnostic()); } } @@ -415,7 +389,7 @@ List undetvars, List arguments, Warner warn) - throws InvalidInstanceException { + throws InferenceException { List args = arguments; for (Type t : undetvars) { UndetVar uv = (UndetVar)t; @@ -496,7 +470,7 @@ } //where void reportBoundError(UndetVar uv, BoundErrorKind bk) { - throw bk.setMessage(uv.inst == null ? ambiguousNoInstanceException : invalidInstanceException, uv); + throw bk.setMessage(inferenceException, uv); } /** diff -r 45a1817f956b -r 2aaad794fdd1 src/share/classes/com/sun/tools/javac/comp/Resolve.java --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Fri Aug 03 20:23:20 2012 +0100 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Fri Aug 24 09:29:21 2012 +0100 @@ -550,7 +550,7 @@ /* The number of actuals and formals differ */ InapplicableMethodException arityMismatch(); /* An actual argument type does not conform to the corresponding formal type */ - InapplicableMethodException argumentMismatch(boolean varargs, Type found, Type expected); + InapplicableMethodException argumentMismatch(boolean varargs, JCDiagnostic details); /* The element type of a varargs is not accessible in the current context */ InapplicableMethodException inaccessibleVarargs(Symbol location, Type expected); } @@ -565,12 +565,12 @@ public InapplicableMethodException arityMismatch() { return inapplicableMethodException.setMessage("arg.length.mismatch"); } - public InapplicableMethodException argumentMismatch(boolean varargs, Type found, Type expected) { + public InapplicableMethodException argumentMismatch(boolean varargs, JCDiagnostic details) { String key = varargs ? "varargs.argument.mismatch" : "no.conforming.assignment.exists"; return inapplicableMethodException.setMessage(key, - found, expected); + details); } public InapplicableMethodException inaccessibleVarargs(Symbol location, Type expected) { return inapplicableMethodException.setMessage("inaccessible.varargs.type", @@ -667,12 +667,8 @@ this.rsWarner = rsWarner; } - public void report(DiagnosticPosition pos, Type found, Type req, JCDiagnostic details) { - throw handler.argumentMismatch(useVarargs, found, req); - } - - public Type rawInstantiatePoly(ForAll found, Type req, Warner warn) { - throw new AssertionError("ForAll in argument position"); + public void report(DiagnosticPosition pos, JCDiagnostic details) { + throw handler.argumentMismatch(useVarargs, details); } public Warner checkWarner(DiagnosticPosition pos, Type found, Type req) { diff -r 45a1817f956b -r 2aaad794fdd1 src/share/classes/com/sun/tools/javac/parser/JavacParser.java --- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Fri Aug 03 20:23:20 2012 +0100 +++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Fri Aug 24 09:29:21 2012 +0100 @@ -113,9 +113,9 @@ this.allowMulticatch = source.allowMulticatch(); this.allowStringFolding = fac.options.getBoolean("allowStringFolding", true); this.allowLambda = source.allowLambda() && - fac.options.isSet("allowLambda"); + fac.options.isSet("allowLambda"); //pre-lambda guard this.allowMethodReferences = source.allowMethodReferences() && - fac.options.isSet("allowMethodReferences"); + fac.options.isSet("allowMethodReferences"); //pre-lambda guard this.keepDocComments = keepDocComments; docComments = newDocCommentTable(keepDocComments); this.keepLineMap = keepLineMap; diff -r 45a1817f956b -r 2aaad794fdd1 src/share/classes/com/sun/tools/javac/resources/compiler.properties --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Fri Aug 03 20:23:20 2012 +0100 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Fri Aug 24 09:29:21 2012 +0100 @@ -168,6 +168,14 @@ compiler.err.cant.assign.val.to.final.var=\ cannot assign a value to final variable {0} +# 0: symbol, 1: message segment +compiler.err.cant.ref.non.effectively.final.var=\ + local variables referenced from {1} must be final or effectively final + + +compiler.misc.inner.cls=\ + an inner class + # 0: type compiler.err.cant.deref=\ {0} cannot be dereferenced @@ -1497,14 +1505,8 @@ ##### -# 0: type, 1: type +# 0: message segment compiler.err.prob.found.req=\ - incompatible types\n\ - required: {1}\n\ - found: {0} - -# 0: message segment -compiler.err.prob.found.req.1=\ incompatible types: {0} # 0: message segment, 1: type, 2: type @@ -1517,8 +1519,9 @@ compiler.misc.inconvertible.types=\ {0} cannot be converted to {1} +# 0: type, 1: type compiler.misc.possible.loss.of.precision=\ - possible loss of precision + possible lossy conversion from {0} to {1} compiler.misc.unchecked.assign=\ unchecked conversion @@ -1537,8 +1540,8 @@ # 0: type compiler.misc.try.not.applicable.to.type=\ - try-with-resources not applicable to variable type {0}\n\ - (expected a variable of type java.lang.AutoCloseable) + try-with-resources not applicable to variable type\n\ + ({0}) ##### @@ -1589,16 +1592,20 @@ compiler.misc.infer.no.conforming.instance.exists=\ no instance(s) of type variable(s) {0} exist so that {1} conforms to {2} -# 0: list of type, 1: type, 2: type +# 0: list of type, 1: message segment compiler.misc.infer.no.conforming.assignment.exists=\ - no instance(s) of type variable(s) {0} exist so that argument type {1} conforms to formal parameter type {2} - + cannot infer type-variable(s) {0}\n\ + (argument mismatch; {1}) + +# 0: list of type compiler.misc.infer.arg.length.mismatch=\ - cannot instantiate from arguments because actual and formal argument lists differ in length - -# 0: list of type, 1: type, 2: type + cannot infer type-variable(s) {0}\n\ + (actual and formal argument lists differ in length) + +# 0: list of type, 1: message segment compiler.misc.infer.varargs.argument.mismatch=\ - no instance(s) of type variable(s) {0} exist so that argument type {1} conforms to vararg element type {2} + cannot infer type-variable(s) {0}\n\ + (varargs mismatch; {1}) # 0: type, 1: list of type compiler.misc.inferred.do.not.conform.to.upper.bounds=\ @@ -1637,13 +1644,13 @@ compiler.misc.arg.length.mismatch=\ actual and formal argument lists differ in length -# 0: type, 1: type +# 0: message segment compiler.misc.no.conforming.assignment.exists=\ - actual argument {0} cannot be converted to {1} by method invocation conversion - -# 0: type, 1: type + argument mismatch; {0} + +# 0: message segment compiler.misc.varargs.argument.mismatch=\ - argument type {0} does not conform to vararg element type {1} + varargs mismatch; {0} ##### diff -r 45a1817f956b -r 2aaad794fdd1 src/share/classes/com/sun/tools/javac/tree/TreeInfo.java --- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Fri Aug 03 20:23:20 2012 +0100 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Fri Aug 24 09:29:21 2012 +0100 @@ -308,9 +308,8 @@ return endPos(((JCSynchronized) tree).body); else if (tree.hasTag(TRY)) { JCTry t = (JCTry) tree; - return endPos((t.finalizer != null) - ? t.finalizer - : t.catchers.last().body); + return endPos((t.finalizer != null) ? t.finalizer + : (t.catchers.nonEmpty() ? t.catchers.last().body : t.body)); } else return tree.pos; } diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/6840059/T6840059.out --- a/test/tools/javac/6840059/T6840059.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/6840059/T6840059.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,3 +1,3 @@ -T6840059.java:15:9: compiler.err.cant.apply.symbol.1: kindname.constructor, T6840059, java.lang.Integer, java.lang.String, kindname.class, T6840059, (compiler.misc.no.conforming.assignment.exists: java.lang.String, java.lang.Integer) +T6840059.java:15:9: compiler.err.cant.apply.symbol.1: kindname.constructor, T6840059, java.lang.Integer, java.lang.String, kindname.class, T6840059, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Integer)) T6840059.java:15:25: compiler.err.cant.apply.symbol.1: kindname.constructor, T6840059, java.lang.Integer, compiler.misc.no.args, kindname.class, T6840059, (compiler.misc.arg.length.mismatch) 2 errors diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/6979683/TestCast6979683_BAD34.java.errlog --- a/test/tools/javac/6979683/TestCast6979683_BAD34.java.errlog Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/6979683/TestCast6979683_BAD34.java.errlog Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -TestCast6979683_BAD34.java:34:49: compiler.err.prob.found.req: java.lang.Number, boolean +TestCast6979683_BAD34.java:34:49: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Number, boolean) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/6979683/TestCast6979683_BAD35.java.errlog --- a/test/tools/javac/6979683/TestCast6979683_BAD35.java.errlog Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/6979683/TestCast6979683_BAD35.java.errlog Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -TestCast6979683_BAD35.java:35:45: compiler.err.prob.found.req: java.lang.Number, int +TestCast6979683_BAD35.java:35:45: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Number, int) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/6979683/TestCast6979683_BAD36.java.errlog --- a/test/tools/javac/6979683/TestCast6979683_BAD36.java.errlog Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/6979683/TestCast6979683_BAD36.java.errlog Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -TestCast6979683_BAD36.java:36:58: compiler.err.prob.found.req: java.lang.Comparable, int +TestCast6979683_BAD36.java:36:58: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Comparable, int) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/6979683/TestCast6979683_BAD37.java.errlog --- a/test/tools/javac/6979683/TestCast6979683_BAD37.java.errlog Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/6979683/TestCast6979683_BAD37.java.errlog Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -TestCast6979683_BAD37.java:37:61: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: java.lang.Comparable, int) +TestCast6979683_BAD37.java:37:61: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Comparable, int) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/6979683/TestCast6979683_BAD38.java.errlog --- a/test/tools/javac/6979683/TestCast6979683_BAD38.java.errlog Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/6979683/TestCast6979683_BAD38.java.errlog Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -TestCast6979683_BAD38.java:38:62: compiler.err.prob.found.req: java.lang.Comparable, float +TestCast6979683_BAD38.java:38:62: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Comparable, float) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/6979683/TestCast6979683_BAD39.java.errlog --- a/test/tools/javac/6979683/TestCast6979683_BAD39.java.errlog Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/6979683/TestCast6979683_BAD39.java.errlog Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -TestCast6979683_BAD39.java:39:53: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: java.lang.Number, char) +TestCast6979683_BAD39.java:39:53: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Number, char) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/7132880/T7132880.out --- a/test/tools/javac/7132880/T7132880.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/7132880/T7132880.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,4 +1,4 @@ -T7132880.java:23:12: compiler.err.cant.apply.symbol.1: kindname.method, m1, java.lang.Integer, java.lang.String, kindname.class, Outer.Inner1, (compiler.misc.no.conforming.assignment.exists: java.lang.String, java.lang.Integer) -T7132880.java:33:12: compiler.err.cant.apply.symbols: kindname.method, m1, java.lang.String,{(compiler.misc.inapplicable.method: kindname.method, Outer.Inner2, m1(java.lang.Double), (compiler.misc.no.conforming.assignment.exists: java.lang.String, java.lang.Double)),(compiler.misc.inapplicable.method: kindname.method, Outer.Inner2, m1(java.lang.Integer), (compiler.misc.no.conforming.assignment.exists: java.lang.String, java.lang.Integer))} +T7132880.java:23:12: compiler.err.cant.apply.symbol.1: kindname.method, m1, java.lang.Integer, java.lang.String, kindname.class, Outer.Inner1, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Integer)) +T7132880.java:33:12: compiler.err.cant.apply.symbols: kindname.method, m1, java.lang.String,{(compiler.misc.inapplicable.method: kindname.method, Outer.Inner2, m1(java.lang.Double), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Double))),(compiler.misc.inapplicable.method: kindname.method, Outer.Inner2, m1(java.lang.Integer), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Integer)))} T7132880.java:43:12: compiler.err.ref.ambiguous: m2, kindname.method, m2(java.lang.Object,int), Outer.Inner3, kindname.method, m2(int,java.lang.Object), Outer.Inner3 3 errors diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/Diagnostics/6722234/T6722234a_1.out --- a/test/tools/javac/Diagnostics/6722234/T6722234a_1.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/Diagnostics/6722234/T6722234a_1.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -T6722234a.java:12:9: compiler.err.cant.apply.symbol.1: kindname.method, m, compiler.misc.type.var: T, 1, compiler.misc.type.var: T, 2, kindname.class, T6722234a, (compiler.misc.no.conforming.assignment.exists: compiler.misc.type.var: T, 2, compiler.misc.type.var: T, 1) +T6722234a.java:12:9: compiler.err.cant.apply.symbol.1: kindname.method, m, compiler.misc.type.var: T, 1, compiler.misc.type.var: T, 2, kindname.class, T6722234a, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: compiler.misc.type.var: T, 2, compiler.misc.type.var: T, 1)) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/Diagnostics/6722234/T6722234a_2.out --- a/test/tools/javac/Diagnostics/6722234/T6722234a_2.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/Diagnostics/6722234/T6722234a_2.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,3 +1,3 @@ -T6722234a.java:12:9: compiler.err.cant.apply.symbol.1: kindname.method, m, compiler.misc.type.var: T, 1, compiler.misc.type.var: T, 2, kindname.class, T6722234a, (compiler.misc.no.conforming.assignment.exists: compiler.misc.type.var: T, 2, compiler.misc.type.var: T, 1) +T6722234a.java:12:9: compiler.err.cant.apply.symbol.1: kindname.method, m, compiler.misc.type.var: T, 1, compiler.misc.type.var: T, 2, kindname.class, T6722234a, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: compiler.misc.type.var: T, 2, compiler.misc.type.var: T, 1)) - compiler.misc.where.description.typevar.1: compiler.misc.type.var: T, 1,compiler.misc.type.var: T, 2,{(compiler.misc.where.typevar: compiler.misc.type.var: T, 1, java.lang.String, kindname.class, T6722234a),(compiler.misc.where.typevar: compiler.misc.type.var: T, 2, java.lang.Integer, kindname.method, test(compiler.misc.type.var: T, 2))} 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/Diagnostics/6722234/T6722234c.out --- a/test/tools/javac/Diagnostics/6722234/T6722234c.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/Diagnostics/6722234/T6722234c.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -T6722234c.java:14:9: compiler.err.cant.apply.symbol.1: kindname.method, m, T6722234c.String, java.lang.String, kindname.class, T6722234c, (compiler.misc.infer.no.conforming.assignment.exists: T, java.lang.String, T6722234c.String) +T6722234c.java:14:9: compiler.err.cant.apply.symbol.1: kindname.method, m, T6722234c.String, java.lang.String, kindname.class, T6722234c, (compiler.misc.infer.no.conforming.assignment.exists: T, (compiler.misc.inconvertible.types: java.lang.String, T6722234c.String)) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/Diagnostics/6722234/T6722234d_1.out --- a/test/tools/javac/Diagnostics/6722234/T6722234d_1.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/Diagnostics/6722234/T6722234d_1.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,3 +1,3 @@ -T6722234d.java:18:20: compiler.err.prob.found.req: compiler.misc.intersection.type: 1, T6722234d.A +T6722234d.java:18:20: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: compiler.misc.intersection.type: 1, T6722234d.A) - compiler.misc.where.description.intersection: compiler.misc.intersection.type: 1,{(compiler.misc.where.intersection: compiler.misc.intersection.type: 1, java.lang.Object,T6722234d.I1,T6722234d.I2)} 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/Diagnostics/6722234/T6722234d_2.out --- a/test/tools/javac/Diagnostics/6722234/T6722234d_2.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/Diagnostics/6722234/T6722234d_2.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,3 +1,3 @@ -T6722234d.java:18:20: compiler.err.prob.found.req: compiler.misc.intersection.type: 1, T6722234d.A +T6722234d.java:18:20: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: compiler.misc.intersection.type: 1, T6722234d.A) - compiler.misc.where.description.intersection: compiler.misc.intersection.type: 1,{(compiler.misc.where.intersection: compiler.misc.intersection.type: 1, Object,I1,I2)} 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/Diagnostics/6799605/T6799605.out --- a/test/tools/javac/Diagnostics/6799605/T6799605.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/Diagnostics/6799605/T6799605.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,4 +1,4 @@ -T6799605.java:17:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605,{(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605,T6799605), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605), (compiler.misc.inferred.do.not.conform.to.upper.bounds: compiler.misc.type.captureof: 1, ?, T6799605))} -T6799605.java:18:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605,T6799605,{(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605,T6799605), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 2, ?, compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605), (compiler.misc.infer.arg.length.mismatch))} -T6799605.java:19:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605,T6799605,T6799605,{(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605,T6799605), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 3, ?, compiler.misc.type.captureof: 3, ?,compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605), (compiler.misc.infer.arg.length.mismatch))} +T6799605.java:17:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605,{(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605,T6799605), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605), (compiler.misc.inferred.do.not.conform.to.upper.bounds: compiler.misc.type.captureof: 1, ?, T6799605))} +T6799605.java:18:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605,T6799605,{(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605,T6799605), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 2, ?, compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605), (compiler.misc.infer.arg.length.mismatch: T))} +T6799605.java:19:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605,T6799605,T6799605,{(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605,T6799605), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 3, ?, compiler.misc.type.captureof: 3, ?,compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605), (compiler.misc.infer.arg.length.mismatch: T))} 3 errors diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/Diagnostics/6862608/T6862608a.out --- a/test/tools/javac/Diagnostics/6862608/T6862608a.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/Diagnostics/6862608/T6862608a.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,3 +1,3 @@ -T6862608a.java:19:33: compiler.err.cant.apply.symbol.1: kindname.method, compound, java.lang.Iterable>, java.util.List>, kindname.class, T6862608a, (compiler.misc.infer.no.conforming.assignment.exists: T, java.util.List>, java.lang.Iterable>) +T6862608a.java:19:33: compiler.err.cant.apply.symbol.1: kindname.method, compound, java.lang.Iterable>, java.util.List>, kindname.class, T6862608a, (compiler.misc.infer.no.conforming.assignment.exists: T, (compiler.misc.inconvertible.types: java.util.List>, java.lang.Iterable>)) - compiler.misc.where.description.typevar: T,{(compiler.misc.where.typevar: T, java.lang.Object, kindname.method, compound(java.lang.Iterable>))} 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/Diagnostics/6862608/T6862608b.out --- a/test/tools/javac/Diagnostics/6862608/T6862608b.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/Diagnostics/6862608/T6862608b.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,3 +1,3 @@ -T6862608b.java:11:7: compiler.err.cant.apply.symbol.1: kindname.method, test, compiler.misc.type.var: T, 1, compiler.misc.type.var: T, 2, kindname.class, T66862608b, (compiler.misc.no.conforming.assignment.exists: compiler.misc.type.var: T, 2, compiler.misc.type.var: T, 1) +T6862608b.java:11:7: compiler.err.cant.apply.symbol.1: kindname.method, test, compiler.misc.type.var: T, 1, compiler.misc.type.var: T, 2, kindname.class, T66862608b, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: compiler.misc.type.var: T, 2, compiler.misc.type.var: T, 1)) - compiler.misc.where.description.typevar.1: compiler.misc.type.var: T, 1,compiler.misc.type.var: T, 2,compiler.misc.type.var: S, 1,compiler.misc.type.var: S, 2,{(compiler.misc.where.typevar: compiler.misc.type.var: T, 1, java.lang.String, kindname.class, T66862608b),(compiler.misc.where.typevar: compiler.misc.type.var: T, 2, compiler.misc.type.var: S, 1, kindname.method, foo(compiler.misc.type.var: T, 2)),(compiler.misc.where.typevar: compiler.misc.type.var: S, 1, java.lang.Object, kindname.method, foo(compiler.misc.type.var: T, 2)),(compiler.misc.where.typevar: compiler.misc.type.var: S, 2, java.lang.Object, kindname.class, T66862608b)} 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/OverrideChecks/6400189/T6400189a.out --- a/test/tools/javac/OverrideChecks/6400189/T6400189a.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/OverrideChecks/6400189/T6400189a.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,4 +1,4 @@ T6400189a.java:14:35: compiler.warn.unchecked.call.mbr.of.raw.type: getAnnotation(java.lang.Class), java.lang.reflect.Constructor -T6400189a.java:14:35: compiler.err.prob.found.req: java.lang.annotation.Annotation, java.lang.annotation.Documented +T6400189a.java:14:35: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.annotation.Annotation, java.lang.annotation.Documented) 1 error 1 warning diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/OverrideChecks/6400189/T6400189b.out --- a/test/tools/javac/OverrideChecks/6400189/T6400189b.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/OverrideChecks/6400189/T6400189b.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,4 +1,4 @@ T6400189b.java:24:24: compiler.warn.unchecked.call.mbr.of.raw.type: m(T6400189b), T6400189b.B -T6400189b.java:24:24: compiler.err.prob.found.req: java.lang.Object, java.lang.Integer +T6400189b.java:24:24: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Object, java.lang.Integer) 1 error 1 warning diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/StringsInSwitch/BadlyTypedLabel1.out --- a/test/tools/javac/StringsInSwitch/BadlyTypedLabel1.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/StringsInSwitch/BadlyTypedLabel1.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -BadlyTypedLabel1.java:13:14: compiler.err.prob.found.req: int, java.lang.String +BadlyTypedLabel1.java:13:14: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, java.lang.String) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/StringsInSwitch/BadlyTypedLabel2.out --- a/test/tools/javac/StringsInSwitch/BadlyTypedLabel2.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/StringsInSwitch/BadlyTypedLabel2.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -BadlyTypedLabel2.java:15:14: compiler.err.prob.found.req: java.math.RoundingMode, java.lang.String +BadlyTypedLabel2.java:15:14: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.math.RoundingMode, java.lang.String) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/T6326754.out --- a/test/tools/javac/T6326754.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/T6326754.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,6 +1,6 @@ T6326754.java:44:12: compiler.err.name.clash.same.erasure: TestConstructor(T), TestConstructor(K) T6326754.java:52:17: compiler.err.name.clash.same.erasure: setT(K), setT(T) -T6326754.java:64:18: compiler.err.prob.found.req: T, T +T6326754.java:64:18: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T, T) T6326754.java:70:11: compiler.err.cant.apply.symbol.1: kindname.method, setT, java.lang.Object, compiler.misc.no.args, kindname.class, TestC, (compiler.misc.arg.length.mismatch) - compiler.note.unchecked.filename: T6326754.java - compiler.note.unchecked.recompile diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/TryWithResources/T7178324.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/TryWithResources/T7178324.java Fri Aug 24 09:29:21 2012 +0100 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7178324 + * @summary Crash when compiling for(i : x) try(AutoCloseable x = ...) {} + * @compile T7178324.java + */ + +import java.io.File; +import java.io.FileInputStream; +import java.util.ArrayList; +import java.util.List; + +class T7178324 { + public static void main(String[] args) throws Exception { + List files = new ArrayList<>(); + for (File f : files) + try (FileInputStream is = new FileInputStream(f)) { + } + } +} diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/TryWithResources/TwrOnNonResource.out --- a/test/tools/javac/TryWithResources/TwrOnNonResource.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/TryWithResources/TwrOnNonResource.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,4 +1,4 @@ -TwrOnNonResource.java:12:30: compiler.err.prob.found.req.1: (compiler.misc.try.not.applicable.to.type: TwrOnNonResource) -TwrOnNonResource.java:15:30: compiler.err.prob.found.req.1: (compiler.misc.try.not.applicable.to.type: TwrOnNonResource) -TwrOnNonResource.java:18:30: compiler.err.prob.found.req.1: (compiler.misc.try.not.applicable.to.type: TwrOnNonResource) +TwrOnNonResource.java:12:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable)) +TwrOnNonResource.java:15:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable)) +TwrOnNonResource.java:18:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable)) 3 errors diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/cast/6270087/T6270087neg.out --- a/test/tools/javac/cast/6270087/T6270087neg.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/cast/6270087/T6270087neg.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -T6270087neg.java:36:29: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6270087neg.Foo, T6270087neg.Foo) +T6270087neg.java:36:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T6270087neg.Foo, T6270087neg.Foo) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/cast/6557182/T6557182.out --- a/test/tools/javac/cast/6557182/T6557182.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/cast/6557182/T6557182.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,4 +1,4 @@ -T6557182.java:12:56: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T, java.lang.Comparable) +T6557182.java:12:56: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T, java.lang.Comparable) T6557182.java:16:56: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), T, java.lang.Comparable 1 error 1 warning diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/cast/6665356/T6665356.out --- a/test/tools/javac/cast/6665356/T6665356.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/cast/6665356/T6665356.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,8 +1,8 @@ -T6665356.java:31:55: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer.Inner, T6665356.Outer.Inner) -T6665356.java:35:58: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer.Inner, T6665356.Outer.Inner) -T6665356.java:39:65: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer.Inner, T6665356.Outer.Inner) -T6665356.java:43:57: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer.Inner, T6665356.Outer.Inner) -T6665356.java:47:60: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer.Inner, T6665356.Outer.Inner) -T6665356.java:51:55: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer.Inner, T6665356.Outer.Inner) -T6665356.java:55:58: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer.Inner, T6665356.Outer.Inner) +T6665356.java:31:55: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T6665356.Outer.Inner, T6665356.Outer.Inner) +T6665356.java:35:58: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T6665356.Outer.Inner, T6665356.Outer.Inner) +T6665356.java:39:65: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T6665356.Outer.Inner, T6665356.Outer.Inner) +T6665356.java:43:57: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T6665356.Outer.Inner, T6665356.Outer.Inner) +T6665356.java:47:60: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T6665356.Outer.Inner, T6665356.Outer.Inner) +T6665356.java:51:55: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T6665356.Outer.Inner, T6665356.Outer.Inner) +T6665356.java:55:58: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T6665356.Outer.Inner, T6665356.Outer.Inner) 7 errors diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/cast/6795580/T6795580.out --- a/test/tools/javac/cast/6795580/T6795580.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/cast/6795580/T6795580.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,8 +1,8 @@ -T6795580.java:31:57: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer.Inner[], T6795580.Outer.Inner[]) -T6795580.java:35:60: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer.Inner[], T6795580.Outer.Inner[]) -T6795580.java:39:67: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer.Inner[], T6795580.Outer.Inner[]) -T6795580.java:43:59: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer.Inner[], T6795580.Outer.Inner[]) -T6795580.java:47:62: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer.Inner[], T6795580.Outer.Inner[]) -T6795580.java:51:57: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer.Inner[], T6795580.Outer.Inner[]) -T6795580.java:55:60: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer.Inner[], T6795580.Outer.Inner[]) +T6795580.java:31:57: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T6795580.Outer.Inner[], T6795580.Outer.Inner[]) +T6795580.java:35:60: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T6795580.Outer.Inner[], T6795580.Outer.Inner[]) +T6795580.java:39:67: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T6795580.Outer.Inner[], T6795580.Outer.Inner[]) +T6795580.java:43:59: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T6795580.Outer.Inner[], T6795580.Outer.Inner[]) +T6795580.java:47:62: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T6795580.Outer.Inner[], T6795580.Outer.Inner[]) +T6795580.java:51:57: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T6795580.Outer.Inner[], T6795580.Outer.Inner[]) +T6795580.java:55:60: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T6795580.Outer.Inner[], T6795580.Outer.Inner[]) 7 errors diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/cast/6932571/T6932571neg.out --- a/test/tools/javac/cast/6932571/T6932571neg.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/cast/6932571/T6932571neg.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -T6932571neg.java:39:19: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6932571neg.S, G) +T6932571neg.java:39:19: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T6932571neg.S, G) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/cast/7005095/T7005095neg.out --- a/test/tools/javac/cast/7005095/T7005095neg.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/cast/7005095/T7005095neg.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -T7005095neg.java:13:25: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T7005095pos.FooImpl, T7005095pos.Foo) +T7005095neg.java:13:25: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T7005095pos.FooImpl, T7005095pos.Foo) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/cast/7005671/T7005671.out --- a/test/tools/javac/cast/7005671/T7005671.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/cast/7005671/T7005671.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,17 +1,17 @@ -T7005671.java:12:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: byte[], X[]) -T7005671.java:13:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: short[], X[]) -T7005671.java:14:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: int[], X[]) -T7005671.java:15:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: long[], X[]) -T7005671.java:16:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: float[], X[]) -T7005671.java:17:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: double[], X[]) -T7005671.java:18:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: char[], X[]) -T7005671.java:19:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: boolean[], X[]) -T7005671.java:23:29: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], byte[]) -T7005671.java:24:30: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], short[]) -T7005671.java:25:28: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], int[]) -T7005671.java:26:29: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], long[]) -T7005671.java:27:30: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], float[]) -T7005671.java:28:31: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], double[]) -T7005671.java:29:29: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], char[]) -T7005671.java:30:32: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], boolean[]) +T7005671.java:12:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: byte[], X[]) +T7005671.java:13:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: short[], X[]) +T7005671.java:14:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int[], X[]) +T7005671.java:15:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: long[], X[]) +T7005671.java:16:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: float[], X[]) +T7005671.java:17:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: double[], X[]) +T7005671.java:18:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: char[], X[]) +T7005671.java:19:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: boolean[], X[]) +T7005671.java:23:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: X[], byte[]) +T7005671.java:24:30: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: X[], short[]) +T7005671.java:25:28: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: X[], int[]) +T7005671.java:26:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: X[], long[]) +T7005671.java:27:30: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: X[], float[]) +T7005671.java:28:31: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: X[], double[]) +T7005671.java:29:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: X[], char[]) +T7005671.java:30:32: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: X[], boolean[]) 16 errors diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/diags/examples/CantApplyDiamond1.java --- a/test/tools/javac/diags/examples/CantApplyDiamond1.java Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/diags/examples/CantApplyDiamond1.java Fri Aug 24 09:29:21 2012 +0100 @@ -21,7 +21,7 @@ * questions. */ -// key: compiler.err.prob.found.req.1 +// key: compiler.err.prob.found.req // key: compiler.misc.cant.apply.diamond.1 // key: compiler.misc.inferred.do.not.conform.to.upper.bounds // key: compiler.misc.diamond diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/diags/examples/CantRefNonEffectivelyFinalVar.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/CantRefNonEffectivelyFinalVar.java Fri Aug 24 09:29:21 2012 +0100 @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.err.cant.ref.non.effectively.final.var +// key: compiler.misc.inner.cls +// options: -XDallowEffectivelyFinalInInnerClasses + +class CantRefNonEffectivelyFinalVar { + void test() { + int i = 0; + new Object() { int j = i; }; + i = 2; + } +} diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/diags/examples/IncompatibleTypes1.java --- a/test/tools/javac/diags/examples/IncompatibleTypes1.java Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/diags/examples/IncompatibleTypes1.java Fri Aug 24 09:29:21 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ // key: compiler.misc.infer.no.conforming.instance.exists -// key: compiler.err.cant.apply.symbol.1 +// key: compiler.err.prob.found.req class IncompatibleTypes1 { IncompatibleTypes1 m() { diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/diags/examples/InconvertibleTypes.java --- a/test/tools/javac/diags/examples/InconvertibleTypes.java Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/diags/examples/InconvertibleTypes.java Fri Aug 24 09:29:21 2012 +0100 @@ -22,7 +22,7 @@ */ // key: compiler.misc.inconvertible.types -// key: compiler.err.prob.found.req.1 +// key: compiler.err.prob.found.req class InconvertibleTypes { class Outer { diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/diags/examples/InferNoConformingAssignment.java --- a/test/tools/javac/diags/examples/InferNoConformingAssignment.java Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/diags/examples/InferNoConformingAssignment.java Fri Aug 24 09:29:21 2012 +0100 @@ -22,6 +22,7 @@ */ // key: compiler.err.cant.apply.symbol.1 +// key: compiler.misc.inconvertible.types // key: compiler.misc.infer.no.conforming.assignment.exists import java.util.*; diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/diags/examples/InferVarargsArgumentMismatch.java --- a/test/tools/javac/diags/examples/InferVarargsArgumentMismatch.java Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/diags/examples/InferVarargsArgumentMismatch.java Fri Aug 24 09:29:21 2012 +0100 @@ -23,6 +23,7 @@ // key: compiler.err.cant.apply.symbol.1 // key: compiler.misc.infer.varargs.argument.mismatch +// key: compiler.misc.inconvertible.types class InferVarargsArgumentMismatch { void m(X x1, String... xs) {} diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/diags/examples/InferredDoNotConformToLower.java --- a/test/tools/javac/diags/examples/InferredDoNotConformToLower.java Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/diags/examples/InferredDoNotConformToLower.java Fri Aug 24 09:29:21 2012 +0100 @@ -21,7 +21,7 @@ * questions. */ -// key: compiler.err.cant.apply.symbol.1 +// key: compiler.err.prob.found.req // key: compiler.misc.inferred.do.not.conform.to.lower.bounds import java.util.*; diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/diags/examples/KindnameConstructor.java --- a/test/tools/javac/diags/examples/KindnameConstructor.java Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/diags/examples/KindnameConstructor.java Fri Aug 24 09:29:21 2012 +0100 @@ -27,6 +27,7 @@ // key: compiler.err.cant.apply.symbol.1 // key: compiler.misc.arg.length.mismatch // key: compiler.misc.no.conforming.assignment.exists +// key: compiler.misc.inconvertible.types // key: compiler.misc.count.error.plural // key: compiler.err.error // run: backdoor diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/diags/examples/NoUniqueMaximalInstance.java --- a/test/tools/javac/diags/examples/NoUniqueMaximalInstance.java Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/diags/examples/NoUniqueMaximalInstance.java Fri Aug 24 09:29:21 2012 +0100 @@ -21,7 +21,7 @@ * questions. */ -// key: compiler.err.cant.apply.symbol.1 +// key: compiler.err.prob.found.req // key: compiler.misc.no.unique.maximal.instance.exists class NoUniqueMaximalInstance { diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/diags/examples/NotApplicableMethodFound.java --- a/test/tools/javac/diags/examples/NotApplicableMethodFound.java Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/diags/examples/NotApplicableMethodFound.java Fri Aug 24 09:29:21 2012 +0100 @@ -25,6 +25,7 @@ // key: compiler.note.verbose.resolve.multi.1 // key: compiler.err.cant.apply.symbol.1 // key: compiler.misc.no.conforming.assignment.exists +// key: compiler.misc.inconvertible.types // options: -XDverboseResolution=inapplicable,failure class NotApplicableMethodFound { diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/diags/examples/PossibleLossPrecision.java --- a/test/tools/javac/diags/examples/PossibleLossPrecision.java Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/diags/examples/PossibleLossPrecision.java Fri Aug 24 09:29:21 2012 +0100 @@ -22,7 +22,7 @@ */ // key: compiler.misc.possible.loss.of.precision -// key: compiler.err.prob.found.req.1 +// key: compiler.err.prob.found.req class PossibleLossPrecision { long l; diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/diags/examples/ResourceNotApplicableToType.java --- a/test/tools/javac/diags/examples/ResourceNotApplicableToType.java Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/diags/examples/ResourceNotApplicableToType.java Fri Aug 24 09:29:21 2012 +0100 @@ -22,7 +22,8 @@ */ // key: compiler.misc.try.not.applicable.to.type -// key: compiler.err.prob.found.req.1 +// key: compiler.err.prob.found.req +// key: compiler.misc.inconvertible.types class ResourceNotApplicableToType { void m() { diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/diags/examples/VarargsArgumentMismatch.java --- a/test/tools/javac/diags/examples/VarargsArgumentMismatch.java Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/diags/examples/VarargsArgumentMismatch.java Fri Aug 24 09:29:21 2012 +0100 @@ -23,6 +23,7 @@ // key: compiler.err.cant.apply.symbol.1 // key: compiler.misc.varargs.argument.mismatch +// key: compiler.misc.inconvertible.types class VarargsArgumentMismatch { void m(String s, Integer... is) {} diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/diags/examples/VerboseResolveMulti1.java --- a/test/tools/javac/diags/examples/VerboseResolveMulti1.java Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/diags/examples/VerboseResolveMulti1.java Fri Aug 24 09:29:21 2012 +0100 @@ -25,6 +25,7 @@ // key: compiler.note.verbose.resolve.multi.1 // key: compiler.err.cant.apply.symbol.1 // key: compiler.misc.no.conforming.assignment.exists +// key: compiler.misc.inconvertible.types // options: -XDverboseResolution=inapplicable,failure class VerboseResolveMulti1 { diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/diags/examples/WhereFreshTvar.java --- a/test/tools/javac/diags/examples/WhereFreshTvar.java Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/diags/examples/WhereFreshTvar.java Fri Aug 24 09:29:21 2012 +0100 @@ -23,8 +23,7 @@ // key: compiler.misc.where.fresh.typevar // key: compiler.misc.where.description.typevar -// key: compiler.err.cant.apply.symbol.1 -// key: compiler.misc.no.args +// key: compiler.err.prob.found.req // key: compiler.misc.inferred.do.not.conform.to.upper.bounds // options: -XDdiags=where,simpleNames // run: simple diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/diags/examples/WhereIntersection.java --- a/test/tools/javac/diags/examples/WhereIntersection.java Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/diags/examples/WhereIntersection.java Fri Aug 24 09:29:21 2012 +0100 @@ -25,6 +25,7 @@ // key: compiler.misc.where.description.intersection // key: compiler.misc.intersection.type // key: compiler.err.prob.found.req +// key: compiler.misc.inconvertible.types // options: -XDdiags=where // run: simple diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/diags/examples/WhereTypeVar.java --- a/test/tools/javac/diags/examples/WhereTypeVar.java Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/diags/examples/WhereTypeVar.java Fri Aug 24 09:29:21 2012 +0100 @@ -26,6 +26,7 @@ // key: compiler.misc.type.var // key: compiler.err.cant.apply.symbol.1 // key: compiler.misc.no.conforming.assignment.exists +// key: compiler.misc.inconvertible.types // options: -XDdiags=where,disambiguateTvars // run: simple diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/generics/6207386/T6207386.out --- a/test/tools/javac/generics/6207386/T6207386.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/generics/6207386/T6207386.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -T6207386.java:13:30: compiler.err.prob.found.req: X, T6207386.F +T6207386.java:13:30: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: X, T6207386.F) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/generics/diamond/neg/Neg05.out --- a/test/tools/javac/generics/diamond/neg/Neg05.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/generics/diamond/neg/Neg05.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,19 +1,19 @@ Neg05.java:19:48: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:19:35: compiler.err.prob.found.req: Neg05.Foo, Neg05.Foo +Neg05.java:19:35: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg05.Foo, Neg05.Foo) Neg05.java:20:58: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:20:45: compiler.err.prob.found.req: Neg05.Foo, Neg05.Foo +Neg05.java:20:45: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg05.Foo, Neg05.Foo) Neg05.java:21:43: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:21:30: compiler.err.prob.found.req: Neg05.Foo, Neg05.Foo +Neg05.java:21:30: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg05.Foo, Neg05.Foo) Neg05.java:22:56: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:22:43: compiler.err.prob.found.req: Neg05.Foo, Neg05.Foo +Neg05.java:22:43: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg05.Foo, Neg05.Foo) Neg05.java:24:48: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:24:35: compiler.err.prob.found.req: Neg05.Foo, Neg05.Foo +Neg05.java:24:35: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg05.Foo, Neg05.Foo) Neg05.java:25:58: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:25:45: compiler.err.prob.found.req: Neg05.Foo, Neg05.Foo +Neg05.java:25:45: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg05.Foo, Neg05.Foo) Neg05.java:26:43: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:26:30: compiler.err.prob.found.req: Neg05.Foo, Neg05.Foo +Neg05.java:26:30: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg05.Foo, Neg05.Foo) Neg05.java:27:56: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:27:43: compiler.err.prob.found.req: Neg05.Foo, Neg05.Foo +Neg05.java:27:43: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg05.Foo, Neg05.Foo) Neg05.java:31:37: compiler.err.improperly.formed.type.inner.raw.param Neg05.java:32:47: compiler.err.improperly.formed.type.inner.raw.param Neg05.java:33:32: compiler.err.improperly.formed.type.inner.raw.param diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/generics/diamond/neg/Neg06.out --- a/test/tools/javac/generics/diamond/neg/Neg06.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/generics/diamond/neg/Neg06.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -Neg06.java:16:37: compiler.err.prob.found.req.1: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number)) +Neg06.java:16:37: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number)) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/generics/diamond/neg/Neg10.out --- a/test/tools/javac/generics/diamond/neg/Neg10.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/generics/diamond/neg/Neg10.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -Neg10.java:16:22: compiler.err.prob.found.req: Neg10.Foo, Neg10.Foo +Neg10.java:16:22: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg10.Foo, Neg10.Foo) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/generics/inference/6315770/T6315770.out --- a/test/tools/javac/generics/inference/6315770/T6315770.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/generics/inference/6315770/T6315770.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,3 +1,3 @@ -T6315770.java:16:42: compiler.err.cant.apply.symbol.1: kindname.method, m, compiler.misc.no.args, compiler.misc.no.args, kindname.class, T6315770, (compiler.misc.no.unique.maximal.instance.exists: T, java.lang.String,java.lang.Integer,java.lang.Runnable) -T6315770.java:17:40: compiler.err.cant.apply.symbol.1: kindname.method, m, compiler.misc.no.args, compiler.misc.no.args, kindname.class, T6315770, (compiler.misc.inferred.do.not.conform.to.lower.bounds: java.lang.Integer&java.lang.Runnable, java.lang.String) +T6315770.java:16:42: compiler.err.prob.found.req: (compiler.misc.no.unique.maximal.instance.exists: T, java.lang.String,java.lang.Integer,java.lang.Runnable) +T6315770.java:17:40: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.lower.bounds: java.lang.Integer&java.lang.Runnable, java.lang.String) 2 errors diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/generics/inference/6611449/T6611449.out --- a/test/tools/javac/generics/inference/6611449/T6611449.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/generics/inference/6611449/T6611449.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,5 +1,5 @@ -T6611449.java:18:9: compiler.err.cant.apply.symbols: kindname.constructor, T6611449, int,{(compiler.misc.inapplicable.method: kindname.constructor, T6611449, T6611449(T,T), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T6611449, T6611449(T), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, S))} -T6611449.java:19:9: compiler.err.cant.apply.symbols: kindname.constructor, T6611449, int,int,{(compiler.misc.inapplicable.method: kindname.constructor, T6611449, T6611449(T,T), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, S)),(compiler.misc.inapplicable.method: kindname.constructor, T6611449, T6611449(T), (compiler.misc.infer.arg.length.mismatch))} +T6611449.java:18:9: compiler.err.cant.apply.symbols: kindname.constructor, T6611449, int,{(compiler.misc.inapplicable.method: kindname.constructor, T6611449, T6611449(T,T), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.constructor, T6611449, T6611449(T), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, S))} +T6611449.java:19:9: compiler.err.cant.apply.symbols: kindname.constructor, T6611449, int,int,{(compiler.misc.inapplicable.method: kindname.constructor, T6611449, T6611449(T,T), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, S)),(compiler.misc.inapplicable.method: kindname.constructor, T6611449, T6611449(T), (compiler.misc.infer.arg.length.mismatch: T))} T6611449.java:20:9: compiler.err.cant.apply.symbol.1: kindname.method, m1, T, int, kindname.class, T6611449, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, S) T6611449.java:21:9: compiler.err.cant.apply.symbol.1: kindname.method, m2, T,T, int,int, kindname.class, T6611449, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, S) 4 errors diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/generics/inference/6638712/T6638712a.out --- a/test/tools/javac/generics/inference/6638712/T6638712a.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/generics/inference/6638712/T6638712a.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -T6638712a.java:16:33: compiler.err.cant.apply.symbol.1: kindname.method, compound, java.lang.Iterable>, java.util.List>, kindname.class, T6638712a, (compiler.misc.infer.no.conforming.assignment.exists: T, java.util.List>, java.lang.Iterable>) +T6638712a.java:16:33: compiler.err.cant.apply.symbol.1: kindname.method, compound, java.lang.Iterable>, java.util.List>, kindname.class, T6638712a, (compiler.misc.infer.no.conforming.assignment.exists: T, (compiler.misc.inconvertible.types: java.util.List>, java.lang.Iterable>)) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/generics/inference/6638712/T6638712b.out --- a/test/tools/javac/generics/inference/6638712/T6638712b.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/generics/inference/6638712/T6638712b.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -T6638712b.java:14:21: compiler.err.cant.apply.symbol.1: kindname.method, m, I, T6638712b, kindname.class, T6638712b, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, java.lang.String,java.lang.Object) +T6638712b.java:14:21: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, java.lang.String,java.lang.Object) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/generics/inference/6638712/T6638712c.out --- a/test/tools/javac/generics/inference/6638712/T6638712c.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/generics/inference/6638712/T6638712c.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -T6638712c.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, sort, T[],java.util.Comparator, java.lang.Enum[],java.util.Comparator>, kindname.class, T6638712c, (compiler.misc.no.conforming.assignment.exists: java.util.Comparator>, java.util.Comparator) +T6638712c.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, sort, T[],java.util.Comparator, java.lang.Enum[],java.util.Comparator>, kindname.class, T6638712c, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.util.Comparator>, java.util.Comparator)) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/generics/inference/6638712/T6638712e.out --- a/test/tools/javac/generics/inference/6638712/T6638712e.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/generics/inference/6638712/T6638712e.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -T6638712e.java:17:27: compiler.err.cant.apply.symbol.1: kindname.method, m, T6638712e.Foo, T6638712e.Foo, kindname.class, T6638712e.Foo, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object, java.lang.Boolean,java.lang.Object) +T6638712e.java:17:27: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object, java.lang.Boolean,java.lang.Object) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/generics/inference/6650759/T6650759m.out --- a/test/tools/javac/generics/inference/6650759/T6650759m.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/generics/inference/6650759/T6650759m.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -T6650759m.java:43:36: compiler.err.cant.apply.symbol.1: kindname.method, m, java.util.List>, java.util.ArrayList>, kindname.class, T6650759m, (compiler.misc.inferred.do.not.conform.to.lower.bounds: java.lang.Integer, java.lang.String) +T6650759m.java:43:36: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.lower.bounds: java.lang.Integer, java.lang.String) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/generics/inference/6838943/T6838943.out --- a/test/tools/javac/generics/inference/6838943/T6838943.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/generics/inference/6838943/T6838943.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -T6838943.java:13:14: compiler.err.cant.apply.symbol.1: kindname.method, m, T6838943.A,Z, T6838943.A,T6838943.B, kindname.class, T6838943.C, (compiler.misc.infer.no.conforming.assignment.exists: Z, T6838943.A, T6838943.A) +T6838943.java:13:14: compiler.err.cant.apply.symbol.1: kindname.method, m, T6838943.A,Z, T6838943.A,T6838943.B, kindname.class, T6838943.C, (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.inconvertible.types: T6838943.A, T6838943.A)) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/generics/inference/7086586/T7086586.out --- a/test/tools/javac/generics/inference/7086586/T7086586.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/generics/inference/7086586/T7086586.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,5 +1,5 @@ -T7086586.java:14:20: compiler.err.cant.apply.symbol.1: kindname.method, m, java.util.List, java.util.List, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, java.util.List, java.util.List) -T7086586.java:15:20: compiler.err.cant.apply.symbol.1: kindname.method, m, java.util.List, java.util.List, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, java.util.List, java.util.List) -T7086586.java:16:23: compiler.err.cant.apply.symbol.1: kindname.method, m, java.util.List, java.util.List, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, java.util.List, java.util.List) -T7086586.java:17:9: compiler.err.cant.apply.symbol.1: kindname.method, m, java.util.List, java.util.List, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, java.util.List, java.util.List) +T7086586.java:14:20: compiler.err.cant.apply.symbol.1: kindname.method, m, java.util.List, java.util.List, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, (compiler.misc.inconvertible.types: java.util.List, java.util.List)) +T7086586.java:15:20: compiler.err.cant.apply.symbol.1: kindname.method, m, java.util.List, java.util.List, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, (compiler.misc.inconvertible.types: java.util.List, java.util.List)) +T7086586.java:16:23: compiler.err.cant.apply.symbol.1: kindname.method, m, java.util.List, java.util.List, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, (compiler.misc.inconvertible.types: java.util.List, java.util.List)) +T7086586.java:17:9: compiler.err.cant.apply.symbol.1: kindname.method, m, java.util.List, java.util.List, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, (compiler.misc.inconvertible.types: java.util.List, java.util.List)) 4 errors diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/generics/inference/7154127/T7154127.out --- a/test/tools/javac/generics/inference/7154127/T7154127.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/generics/inference/7154127/T7154127.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -T7154127.java:19:49: compiler.err.cant.apply.symbol.1: kindname.method, m, compiler.misc.no.args, compiler.misc.no.args, kindname.class, T7154127, (compiler.misc.inferred.do.not.conform.to.upper.bounds: Y, T7154127.D,T7154127.B) +T7154127.java:19:49: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: Y, T7154127.D,T7154127.B) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/generics/rawOverride/7062745/T7062745neg.out --- a/test/tools/javac/generics/rawOverride/7062745/T7062745neg.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/generics/rawOverride/7062745/T7062745neg.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -T7062745neg.java:16:36: compiler.err.prob.found.req: java.lang.Object, java.lang.Number +T7062745neg.java:16:36: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Object, java.lang.Number) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/generics/wildcards/6886247/T6886247_2.out --- a/test/tools/javac/generics/wildcards/6886247/T6886247_2.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/generics/wildcards/6886247/T6886247_2.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -T6886247_2.java:35:28: compiler.err.prob.found.req: compiler.misc.type.captureof: 1, ?, E +T6886247_2.java:35:28: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: compiler.misc.type.captureof: 1, ?, E) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/lambda/EffectivelyFinalTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/EffectivelyFinalTest.java Fri Aug 24 09:29:21 2012 +0100 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @summary Integrate efectively final check with DA/DU analysis + * @compile/fail/ref=EffectivelyFinalTest01.out -XDallowEffectivelyFinalInInnerClasses -XDrawDiagnostics EffectivelyFinalTest.java + * @compile/fail/ref=EffectivelyFinalTest02.out -source 7 -Xlint:-options -XDrawDiagnostics EffectivelyFinalTest.java + */ +class EffectivelyFinalTest { + + void m1(int x) { + int y = 1; + new Object() { { System.out.println(x+y); } }; //ok - both x and y are EF + } + + void m2(int x) { + int y; + y = 1; + new Object() { { System.out.println(x+y); } }; //ok - both x and y are EF + } + + void m3(int x, boolean cond) { + int y; + if (cond) y = 1; + new Object() { { System.out.println(x+y); } }; //error - y not DA + } + + void m4(int x, boolean cond) { + int y; + if (cond) y = 1; + else y = 2; + new Object() { { System.out.println(x+y); } }; //ok - both x and y are EF + } + + void m5(int x, boolean cond) { + int y; + if (cond) y = 1; + y = 2; + new Object() { { System.out.println(x+y); } }; //error - y not EF + } + + void m6(int x) { + new Object() { { System.out.println(x+1); } }; //error - x not EF + x++; + } + + void m7(int x) { + new Object() { { System.out.println(x=1); } }; //error - x not EF + } + + void m8() { + int y; + new Object() { { System.out.println(y=1); } }; //error - y not EF + } +} diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/lambda/EffectivelyFinalTest01.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/EffectivelyFinalTest01.out Fri Aug 24 09:29:21 2012 +0100 @@ -0,0 +1,6 @@ +EffectivelyFinalTest.java:46:47: compiler.err.var.might.not.have.been.initialized: y +EffectivelyFinalTest.java:60:47: compiler.err.cant.ref.non.effectively.final.var: y, (compiler.misc.inner.cls) +EffectivelyFinalTest.java:64:45: compiler.err.cant.ref.non.effectively.final.var: x, (compiler.misc.inner.cls) +EffectivelyFinalTest.java:69:45: compiler.err.cant.ref.non.effectively.final.var: x, (compiler.misc.inner.cls) +EffectivelyFinalTest.java:74:45: compiler.err.cant.ref.non.effectively.final.var: y, (compiler.misc.inner.cls) +5 errors diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/lambda/EffectivelyFinalTest02.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/EffectivelyFinalTest02.out Fri Aug 24 09:29:21 2012 +0100 @@ -0,0 +1,14 @@ +EffectivelyFinalTest.java:46:47: compiler.err.var.might.not.have.been.initialized: y +EffectivelyFinalTest.java:34:45: compiler.err.local.var.accessed.from.icls.needs.final: x +EffectivelyFinalTest.java:34:47: compiler.err.local.var.accessed.from.icls.needs.final: y +EffectivelyFinalTest.java:40:45: compiler.err.local.var.accessed.from.icls.needs.final: x +EffectivelyFinalTest.java:40:47: compiler.err.local.var.accessed.from.icls.needs.final: y +EffectivelyFinalTest.java:46:45: compiler.err.local.var.accessed.from.icls.needs.final: x +EffectivelyFinalTest.java:53:45: compiler.err.local.var.accessed.from.icls.needs.final: x +EffectivelyFinalTest.java:53:47: compiler.err.local.var.accessed.from.icls.needs.final: y +EffectivelyFinalTest.java:60:45: compiler.err.local.var.accessed.from.icls.needs.final: x +EffectivelyFinalTest.java:60:47: compiler.err.local.var.accessed.from.icls.needs.final: y +EffectivelyFinalTest.java:64:45: compiler.err.local.var.accessed.from.icls.needs.final: x +EffectivelyFinalTest.java:69:45: compiler.err.local.var.accessed.from.icls.needs.final: x +EffectivelyFinalTest.java:74:45: compiler.err.local.var.accessed.from.icls.needs.final: y +13 errors diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/multicatch/Neg06.out --- a/test/tools/javac/multicatch/Neg06.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/multicatch/Neg06.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,3 +1,3 @@ -Neg06.java:14:16: compiler.err.prob.found.req: java.lang.String, java.lang.Throwable -Neg06.java:14:25: compiler.err.prob.found.req: java.lang.Integer, java.lang.Throwable +Neg06.java:14:16: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Throwable) +Neg06.java:14:25: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Integer, java.lang.Throwable) 2 errors diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/multicatch/Neg07.out --- a/test/tools/javac/multicatch/Neg07.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/multicatch/Neg07.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -Neg07.java:14:56: compiler.err.prob.found.req: java.lang.Class, java.lang.Class +Neg07.java:14:56: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Class, java.lang.Class) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/types/CastObjectToPrimitiveTest.out --- a/test/tools/javac/types/CastObjectToPrimitiveTest.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/types/CastObjectToPrimitiveTest.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,2 +1,2 @@ -CastObjectToPrimitiveTest.java:36:23: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: java.lang.Object, int) +CastObjectToPrimitiveTest.java:36:23: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Object, int) 1 error diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/varargs/6313164/T6313164.out --- a/test/tools/javac/varargs/6313164/T6313164.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/varargs/6313164/T6313164.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,6 +1,6 @@ T6313164.java:12:8: compiler.err.cant.apply.symbol.1: kindname.method, foo1, p1.A[], p1.B,p1.B, kindname.class, p1.B, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164) -T6313164.java:14:13: compiler.err.cant.apply.symbol.1: kindname.method, foo3, X[], compiler.misc.type.null,compiler.misc.type.null, kindname.class, p1.B, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164) -T6313164.java:15:13: compiler.err.cant.apply.symbol.1: kindname.method, foo4, X[], compiler.misc.type.null,compiler.misc.type.null, kindname.class, p1.B, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164) +T6313164.java:14:13: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164) +T6313164.java:15:13: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164) - compiler.note.unchecked.filename: B.java - compiler.note.unchecked.recompile 3 errors diff -r 45a1817f956b -r 2aaad794fdd1 test/tools/javac/varargs/7097436/T7097436.out --- a/test/tools/javac/varargs/7097436/T7097436.out Fri Aug 03 20:23:20 2012 +0100 +++ b/test/tools/javac/varargs/7097436/T7097436.out Fri Aug 24 09:29:21 2012 +0100 @@ -1,6 +1,6 @@ T7097436.java:13:20: compiler.warn.varargs.unsafe.use.varargs.param: ls T7097436.java:14:25: compiler.warn.varargs.unsafe.use.varargs.param: ls -T7097436.java:15:20: compiler.err.prob.found.req: java.util.List[], java.lang.String -T7097436.java:16:26: compiler.err.prob.found.req: java.util.List[], java.lang.Integer[] +T7097436.java:15:20: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.util.List[], java.lang.String) +T7097436.java:16:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.util.List[], java.lang.Integer[]) 2 errors 2 warnings