Merge

Thu, 25 Jul 2013 19:06:03 +0100

author
chegar
date
Thu, 25 Jul 2013 19:06:03 +0100
changeset 2120
8b3e2cc5f1de
parent 2119
84df20dc604a
parent 1909
0324dbf07b0f
child 2121
0d75d3b96477

Merge

test/tools/javac/generics/6723444/T6723444.out file | annotate | diff | comparison | revisions
test/tools/javac/generics/7015430/T7015430.out file | annotate | diff | comparison | revisions
     1.1 --- a/.hgtags	Wed Jul 24 15:18:33 2013 -0700
     1.2 +++ b/.hgtags	Thu Jul 25 19:06:03 2013 +0100
     1.3 @@ -221,3 +221,4 @@
     1.4  6a11a81a8824c17f6cd2ec8f8492e1229b694e96 jdk8-b97
     1.5  ce5a90df517bdceb2739d7dd3e6764b070def802 jdk8-b98
     1.6  6d85acab769eb79bc058f5640fa86a6ef096a583 jdk8-b99
     1.7 +82f68da70e471ee5640016e3f38c014347a5c785 jdk8-b100
     2.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Wed Jul 24 15:18:33 2013 -0700
     2.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Thu Jul 25 19:06:03 2013 +0100
     2.3 @@ -467,7 +467,7 @@
     2.4                  nodeprecated = true;
     2.5              } else if (opt.equals("-sourcepath")) {
     2.6                  sourcepath = os[1];
     2.7 -            } else if (opt.equals("-classpath") &&
     2.8 +            } else if ((opt.equals("-classpath") || opt.equals("-cp")) &&
     2.9                         sourcepath.length() == 0) {
    2.10                  sourcepath = os[1];
    2.11              } else if (opt.equals("-excludedocfilessubdir")) {
     3.1 --- a/src/share/classes/com/sun/tools/doclint/DocLint.java	Wed Jul 24 15:18:33 2013 -0700
     3.2 +++ b/src/share/classes/com/sun/tools/doclint/DocLint.java	Thu Jul 25 19:06:03 2013 +0100
     3.3 @@ -187,6 +187,8 @@
     3.4                  javacBootClassPath = splitPath(args[++i]);
     3.5              } else if (arg.equals("-classpath") && i + 1 < args.length) {
     3.6                  javacClassPath = splitPath(args[++i]);
     3.7 +            } else if (arg.equals("-cp") && i + 1 < args.length) {
     3.8 +                javacClassPath = splitPath(args[++i]);
     3.9              } else if (arg.equals("-sourcepath") && i + 1 < args.length) {
    3.10                  javacSourcePath = splitPath(args[++i]);
    3.11              } else if (arg.equals(XMSGS_OPTION)) {
    3.12 @@ -326,6 +328,14 @@
    3.13          abstract void visitDecl(Tree tree, Name name);
    3.14  
    3.15          @Override
    3.16 +        public Void visitCompilationUnit(CompilationUnitTree tree, Void ignore) {
    3.17 +            if (tree.getPackageName() != null) {
    3.18 +                visitDecl(tree, null);
    3.19 +            }
    3.20 +            return super.visitCompilationUnit(tree, ignore);
    3.21 +        }
    3.22 +
    3.23 +        @Override
    3.24          public Void visitClass(ClassTree tree, Void ignore) {
    3.25              visitDecl(tree, tree.getSimpleName());
    3.26              return super.visitClass(tree, ignore);
     4.1 --- a/src/share/classes/com/sun/tools/doclint/Env.java	Wed Jul 24 15:18:33 2013 -0700
     4.2 +++ b/src/share/classes/com/sun/tools/doclint/Env.java	Thu Jul 25 19:06:03 2013 +0100
     4.3 @@ -142,7 +142,7 @@
     4.4          currElement = trees.getElement(currPath);
     4.5          currOverriddenMethods = ((JavacTypes) types).getOverriddenMethods(currElement);
     4.6  
     4.7 -        AccessKind ak = null;
     4.8 +        AccessKind ak = AccessKind.PUBLIC;
     4.9          for (TreePath p = path; p != null; p = p.getParentPath()) {
    4.10              Element e = trees.getElement(p);
    4.11              if (e != null && e.getKind() != ElementKind.PACKAGE) {
     5.1 --- a/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Wed Jul 24 15:18:33 2013 -0700
     5.2 +++ b/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Thu Jul 25 19:06:03 2013 +0100
     5.3 @@ -109,7 +109,7 @@
     5.4  \    Show this message.\n\
     5.5  \n\
     5.6  The following javac options are also supported\n\
     5.7 -\  -bootclasspath, -classpath, -sourcepath, -Xmaxerrs, -Xmaxwarns\n\
     5.8 +\  -bootclasspath, -classpath, -cp, -sourcepath, -Xmaxerrs, -Xmaxwarns\n\
     5.9  \n\
    5.10  To run doclint on part of a project, put the compiled classes for your\n\
    5.11  project on the classpath (or bootclasspath), then specify the source files\n\
     6.1 --- a/src/share/classes/com/sun/tools/javac/code/Flags.java	Wed Jul 24 15:18:33 2013 -0700
     6.2 +++ b/src/share/classes/com/sun/tools/javac/code/Flags.java	Thu Jul 25 19:06:03 2013 +0100
     6.3 @@ -261,6 +261,11 @@
     6.4       */
     6.5      public static final long SIGNATURE_POLYMORPHIC = 1L<<46;
     6.6  
     6.7 +    /**
     6.8 +     * Flag that marks inference variables used in a 'throws' clause
     6.9 +     */
    6.10 +    public static final long THROWS = 1L<<47;
    6.11 +
    6.12      /** Modifier masks.
    6.13       */
    6.14      public static final int
    6.15 @@ -365,7 +370,9 @@
    6.16          CLASH(Flags.CLASH),
    6.17          AUXILIARY(Flags.AUXILIARY),
    6.18          NOT_IN_PROFILE(Flags.NOT_IN_PROFILE),
    6.19 -        BAD_OVERRIDE(Flags.BAD_OVERRIDE);
    6.20 +        BAD_OVERRIDE(Flags.BAD_OVERRIDE),
    6.21 +        SIGNATURE_POLYMORPHIC(Flags.SIGNATURE_POLYMORPHIC),
    6.22 +        THROWS(Flags.THROWS);
    6.23  
    6.24          Flag(long flag) {
    6.25              this.value = flag;
     7.1 --- a/src/share/classes/com/sun/tools/javac/code/Scope.java	Wed Jul 24 15:18:33 2013 -0700
     7.2 +++ b/src/share/classes/com/sun/tools/javac/code/Scope.java	Thu Jul 25 19:06:03 2013 +0100
     7.3 @@ -1,5 +1,5 @@
     7.4  /*
     7.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
     7.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
     7.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8   *
     7.9   * This code is free software; you can redistribute it and/or modify it
    7.10 @@ -316,6 +316,7 @@
    7.11      public Entry lookup(Name name) {
    7.12          return lookup(name, noFilter);
    7.13      }
    7.14 +
    7.15      public Entry lookup(Name name, Filter<Symbol> sf) {
    7.16          Entry e = table[getIndex(name)];
    7.17          if (e == null || e == sentinel)
    7.18 @@ -361,6 +362,10 @@
    7.19          }
    7.20      }
    7.21  
    7.22 +    public boolean anyMatch(Filter<Symbol> sf) {
    7.23 +        return getElements(sf).iterator().hasNext();
    7.24 +    }
    7.25 +
    7.26      public Iterable<Symbol> getElements() {
    7.27          return getElements(noFilter);
    7.28      }
     8.1 --- a/src/share/classes/com/sun/tools/javac/code/Type.java	Wed Jul 24 15:18:33 2013 -0700
     8.2 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java	Thu Jul 25 19:06:03 2013 +0100
     8.3 @@ -78,6 +78,9 @@
     8.4      /** Constant type: special type to be used during recovery of deferred expressions. */
     8.5      public static final JCNoType recoveryType = new JCNoType();
     8.6  
     8.7 +    /** Constant type: special type to be used for marking stuck trees. */
     8.8 +    public static final JCNoType stuckType = new JCNoType();
     8.9 +
    8.10      /** If this switch is turned on, the names of type variables
    8.11       *  and anonymous classes are printed with hashcodes appended.
    8.12       */
    8.13 @@ -1449,7 +1452,7 @@
    8.14          }
    8.15  
    8.16          /** inference variable bounds */
    8.17 -        private Map<InferenceBound, List<Type>> bounds;
    8.18 +        protected Map<InferenceBound, List<Type>> bounds;
    8.19  
    8.20          /** inference variable's inferred type (set from Infer.java) */
    8.21          public Type inst = null;
    8.22 @@ -1511,8 +1514,17 @@
    8.23              return buf.toList();
    8.24          }
    8.25  
    8.26 +        /** internal method used to override an undetvar bounds */
    8.27 +        public void setBounds(InferenceBound ib, List<Type> newBounds) {
    8.28 +            bounds.put(ib, newBounds);
    8.29 +        }
    8.30 +
    8.31          /** add a bound of a given kind - this might trigger listener notification */
    8.32 -        public void addBound(InferenceBound ib, Type bound, Types types) {
    8.33 +        public final void addBound(InferenceBound ib, Type bound, Types types) {
    8.34 +            addBound(ib, bound, types, false);
    8.35 +        }
    8.36 +
    8.37 +        protected void addBound(InferenceBound ib, Type bound, Types types, boolean update) {
    8.38              Type bound2 = toTypeVarMap.apply(bound);
    8.39              List<Type> prevBounds = bounds.get(ib);
    8.40              for (Type b : prevBounds) {
    8.41 @@ -1529,7 +1541,7 @@
    8.42                  public Type apply(Type t) {
    8.43                      if (t.hasTag(UNDETVAR)) {
    8.44                          UndetVar uv = (UndetVar)t;
    8.45 -                        return uv.qtype;
    8.46 +                        return uv.inst != null ? uv.inst : uv.qtype;
    8.47                      } else {
    8.48                          return t.map(this);
    8.49                      }
    8.50 @@ -1567,7 +1579,7 @@
    8.51                      bounds.put(ib, newBounds.toList());
    8.52                      //step 3 - for each dependency, add new replaced bound
    8.53                      for (Type dep : deps) {
    8.54 -                        addBound(ib, types.subst(dep, from, to), types);
    8.55 +                        addBound(ib, types.subst(dep, from, to), types, true);
    8.56                      }
    8.57                  }
    8.58              } finally {
    8.59 @@ -1583,6 +1595,39 @@
    8.60                  listener.varChanged(this, ibs);
    8.61              }
    8.62          }
    8.63 +
    8.64 +        public boolean isCaptured() {
    8.65 +            return false;
    8.66 +        }
    8.67 +    }
    8.68 +
    8.69 +    /**
    8.70 +     * This class is used to represent synthetic captured inference variables
    8.71 +     * that can be generated during nested generic method calls. The only difference
    8.72 +     * between these inference variables and ordinary ones is that captured inference
    8.73 +     * variables cannot get new bounds through incorporation.
    8.74 +     */
    8.75 +    public static class CapturedUndetVar extends UndetVar {
    8.76 +
    8.77 +        public CapturedUndetVar(CapturedType origin, Types types) {
    8.78 +            super(origin, types);
    8.79 +            if (!origin.lower.hasTag(BOT)) {
    8.80 +                bounds.put(InferenceBound.LOWER, List.of(origin.lower));
    8.81 +            }
    8.82 +        }
    8.83 +
    8.84 +        @Override
    8.85 +        public void addBound(InferenceBound ib, Type bound, Types types, boolean update) {
    8.86 +            if (update) {
    8.87 +                //only change bounds if request comes from substBounds
    8.88 +                super.addBound(ib, bound, types, update);
    8.89 +            }
    8.90 +        }
    8.91 +
    8.92 +        @Override
    8.93 +        public boolean isCaptured() {
    8.94 +            return true;
    8.95 +        }
    8.96      }
    8.97  
    8.98      /** Represents NONE.
     9.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java	Wed Jul 24 15:18:33 2013 -0700
     9.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Jul 25 19:06:03 2013 +0100
     9.3 @@ -2330,7 +2330,7 @@
     9.4  
     9.5              @Override
     9.6              public Type visitErrorType(ErrorType t, Void ignored) {
     9.7 -                return t;
     9.8 +                return Type.noType;
     9.9              }
    9.10          };
    9.11      // </editor-fold>
    9.12 @@ -2950,7 +2950,7 @@
    9.13              if (elemtype == t.elemtype)
    9.14                  return t;
    9.15              else
    9.16 -                return new ArrayType(upperBound(elemtype), t.tsym);
    9.17 +                return new ArrayType(elemtype, t.tsym);
    9.18          }
    9.19  
    9.20          @Override
    10.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Jul 24 15:18:33 2013 -0700
    10.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Jul 25 19:06:03 2013 +0100
    10.3 @@ -481,31 +481,7 @@
    10.4          static final long serialVersionUID = -6924771130405446405L;
    10.5          private Env<AttrContext> env;
    10.6          private BreakAttr(Env<AttrContext> env) {
    10.7 -            this.env = copyEnv(env);
    10.8 -        }
    10.9 -
   10.10 -        private Env<AttrContext> copyEnv(Env<AttrContext> env) {
   10.11 -            Env<AttrContext> newEnv =
   10.12 -                    env.dup(env.tree, env.info.dup(copyScope(env.info.scope)));
   10.13 -            if (newEnv.outer != null) {
   10.14 -                newEnv.outer = copyEnv(newEnv.outer);
   10.15 -            }
   10.16 -            return newEnv;
   10.17 -        }
   10.18 -
   10.19 -        private Scope copyScope(Scope sc) {
   10.20 -            Scope newScope = new Scope(sc.owner);
   10.21 -            List<Symbol> elemsList = List.nil();
   10.22 -            while (sc != null) {
   10.23 -                for (Scope.Entry e = sc.elems ; e != null ; e = e.sibling) {
   10.24 -                    elemsList = elemsList.prepend(e.sym);
   10.25 -                }
   10.26 -                sc = sc.next;
   10.27 -            }
   10.28 -            for (Symbol s : elemsList) {
   10.29 -                newScope.enter(s);
   10.30 -            }
   10.31 -            return newScope;
   10.32 +            this.env = env;
   10.33          }
   10.34      }
   10.35  
   10.36 @@ -555,11 +531,6 @@
   10.37                  }
   10.38              });
   10.39          }
   10.40 -
   10.41 -        @Override
   10.42 -        protected Type check(DiagnosticPosition pos, Type found) {
   10.43 -            return chk.checkNonVoid(pos, super.check(pos, found));
   10.44 -        }
   10.45      }
   10.46  
   10.47      final ResultInfo statInfo;
   10.48 @@ -610,7 +581,7 @@
   10.49              tree.accept(this);
   10.50              if (tree == breakTree &&
   10.51                      resultInfo.checkContext.deferredAttrContext().mode == AttrMode.CHECK) {
   10.52 -                throw new BreakAttr(env);
   10.53 +                throw new BreakAttr(copyEnv(env));
   10.54              }
   10.55              return result;
   10.56          } catch (CompletionFailure ex) {
   10.57 @@ -622,6 +593,30 @@
   10.58          }
   10.59      }
   10.60  
   10.61 +    Env<AttrContext> copyEnv(Env<AttrContext> env) {
   10.62 +        Env<AttrContext> newEnv =
   10.63 +                env.dup(env.tree, env.info.dup(copyScope(env.info.scope)));
   10.64 +        if (newEnv.outer != null) {
   10.65 +            newEnv.outer = copyEnv(newEnv.outer);
   10.66 +        }
   10.67 +        return newEnv;
   10.68 +    }
   10.69 +
   10.70 +    Scope copyScope(Scope sc) {
   10.71 +        Scope newScope = new Scope(sc.owner);
   10.72 +        List<Symbol> elemsList = List.nil();
   10.73 +        while (sc != null) {
   10.74 +            for (Scope.Entry e = sc.elems ; e != null ; e = e.sibling) {
   10.75 +                elemsList = elemsList.prepend(e.sym);
   10.76 +            }
   10.77 +            sc = sc.next;
   10.78 +        }
   10.79 +        for (Symbol s : elemsList) {
   10.80 +            newScope.enter(s);
   10.81 +        }
   10.82 +        return newScope;
   10.83 +    }
   10.84 +
   10.85      /** Derived visitor method: attribute an expression tree.
   10.86       */
   10.87      public Type attribExpr(JCTree tree, Env<AttrContext> env, Type pt) {
   10.88 @@ -1697,7 +1692,8 @@
   10.89                                diags.fragment("unexpected.ret.val"));
   10.90                  }
   10.91                  attribTree(tree.expr, env, env.info.returnResult);
   10.92 -            } else if (!env.info.returnResult.pt.hasTag(VOID)) {
   10.93 +            } else if (!env.info.returnResult.pt.hasTag(VOID) &&
   10.94 +                    !env.info.returnResult.pt.hasTag(NONE)) {
   10.95                  env.info.returnResult.checkContext.report(tree.pos(),
   10.96                                diags.fragment("missing.ret.val"));
   10.97              }
   10.98 @@ -2395,7 +2391,7 @@
   10.99  
  10.100              ResultInfo bodyResultInfo = lambdaType.getReturnType() == Type.recoveryType ?
  10.101                  recoveryInfo :
  10.102 -                new ResultInfo(VAL, lambdaType.getReturnType(), funcContext);
  10.103 +                new LambdaResultInfo(lambdaType.getReturnType(), funcContext);
  10.104              localEnv.info.returnResult = bodyResultInfo;
  10.105  
  10.106              Log.DeferredDiagnosticHandler lambdaDeferredHandler = new Log.DeferredDiagnosticHandler(log);
  10.107 @@ -2434,7 +2430,7 @@
  10.108              boolean isSpeculativeRound =
  10.109                      resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.SPECULATIVE;
  10.110  
  10.111 -            postAttr(that);
  10.112 +            preFlow(that);
  10.113              flow.analyzeLambda(env, that, make, isSpeculativeRound);
  10.114  
  10.115              checkLambdaCompatible(that, lambdaType, resultInfo.checkContext, isSpeculativeRound);
  10.116 @@ -2456,6 +2452,21 @@
  10.117          }
  10.118      }
  10.119      //where
  10.120 +        void preFlow(JCLambda tree) {
  10.121 +            new PostAttrAnalyzer() {
  10.122 +                @Override
  10.123 +                public void scan(JCTree tree) {
  10.124 +                    if (tree == null ||
  10.125 +                            (tree.type != null &&
  10.126 +                            tree.type == Type.stuckType)) {
  10.127 +                        //don't touch stuck expressions!
  10.128 +                        return;
  10.129 +                    }
  10.130 +                    super.scan(tree);
  10.131 +                }
  10.132 +            }.scan(tree);
  10.133 +        }
  10.134 +
  10.135          Types.MapVisitor<DiagnosticPosition> targetChecker = new Types.MapVisitor<DiagnosticPosition>() {
  10.136  
  10.137              @Override
  10.138 @@ -2587,6 +2598,28 @@
  10.139              }
  10.140          }
  10.141  
  10.142 +        class LambdaResultInfo extends ResultInfo {
  10.143 +
  10.144 +            LambdaResultInfo(Type pt, CheckContext checkContext) {
  10.145 +                super(VAL, pt, checkContext);
  10.146 +            }
  10.147 +
  10.148 +            @Override
  10.149 +            protected Type check(DiagnosticPosition pos, Type found) {
  10.150 +                return super.check(pos, found.baseType());
  10.151 +            }
  10.152 +
  10.153 +            @Override
  10.154 +            protected ResultInfo dup(CheckContext newContext) {
  10.155 +                return new LambdaResultInfo(pt, newContext);
  10.156 +            }
  10.157 +
  10.158 +            @Override
  10.159 +            protected ResultInfo dup(Type newPt) {
  10.160 +                return new LambdaResultInfo(newPt, checkContext);
  10.161 +            }
  10.162 +        }
  10.163 +
  10.164          /**
  10.165          * Lambda compatibility. Check that given return types, thrown types, parameter types
  10.166          * are compatible with the expected functional interface descriptor. This means that:
  10.167 @@ -2688,10 +2721,21 @@
  10.168  
  10.169              setFunctionalInfo(localEnv, that, pt(), desc, target, resultInfo.checkContext);
  10.170              List<Type> argtypes = desc.getParameterTypes();
  10.171 -
  10.172 -            Pair<Symbol, Resolve.ReferenceLookupHelper> refResult =
  10.173 -                    rs.resolveMemberReference(that.pos(), localEnv, that,
  10.174 -                        that.expr.type, that.name, argtypes, typeargtypes, true, rs.resolveMethodCheck);
  10.175 +            Resolve.MethodCheck referenceCheck = rs.resolveMethodCheck;
  10.176 +
  10.177 +            if (resultInfo.checkContext.inferenceContext().free(argtypes)) {
  10.178 +                referenceCheck = rs.new MethodReferenceCheck(resultInfo.checkContext.inferenceContext());
  10.179 +            }
  10.180 +
  10.181 +            Pair<Symbol, Resolve.ReferenceLookupHelper> refResult = null;
  10.182 +            List<Type> saved_undet = resultInfo.checkContext.inferenceContext().save();
  10.183 +            try {
  10.184 +                refResult = rs.resolveMemberReference(that.pos(), localEnv, that, that.expr.type,
  10.185 +                        that.name, argtypes, typeargtypes, true, referenceCheck,
  10.186 +                        resultInfo.checkContext.inferenceContext());
  10.187 +            } finally {
  10.188 +                resultInfo.checkContext.inferenceContext().rollback(saved_undet);
  10.189 +            }
  10.190  
  10.191              Symbol refSym = refResult.fst;
  10.192              Resolve.ReferenceLookupHelper lookupHelper = refResult.snd;
  10.193 @@ -2803,17 +2847,24 @@
  10.194                  }
  10.195              }
  10.196  
  10.197 -            that.sym = refSym.baseSymbol();
  10.198 -            that.kind = lookupHelper.referenceKind(that.sym);
  10.199 -
  10.200              ResultInfo checkInfo =
  10.201                      resultInfo.dup(newMethodTemplate(
  10.202                          desc.getReturnType().hasTag(VOID) ? Type.noType : desc.getReturnType(),
  10.203 -                        lookupHelper.argtypes,
  10.204 -                        typeargtypes));
  10.205 +                        that.kind.isUnbound() ? argtypes.tail : argtypes, typeargtypes));
  10.206  
  10.207              Type refType = checkId(that, lookupHelper.site, refSym, localEnv, checkInfo);
  10.208  
  10.209 +            if (that.kind.isUnbound() &&
  10.210 +                    resultInfo.checkContext.inferenceContext().free(argtypes.head)) {
  10.211 +                //re-generate inference constraints for unbound receiver
  10.212 +                if (!types.isSubtype(resultInfo.checkContext.inferenceContext().asFree(argtypes.head), exprType)) {
  10.213 +                    //cannot happen as this has already been checked - we just need
  10.214 +                    //to regenerate the inference constraints, as that has been lost
  10.215 +                    //as a result of the call to inferenceContext.save()
  10.216 +                    Assert.error("Can't get here");
  10.217 +                }
  10.218 +            }
  10.219 +
  10.220              if (!refType.isErroneous()) {
  10.221                  refType = types.createMethodTypeWithReturn(refType,
  10.222                          adjustMethodReturnType(lookupHelper.site, that.name, checkInfo.pt.getParameterTypes(), refType.getReturnType()));
  10.223 @@ -4305,7 +4356,7 @@
  10.224          if (env.info.lint.isEnabled(LintCategory.SERIAL) &&
  10.225              isSerializable(c) &&
  10.226              (c.flags() & Flags.ENUM) == 0 &&
  10.227 -            (c.flags() & ABSTRACT) == 0) {
  10.228 +            checkForSerial(c)) {
  10.229              checkSerialVersionUID(tree, c);
  10.230          }
  10.231          if (allowTypeAnnos) {
  10.232 @@ -4317,6 +4368,22 @@
  10.233          }
  10.234      }
  10.235          // where
  10.236 +        boolean checkForSerial(ClassSymbol c) {
  10.237 +            if ((c.flags() & ABSTRACT) == 0) {
  10.238 +                return true;
  10.239 +            } else {
  10.240 +                return c.members().anyMatch(anyNonAbstractOrDefaultMethod);
  10.241 +            }
  10.242 +        }
  10.243 +
  10.244 +        public static final Filter<Symbol> anyNonAbstractOrDefaultMethod = new Filter<Symbol>() {
  10.245 +            @Override
  10.246 +            public boolean accepts(Symbol s) {
  10.247 +                return s.kind == Kinds.MTH &&
  10.248 +                       (s.flags() & (DEFAULT | ABSTRACT)) != ABSTRACT;
  10.249 +            }
  10.250 +        };
  10.251 +
  10.252          /** get a diagnostic position for an attribute of Type t, or null if attribute missing */
  10.253          private DiagnosticPosition getDiagnosticPosition(JCClassDecl tree, Type t) {
  10.254              for(List<JCAnnotation> al = tree.mods.annotations; !al.isEmpty(); al = al.tail) {
  10.255 @@ -4369,9 +4436,7 @@
  10.256          }
  10.257  
  10.258      private Type capture(Type type) {
  10.259 -        //do not capture free types
  10.260 -        return resultInfo.checkContext.inferenceContext().free(type) ?
  10.261 -                type : types.capture(type);
  10.262 +        return types.capture(type);
  10.263      }
  10.264  
  10.265      private void validateTypeAnnotations(JCTree tree) {
    11.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed Jul 24 15:18:33 2013 -0700
    11.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Jul 25 19:06:03 2013 +0100
    11.3 @@ -897,7 +897,8 @@
    11.4                      assertConvertible(arg, arg.type, varArg, warn);
    11.5                      args = args.tail;
    11.6                  }
    11.7 -            } else if ((sym.flags() & VARARGS) != 0 && allowVarargs) {
    11.8 +            } else if ((sym.flags() & (VARARGS | SIGNATURE_POLYMORPHIC)) == VARARGS &&
    11.9 +                    allowVarargs) {
   11.10                  // non-varargs call to varargs method
   11.11                  Type varParam = owntype.getParameterTypes().last();
   11.12                  Type lastArg = argtypes.last();
    12.1 --- a/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Wed Jul 24 15:18:33 2013 -0700
    12.2 +++ b/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Thu Jul 25 19:06:03 2013 +0100
    12.3 @@ -34,15 +34,14 @@
    12.4  import com.sun.tools.javac.comp.Attr.ResultInfo;
    12.5  import com.sun.tools.javac.comp.Infer.InferenceContext;
    12.6  import com.sun.tools.javac.comp.Resolve.MethodResolutionPhase;
    12.7 +import com.sun.tools.javac.comp.Resolve.ReferenceLookupHelper;
    12.8  import com.sun.tools.javac.tree.JCTree.*;
    12.9  
   12.10 -import javax.tools.JavaFileObject;
   12.11  
   12.12  import java.util.ArrayList;
   12.13  import java.util.EnumSet;
   12.14  import java.util.LinkedHashSet;
   12.15  import java.util.Map;
   12.16 -import java.util.Queue;
   12.17  import java.util.Set;
   12.18  import java.util.WeakHashMap;
   12.19  
   12.20 @@ -95,7 +94,18 @@
   12.21          make = TreeMaker.instance(context);
   12.22          types = Types.instance(context);
   12.23          Names names = Names.instance(context);
   12.24 -        stuckTree = make.Ident(names.empty).setType(Type.noType);
   12.25 +        stuckTree = make.Ident(names.empty).setType(Type.stuckType);
   12.26 +        emptyDeferredAttrContext =
   12.27 +            new DeferredAttrContext(AttrMode.CHECK, null, MethodResolutionPhase.BOX, infer.emptyContext, null, null) {
   12.28 +                @Override
   12.29 +                void addDeferredAttrNode(DeferredType dt, ResultInfo ri, List<Type> stuckVars) {
   12.30 +                    Assert.error("Empty deferred context!");
   12.31 +                }
   12.32 +                @Override
   12.33 +                void complete() {
   12.34 +                    Assert.error("Empty deferred context!");
   12.35 +                }
   12.36 +            };
   12.37      }
   12.38  
   12.39      /** shared tree for stuck expressions */
   12.40 @@ -117,7 +127,7 @@
   12.41          DeferredType(JCExpression tree, Env<AttrContext> env) {
   12.42              super(null);
   12.43              this.tree = tree;
   12.44 -            this.env = env.dup(tree, env.info.dup());
   12.45 +            this.env = attr.copyEnv(env);
   12.46              this.speculativeCache = new SpeculativeCache();
   12.47          }
   12.48  
   12.49 @@ -253,7 +263,7 @@
   12.50      DeferredTypeCompleter dummyCompleter = new DeferredTypeCompleter() {
   12.51          public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
   12.52              Assert.check(deferredAttrContext.mode == AttrMode.CHECK);
   12.53 -            return dt.tree.type = Type.noType;
   12.54 +            return dt.tree.type = Type.stuckType;
   12.55          }
   12.56      };
   12.57  
   12.58 @@ -479,12 +489,10 @@
   12.59  
   12.60              ResultInfo resultInfo;
   12.61              InferenceContext inferenceContext;
   12.62 -            Env<AttrContext> env;
   12.63  
   12.64              public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
   12.65                  this.resultInfo = resultInfo;
   12.66                  this.inferenceContext = deferredAttrContext.inferenceContext;
   12.67 -                this.env = dt.env.dup(dt.tree, dt.env.info.dup());
   12.68                  dt.tree.accept(this);
   12.69                  dt.speculativeCache.put(deferredAttrContext.msym, stuckTree, deferredAttrContext.phase);
   12.70                  return Type.noType;
   12.71 @@ -533,18 +541,7 @@
   12.72                      } catch (Types.FunctionDescriptorLookupError ex) {
   12.73                          checkContext.report(null, ex.getDiagnostic());
   12.74                      }
   12.75 -                    JCExpression exprTree = (JCExpression)attribSpeculative(tree.getQualifierExpression(), env,
   12.76 -                            attr.memberReferenceQualifierResult(tree));
   12.77 -                    ListBuffer<Type> argtypes = ListBuffer.lb();
   12.78 -                    for (Type t : types.findDescriptorType(pt).getParameterTypes()) {
   12.79 -                        argtypes.append(Type.noType);
   12.80 -                    }
   12.81 -                    JCMemberReference mref2 = new TreeCopier<Void>(make).copy(tree);
   12.82 -                    mref2.expr = exprTree;
   12.83 -                    Pair<Symbol, ?> lookupRes =
   12.84 -                            rs.resolveMemberReference(tree, env, mref2, exprTree.type,
   12.85 -                                tree.name, argtypes.toList(), null, true, rs.arityMethodCheck);
   12.86 -                    switch (lookupRes.fst.kind) {
   12.87 +                    switch (tree.sym.kind) {
   12.88                          //note: as argtypes are erroneous types, type-errors must
   12.89                          //have been caused by arity mismatch
   12.90                          case Kinds.ABSENT_MTH:
   12.91 @@ -560,17 +557,7 @@
   12.92      }
   12.93  
   12.94      /** an empty deferred attribution context - all methods throw exceptions */
   12.95 -    final DeferredAttrContext emptyDeferredAttrContext =
   12.96 -            new DeferredAttrContext(AttrMode.CHECK, null, MethodResolutionPhase.BOX, null, null, null) {
   12.97 -                @Override
   12.98 -                void addDeferredAttrNode(DeferredType dt, ResultInfo ri, List<Type> stuckVars) {
   12.99 -                    Assert.error("Empty deferred context!");
  12.100 -                }
  12.101 -                @Override
  12.102 -                void complete() {
  12.103 -                    Assert.error("Empty deferred context!");
  12.104 -                }
  12.105 -            };
  12.106 +    final DeferredAttrContext emptyDeferredAttrContext;
  12.107  
  12.108      /**
  12.109       * Map a list of types possibly containing one or more deferred types
  12.110 @@ -649,7 +636,12 @@
  12.111           * a default expected type (j.l.Object).
  12.112           */
  12.113          private Type recover(DeferredType dt) {
  12.114 -            dt.check(attr.new RecoveryInfo(deferredAttrContext));
  12.115 +            dt.check(attr.new RecoveryInfo(deferredAttrContext) {
  12.116 +                @Override
  12.117 +                protected Type check(DiagnosticPosition pos, Type found) {
  12.118 +                    return chk.checkNonVoid(pos, super.check(pos, found));
  12.119 +                }
  12.120 +            });
  12.121              return super.apply(dt);
  12.122          }
  12.123      }
  12.124 @@ -663,12 +655,12 @@
  12.125                  if (resultInfo.pt.hasTag(NONE) || resultInfo.pt.isErroneous()) {
  12.126              return List.nil();
  12.127          } else {
  12.128 -            return stuckVarsInternal(tree, resultInfo.pt, resultInfo.checkContext.inferenceContext());
  12.129 +            return stuckVarsInternal(tree, resultInfo.pt, env, resultInfo.checkContext.inferenceContext());
  12.130          }
  12.131      }
  12.132      //where
  12.133 -        private List<Type> stuckVarsInternal(JCTree tree, Type pt, Infer.InferenceContext inferenceContext) {
  12.134 -            StuckChecker sc = new StuckChecker(pt, inferenceContext);
  12.135 +        private List<Type> stuckVarsInternal(JCTree tree, Type pt, Env<AttrContext> env, Infer.InferenceContext inferenceContext) {
  12.136 +            StuckChecker sc = new StuckChecker(pt, env, inferenceContext);
  12.137              sc.scan(tree);
  12.138              return List.from(sc.stuckVars);
  12.139          }
  12.140 @@ -748,11 +740,13 @@
  12.141      class StuckChecker extends PolyScanner {
  12.142  
  12.143          Type pt;
  12.144 +        Env<AttrContext> env;
  12.145          Infer.InferenceContext inferenceContext;
  12.146          Set<Type> stuckVars = new LinkedHashSet<Type>();
  12.147  
  12.148 -        StuckChecker(Type pt, Infer.InferenceContext inferenceContext) {
  12.149 +        StuckChecker(Type pt, Env<AttrContext> env, Infer.InferenceContext inferenceContext) {
  12.150              this.pt = pt;
  12.151 +            this.env = env;
  12.152              this.inferenceContext = inferenceContext;
  12.153          }
  12.154  
  12.155 @@ -786,18 +780,41 @@
  12.156  
  12.157              Type descType = types.findDescriptorType(pt);
  12.158              List<Type> freeArgVars = inferenceContext.freeVarsIn(descType.getParameterTypes());
  12.159 -            stuckVars.addAll(freeArgVars);
  12.160 +            Env<AttrContext> localEnv = env.dup(tree, env.info.dup());
  12.161 +            if (freeArgVars.nonEmpty()) {
  12.162 +                //perform arity-based check
  12.163 +                JCExpression exprTree = (JCExpression)attribSpeculative(tree.getQualifierExpression(), localEnv,
  12.164 +                        attr.memberReferenceQualifierResult(tree));
  12.165 +                ListBuffer<Type> argtypes = ListBuffer.lb();
  12.166 +                for (Type t : descType.getParameterTypes()) {
  12.167 +                    argtypes.append(Type.noType);
  12.168 +                }
  12.169 +                JCMemberReference mref2 = new TreeCopier<Void>(make).copy(tree);
  12.170 +                mref2.expr = exprTree;
  12.171 +                Pair<Symbol, ReferenceLookupHelper> lookupRes =
  12.172 +                        rs.resolveMemberReference(tree, localEnv, mref2, exprTree.type,
  12.173 +                            tree.name, argtypes.toList(), null, true, rs.arityMethodCheck,
  12.174 +                            inferenceContext);
  12.175 +                Symbol res = tree.sym = lookupRes.fst;
  12.176 +                if (res.kind >= Kinds.ERRONEOUS ||
  12.177 +                        res.type.hasTag(FORALL) ||
  12.178 +                        (res.flags() & Flags.VARARGS) != 0 ||
  12.179 +                        (TreeInfo.isStaticSelector(exprTree, tree.name.table.names) &&
  12.180 +                        exprTree.type.isRaw())) {
  12.181 +                    stuckVars.addAll(freeArgVars);
  12.182 +                }
  12.183 +            }
  12.184          }
  12.185  
  12.186          void scanLambdaBody(JCLambda lambda, final Type pt) {
  12.187              if (lambda.getBodyKind() == JCTree.JCLambda.BodyKind.EXPRESSION) {
  12.188 -                stuckVars.addAll(stuckVarsInternal(lambda.body, pt, inferenceContext));
  12.189 +                stuckVars.addAll(stuckVarsInternal(lambda.body, pt, env, inferenceContext));
  12.190              } else {
  12.191                  LambdaReturnScanner lambdaScanner = new LambdaReturnScanner() {
  12.192                      @Override
  12.193                      public void visitReturn(JCReturn tree) {
  12.194                          if (tree.expr != null) {
  12.195 -                            stuckVars.addAll(stuckVarsInternal(tree.expr, pt, inferenceContext));
  12.196 +                            stuckVars.addAll(stuckVarsInternal(tree.expr, pt, env, inferenceContext));
  12.197                          }
  12.198                      }
  12.199                  };
  12.200 @@ -941,12 +958,13 @@
  12.201                      attribSpeculative(rec, env, attr.unknownTypeExprInfo).type :
  12.202                      env.enclClass.sym.type;
  12.203  
  12.204 -            ListBuffer<Type> args = ListBuffer.lb();
  12.205 -            for (int i = 0; i < tree.args.length(); i ++) {
  12.206 -                args.append(Type.noType);
  12.207 +            while (site.hasTag(TYPEVAR)) {
  12.208 +                site = site.getUpperBound();
  12.209              }
  12.210  
  12.211 -            Resolve.LookupHelper lh = rs.new LookupHelper(name, site, args.toList(), List.<Type>nil(), MethodResolutionPhase.VARARITY) {
  12.212 +            List<Type> args = rs.dummyArgs(tree.args.length());
  12.213 +
  12.214 +            Resolve.LookupHelper lh = rs.new LookupHelper(name, site, args, List.<Type>nil(), MethodResolutionPhase.VARARITY) {
  12.215                  @Override
  12.216                  Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) {
  12.217                      return rec == null ?
    13.1 --- a/src/share/classes/com/sun/tools/javac/comp/Flow.java	Wed Jul 24 15:18:33 2013 -0700
    13.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java	Thu Jul 25 19:06:03 2013 +0100
    13.3 @@ -373,6 +373,15 @@
    13.4          boolean resolveBreaks(JCTree tree, ListBuffer<P> oldPendingExits) {
    13.5              return resolveJump(tree, oldPendingExits, JumpKind.BREAK);
    13.6          }
    13.7 +
    13.8 +        @Override
    13.9 +        public void scan(JCTree tree) {
   13.10 +            if (tree != null && (
   13.11 +                    tree.type == null ||
   13.12 +                    tree.type != Type.stuckType)) {
   13.13 +                super.scan(tree);
   13.14 +            }
   13.15 +        }
   13.16      }
   13.17  
   13.18      /**
    14.1 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Wed Jul 24 15:18:33 2013 -0700
    14.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Jul 25 19:06:03 2013 +0100
    14.3 @@ -41,9 +41,11 @@
    14.4  import com.sun.tools.javac.comp.Resolve.InapplicableMethodException;
    14.5  import com.sun.tools.javac.comp.Resolve.VerboseResolutionMode;
    14.6  
    14.7 +import java.util.Comparator;
    14.8  import java.util.HashMap;
    14.9  import java.util.Map;
   14.10  import java.util.Set;
   14.11 +import java.util.TreeSet;
   14.12  
   14.13  import java.util.ArrayList;
   14.14  import java.util.Collections;
   14.15 @@ -149,7 +151,7 @@
   14.16          inferenceException.clear();
   14.17          try {
   14.18              DeferredAttr.DeferredAttrContext deferredAttrContext =
   14.19 -                    resolveContext.deferredAttrContext(msym, inferenceContext, resultInfo, warn);
   14.20 +                        resolveContext.deferredAttrContext(msym, inferenceContext, resultInfo, warn);
   14.21  
   14.22              resolveContext.methodCheck.argumentsAcceptable(env, deferredAttrContext,
   14.23                      argtypes, mt.getParameterTypes(), warn);
   14.24 @@ -159,7 +161,8 @@
   14.25                      !warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) {
   14.26                  //inject return constraints earlier
   14.27                  checkWithinBounds(inferenceContext, warn); //propagation
   14.28 -                generateReturnConstraints(resultInfo, mt, inferenceContext);
   14.29 +                Type newRestype = generateReturnConstraints(resultInfo, mt, inferenceContext);
   14.30 +                mt = (MethodType)types.createMethodTypeWithReturn(mt, newRestype);
   14.31                  //propagate outwards if needed
   14.32                  if (resultInfo.checkContext.inferenceContext().free(resultInfo.pt)) {
   14.33                      //propagate inference context outwards and exit
   14.34 @@ -209,9 +212,20 @@
   14.35       * call occurs in a context where a type T is expected, use the expected
   14.36       * type to derive more constraints on the generic method inference variables.
   14.37       */
   14.38 -    void generateReturnConstraints(Attr.ResultInfo resultInfo,
   14.39 +    Type generateReturnConstraints(Attr.ResultInfo resultInfo,
   14.40              MethodType mt, InferenceContext inferenceContext) {
   14.41 -        Type qtype1 = inferenceContext.asFree(mt.getReturnType());
   14.42 +        Type from = mt.getReturnType();
   14.43 +        if (mt.getReturnType().containsAny(inferenceContext.inferencevars) &&
   14.44 +                resultInfo.checkContext.inferenceContext() != emptyContext) {
   14.45 +            from = types.capture(from);
   14.46 +            //add synthetic captured ivars
   14.47 +            for (Type t : from.getTypeArguments()) {
   14.48 +                if (t.hasTag(TYPEVAR) && ((TypeVar)t).isCaptured()) {
   14.49 +                    inferenceContext.addVar((TypeVar)t);
   14.50 +                }
   14.51 +            }
   14.52 +        }
   14.53 +        Type qtype1 = inferenceContext.asFree(from);
   14.54          Type to = returnConstraintTarget(qtype1, resultInfo.pt);
   14.55          Assert.check(allowGraphInference || !resultInfo.checkContext.inferenceContext().free(to),
   14.56                  "legacy inference engine cannot handle constraints on both sides of a subtyping assertion");
   14.57 @@ -224,33 +238,34 @@
   14.58                      .setMessage("infer.no.conforming.instance.exists",
   14.59                      inferenceContext.restvars(), mt.getReturnType(), to);
   14.60          }
   14.61 +        return from;
   14.62      }
   14.63 -    //where
   14.64 -        private Type returnConstraintTarget(Type from, Type to) {
   14.65 -            if (from.hasTag(VOID)) {
   14.66 -                return syms.voidType;
   14.67 -            } else if (to.hasTag(NONE)) {
   14.68 -                return from.isPrimitive() ? from : syms.objectType;
   14.69 -            } else if (from.hasTag(UNDETVAR) && to.isPrimitive()) {
   14.70 -                if (!allowGraphInference) {
   14.71 -                    //if legacy, just return boxed type
   14.72 -                    return types.boxedClass(to).type;
   14.73 +
   14.74 +    Type returnConstraintTarget(Type from, Type to) {
   14.75 +        if (from.hasTag(VOID)) {
   14.76 +            return syms.voidType;
   14.77 +        } else if (to.hasTag(NONE)) {
   14.78 +            return from.isPrimitive() ? from : syms.objectType;
   14.79 +        } else if (from.hasTag(UNDETVAR) && to.isPrimitive()) {
   14.80 +            if (!allowGraphInference) {
   14.81 +                //if legacy, just return boxed type
   14.82 +                return types.boxedClass(to).type;
   14.83 +            }
   14.84 +            //if graph inference we need to skip conflicting boxed bounds...
   14.85 +            UndetVar uv = (UndetVar)from;
   14.86 +            for (Type t : uv.getBounds(InferenceBound.EQ, InferenceBound.LOWER)) {
   14.87 +                Type boundAsPrimitive = types.unboxedType(t);
   14.88 +                if (boundAsPrimitive == null) continue;
   14.89 +                if (types.isConvertible(boundAsPrimitive, to)) {
   14.90 +                    //effectively skip return-type constraint generation (compatibility)
   14.91 +                    return syms.objectType;
   14.92                  }
   14.93 -                //if graph inference we need to skip conflicting boxed bounds...
   14.94 -                UndetVar uv = (UndetVar)from;
   14.95 -                for (Type t : uv.getBounds(InferenceBound.EQ, InferenceBound.LOWER)) {
   14.96 -                    Type boundAsPrimitive = types.unboxedType(t);
   14.97 -                    if (boundAsPrimitive == null) continue;
   14.98 -                    if (types.isConvertible(boundAsPrimitive, to)) {
   14.99 -                        //effectively skip return-type constraint generation (compatibility)
  14.100 -                        return syms.objectType;
  14.101 -                    }
  14.102 -                }
  14.103 -                return types.boxedClass(to).type;
  14.104 -            } else {
  14.105 -                return to;
  14.106              }
  14.107 +            return types.boxedClass(to).type;
  14.108 +        } else {
  14.109 +            return to;
  14.110          }
  14.111 +    }
  14.112  
  14.113      /**
  14.114        * Infer cyclic inference variables as described in 15.12.2.8.
  14.115 @@ -418,6 +433,7 @@
  14.116      void checkWithinBounds(InferenceContext inferenceContext,
  14.117                               Warner warn) throws InferenceException {
  14.118          MultiUndetVarListener mlistener = new MultiUndetVarListener(inferenceContext.undetvars);
  14.119 +        List<Type> saved_undet = inferenceContext.save();
  14.120          try {
  14.121              while (true) {
  14.122                  mlistener.reset();
  14.123 @@ -435,7 +451,9 @@
  14.124                      EnumSet<IncorporationStep> incorporationSteps = allowGraphInference ?
  14.125                              incorporationStepsGraph : incorporationStepsLegacy;
  14.126                      for (IncorporationStep is : incorporationSteps) {
  14.127 -                        is.apply(uv, inferenceContext, warn);
  14.128 +                        if (is.accepts(uv, inferenceContext)) {
  14.129 +                            is.apply(uv, inferenceContext, warn);
  14.130 +                        }
  14.131                      }
  14.132                  }
  14.133                  if (!mlistener.changed || !allowGraphInference) break;
  14.134 @@ -443,6 +461,10 @@
  14.135          }
  14.136          finally {
  14.137              mlistener.detach();
  14.138 +            if (incorporationCache.size() == MAX_INCORPORATION_STEPS) {
  14.139 +                inferenceContext.rollback(saved_undet);
  14.140 +            }
  14.141 +            incorporationCache.clear();
  14.142          }
  14.143      }
  14.144      //where
  14.145 @@ -454,7 +476,6 @@
  14.146           */
  14.147          class MultiUndetVarListener implements UndetVar.UndetVarListener {
  14.148  
  14.149 -            int rounds;
  14.150              boolean changed;
  14.151              List<Type> undetvars;
  14.152  
  14.153 @@ -468,13 +489,12 @@
  14.154  
  14.155              public void varChanged(UndetVar uv, Set<InferenceBound> ibs) {
  14.156                  //avoid non-termination
  14.157 -                if (rounds < MAX_INCORPORATION_STEPS) {
  14.158 +                if (incorporationCache.size() < MAX_INCORPORATION_STEPS) {
  14.159                      changed = true;
  14.160                  }
  14.161              }
  14.162  
  14.163              void reset() {
  14.164 -                rounds++;
  14.165                  changed = false;
  14.166              }
  14.167  
  14.168 @@ -507,22 +527,27 @@
  14.169                  if (uv.inst != null) {
  14.170                      Type inst = uv.inst;
  14.171                      for (Type u : uv.getBounds(InferenceBound.UPPER)) {
  14.172 -                        if (!infer.types.isSubtypeUnchecked(inst, inferenceContext.asFree(u), warn)) {
  14.173 +                        if (!isSubtype(inst, inferenceContext.asFree(u), warn, infer)) {
  14.174                              infer.reportBoundError(uv, BoundErrorKind.UPPER);
  14.175                          }
  14.176                      }
  14.177                      for (Type l : uv.getBounds(InferenceBound.LOWER)) {
  14.178 -                        if (!infer.types.isSubtypeUnchecked(inferenceContext.asFree(l), inst, warn)) {
  14.179 +                        if (!isSubtype(inferenceContext.asFree(l), inst, warn, infer)) {
  14.180                              infer.reportBoundError(uv, BoundErrorKind.LOWER);
  14.181                          }
  14.182                      }
  14.183                      for (Type e : uv.getBounds(InferenceBound.EQ)) {
  14.184 -                        if (!infer.types.isSameType(inst, inferenceContext.asFree(e))) {
  14.185 +                        if (!isSameType(inst, inferenceContext.asFree(e), infer)) {
  14.186                              infer.reportBoundError(uv, BoundErrorKind.EQ);
  14.187                          }
  14.188                      }
  14.189                  }
  14.190              }
  14.191 +            @Override
  14.192 +            boolean accepts(UndetVar uv, InferenceContext inferenceContext) {
  14.193 +                //applies to all undetvars
  14.194 +                return true;
  14.195 +            }
  14.196          },
  14.197          /**
  14.198           * Check consistency of equality constraints. This is a slightly more aggressive
  14.199 @@ -535,19 +560,19 @@
  14.200                  Type eq = null;
  14.201                  for (Type e : uv.getBounds(InferenceBound.EQ)) {
  14.202                      Assert.check(!inferenceContext.free(e));
  14.203 -                    if (eq != null && !infer.types.isSameType(e, eq)) {
  14.204 +                    if (eq != null && !isSameType(e, eq, infer)) {
  14.205                          infer.reportBoundError(uv, BoundErrorKind.EQ);
  14.206                      }
  14.207                      eq = e;
  14.208                      for (Type l : uv.getBounds(InferenceBound.LOWER)) {
  14.209                          Assert.check(!inferenceContext.free(l));
  14.210 -                        if (!infer.types.isSubtypeUnchecked(l, e, warn)) {
  14.211 +                        if (!isSubtype(l, e, warn, infer)) {
  14.212                              infer.reportBoundError(uv, BoundErrorKind.BAD_EQ_LOWER);
  14.213                          }
  14.214                      }
  14.215                      for (Type u : uv.getBounds(InferenceBound.UPPER)) {
  14.216                          if (inferenceContext.free(u)) continue;
  14.217 -                        if (!infer.types.isSubtypeUnchecked(e, u, warn)) {
  14.218 +                        if (!isSubtype(e, u, warn, infer)) {
  14.219                              infer.reportBoundError(uv, BoundErrorKind.BAD_EQ_UPPER);
  14.220                          }
  14.221                      }
  14.222 @@ -563,12 +588,12 @@
  14.223                  for (Type e : uv.getBounds(InferenceBound.EQ)) {
  14.224                      if (e.containsAny(inferenceContext.inferenceVars())) continue;
  14.225                      for (Type u : uv.getBounds(InferenceBound.UPPER)) {
  14.226 -                        if (!infer.types.isSubtypeUnchecked(e, inferenceContext.asFree(u), warn)) {
  14.227 +                        if (!isSubtype(e, inferenceContext.asFree(u), warn, infer)) {
  14.228                              infer.reportBoundError(uv, BoundErrorKind.BAD_EQ_UPPER);
  14.229                          }
  14.230                      }
  14.231                      for (Type l : uv.getBounds(InferenceBound.LOWER)) {
  14.232 -                        if (!infer.types.isSubtypeUnchecked(inferenceContext.asFree(l), e, warn)) {
  14.233 +                        if (!isSubtype(inferenceContext.asFree(l), e, warn, infer)) {
  14.234                              infer.reportBoundError(uv, BoundErrorKind.BAD_EQ_LOWER);
  14.235                          }
  14.236                      }
  14.237 @@ -584,7 +609,7 @@
  14.238                  Infer infer = inferenceContext.infer();
  14.239                  for (Type b1 : uv.getBounds(InferenceBound.UPPER)) {
  14.240                      for (Type b2 : uv.getBounds(InferenceBound.LOWER)) {
  14.241 -                        infer.types.isSubtypeUnchecked(inferenceContext.asFree(b2), inferenceContext.asFree(b1));
  14.242 +                        isSubtype(inferenceContext.asFree(b2), inferenceContext.asFree(b1), warn , infer);
  14.243                      }
  14.244                  }
  14.245              }
  14.246 @@ -598,7 +623,7 @@
  14.247                  Infer infer = inferenceContext.infer();
  14.248                  for (Type b1 : uv.getBounds(InferenceBound.UPPER)) {
  14.249                      for (Type b2 : uv.getBounds(InferenceBound.EQ)) {
  14.250 -                        infer.types.isSubtypeUnchecked(inferenceContext.asFree(b2), inferenceContext.asFree(b1));
  14.251 +                        isSubtype(inferenceContext.asFree(b2), inferenceContext.asFree(b1), warn, infer);
  14.252                      }
  14.253                  }
  14.254              }
  14.255 @@ -612,7 +637,7 @@
  14.256                  Infer infer = inferenceContext.infer();
  14.257                  for (Type b1 : uv.getBounds(InferenceBound.EQ)) {
  14.258                      for (Type b2 : uv.getBounds(InferenceBound.LOWER)) {
  14.259 -                        infer.types.isSubtypeUnchecked(inferenceContext.asFree(b2), inferenceContext.asFree(b1));
  14.260 +                        isSubtype(inferenceContext.asFree(b2), inferenceContext.asFree(b1), warn, infer);
  14.261                      }
  14.262                  }
  14.263              }
  14.264 @@ -627,7 +652,7 @@
  14.265                  for (Type b1 : uv.getBounds(InferenceBound.EQ)) {
  14.266                      for (Type b2 : uv.getBounds(InferenceBound.EQ)) {
  14.267                          if (b1 != b2) {
  14.268 -                            infer.types.isSameType(inferenceContext.asFree(b2), inferenceContext.asFree(b1));
  14.269 +                            isSameType(inferenceContext.asFree(b2), inferenceContext.asFree(b1), infer);
  14.270                          }
  14.271                      }
  14.272                  }
  14.273 @@ -643,16 +668,17 @@
  14.274                  for (Type b : uv.getBounds(InferenceBound.UPPER)) {
  14.275                      if (inferenceContext.inferenceVars().contains(b)) {
  14.276                          UndetVar uv2 = (UndetVar)inferenceContext.asFree(b);
  14.277 +                        if (uv2.isCaptured()) continue;
  14.278                          //alpha <: beta
  14.279                          //0. set beta :> alpha
  14.280 -                        uv2.addBound(InferenceBound.LOWER, uv.qtype, infer.types);
  14.281 +                        addBound(InferenceBound.LOWER, uv2, inferenceContext.asInstType(uv.qtype), infer);
  14.282                          //1. copy alpha's lower to beta's
  14.283                          for (Type l : uv.getBounds(InferenceBound.LOWER)) {
  14.284 -                            uv2.addBound(InferenceBound.LOWER, inferenceContext.asInstType(l), infer.types);
  14.285 +                            addBound(InferenceBound.LOWER, uv2, inferenceContext.asInstType(l), infer);
  14.286                          }
  14.287                          //2. copy beta's upper to alpha's
  14.288                          for (Type u : uv2.getBounds(InferenceBound.UPPER)) {
  14.289 -                            uv.addBound(InferenceBound.UPPER, inferenceContext.asInstType(u), infer.types);
  14.290 +                            addBound(InferenceBound.UPPER, uv, inferenceContext.asInstType(u), infer);
  14.291                          }
  14.292                      }
  14.293                  }
  14.294 @@ -668,16 +694,17 @@
  14.295                  for (Type b : uv.getBounds(InferenceBound.LOWER)) {
  14.296                      if (inferenceContext.inferenceVars().contains(b)) {
  14.297                          UndetVar uv2 = (UndetVar)inferenceContext.asFree(b);
  14.298 +                        if (uv2.isCaptured()) continue;
  14.299                          //alpha :> beta
  14.300                          //0. set beta <: alpha
  14.301 -                        uv2.addBound(InferenceBound.UPPER, uv.qtype, infer.types);
  14.302 +                        addBound(InferenceBound.UPPER, uv2, inferenceContext.asInstType(uv.qtype), infer);
  14.303                          //1. copy alpha's upper to beta's
  14.304                          for (Type u : uv.getBounds(InferenceBound.UPPER)) {
  14.305 -                            uv2.addBound(InferenceBound.UPPER, inferenceContext.asInstType(u), infer.types);
  14.306 +                            addBound(InferenceBound.UPPER, uv2, inferenceContext.asInstType(u), infer);
  14.307                          }
  14.308                          //2. copy beta's lower to alpha's
  14.309                          for (Type l : uv2.getBounds(InferenceBound.LOWER)) {
  14.310 -                            uv.addBound(InferenceBound.LOWER, inferenceContext.asInstType(l), infer.types);
  14.311 +                            addBound(InferenceBound.LOWER, uv, inferenceContext.asInstType(l), infer);
  14.312                          }
  14.313                      }
  14.314                  }
  14.315 @@ -693,14 +720,15 @@
  14.316                  for (Type b : uv.getBounds(InferenceBound.EQ)) {
  14.317                      if (inferenceContext.inferenceVars().contains(b)) {
  14.318                          UndetVar uv2 = (UndetVar)inferenceContext.asFree(b);
  14.319 +                        if (uv2.isCaptured()) continue;
  14.320                          //alpha == beta
  14.321                          //0. set beta == alpha
  14.322 -                        uv2.addBound(InferenceBound.EQ, uv.qtype, infer.types);
  14.323 +                        addBound(InferenceBound.EQ, uv2, inferenceContext.asInstType(uv.qtype), infer);
  14.324                          //1. copy all alpha's bounds to beta's
  14.325                          for (InferenceBound ib : InferenceBound.values()) {
  14.326                              for (Type b2 : uv.getBounds(ib)) {
  14.327                                  if (b2 != uv2) {
  14.328 -                                    uv2.addBound(ib, inferenceContext.asInstType(b2), infer.types);
  14.329 +                                    addBound(ib, uv2, inferenceContext.asInstType(b2), infer);
  14.330                                  }
  14.331                              }
  14.332                          }
  14.333 @@ -708,7 +736,7 @@
  14.334                          for (InferenceBound ib : InferenceBound.values()) {
  14.335                              for (Type b2 : uv2.getBounds(ib)) {
  14.336                                  if (b2 != uv) {
  14.337 -                                    uv.addBound(ib, inferenceContext.asInstType(b2), infer.types);
  14.338 +                                    addBound(ib, uv, inferenceContext.asInstType(b2), infer);
  14.339                                  }
  14.340                              }
  14.341                          }
  14.342 @@ -718,6 +746,45 @@
  14.343          };
  14.344  
  14.345          abstract void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn);
  14.346 +
  14.347 +        boolean accepts(UndetVar uv, InferenceContext inferenceContext) {
  14.348 +            return !uv.isCaptured();
  14.349 +        }
  14.350 +
  14.351 +        boolean isSubtype(Type s, Type t, Warner warn, Infer infer) {
  14.352 +            return doIncorporationOp(IncorporationBinaryOpKind.IS_SUBTYPE, s, t, warn, infer);
  14.353 +        }
  14.354 +
  14.355 +        boolean isSameType(Type s, Type t, Infer infer) {
  14.356 +            return doIncorporationOp(IncorporationBinaryOpKind.IS_SAME_TYPE, s, t, null, infer);
  14.357 +        }
  14.358 +
  14.359 +        void addBound(InferenceBound ib, UndetVar uv, Type b, Infer infer) {
  14.360 +            doIncorporationOp(opFor(ib), uv, b, null, infer);
  14.361 +        }
  14.362 +
  14.363 +        IncorporationBinaryOpKind opFor(InferenceBound boundKind) {
  14.364 +            switch (boundKind) {
  14.365 +                case EQ:
  14.366 +                    return IncorporationBinaryOpKind.ADD_EQ_BOUND;
  14.367 +                case LOWER:
  14.368 +                    return IncorporationBinaryOpKind.ADD_LOWER_BOUND;
  14.369 +                case UPPER:
  14.370 +                    return IncorporationBinaryOpKind.ADD_UPPER_BOUND;
  14.371 +                default:
  14.372 +                    Assert.error("Can't get here!");
  14.373 +                    return null;
  14.374 +            }
  14.375 +        }
  14.376 +
  14.377 +        boolean doIncorporationOp(IncorporationBinaryOpKind opKind, Type op1, Type op2, Warner warn, Infer infer) {
  14.378 +            IncorporationBinaryOp newOp = infer.new IncorporationBinaryOp(opKind, op1, op2);
  14.379 +            Boolean res = infer.incorporationCache.get(newOp);
  14.380 +            if (res == null) {
  14.381 +                infer.incorporationCache.put(newOp, res = newOp.apply(warn));
  14.382 +            }
  14.383 +            return res;
  14.384 +        }
  14.385      }
  14.386  
  14.387      /** incorporation steps to be executed when running in legacy mode */
  14.388 @@ -728,6 +795,102 @@
  14.389              EnumSet.complementOf(EnumSet.of(IncorporationStep.EQ_CHECK_LEGACY));
  14.390  
  14.391      /**
  14.392 +     * Three kinds of basic operation are supported as part of an incorporation step:
  14.393 +     * (i) subtype check, (ii) same type check and (iii) bound addition (either
  14.394 +     * upper/lower/eq bound).
  14.395 +     */
  14.396 +    enum IncorporationBinaryOpKind {
  14.397 +        IS_SUBTYPE() {
  14.398 +            @Override
  14.399 +            boolean apply(Type op1, Type op2, Warner warn, Types types) {
  14.400 +                return types.isSubtypeUnchecked(op1, op2, warn);
  14.401 +            }
  14.402 +        },
  14.403 +        IS_SAME_TYPE() {
  14.404 +            @Override
  14.405 +            boolean apply(Type op1, Type op2, Warner warn, Types types) {
  14.406 +                return types.isSameType(op1, op2);
  14.407 +            }
  14.408 +        },
  14.409 +        ADD_UPPER_BOUND() {
  14.410 +            @Override
  14.411 +            boolean apply(Type op1, Type op2, Warner warn, Types types) {
  14.412 +                UndetVar uv = (UndetVar)op1;
  14.413 +                uv.addBound(InferenceBound.UPPER, op2, types);
  14.414 +                return true;
  14.415 +            }
  14.416 +        },
  14.417 +        ADD_LOWER_BOUND() {
  14.418 +            @Override
  14.419 +            boolean apply(Type op1, Type op2, Warner warn, Types types) {
  14.420 +                UndetVar uv = (UndetVar)op1;
  14.421 +                uv.addBound(InferenceBound.LOWER, op2, types);
  14.422 +                return true;
  14.423 +            }
  14.424 +        },
  14.425 +        ADD_EQ_BOUND() {
  14.426 +            @Override
  14.427 +            boolean apply(Type op1, Type op2, Warner warn, Types types) {
  14.428 +                UndetVar uv = (UndetVar)op1;
  14.429 +                uv.addBound(InferenceBound.EQ, op2, types);
  14.430 +                return true;
  14.431 +            }
  14.432 +        };
  14.433 +
  14.434 +        abstract boolean apply(Type op1, Type op2, Warner warn, Types types);
  14.435 +    }
  14.436 +
  14.437 +    /**
  14.438 +     * This class encapsulates a basic incorporation operation; incorporation
  14.439 +     * operations takes two type operands and a kind. Each operation performed
  14.440 +     * during an incorporation round is stored in a cache, so that operations
  14.441 +     * are not executed unnecessarily (which would potentially lead to adding
  14.442 +     * same bounds over and over).
  14.443 +     */
  14.444 +    class IncorporationBinaryOp {
  14.445 +
  14.446 +        IncorporationBinaryOpKind opKind;
  14.447 +        Type op1;
  14.448 +        Type op2;
  14.449 +
  14.450 +        IncorporationBinaryOp(IncorporationBinaryOpKind opKind, Type op1, Type op2) {
  14.451 +            this.opKind = opKind;
  14.452 +            this.op1 = op1;
  14.453 +            this.op2 = op2;
  14.454 +        }
  14.455 +
  14.456 +        @Override
  14.457 +        public boolean equals(Object o) {
  14.458 +            if (!(o instanceof IncorporationBinaryOp)) {
  14.459 +                return false;
  14.460 +            } else {
  14.461 +                IncorporationBinaryOp that = (IncorporationBinaryOp)o;
  14.462 +                return opKind == that.opKind &&
  14.463 +                        types.isSameType(op1, that.op1, true) &&
  14.464 +                        types.isSameType(op2, that.op2, true);
  14.465 +            }
  14.466 +        }
  14.467 +
  14.468 +        @Override
  14.469 +        public int hashCode() {
  14.470 +            int result = opKind.hashCode();
  14.471 +            result *= 127;
  14.472 +            result += types.hashCode(op1);
  14.473 +            result *= 127;
  14.474 +            result += types.hashCode(op2);
  14.475 +            return result;
  14.476 +        }
  14.477 +
  14.478 +        boolean apply(Warner warn) {
  14.479 +            return opKind.apply(op1, op2, warn, types);
  14.480 +        }
  14.481 +    }
  14.482 +
  14.483 +    /** an incorporation cache keeps track of all executed incorporation-related operations */
  14.484 +    Map<IncorporationBinaryOp, Boolean> incorporationCache =
  14.485 +            new HashMap<IncorporationBinaryOp, Boolean>();
  14.486 +
  14.487 +    /**
  14.488       * Make sure that the upper bounds we got so far lead to a solvable inference
  14.489       * variable by making sure that a glb exists.
  14.490       */
  14.491 @@ -862,6 +1025,41 @@
  14.492                          Assert.check(!g.nodes.isEmpty(), "No nodes to solve!");
  14.493              return g.nodes.get(0);
  14.494          }
  14.495 +
  14.496 +        boolean isSubtype(Type s, Type t, Warner warn, Infer infer) {
  14.497 +            return doIncorporationOp(IncorporationBinaryOpKind.IS_SUBTYPE, s, t, warn, infer);
  14.498 +        }
  14.499 +
  14.500 +        boolean isSameType(Type s, Type t, Infer infer) {
  14.501 +            return doIncorporationOp(IncorporationBinaryOpKind.IS_SAME_TYPE, s, t, null, infer);
  14.502 +        }
  14.503 +
  14.504 +        void addBound(InferenceBound ib, UndetVar uv, Type b, Infer infer) {
  14.505 +            doIncorporationOp(opFor(ib), uv, b, null, infer);
  14.506 +        }
  14.507 +
  14.508 +        IncorporationBinaryOpKind opFor(InferenceBound boundKind) {
  14.509 +            switch (boundKind) {
  14.510 +                case EQ:
  14.511 +                    return IncorporationBinaryOpKind.ADD_EQ_BOUND;
  14.512 +                case LOWER:
  14.513 +                    return IncorporationBinaryOpKind.ADD_LOWER_BOUND;
  14.514 +                case UPPER:
  14.515 +                    return IncorporationBinaryOpKind.ADD_UPPER_BOUND;
  14.516 +                default:
  14.517 +                    Assert.error("Can't get here!");
  14.518 +                    return null;
  14.519 +            }
  14.520 +        }
  14.521 +
  14.522 +        boolean doIncorporationOp(IncorporationBinaryOpKind opKind, Type op1, Type op2, Warner warn, Infer infer) {
  14.523 +            IncorporationBinaryOp newOp = infer.new IncorporationBinaryOp(opKind, op1, op2);
  14.524 +            Boolean res = infer.incorporationCache.get(newOp);
  14.525 +            if (res == null) {
  14.526 +                infer.incorporationCache.put(newOp, res = newOp.apply(warn));
  14.527 +            }
  14.528 +            return res;
  14.529 +        }
  14.530      }
  14.531  
  14.532      /**
  14.533 @@ -878,27 +1076,32 @@
  14.534          }
  14.535  
  14.536          /**
  14.537 -         * Computes the cost associated with a given node; the cost is computed
  14.538 -         * as the total number of type-variables that should be eagerly instantiated
  14.539 -         * in order to get to some of the variables in {@code varsToSolve} from
  14.540 -         * a given node
  14.541 +         * Computes the minimum path that goes from a given node to any of the nodes
  14.542 +         * containing a variable in {@code varsToSolve}. For any given path, the cost
  14.543 +         * is computed as the total number of type-variables that should be eagerly
  14.544 +         * instantiated across that path.
  14.545           */
  14.546 -        void computeCostIfNeeded(Node n, Map<Node, Integer> costMap) {
  14.547 -            if (costMap.containsKey(n)) {
  14.548 -                return;
  14.549 -            } else if (!Collections.disjoint(n.data, varsToSolve)) {
  14.550 -                costMap.put(n, n.data.size());
  14.551 +        int computeMinPath(InferenceGraph g, Node n) {
  14.552 +            return computeMinPath(g, n, List.<Node>nil(), 0);
  14.553 +        }
  14.554 +
  14.555 +        int computeMinPath(InferenceGraph g, Node n, List<Node> path, int cost) {
  14.556 +            if (path.contains(n)) return Integer.MAX_VALUE;
  14.557 +            List<Node> path2 = path.prepend(n);
  14.558 +            int cost2 = cost + n.data.size();
  14.559 +            if (!Collections.disjoint(n.data, varsToSolve)) {
  14.560 +                return cost2;
  14.561              } else {
  14.562 -                int subcost = Integer.MAX_VALUE;
  14.563 -                costMap.put(n, subcost); //avoid loops
  14.564 -                for (Node n2 : n.getDependencies()) {
  14.565 -                    computeCostIfNeeded(n2, costMap);
  14.566 -                    subcost = Math.min(costMap.get(n2), subcost);
  14.567 +               int bestPath = Integer.MAX_VALUE;
  14.568 +               for (Node n2 : g.nodes) {
  14.569 +                   if (n2.deps.contains(n)) {
  14.570 +                       int res = computeMinPath(g, n2, path2, cost2);
  14.571 +                       if (res < bestPath) {
  14.572 +                           bestPath = res;
  14.573 +                       }
  14.574 +                   }
  14.575                  }
  14.576 -                //update cost map to reflect real cost
  14.577 -                costMap.put(n, subcost == Integer.MAX_VALUE ?
  14.578 -                        Integer.MAX_VALUE :
  14.579 -                        n.data.size() + subcost);
  14.580 +               return bestPath;
  14.581              }
  14.582          }
  14.583  
  14.584 @@ -907,21 +1110,20 @@
  14.585           */
  14.586          @Override
  14.587          public Node pickNode(final InferenceGraph g) {
  14.588 -            final Map<Node, Integer> costMap = new HashMap<Node, Integer>();
  14.589 -            ArrayList<Node> leaves = new ArrayList<Node>();
  14.590 +            final Map<Node, Integer> leavesMap = new HashMap<Node, Integer>();
  14.591              for (Node n : g.nodes) {
  14.592 -                computeCostIfNeeded(n, costMap);
  14.593                  if (n.isLeaf(n)) {
  14.594 -                    leaves.add(n);
  14.595 +                    leavesMap.put(n, computeMinPath(g, n));
  14.596                  }
  14.597              }
  14.598 -            Assert.check(!leaves.isEmpty(), "No nodes to solve!");
  14.599 -            Collections.sort(leaves, new java.util.Comparator<Node>() {
  14.600 +            Assert.check(!leavesMap.isEmpty(), "No nodes to solve!");
  14.601 +            TreeSet<Node> orderedLeaves = new TreeSet<Node>(new Comparator<Node>() {
  14.602                  public int compare(Node n1, Node n2) {
  14.603 -                    return costMap.get(n1) - costMap.get(n2);
  14.604 +                    return leavesMap.get(n1) - leavesMap.get(n2);
  14.605                  }
  14.606              });
  14.607 -            return leaves.get(0);
  14.608 +            orderedLeaves.addAll(leavesMap.keySet());
  14.609 +            return orderedLeaves.first();
  14.610          }
  14.611      }
  14.612  
  14.613 @@ -964,6 +1166,39 @@
  14.614              }
  14.615          },
  14.616          /**
  14.617 +         * Infer uninstantiated/unbound inference variables occurring in 'throws'
  14.618 +         * clause as RuntimeException
  14.619 +         */
  14.620 +        THROWS(InferenceBound.UPPER) {
  14.621 +            @Override
  14.622 +            public boolean accepts(UndetVar t, InferenceContext inferenceContext) {
  14.623 +                if ((t.qtype.tsym.flags() & Flags.THROWS) == 0) {
  14.624 +                    //not a throws undet var
  14.625 +                    return false;
  14.626 +                }
  14.627 +                if (t.getBounds(InferenceBound.EQ, InferenceBound.LOWER, InferenceBound.UPPER)
  14.628 +                            .diff(t.getDeclaredBounds()).nonEmpty()) {
  14.629 +                    //not an unbounded undet var
  14.630 +                    return false;
  14.631 +                }
  14.632 +                Infer infer = inferenceContext.infer();
  14.633 +                for (Type db : t.getDeclaredBounds()) {
  14.634 +                    if (t.isInterface()) continue;
  14.635 +                    if (infer.types.asSuper(infer.syms.runtimeExceptionType, db.tsym) != null) {
  14.636 +                        //declared bound is a supertype of RuntimeException
  14.637 +                        return true;
  14.638 +                    }
  14.639 +                }
  14.640 +                //declared bound is more specific then RuntimeException - give up
  14.641 +                return false;
  14.642 +            }
  14.643 +
  14.644 +            @Override
  14.645 +            Type solve(UndetVar uv, InferenceContext inferenceContext) {
  14.646 +                return inferenceContext.infer().syms.runtimeExceptionType;
  14.647 +            }
  14.648 +        },
  14.649 +        /**
  14.650           * Instantiate an inference variables using its (ground) upper bounds. Such
  14.651           * bounds are merged together using glb().
  14.652           */
  14.653 @@ -990,13 +1225,36 @@
  14.654          UPPER_LEGACY(InferenceBound.UPPER) {
  14.655              @Override
  14.656              public boolean accepts(UndetVar t, InferenceContext inferenceContext) {
  14.657 -                return !inferenceContext.free(t.getBounds(ib));
  14.658 +                return !inferenceContext.free(t.getBounds(ib)) && !t.isCaptured();
  14.659              }
  14.660  
  14.661              @Override
  14.662              Type solve(UndetVar uv, InferenceContext inferenceContext) {
  14.663                  return UPPER.solve(uv, inferenceContext);
  14.664              }
  14.665 +        },
  14.666 +        /**
  14.667 +         * Like the former; the only difference is that this step can only be applied
  14.668 +         * if all upper/lower bounds are ground.
  14.669 +         */
  14.670 +        CAPTURED(InferenceBound.UPPER) {
  14.671 +            @Override
  14.672 +            public boolean accepts(UndetVar t, InferenceContext inferenceContext) {
  14.673 +                return !inferenceContext.free(t.getBounds(InferenceBound.UPPER, InferenceBound.LOWER));
  14.674 +            }
  14.675 +
  14.676 +            @Override
  14.677 +            Type solve(UndetVar uv, InferenceContext inferenceContext) {
  14.678 +                Infer infer = inferenceContext.infer();
  14.679 +                Type upper = UPPER.filterBounds(uv, inferenceContext).nonEmpty() ?
  14.680 +                        UPPER.solve(uv, inferenceContext) :
  14.681 +                        infer.syms.objectType;
  14.682 +                Type lower = LOWER.filterBounds(uv, inferenceContext).nonEmpty() ?
  14.683 +                        LOWER.solve(uv, inferenceContext) :
  14.684 +                        infer.syms.botType;
  14.685 +                CapturedType prevCaptured = (CapturedType)uv.qtype;
  14.686 +                return new CapturedType(prevCaptured.tsym.name, prevCaptured.tsym.owner, upper, lower, prevCaptured.wildcard);
  14.687 +            }
  14.688          };
  14.689  
  14.690          final InferenceBound ib;
  14.691 @@ -1015,7 +1273,7 @@
  14.692           * Can the inference variable be instantiated using this step?
  14.693           */
  14.694          public boolean accepts(UndetVar t, InferenceContext inferenceContext) {
  14.695 -            return filterBounds(t, inferenceContext).nonEmpty();
  14.696 +            return filterBounds(t, inferenceContext).nonEmpty() && !t.isCaptured();
  14.697          }
  14.698  
  14.699          /**
  14.700 @@ -1052,7 +1310,7 @@
  14.701  
  14.702          EQ(EnumSet.of(InferenceStep.EQ)),
  14.703          EQ_LOWER(EnumSet.of(InferenceStep.EQ, InferenceStep.LOWER)),
  14.704 -        EQ_LOWER_UPPER(EnumSet.of(InferenceStep.EQ, InferenceStep.LOWER, InferenceStep.UPPER));
  14.705 +        EQ_LOWER_THROWS_UPPER_CAPTURED(EnumSet.of(InferenceStep.EQ, InferenceStep.LOWER, InferenceStep.UPPER, InferenceStep.THROWS, InferenceStep.CAPTURED));
  14.706  
  14.707          final EnumSet<InferenceStep> steps;
  14.708  
  14.709 @@ -1090,7 +1348,7 @@
  14.710              while (!sstrategy.done()) {
  14.711                  InferenceGraph.Node nodeToSolve = sstrategy.pickNode(inferenceGraph);
  14.712                  List<Type> varsToSolve = List.from(nodeToSolve.data);
  14.713 -                inferenceContext.save();
  14.714 +                List<Type> saved_undet = inferenceContext.save();
  14.715                  try {
  14.716                      //repeat until all variables are solved
  14.717                      outer: while (Type.containsAny(inferenceContext.restvars(), varsToSolve)) {
  14.718 @@ -1107,7 +1365,7 @@
  14.719                  }
  14.720                  catch (InferenceException ex) {
  14.721                      //did we fail because of interdependent ivars?
  14.722 -                    inferenceContext.rollback();
  14.723 +                    inferenceContext.rollback(saved_undet);
  14.724                      instantiateAsUninferredVars(varsToSolve, inferenceContext);
  14.725                      checkWithinBounds(inferenceContext, warn);
  14.726                  }
  14.727 @@ -1300,9 +1558,6 @@
  14.728          /** list of inference vars in this context */
  14.729          List<Type> inferencevars;
  14.730  
  14.731 -        /** backed up inference variables */
  14.732 -        List<Type> saved_undet;
  14.733 -
  14.734          java.util.Map<FreeTypeListener, List<Type>> freeTypeListeners =
  14.735                  new java.util.HashMap<FreeTypeListener, List<Type>>();
  14.736  
  14.737 @@ -1316,12 +1571,26 @@
  14.738              Mapping fromTypeVarFun = new Mapping("fromTypeVarFunWithBounds") {
  14.739                  // mapping that turns inference variables into undet vars
  14.740                  public Type apply(Type t) {
  14.741 -                    if (t.hasTag(TYPEVAR)) return new UndetVar((TypeVar)t, types);
  14.742 -                    else return t.map(this);
  14.743 +                    if (t.hasTag(TYPEVAR)) {
  14.744 +                        TypeVar tv = (TypeVar)t;
  14.745 +                        return tv.isCaptured() ?
  14.746 +                                new CapturedUndetVar((CapturedType)tv, types) :
  14.747 +                                new UndetVar(tv, types);
  14.748 +                    } else {
  14.749 +                        return t.map(this);
  14.750 +                    }
  14.751                  }
  14.752              };
  14.753  
  14.754          /**
  14.755 +         * add a new inference var to this inference context
  14.756 +         */
  14.757 +        void addVar(TypeVar t) {
  14.758 +            this.undetvars = this.undetvars.prepend(fromTypeVarFun.apply(t));
  14.759 +            this.inferencevars = this.inferencevars.prepend(t);
  14.760 +        }
  14.761 +
  14.762 +        /**
  14.763           * returns the list of free variables (as type-variables) in this
  14.764           * inference context
  14.765           */
  14.766 @@ -1502,7 +1771,7 @@
  14.767          /**
  14.768           * Save the state of this inference context
  14.769           */
  14.770 -        void save() {
  14.771 +        List<Type> save() {
  14.772              ListBuffer<Type> buf = ListBuffer.lb();
  14.773              for (Type t : undetvars) {
  14.774                  UndetVar uv = (UndetVar)t;
  14.775 @@ -1515,16 +1784,24 @@
  14.776                  uv2.inst = uv.inst;
  14.777                  buf.add(uv2);
  14.778              }
  14.779 -            saved_undet = buf.toList();
  14.780 +            return buf.toList();
  14.781          }
  14.782  
  14.783          /**
  14.784           * Restore the state of this inference context to the previous known checkpoint
  14.785           */
  14.786 -        void rollback() {
  14.787 -            Assert.check(saved_undet != null && saved_undet.length() == undetvars.length());
  14.788 -            undetvars = saved_undet;
  14.789 -            saved_undet = null;
  14.790 +        void rollback(List<Type> saved_undet) {
  14.791 +             Assert.check(saved_undet != null && saved_undet.length() == undetvars.length());
  14.792 +            //restore bounds (note: we need to preserve the old instances)
  14.793 +            for (Type t : undetvars) {
  14.794 +                UndetVar uv = (UndetVar)t;
  14.795 +                UndetVar uv_saved = (UndetVar)saved_undet.head;
  14.796 +                for (InferenceBound ib : InferenceBound.values()) {
  14.797 +                    uv.setBounds(ib, uv_saved.getBounds(ib));
  14.798 +                }
  14.799 +                uv.inst = uv_saved.inst;
  14.800 +                saved_undet = saved_undet.tail;
  14.801 +            }
  14.802          }
  14.803  
  14.804          /**
    15.1 --- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Wed Jul 24 15:18:33 2013 -0700
    15.2 +++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Thu Jul 25 19:06:03 2013 +0100
    15.3 @@ -358,7 +358,8 @@
    15.4       *  @param thrown      The method's thrown exceptions.
    15.5       *  @param env             The method's (local) environment.
    15.6       */
    15.7 -    Type signature(List<JCTypeParameter> typarams,
    15.8 +    Type signature(MethodSymbol msym,
    15.9 +                   List<JCTypeParameter> typarams,
   15.10                     List<JCVariableDecl> params,
   15.11                     JCTree res,
   15.12                     JCVariableDecl recvparam,
   15.13 @@ -392,8 +393,12 @@
   15.14          ListBuffer<Type> thrownbuf = new ListBuffer<Type>();
   15.15          for (List<JCExpression> l = thrown; l.nonEmpty(); l = l.tail) {
   15.16              Type exc = attr.attribType(l.head, env);
   15.17 -            if (!exc.hasTag(TYPEVAR))
   15.18 +            if (!exc.hasTag(TYPEVAR)) {
   15.19                  exc = chk.checkClassType(l.head.pos(), exc);
   15.20 +            } else if (exc.tsym.owner == msym) {
   15.21 +                //mark inference variables in 'throws' clause
   15.22 +                exc.tsym.flags_field |= THROWS;
   15.23 +            }
   15.24              thrownbuf.append(exc);
   15.25          }
   15.26          MethodType mtype = new MethodType(argbuf.toList(),
   15.27 @@ -503,11 +508,17 @@
   15.28          // process package annotations
   15.29          annotateLater(tree.packageAnnotations, env, tree.packge);
   15.30  
   15.31 -        // Import-on-demand java.lang.
   15.32 -        importAll(tree.pos, reader.enterPackage(names.java_lang), env);
   15.33 +        DeferredLintHandler prevLintHandler = chk.setDeferredLintHandler(DeferredLintHandler.immediateHandler);
   15.34  
   15.35 -        // Process all import clauses.
   15.36 -        memberEnter(tree.defs, env);
   15.37 +        try {
   15.38 +            // Import-on-demand java.lang.
   15.39 +            importAll(tree.pos, reader.enterPackage(names.java_lang), env);
   15.40 +
   15.41 +            // Process all import clauses.
   15.42 +            memberEnter(tree.defs, env);
   15.43 +        } finally {
   15.44 +            chk.setDeferredLintHandler(prevLintHandler);
   15.45 +        }
   15.46      }
   15.47  
   15.48      // process the non-static imports and the static imports of types.
   15.49 @@ -557,7 +568,7 @@
   15.50                  chk.setDeferredLintHandler(deferredLintHandler.setPos(tree.pos()));
   15.51          try {
   15.52              // Compute the method type
   15.53 -            m.type = signature(tree.typarams, tree.params,
   15.54 +            m.type = signature(m, tree.typarams, tree.params,
   15.55                                 tree.restype, tree.recvparam,
   15.56                                 tree.thrown,
   15.57                                 localEnv);
    16.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed Jul 24 15:18:33 2013 -0700
    16.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Jul 25 19:06:03 2013 +0100
    16.3 @@ -345,7 +345,7 @@
    16.4  
    16.5      boolean isAccessible(Env<AttrContext> env, Type t, boolean checkInner) {
    16.6          return (t.hasTag(ARRAY))
    16.7 -            ? isAccessible(env, types.elemtype(t))
    16.8 +            ? isAccessible(env, types.upperBound(types.elemtype(t)))
    16.9              : isAccessible(env, t.tsym, checkInner);
   16.10      }
   16.11  
   16.12 @@ -584,6 +584,13 @@
   16.13          try {
   16.14              currentResolutionContext = new MethodResolutionContext();
   16.15              currentResolutionContext.attrMode = DeferredAttr.AttrMode.CHECK;
   16.16 +            if (env.tree.hasTag(JCTree.Tag.REFERENCE)) {
   16.17 +                //method/constructor references need special check class
   16.18 +                //to handle inference variables in 'argtypes' (might happen
   16.19 +                //during an unsticking round)
   16.20 +                currentResolutionContext.methodCheck =
   16.21 +                        new MethodReferenceCheck(resultInfo.checkContext.inferenceContext());
   16.22 +            }
   16.23              MethodResolutionPhase step = currentResolutionContext.step = env.info.pendingResolutionPhase;
   16.24              return rawInstantiate(env, site, m, resultInfo, argtypes, typeargtypes,
   16.25                      step.isBoxingRequired(), step.isVarargsRequired(), warn);
   16.26 @@ -773,6 +780,14 @@
   16.27          }
   16.28      };
   16.29  
   16.30 +    List<Type> dummyArgs(int length) {
   16.31 +        ListBuffer<Type> buf = ListBuffer.lb();
   16.32 +        for (int i = 0 ; i < length ; i++) {
   16.33 +            buf.append(Type.noType);
   16.34 +        }
   16.35 +        return buf.toList();
   16.36 +    }
   16.37 +
   16.38      /**
   16.39       * Main method applicability routine. Given a list of actual types A,
   16.40       * a list of formal types F, determines whether the types in A are
   16.41 @@ -850,6 +865,47 @@
   16.42          }
   16.43      };
   16.44  
   16.45 +    class MethodReferenceCheck extends AbstractMethodCheck {
   16.46 +
   16.47 +        InferenceContext pendingInferenceContext;
   16.48 +
   16.49 +        MethodReferenceCheck(InferenceContext pendingInferenceContext) {
   16.50 +            this.pendingInferenceContext = pendingInferenceContext;
   16.51 +        }
   16.52 +
   16.53 +        @Override
   16.54 +        void checkArg(DiagnosticPosition pos, boolean varargs, Type actual, Type formal, DeferredAttrContext deferredAttrContext, Warner warn) {
   16.55 +            ResultInfo mresult = methodCheckResult(varargs, formal, deferredAttrContext, warn);
   16.56 +            mresult.check(pos, actual);
   16.57 +        }
   16.58 +
   16.59 +        private ResultInfo methodCheckResult(final boolean varargsCheck, Type to,
   16.60 +                final DeferredAttr.DeferredAttrContext deferredAttrContext, Warner rsWarner) {
   16.61 +            CheckContext checkContext = new MethodCheckContext(!deferredAttrContext.phase.isBoxingRequired(), deferredAttrContext, rsWarner) {
   16.62 +                MethodCheckDiag methodDiag = varargsCheck ?
   16.63 +                                 MethodCheckDiag.VARARG_MISMATCH : MethodCheckDiag.ARG_MISMATCH;
   16.64 +
   16.65 +                @Override
   16.66 +                public boolean compatible(Type found, Type req, Warner warn) {
   16.67 +                    found = pendingInferenceContext.asFree(found);
   16.68 +                    req = infer.returnConstraintTarget(found, req);
   16.69 +                    return super.compatible(found, req, warn);
   16.70 +                }
   16.71 +
   16.72 +                @Override
   16.73 +                public void report(DiagnosticPosition pos, JCDiagnostic details) {
   16.74 +                    reportMC(pos, methodDiag, deferredAttrContext.inferenceContext, details);
   16.75 +                }
   16.76 +            };
   16.77 +            return new MethodResultInfo(to, checkContext);
   16.78 +        }
   16.79 +
   16.80 +        @Override
   16.81 +        public MethodCheck mostSpecificCheck(List<Type> actuals, boolean strict) {
   16.82 +            return new MostSpecificCheck(strict, actuals);
   16.83 +        }
   16.84 +    };
   16.85 +
   16.86      /**
   16.87       * Check context to be used during method applicability checks. A method check
   16.88       * context might contain inference variables.
   16.89 @@ -905,10 +961,23 @@
   16.90                  DeferredType dt = (DeferredType)found;
   16.91                  return dt.check(this);
   16.92              } else {
   16.93 -                return super.check(pos, chk.checkNonVoid(pos, types.capture(types.upperBound(found.baseType()))));
   16.94 +                return super.check(pos, chk.checkNonVoid(pos, types.capture(U(found.baseType()))));
   16.95              }
   16.96          }
   16.97  
   16.98 +        /**
   16.99 +         * javac has a long-standing 'simplification' (see 6391995):
  16.100 +         * given an actual argument type, the method check is performed
  16.101 +         * on its upper bound. This leads to inconsistencies when an
  16.102 +         * argument type is checked against itself. For example, given
  16.103 +         * a type-variable T, it is not true that {@code U(T) <: T},
  16.104 +         * so we need to guard against that.
  16.105 +         */
  16.106 +        private Type U(Type found) {
  16.107 +            return found == pt ?
  16.108 +                    found : types.upperBound(found);
  16.109 +        }
  16.110 +
  16.111          @Override
  16.112          protected MethodResultInfo dup(Type newPt) {
  16.113              return new MethodResultInfo(newPt, checkContext);
  16.114 @@ -2421,7 +2490,7 @@
  16.115                      Symbol access(Env<AttrContext> env, DiagnosticPosition pos, Symbol location, Symbol sym) {
  16.116                          if (sym.kind >= AMBIGUOUS) {
  16.117                              final JCDiagnostic details = sym.kind == WRONG_MTH ?
  16.118 -                                            ((InapplicableSymbolError)sym).errCandidate().details :
  16.119 +                                            ((InapplicableSymbolError)sym).errCandidate().snd :
  16.120                                              null;
  16.121                              sym = new InapplicableSymbolError(sym.kind, "diamondError", currentResolutionContext) {
  16.122                                  @Override
  16.123 @@ -2576,7 +2645,8 @@
  16.124                                    Name name, List<Type> argtypes,
  16.125                                    List<Type> typeargtypes,
  16.126                                    boolean boxingAllowed,
  16.127 -                                  MethodCheck methodCheck) {
  16.128 +                                  MethodCheck methodCheck,
  16.129 +                                  InferenceContext inferenceContext) {
  16.130          MethodResolutionPhase maxPhase = boxingAllowed ? VARARITY : BASIC;
  16.131  
  16.132          ReferenceLookupHelper boundLookupHelper;
  16.133 @@ -2599,7 +2669,7 @@
  16.134          Symbol boundSym = lookupMethod(boundEnv, env.tree.pos(), site.tsym, methodCheck, boundLookupHelper);
  16.135  
  16.136          //step 2 - unbound lookup
  16.137 -        ReferenceLookupHelper unboundLookupHelper = boundLookupHelper.unboundLookup();
  16.138 +        ReferenceLookupHelper unboundLookupHelper = boundLookupHelper.unboundLookup(inferenceContext);
  16.139          Env<AttrContext> unboundEnv = env.dup(env.tree, env.info.dup());
  16.140          Symbol unboundSym = lookupMethod(unboundEnv, env.tree.pos(), site.tsym, methodCheck, unboundLookupHelper);
  16.141  
  16.142 @@ -2739,11 +2809,11 @@
  16.143           * Returns an unbound version of this lookup helper. By default, this
  16.144           * method returns an dummy lookup helper.
  16.145           */
  16.146 -        ReferenceLookupHelper unboundLookup() {
  16.147 +        ReferenceLookupHelper unboundLookup(InferenceContext inferenceContext) {
  16.148              //dummy loopkup helper that always return 'methodNotFound'
  16.149              return new ReferenceLookupHelper(referenceTree, name, site, argtypes, typeargtypes, maxPhase) {
  16.150                  @Override
  16.151 -                ReferenceLookupHelper unboundLookup() {
  16.152 +                ReferenceLookupHelper unboundLookup(InferenceContext inferenceContext) {
  16.153                      return this;
  16.154                  }
  16.155                  @Override
  16.156 @@ -2793,14 +2863,15 @@
  16.157          }
  16.158  
  16.159          @Override
  16.160 -        ReferenceLookupHelper unboundLookup() {
  16.161 +        ReferenceLookupHelper unboundLookup(InferenceContext inferenceContext) {
  16.162              if (TreeInfo.isStaticSelector(referenceTree.expr, names) &&
  16.163                      argtypes.nonEmpty() &&
  16.164 -                    (argtypes.head.hasTag(NONE) || types.isSubtypeUnchecked(argtypes.head, site))) {
  16.165 +                    (argtypes.head.hasTag(NONE) ||
  16.166 +                    types.isSubtypeUnchecked(inferenceContext.asFree(argtypes.head), site))) {
  16.167                  return new UnboundMethodReferenceLookupHelper(referenceTree, name,
  16.168                          site, argtypes, typeargtypes, maxPhase);
  16.169              } else {
  16.170 -                return super.unboundLookup();
  16.171 +                return super.unboundLookup(inferenceContext);
  16.172              }
  16.173          }
  16.174  
  16.175 @@ -2836,7 +2907,7 @@
  16.176          }
  16.177  
  16.178          @Override
  16.179 -        ReferenceLookupHelper unboundLookup() {
  16.180 +        ReferenceLookupHelper unboundLookup(InferenceContext inferenceContext) {
  16.181              return this;
  16.182          }
  16.183  
  16.184 @@ -3371,20 +3442,20 @@
  16.185                          key, name, first, second);
  16.186              }
  16.187              else {
  16.188 -                Candidate c = errCandidate();
  16.189 +                Pair<Symbol, JCDiagnostic> c = errCandidate();
  16.190                  if (compactMethodDiags) {
  16.191                      for (Map.Entry<Template, DiagnosticRewriter> _entry :
  16.192                              MethodResolutionDiagHelper.rewriters.entrySet()) {
  16.193 -                        if (_entry.getKey().matches(c.details)) {
  16.194 +                        if (_entry.getKey().matches(c.snd)) {
  16.195                              JCDiagnostic simpleDiag =
  16.196                                      _entry.getValue().rewriteDiagnostic(diags, pos,
  16.197 -                                        log.currentSource(), dkind, c.details);
  16.198 +                                        log.currentSource(), dkind, c.snd);
  16.199                              simpleDiag.setFlag(DiagnosticFlag.COMPRESSED);
  16.200                              return simpleDiag;
  16.201                          }
  16.202                      }
  16.203                  }
  16.204 -                Symbol ws = c.sym.asMemberOf(site, types);
  16.205 +                Symbol ws = c.fst.asMemberOf(site, types);
  16.206                  return diags.create(dkind, log.currentSource(), pos,
  16.207                            "cant.apply.symbol",
  16.208                            kindName(ws),
  16.209 @@ -3393,7 +3464,7 @@
  16.210                            methodArguments(argtypes),
  16.211                            kindName(ws.owner),
  16.212                            ws.owner.type,
  16.213 -                          c.details);
  16.214 +                          c.snd);
  16.215              }
  16.216          }
  16.217  
  16.218 @@ -3402,14 +3473,14 @@
  16.219              return types.createErrorType(name, location, syms.errSymbol.type).tsym;
  16.220          }
  16.221  
  16.222 -        private Candidate errCandidate() {
  16.223 +        protected Pair<Symbol, JCDiagnostic> errCandidate() {
  16.224              Candidate bestSoFar = null;
  16.225              for (Candidate c : resolveContext.candidates) {
  16.226                  if (c.isApplicable()) continue;
  16.227                  bestSoFar = c;
  16.228              }
  16.229              Assert.checkNonNull(bestSoFar);
  16.230 -            return bestSoFar;
  16.231 +            return new Pair<Symbol, JCDiagnostic>(bestSoFar.sym, bestSoFar.details);
  16.232          }
  16.233      }
  16.234  
  16.235 @@ -3452,7 +3523,15 @@
  16.236                          methodArguments(argtypes));
  16.237                  return new JCDiagnostic.MultilineDiagnostic(err, candidateDetails(filteredCandidates, site));
  16.238              } else if (filteredCandidates.size() == 1) {
  16.239 -                JCDiagnostic d =  new InapplicableSymbolError(resolveContext).getDiagnostic(dkind, pos,
  16.240 +                Map.Entry<Symbol, JCDiagnostic> _e =
  16.241 +                                filteredCandidates.entrySet().iterator().next();
  16.242 +                final Pair<Symbol, JCDiagnostic> p = new Pair<Symbol, JCDiagnostic>(_e.getKey(), _e.getValue());
  16.243 +                JCDiagnostic d = new InapplicableSymbolError(resolveContext) {
  16.244 +                    @Override
  16.245 +                    protected Pair<Symbol, JCDiagnostic> errCandidate() {
  16.246 +                        return p;
  16.247 +                    }
  16.248 +                }.getDiagnostic(dkind, pos,
  16.249                      location, site, name, argtypes, typeargtypes);
  16.250                  if (truncatedDiag) {
  16.251                      d.setFlag(DiagnosticFlag.COMPRESSED);
    17.1 --- a/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Wed Jul 24 15:18:33 2013 -0700
    17.2 +++ b/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Thu Jul 25 19:06:03 2013 +0100
    17.3 @@ -303,8 +303,9 @@
    17.4                      conflicts.contains(s))) {
    17.5                      List<Name> l = List.nil();
    17.6                      Symbol s2 = s;
    17.7 -                    while (s2.type.getEnclosingType().hasTag(CLASS)
    17.8 -                            && s2.owner.kind == Kinds.TYP) {
    17.9 +                    while (s2.type.hasTag(CLASS) &&
   17.10 +                            s2.type.getEnclosingType().hasTag(CLASS) &&
   17.11 +                            s2.owner.kind == Kinds.TYP) {
   17.12                          l = l.prepend(s2.getSimpleName());
   17.13                          s2 = s2.owner;
   17.14                      }
    18.1 --- a/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Wed Jul 24 15:18:33 2013 -0700
    18.2 +++ b/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Thu Jul 25 19:06:03 2013 +0100
    18.3 @@ -46,6 +46,7 @@
    18.4  import com.sun.tools.javac.code.Symbol.*;
    18.5  import com.sun.tools.javac.code.Type;
    18.6  import com.sun.tools.javac.code.Type.ClassType;
    18.7 +import com.sun.tools.javac.code.TypeTag;
    18.8  import com.sun.tools.javac.comp.AttrContext;
    18.9  import com.sun.tools.javac.comp.Env;
   18.10  import com.sun.tools.javac.tree.JCTree;
   18.11 @@ -516,7 +517,7 @@
   18.12              return null;
   18.13          Type sup = env.types.supertype(type);
   18.14          return TypeMaker.getType(env,
   18.15 -                                 (sup != type) ? sup : env.syms.objectType);
   18.16 +                                 (sup.hasTag(TypeTag.NONE)) ? env.syms.objectType : sup);
   18.17      }
   18.18  
   18.19      /**
    19.1 --- a/src/share/classes/com/sun/tools/javadoc/ToolOption.java	Wed Jul 24 15:18:33 2013 -0700
    19.2 +++ b/src/share/classes/com/sun/tools/javadoc/ToolOption.java	Thu Jul 25 19:06:03 2013 +0100
    19.3 @@ -1,5 +1,5 @@
    19.4  /*
    19.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    19.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
    19.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.8   *
    19.9   * This code is free software; you can redistribute it and/or modify it
   19.10 @@ -56,6 +56,13 @@
   19.11          }
   19.12      },
   19.13  
   19.14 +    CP("-cp", true) {
   19.15 +        @Override
   19.16 +        public void process(Helper helper, String arg) {
   19.17 +            helper.setCompilerOpt(opt, arg);
   19.18 +        }
   19.19 +    },
   19.20 +
   19.21      EXTDIRS("-extdirs", true) {
   19.22          @Override
   19.23          public void process(Helper helper, String arg) {
    20.1 --- a/src/share/classes/com/sun/tools/javadoc/resources/javadoc.properties	Wed Jul 24 15:18:33 2013 -0700
    20.2 +++ b/src/share/classes/com/sun/tools/javadoc/resources/javadoc.properties	Thu Jul 25 19:06:03 2013 +0100
    20.3 @@ -39,6 +39,7 @@
    20.4  \  -docletpath <path>               Specify where to find doclet class files\n\
    20.5  \  -sourcepath <pathlist>           Specify where to find source files\n\
    20.6  \  -classpath <pathlist>            Specify where to find user class files\n\
    20.7 +\  -cp <pathlist>                   Specify where to find user class files\n\
    20.8  \  -exclude <pkglist>               Specify a list of packages to exclude\n\
    20.9  \  -subpackages <subpkglist>        Specify subpackages to recursively load\n\
   20.10  \  -breakiterator                   Compute first sentence with BreakIterator\n\
    21.1 --- a/src/share/classes/com/sun/tools/javah/JavahTask.java	Wed Jul 24 15:18:33 2013 -0700
    21.2 +++ b/src/share/classes/com/sun/tools/javah/JavahTask.java	Thu Jul 25 19:06:03 2013 +0100
    21.3 @@ -531,7 +531,7 @@
    21.4              String name = o.aliases[0].substring(1); // there must always be at least one name
    21.5              log.println(getMessage("main.opt." + name));
    21.6          }
    21.7 -        String[] fmOptions = { "-classpath", "-bootclasspath" };
    21.8 +        String[] fmOptions = { "-classpath", "-cp", "-bootclasspath" };
    21.9          for (String o: fmOptions) {
   21.10              if (fileManager.isSupportedOption(o) == -1)
   21.11                  continue;
    22.1 --- a/src/share/classes/com/sun/tools/javah/resources/l10n.properties	Wed Jul 24 15:18:33 2013 -0700
    22.2 +++ b/src/share/classes/com/sun/tools/javah/resources/l10n.properties	Thu Jul 25 19:06:03 2013 +0100
    22.3 @@ -1,5 +1,5 @@
    22.4  #
    22.5 -# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    22.6 +# Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
    22.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    22.8  #
    22.9  # This code is free software; you can redistribute it and/or modify it
   22.10 @@ -77,6 +77,7 @@
   22.11  \n\t\
   22.12  -help                 Print this help message and exit\n\t\
   22.13  -classpath <path>     Path from which to load classes\n\t\
   22.14 +-cp <path>            Path from which to load classes\n\t\
   22.15  -bootclasspath <path> Path from which to load bootstrap classes\n\t\
   22.16  -d <dir>              Output directory\n\t\
   22.17  -o <file>             Output file (only one of -d or -o may be used)\n\t\
   22.18 @@ -108,6 +109,8 @@
   22.19  \  -force                   Always write output files
   22.20  main.opt.classpath=\
   22.21  \  -classpath <path>        Path from which to load classes
   22.22 +main.opt.cp=\
   22.23 +\  -cp <path>               Path from which to load classes
   22.24  main.opt.bootclasspath=\
   22.25  \  -bootclasspath <path>    Path from which to load bootstrap classes
   22.26  main.usage.foot=\
    23.1 --- a/src/share/classes/com/sun/tools/javap/JavapTask.java	Wed Jul 24 15:18:33 2013 -0700
    23.2 +++ b/src/share/classes/com/sun/tools/javap/JavapTask.java	Thu Jul 25 19:06:03 2013 +0100
    23.3 @@ -885,7 +885,7 @@
    23.4                  continue;
    23.5              log.println(getMessage("main.opt." + name));
    23.6          }
    23.7 -        String[] fmOptions = { "-classpath", "-bootclasspath" };
    23.8 +        String[] fmOptions = { "-classpath", "-cp", "-bootclasspath" };
    23.9          for (String o: fmOptions) {
   23.10              if (fileManager.isSupportedOption(o) == -1)
   23.11                  continue;
    24.1 --- a/src/share/classes/com/sun/tools/javap/resources/javap.properties	Wed Jul 24 15:18:33 2013 -0700
    24.2 +++ b/src/share/classes/com/sun/tools/javap/resources/javap.properties	Thu Jul 25 19:06:03 2013 +0100
    24.3 @@ -1,5 +1,5 @@
    24.4  
    24.5 -err.prefix=Error: 
    24.6 +err.prefix=Error:
    24.7  
    24.8  err.bad.constant.pool=error while reading constant pool for {0}: {1}
    24.9  err.class.not.found=class not found: {0}
   24.10 @@ -73,6 +73,9 @@
   24.11  main.opt.classpath=\
   24.12  \  -classpath <path>        Specify where to find user class files
   24.13  
   24.14 +main.opt.cp=\
   24.15 +\  -cp <path>               Specify where to find user class files
   24.16 +
   24.17  main.opt.bootclasspath=\
   24.18  \  -bootclasspath <path>    Override location of bootstrap class files
   24.19  
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/test/tools/doclint/BadPackageCommentTest.java	Thu Jul 25 19:06:03 2013 +0100
    25.3 @@ -0,0 +1,13 @@
    25.4 +/*
    25.5 + * @test /nodynamiccopyright/
    25.6 + * @bug 8020278
    25.7 + * @summary NPE in javadoc (bad handling of bad tag in package-info.java)
    25.8 + * @build DocLintTester
    25.9 + * @run main DocLintTester -ref BadPackageCommentTest.out BadPackageCommentTest.java
   25.10 + */
   25.11 +
   25.12 +/**
   25.13 + * abc.
   25.14 + * @@@
   25.15 + */
   25.16 +package p;
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/test/tools/doclint/BadPackageCommentTest.out	Thu Jul 25 19:06:03 2013 +0100
    26.3 @@ -0,0 +1,10 @@
    26.4 +BadPackageCommentTest.java:11: error: no tag name after @
    26.5 + * @@@
    26.6 +   ^
    26.7 +BadPackageCommentTest.java:11: error: no tag name after @
    26.8 + * @@@
    26.9 +    ^
   26.10 +BadPackageCommentTest.java:11: error: no tag name after @
   26.11 + * @@@
   26.12 +     ^
   26.13 +3 errors
    27.1 --- a/test/tools/doclint/tool/HelpTest.out	Wed Jul 24 15:18:33 2013 -0700
    27.2 +++ b/test/tools/doclint/tool/HelpTest.out	Thu Jul 25 19:06:03 2013 +0100
    27.3 @@ -36,7 +36,7 @@
    27.4      Show this message.
    27.5  
    27.6  The following javac options are also supported
    27.7 -  -bootclasspath, -classpath, -sourcepath, -Xmaxerrs, -Xmaxwarns
    27.8 +  -bootclasspath, -classpath, -cp, -sourcepath, -Xmaxerrs, -Xmaxwarns
    27.9  
   27.10  To run doclint on part of a project, put the compiled classes for your
   27.11  project on the classpath (or bootclasspath), then specify the source files
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/test/tools/javac/Diagnostics/compressed/T8020286.java	Thu Jul 25 19:06:03 2013 +0100
    28.3 @@ -0,0 +1,15 @@
    28.4 +/**
    28.5 + * @test /nodynamiccopyright/
    28.6 + * @bug     8020286
    28.7 + * @summary Wrong diagnostic after compaction
    28.8 + * @compile/fail/ref=T8020286.out -XDrawDiagnostics -Xdiags:compact T8020286.java
    28.9 + */
   28.10 +
   28.11 +class T8020286 {
   28.12 +   void m(String s) { }
   28.13 +   void m(Integer i, String s) { }
   28.14 +   void test() {
   28.15 +       m(1, 1);
   28.16 +       m(1);
   28.17 +   }
   28.18 +}
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/test/tools/javac/Diagnostics/compressed/T8020286.out	Thu Jul 25 19:06:03 2013 +0100
    29.3 @@ -0,0 +1,4 @@
    29.4 +T8020286.java:12:13: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, java.lang.String)
    29.5 +T8020286.java:13:10: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, java.lang.String)
    29.6 +- compiler.note.compressed.diags
    29.7 +2 errors
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/test/tools/javac/T6356530/SerializableAbstractClassWithNonAbstractMethodsTest.java	Thu Jul 25 19:06:03 2013 +0100
    30.3 @@ -0,0 +1,48 @@
    30.4 +/*
    30.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    30.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    30.7 + *
    30.8 + * This code is free software; you can redistribute it and/or modify it
    30.9 + * under the terms of the GNU General Public License version 2 only, as
   30.10 + * published by the Free Software Foundation.
   30.11 + *
   30.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   30.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   30.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   30.15 + * version 2 for more details (a copy is included in the LICENSE file that
   30.16 + * accompanied this code).
   30.17 + *
   30.18 + * You should have received a copy of the GNU General Public License version
   30.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   30.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   30.21 + *
   30.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   30.23 + * or visit www.oracle.com if you need additional information or have any
   30.24 + * questions.
   30.25 + */
   30.26 +
   30.27 +/*
   30.28 + * @test
   30.29 + * @bug 6356530
   30.30 + * @summary -Xlint:serial does not flag abstract classes with concrete methods/members
   30.31 + * @compile/fail/ref=SerializableAbstractClassWithNonAbstractMethodsTest.out -XDrawDiagnostics -Werror -Xlint:serial SerializableAbstractClassWithNonAbstractMethodsTest.java
   30.32 + */
   30.33 +
   30.34 +abstract class SerializableAbstractClassWithNonAbstractMethodsTest implements java.io.Serializable {
   30.35 +    void m1() {}
   30.36 +    abstract void m2();
   30.37 +
   30.38 +    abstract class AWithUID implements java.io.Serializable {
   30.39 +        private static final long serialVersionUID = 0;
   30.40 +        void m(){}
   30.41 +    }
   30.42 +
   30.43 +    interface IDefault extends java.io.Serializable {
   30.44 +        default int m() { return 1; }
   30.45 +    }
   30.46 +
   30.47 +    interface IDefaultAndUID extends java.io.Serializable {
   30.48 +        static final long serialVersionUID = 0;
   30.49 +        default int m() { return 1; }
   30.50 +    }
   30.51 +}
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/test/tools/javac/T6356530/SerializableAbstractClassWithNonAbstractMethodsTest.out	Thu Jul 25 19:06:03 2013 +0100
    31.3 @@ -0,0 +1,5 @@
    31.4 +SerializableAbstractClassWithNonAbstractMethodsTest.java:40:5: compiler.warn.missing.SVUID: SerializableAbstractClassWithNonAbstractMethodsTest.IDefault
    31.5 +SerializableAbstractClassWithNonAbstractMethodsTest.java:31:10: compiler.warn.missing.SVUID: SerializableAbstractClassWithNonAbstractMethodsTest
    31.6 +- compiler.err.warnings.and.werror
    31.7 +1 error
    31.8 +2 warnings
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/test/tools/javac/conditional/T8016702.java	Thu Jul 25 19:06:03 2013 +0100
    32.3 @@ -0,0 +1,66 @@
    32.4 +/*
    32.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    32.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    32.7 + *
    32.8 + * This code is free software; you can redistribute it and/or modify it
    32.9 + * under the terms of the GNU General Public License version 2 only, as
   32.10 + * published by the Free Software Foundation.
   32.11 + *
   32.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   32.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   32.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   32.15 + * version 2 for more details (a copy is included in the LICENSE file that
   32.16 + * accompanied this code).
   32.17 + *
   32.18 + * You should have received a copy of the GNU General Public License version
   32.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   32.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   32.21 + *
   32.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   32.23 + * or visit www.oracle.com if you need additional information or have any
   32.24 + * questions.
   32.25 + */
   32.26 +
   32.27 +/*
   32.28 + * @test
   32.29 + * @bug 8016702
   32.30 + * @summary use of ternary operator in lambda expression gives incorrect results
   32.31 + */
   32.32 +import java.util.Arrays;
   32.33 +import java.util.List;
   32.34 +
   32.35 +public class T8016702 {
   32.36 +
   32.37 +    static int assertionCount;
   32.38 +
   32.39 +    static void assertTrue(boolean b, String msg) {
   32.40 +        assertionCount++;
   32.41 +        if (!b) {
   32.42 +            throw new AssertionError(msg);
   32.43 +        }
   32.44 +    }
   32.45 +
   32.46 +    interface IntFunction<Y> {
   32.47 +        Y m(int x);
   32.48 +    }
   32.49 +
   32.50 +    void test(List<Integer> li) {
   32.51 +        map(i -> (i % 2 == 0) ? "" : "i="+i, li);
   32.52 +    }
   32.53 +
   32.54 +
   32.55 +    @SuppressWarnings("unchecked")
   32.56 +    <R> void map(IntFunction<R> mapper, List<Integer> li) {
   32.57 +        for (int i : li) {
   32.58 +            String res = (String)mapper.m(i);
   32.59 +            assertTrue((i % 2 == 0) ? res.isEmpty() : res.contains("" + i),
   32.60 +                    "i = " + i + " res = " + res);
   32.61 +        }
   32.62 +    }
   32.63 +
   32.64 +    public static void main(String[] args) {
   32.65 +        T8016702 tester = new T8016702();
   32.66 +        tester.test(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9));
   32.67 +        assertTrue(assertionCount == 10, "wrong assertion count: " + assertionCount);
   32.68 +    }
   32.69 +}
    33.1 --- a/test/tools/javac/generics/6723444/T6723444.java	Wed Jul 24 15:18:33 2013 -0700
    33.2 +++ b/test/tools/javac/generics/6723444/T6723444.java	Thu Jul 25 19:06:03 2013 +0100
    33.3 @@ -4,7 +4,8 @@
    33.4   *
    33.5   * @summary javac fails to substitute type variables into a constructor's throws clause
    33.6   * @author Mark Mahieu
    33.7 - * @compile/fail/ref=T6723444.out -XDrawDiagnostics T6723444.java
    33.8 + * @compile/fail/ref=T6723444_1.out -Xlint:-options -source 7 -XDrawDiagnostics T6723444.java
    33.9 + * @compile/fail/ref=T6723444_2.out -XDrawDiagnostics T6723444.java
   33.10   *
   33.11   */
   33.12  public class T6723444 {
    34.1 --- a/test/tools/javac/generics/6723444/T6723444.out	Wed Jul 24 15:18:33 2013 -0700
    34.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.3 @@ -1,13 +0,0 @@
    34.4 -T6723444.java:42:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
    34.5 -T6723444.java:43:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
    34.6 -T6723444.java:45:32: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
    34.7 -T6723444.java:46:17: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
    34.8 -T6723444.java:48:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
    34.9 -T6723444.java:49:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   34.10 -T6723444.java:50:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   34.11 -T6723444.java:51:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   34.12 -T6723444.java:52:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   34.13 -T6723444.java:53:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   34.14 -T6723444.java:54:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   34.15 -T6723444.java:55:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   34.16 -12 errors
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/test/tools/javac/generics/6723444/T6723444_1.out	Thu Jul 25 19:06:03 2013 +0100
    35.3 @@ -0,0 +1,13 @@
    35.4 +T6723444.java:43:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
    35.5 +T6723444.java:44:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
    35.6 +T6723444.java:46:32: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
    35.7 +T6723444.java:47:17: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
    35.8 +T6723444.java:49:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
    35.9 +T6723444.java:50:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   35.10 +T6723444.java:51:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   35.11 +T6723444.java:52:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   35.12 +T6723444.java:53:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   35.13 +T6723444.java:54:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   35.14 +T6723444.java:55:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   35.15 +T6723444.java:56:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   35.16 +12 errors
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/test/tools/javac/generics/6723444/T6723444_2.out	Thu Jul 25 19:06:03 2013 +0100
    36.3 @@ -0,0 +1,11 @@
    36.4 +T6723444.java:46:32: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
    36.5 +T6723444.java:47:17: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
    36.6 +T6723444.java:49:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
    36.7 +T6723444.java:50:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
    36.8 +T6723444.java:51:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
    36.9 +T6723444.java:52:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   36.10 +T6723444.java:53:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   36.11 +T6723444.java:54:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   36.12 +T6723444.java:55:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   36.13 +T6723444.java:56:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
   36.14 +10 errors
    37.1 --- a/test/tools/javac/generics/7015430/T7015430.java	Wed Jul 24 15:18:33 2013 -0700
    37.2 +++ b/test/tools/javac/generics/7015430/T7015430.java	Thu Jul 25 19:06:03 2013 +0100
    37.3 @@ -4,7 +4,8 @@
    37.4   *
    37.5   * @summary  Incorrect thrown type determined for unchecked invocations
    37.6   * @author Daniel Smith
    37.7 - * @compile/fail/ref=T7015430.out -Xlint:unchecked -XDrawDiagnostics T7015430.java
    37.8 + * @compile/fail/ref=T7015430_1.out -source 7 -Xlint:-options,unchecked -XDrawDiagnostics T7015430.java
    37.9 + * @compile/fail/ref=T7015430_2.out -Xlint:unchecked -XDrawDiagnostics T7015430.java
   37.10   *
   37.11   */
   37.12  
    38.1 --- a/test/tools/javac/generics/7015430/T7015430.out	Wed Jul 24 15:18:33 2013 -0700
    38.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.3 @@ -1,19 +0,0 @@
    38.4 -T7015430.java:41:14: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
    38.5 -T7015430.java:41:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
    38.6 -T7015430.java:50:41: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
    38.7 -T7015430.java:50:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
    38.8 -T7015430.java:68:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
    38.9 -T7015430.java:68:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
   38.10 -T7015430.java:77:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
   38.11 -T7015430.java:77:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
   38.12 -T7015430.java:104:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
   38.13 -T7015430.java:104:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
   38.14 -T7015430.java:113:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
   38.15 -T7015430.java:113:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
   38.16 -T7015430.java:41:14: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
   38.17 -T7015430.java:68:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
   38.18 -T7015430.java:95:15: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
   38.19 -T7015430.java:113:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
   38.20 -T7015430.java:129:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
   38.21 -5 errors
   38.22 -12 warnings
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/test/tools/javac/generics/7015430/T7015430_1.out	Thu Jul 25 19:06:03 2013 +0100
    39.3 @@ -0,0 +1,19 @@
    39.4 +T7015430.java:42:14: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
    39.5 +T7015430.java:42:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
    39.6 +T7015430.java:51:41: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
    39.7 +T7015430.java:51:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
    39.8 +T7015430.java:69:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
    39.9 +T7015430.java:69:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
   39.10 +T7015430.java:78:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
   39.11 +T7015430.java:78:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
   39.12 +T7015430.java:105:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
   39.13 +T7015430.java:105:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
   39.14 +T7015430.java:114:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
   39.15 +T7015430.java:114:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
   39.16 +T7015430.java:42:14: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
   39.17 +T7015430.java:69:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
   39.18 +T7015430.java:96:15: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
   39.19 +T7015430.java:114:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
   39.20 +T7015430.java:130:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
   39.21 +5 errors
   39.22 +12 warnings
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/test/tools/javac/generics/7015430/T7015430_2.out	Thu Jul 25 19:06:03 2013 +0100
    40.3 @@ -0,0 +1,15 @@
    40.4 +T7015430.java:42:14: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
    40.5 +T7015430.java:42:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
    40.6 +T7015430.java:51:41: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
    40.7 +T7015430.java:51:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
    40.8 +T7015430.java:69:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
    40.9 +T7015430.java:69:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
   40.10 +T7015430.java:78:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
   40.11 +T7015430.java:78:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
   40.12 +T7015430.java:105:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
   40.13 +T7015430.java:105:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
   40.14 +T7015430.java:114:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
   40.15 +T7015430.java:114:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
   40.16 +T7015430.java:130:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
   40.17 +1 error
   40.18 +12 warnings
    41.1 --- a/test/tools/javac/generics/7034511/T7034511a.java	Wed Jul 24 15:18:33 2013 -0700
    41.2 +++ b/test/tools/javac/generics/7034511/T7034511a.java	Thu Jul 25 19:06:03 2013 +0100
    41.3 @@ -1,13 +1,10 @@
    41.4  /*
    41.5   * @test /nodynamiccopyright/
    41.6 - * @ignore 7041019 Bogus type-variable substitution with array types with dependencies on accessibility check
    41.7 - * @bug     7034511 7040883
    41.8 + * @bug     7034511 7040883 7041019
    41.9   * @summary Loophole in typesafety
   41.10   * @compile/fail/ref=T7034511a.out -XDrawDiagnostics T7034511a.java
   41.11   */
   41.12  
   41.13 -// backing out 7034511, see 7040883
   41.14 -
   41.15  class T7034511a {
   41.16  
   41.17      interface A<T> {
    42.1 --- a/test/tools/javac/generics/7034511/T7034511a.out	Wed Jul 24 15:18:33 2013 -0700
    42.2 +++ b/test/tools/javac/generics/7034511/T7034511a.out	Thu Jul 25 19:06:03 2013 +0100
    42.3 @@ -1,2 +1,2 @@
    42.4 -T7034511a.java:18:14: compiler.err.cant.apply.symbol: kindname.method, foo, compiler.misc.type.captureof: 1, ?[], java.lang.String[], kindname.interface, T7034511a.A<T>, (compiler.misc.no.conforming.assignment.exists: java.lang.String[], compiler.misc.type.captureof: 1, ?[])
    42.5 +T7034511a.java:18:14: compiler.err.cant.apply.symbol: kindname.method, foo, compiler.misc.type.captureof: 1, ?[], java.lang.String[], kindname.interface, T7034511a.A<T>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String[], compiler.misc.type.captureof: 1, ?[]))
    42.6  1 error
    43.1 --- a/test/tools/javac/generics/7034511/T7034511b.java	Wed Jul 24 15:18:33 2013 -0700
    43.2 +++ b/test/tools/javac/generics/7034511/T7034511b.java	Thu Jul 25 19:06:03 2013 +0100
    43.3 @@ -1,13 +1,10 @@
    43.4  /*
    43.5   * @test /nodynamiccopyright/
    43.6 - * @ignore 7041019 Bogus type-variable substitution with array types with dependencies on accessibility check
    43.7 - * @bug     7034511 7040883
    43.8 + * @bug     7034511 7040883 7041019
    43.9   * @summary Loophole in typesafety
   43.10   * @compile/fail/ref=T7034511b.out -XDrawDiagnostics T7034511b.java
   43.11   */
   43.12  
   43.13 -// backing out 7034511, see 7040883
   43.14 -
   43.15  class T7034511b {
   43.16      static class MyList<E> {
   43.17          E toArray(E[] e) { return null; }
    44.1 --- a/test/tools/javac/generics/7034511/T7034511b.out	Wed Jul 24 15:18:33 2013 -0700
    44.2 +++ b/test/tools/javac/generics/7034511/T7034511b.out	Thu Jul 25 19:06:03 2013 +0100
    44.3 @@ -1,2 +1,2 @@
    44.4 -T7034511b.java:14:11: compiler.err.cant.apply.symbol: kindname.method, toArray, compiler.misc.type.captureof: 1, ?[], java.lang.Object[], kindname.class, T7034511b.MyList<E>, (compiler.misc.no.conforming.assignment.exists: java.lang.Object[], compiler.misc.type.captureof: 1, ?[])
    44.5 +T7034511b.java:14:11: compiler.err.cant.apply.symbol: kindname.method, toArray, compiler.misc.type.captureof: 1, ?[], java.lang.Object[], kindname.class, T7034511b.MyList<E>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object[], compiler.misc.type.captureof: 1, ?[]))
    44.6  1 error
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/test/tools/javac/generics/7034511/T7041019.java	Thu Jul 25 19:06:03 2013 +0100
    45.3 @@ -0,0 +1,39 @@
    45.4 +/*
    45.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    45.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    45.7 + *
    45.8 + * This code is free software; you can redistribute it and/or modify it
    45.9 + * under the terms of the GNU General Public License version 2 only, as
   45.10 + * published by the Free Software Foundation.
   45.11 + *
   45.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   45.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   45.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   45.15 + * version 2 for more details (a copy is included in the LICENSE file that
   45.16 + * accompanied this code).
   45.17 + *
   45.18 + * You should have received a copy of the GNU General Public License version
   45.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   45.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   45.21 + *
   45.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   45.23 + * or visit www.oracle.com if you need additional information or have any
   45.24 + * questions.
   45.25 + */
   45.26 +
   45.27 +/*
   45.28 + * @test
   45.29 + * @bug 7034511 7040883 7041019
   45.30 + * @summary Bogus type-variable substitution with array types with dependencies on accessibility check
   45.31 + *
   45.32 + * @compile T7041019.java
   45.33 + */
   45.34 +import java.util.List;
   45.35 +
   45.36 +class T7041019 {
   45.37 +   <E> List<E>[] m(List<E> l) { return null; }
   45.38 +
   45.39 +   void test(List<? extends String> ls) {
   45.40 +      int i = m(ls).length;
   45.41 +   }
   45.42 +}
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/test/tools/javac/generics/8016640/T8016640.java	Thu Jul 25 19:06:03 2013 +0100
    46.3 @@ -0,0 +1,10 @@
    46.4 +/*
    46.5 + * @test /nodynamiccopyright/
    46.6 + * @bug     8016640
    46.7 + * @summary compiler hangs if the generics arity of a base class is wrong
    46.8 + * @compile/fail/ref=T8016640.out -XDrawDiagnostics T8016640.java
    46.9 + */
   46.10 +class T8016640 {
   46.11 +    static class Foo<X,Y> { }
   46.12 +    static class BadFoo<T> extends Foo<T> { }
   46.13 +}
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/test/tools/javac/generics/8016640/T8016640.out	Thu Jul 25 19:06:03 2013 +0100
    47.3 @@ -0,0 +1,2 @@
    47.4 +T8016640.java:9:39: compiler.err.wrong.number.type.args: 2
    47.5 +1 error
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/test/tools/javac/generics/inference/8019824/T8019824.java	Thu Jul 25 19:06:03 2013 +0100
    48.3 @@ -0,0 +1,15 @@
    48.4 +/**
    48.5 + * @test /nodynamiccopyright/
    48.6 + * @bug 8019824
    48.7 + * @summary very long error messages on inference error
    48.8 + * @compile/fail/ref=T8019824.out -XDrawDiagnostics T8019824.java
    48.9 + */
   48.10 +class T8019824 {
   48.11 +    void test(Class<? extends Foo<?, ?>> cls) {
   48.12 +        Foo<?, ?> foo = make(cls);
   48.13 +    }
   48.14 +
   48.15 +    <A, B, C extends Foo<A, B>> Foo<A, B> make(Class<C> cls) { return null; }
   48.16 +
   48.17 +    interface Foo<A, B> {}
   48.18 +}
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/test/tools/javac/generics/inference/8019824/T8019824.out	Thu Jul 25 19:06:03 2013 +0100
    49.3 @@ -0,0 +1,2 @@
    49.4 +T8019824.java:9:25: compiler.err.cant.apply.symbol: kindname.method, make, java.lang.Class<C>, java.lang.Class<compiler.misc.type.captureof: 1, ? extends T8019824.Foo<?,?>>, kindname.class, T8019824, (compiler.misc.incompatible.eq.upper.bounds: C, compiler.misc.type.captureof: 1, ? extends T8019824.Foo<?,?>, T8019824.Foo<compiler.misc.type.captureof: 2, ?,B>)
    49.5 +1 error
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/test/tools/javac/generics/inference/8020149/T8020149.java	Thu Jul 25 19:06:03 2013 +0100
    50.3 @@ -0,0 +1,48 @@
    50.4 +/*
    50.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    50.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    50.7 + *
    50.8 + * This code is free software; you can redistribute it and/or modify it
    50.9 + * under the terms of the GNU General Public License version 2 only, as
   50.10 + * published by the Free Software Foundation.
   50.11 + *
   50.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   50.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   50.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   50.15 + * version 2 for more details (a copy is included in the LICENSE file that
   50.16 + * accompanied this code).
   50.17 + *
   50.18 + * You should have received a copy of the GNU General Public License version
   50.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   50.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   50.21 + *
   50.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   50.23 + * or visit www.oracle.com if you need additional information or have any
   50.24 + * questions.
   50.25 + */
   50.26 +
   50.27 +/**
   50.28 + * @test
   50.29 + * @bug 8020149
   50.30 + * @summary Graph inference: wrong logic for picking best variable to solve
   50.31 + * @compile T8020149.java
   50.32 + */
   50.33 +class T8020149 {
   50.34 +    static class TestData<X,Y> { }
   50.35 +
   50.36 +    interface Foo<X, Y extends Foo<X, Y>> { }
   50.37 +
   50.38 +    interface IntFoo extends Foo<Integer, IntFoo> { }
   50.39 +
   50.40 +    interface Function<X, Y> {
   50.41 +        Y apply(X x);
   50.42 +    }
   50.43 +
   50.44 +    void test(TestData<Integer, IntFoo> data) {
   50.45 +       m1(data, s->s);
   50.46 +       m2(data, s->s);
   50.47 +    }
   50.48 +
   50.49 +    <E, E_OUT extends Foo<E, E_OUT>, W, W_IN extends Foo<W, W_IN>> void m1(TestData<W, W_IN> data, Function<W_IN, E_OUT> m) {  }
   50.50 +    <W, W_IN extends Foo<W, W_IN>, E, E_OUT extends Foo<E, E_OUT>> void m2(TestData<W, W_IN> data, Function<W_IN, E_OUT> m) {  }
   50.51 +}
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/test/tools/javac/lambda/8019480/T8019480.java	Thu Jul 25 19:06:03 2013 +0100
    51.3 @@ -0,0 +1,23 @@
    51.4 +/*
    51.5 + * @test /nodynamiccopyright/
    51.6 + * @bug 8019480
    51.7 + * @summary Javac crashes when method is called on a type-variable receiver from lambda expression
    51.8 + * @author  Maurizio Cimadamore
    51.9 + * @compile/fail/ref=T8019480.out -XDrawDiagnostics T8019480.java
   51.10 + */
   51.11 +import java.util.*;
   51.12 +
   51.13 +class T8019480<U> {
   51.14 +    interface Predicate<T> {
   51.15 +       void m(T t);
   51.16 +    }
   51.17 +
   51.18 +    interface Stream<T> {
   51.19 +       void forEach(Predicate<T> pt);
   51.20 +    }
   51.21 +
   51.22 +    void test(U current, Stream<U> stream) {
   51.23 +        List<U> list3 = new ArrayList<>();
   51.24 +        stream.forEach(i -> list3.add(current.clone()));
   51.25 +    }
   51.26 +}
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/test/tools/javac/lambda/8019480/T8019480.out	Thu Jul 25 19:06:03 2013 +0100
    52.3 @@ -0,0 +1,3 @@
    52.4 +T8019480.java:21:46: compiler.err.report.access: clone(), protected, java.lang.Object
    52.5 +T8019480.java:21:34: compiler.err.cant.apply.symbols: kindname.method, add, java.lang.Object,{(compiler.misc.inapplicable.method: kindname.method, java.util.Collection, add(U), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, U))),(compiler.misc.inapplicable.method: kindname.method, java.util.List, add(U), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, U))),(compiler.misc.inapplicable.method: kindname.method, java.util.List, add(int,U), (compiler.misc.arg.length.mismatch))}
    52.6 +2 errors
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/test/tools/javac/lambda/8020147/T8020147.java	Thu Jul 25 19:06:03 2013 +0100
    53.3 @@ -0,0 +1,19 @@
    53.4 +/*
    53.5 + * @test /nodynamiccopyright/
    53.6 + * @bug 8020147
    53.7 + * @summary Spurious errors when compiling nested stuck lambdas
    53.8 + * @compile/fail/ref=T8020147.out -Werror -Xlint:cast -XDrawDiagnostics T8020147.java
    53.9 + */
   53.10 +class T8020147 {
   53.11 +    interface Function<X, Y> {
   53.12 +        Y apply(X x);
   53.13 +    }
   53.14 +
   53.15 +    <T> void g(Function<String, T> f) { }
   53.16 +    <U> String m(U u, Function<U, U> fuu) { return null; }
   53.17 +
   53.18 +    void test() {
   53.19 +        g(x->m("", i->(String)i));
   53.20 +        g(x->m("", i->(String)x));
   53.21 +    }
   53.22 +}
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/test/tools/javac/lambda/8020147/T8020147.out	Thu Jul 25 19:06:03 2013 +0100
    54.3 @@ -0,0 +1,5 @@
    54.4 +T8020147.java:16:23: compiler.warn.redundant.cast: java.lang.String
    54.5 +T8020147.java:17:23: compiler.warn.redundant.cast: java.lang.String
    54.6 +- compiler.err.warnings.and.werror
    54.7 +1 error
    54.8 +2 warnings
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/test/tools/javac/lambda/BadNestedLambda.java	Thu Jul 25 19:06:03 2013 +0100
    55.3 @@ -0,0 +1,11 @@
    55.4 +/*
    55.5 + * @test /nodynamiccopyright/
    55.6 + * @bug 8017618
    55.7 + * @summary NullPointerException in RichDiagnosticFormatter for bad input program
    55.8 + * @compile/fail/ref=BadNestedLambda.out -XDrawDiagnostics BadNestedLambda.java
    55.9 + */
   55.10 +class BadNestedLambda {
   55.11 +    void test() {
   55.12 +        Runnable add = (int x) -> (int y) -> x + y;
   55.13 +    }
   55.14 +}
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/test/tools/javac/lambda/BadNestedLambda.out	Thu Jul 25 19:06:03 2013 +0100
    56.3 @@ -0,0 +1,3 @@
    56.4 +BadNestedLambda.java:9:35: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.not.a.functional.intf: void))
    56.5 +BadNestedLambda.java:9:24: compiler.err.prob.found.req: (compiler.misc.incompatible.arg.types.in.lambda)
    56.6 +2 errors
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/test/tools/javac/lambda/MethodReference68.java	Thu Jul 25 19:06:03 2013 +0100
    57.3 @@ -0,0 +1,23 @@
    57.4 +/*
    57.5 + * @test /nodynamiccopyright/
    57.6 + * @bug 8016175
    57.7 + * @summary Add bottom-up type-checking support for unambiguous method references
    57.8 + * @compile/fail/ref=MethodReference68.out -XDrawDiagnostics MethodReference68.java
    57.9 + */
   57.10 +class MethodReference68 {
   57.11 +    interface F<X> {
   57.12 +       String m(X x);
   57.13 +    }
   57.14 +
   57.15 +    static class Foo {
   57.16 +        String getName() { return ""; }
   57.17 +    }
   57.18 +
   57.19 +    @SuppressWarnings("unchecked")
   57.20 +    <Z> void g(F<Z> fz, Z... zs) { }
   57.21 +
   57.22 +    void test() {
   57.23 +         g(Foo::getName);
   57.24 +         g(Foo::getName, 1); //incompatible constraints, Z <: Foo, Z :> Integer
   57.25 +    }
   57.26 +}
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/test/tools/javac/lambda/MethodReference68.out	Thu Jul 25 19:06:03 2013 +0100
    58.3 @@ -0,0 +1,2 @@
    58.4 +MethodReference68.java:21:10: compiler.err.cant.apply.symbol: kindname.method, g, MethodReference68.F<Z>,Z[], @493,int, kindname.class, MethodReference68, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, MethodReference68.Foo,java.lang.Object)
    58.5 +1 error
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/test/tools/javac/lambda/MethodReference69.java	Thu Jul 25 19:06:03 2013 +0100
    59.3 @@ -0,0 +1,21 @@
    59.4 +/*
    59.5 + * @test /nodynamiccopyright/
    59.6 + * @bug 8016175
    59.7 + * @summary Add bottom-up type-checking support for unambiguous method references
    59.8 + * @compile/fail/ref=MethodReference69.out -XDrawDiagnostics MethodReference69.java
    59.9 + */
   59.10 +class MethodReference69 {
   59.11 +    interface F<X> {
   59.12 +        String m(Integer x1, X x2);
   59.13 +    }
   59.14 +
   59.15 +    static class Foo {
   59.16 +        String getNameAt(Integer i) { return ""; }
   59.17 +    }
   59.18 +
   59.19 +    <Z> void g(F<Z> fz) { }
   59.20 +
   59.21 +    void test() {
   59.22 +         g(Foo::getName);
   59.23 +    }
   59.24 +}
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/test/tools/javac/lambda/MethodReference69.out	Thu Jul 25 19:06:03 2013 +0100
    60.3 @@ -0,0 +1,2 @@
    60.4 +MethodReference69.java:19:12: compiler.err.invalid.mref: kindname.method, (compiler.misc.cant.resolve.location.args: kindname.method, getName, , , (compiler.misc.location: kindname.class, MethodReference69.Foo, null))
    60.5 +1 error
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/test/tools/javac/lambda/MethodReference70.java	Thu Jul 25 19:06:03 2013 +0100
    61.3 @@ -0,0 +1,28 @@
    61.4 +/*
    61.5 + * @test /nodynamiccopyright/
    61.6 + * @bug 8016175
    61.7 + * @summary Add bottom-up type-checking support for unambiguous method references
    61.8 + * @compile/fail/ref=MethodReference70.out -XDrawDiagnostics MethodReference70.java
    61.9 + */
   61.10 +class MethodReference70 {
   61.11 +    interface F<X> {
   61.12 +        void m(X x);
   61.13 +    }
   61.14 +
   61.15 +    interface G<X> {
   61.16 +        Integer m(X x);
   61.17 +    }
   61.18 +
   61.19 +    void m1(Integer i) { }
   61.20 +
   61.21 +    void m2(Integer i) { }
   61.22 +    void m2(String i) { }
   61.23 +
   61.24 +    <Z> void g(F<Z> fz) { }
   61.25 +    <Z> void g(G<Z> gz) { }
   61.26 +
   61.27 +    void test() {
   61.28 +         g(this::m1); //ok
   61.29 +         g(this::m2); //ambiguous (stuck!)
   61.30 +    }
   61.31 +}
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/test/tools/javac/lambda/MethodReference70.out	Thu Jul 25 19:06:03 2013 +0100
    62.3 @@ -0,0 +1,3 @@
    62.4 +MethodReference70.java:26:10: compiler.err.ref.ambiguous: g, kindname.method, <Z>g(MethodReference70.F<Z>), MethodReference70, kindname.method, <Z>g(MethodReference70.G<Z>), MethodReference70
    62.5 +MethodReference70.java:26:11: compiler.err.prob.found.req: (compiler.misc.cyclic.inference: Z)
    62.6 +2 errors
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/test/tools/javac/lambda/MethodReference71.java	Thu Jul 25 19:06:03 2013 +0100
    63.3 @@ -0,0 +1,26 @@
    63.4 +/*
    63.5 + * @test /nodynamiccopyright/
    63.6 + * @bug 8016175
    63.7 + * @summary Add bottom-up type-checking support for unambiguous method references
    63.8 + * @compile/fail/ref=MethodReference71.out -XDrawDiagnostics MethodReference71.java
    63.9 + */
   63.10 +class MethodReference71 {
   63.11 +    interface F<X> {
   63.12 +        void m(X x);
   63.13 +    }
   63.14 +
   63.15 +    interface G<X> {
   63.16 +        Integer m(X x);
   63.17 +    }
   63.18 +
   63.19 +    void m1(Integer i) { }
   63.20 +    void m2(Integer... i) { }
   63.21 +
   63.22 +    <Z> void g(F<Z> f) { }
   63.23 +    <Z> void g(G<Z> g) { }
   63.24 +
   63.25 +    void test() {
   63.26 +         g(this::m1); //ok
   63.27 +         g(this::m2); //ambiguous (stuck!)
   63.28 +    }
   63.29 +}
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/test/tools/javac/lambda/MethodReference71.out	Thu Jul 25 19:06:03 2013 +0100
    64.3 @@ -0,0 +1,3 @@
    64.4 +MethodReference71.java:24:10: compiler.err.ref.ambiguous: g, kindname.method, <Z>g(MethodReference71.F<Z>), MethodReference71, kindname.method, <Z>g(MethodReference71.G<Z>), MethodReference71
    64.5 +MethodReference71.java:24:11: compiler.err.prob.found.req: (compiler.misc.cyclic.inference: Z)
    64.6 +2 errors
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/test/tools/javac/lambda/MethodReference72.java	Thu Jul 25 19:06:03 2013 +0100
    65.3 @@ -0,0 +1,20 @@
    65.4 +/*
    65.5 + * @test /nodynamiccopyright/
    65.6 + * @bug 8016175
    65.7 + * @summary Add bottom-up type-checking support for unambiguous method references
    65.8 + * @compile/fail/ref=MethodReference72.out -XDrawDiagnostics MethodReference72.java
    65.9 + */
   65.10 +class MethodReference72 {
   65.11 +    interface F<X> {
   65.12 +        @SuppressWarnings("unchecked")
   65.13 +        void m(X... x);
   65.14 +    }
   65.15 +
   65.16 +    void m1(Integer i) { }
   65.17 +
   65.18 +    <Z> void g(F<Z> f) { }
   65.19 +
   65.20 +    void test() {
   65.21 +        g(this::m1); //?
   65.22 +    }
   65.23 +}
    66.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.2 +++ b/test/tools/javac/lambda/MethodReference72.out	Thu Jul 25 19:06:03 2013 +0100
    66.3 @@ -0,0 +1,2 @@
    66.4 +MethodReference72.java:18:9: compiler.err.cant.apply.symbol: kindname.method, g, MethodReference72.F<Z>, @420, kindname.class, MethodReference72, (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m1, java.lang.Integer, Z[], kindname.class, MethodReference72, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: Z[], java.lang.Integer)))))
    66.5 +1 error
    67.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.2 +++ b/test/tools/javac/lambda/NestedCapture01.java	Thu Jul 25 19:06:03 2013 +0100
    67.3 @@ -0,0 +1,43 @@
    67.4 +/*
    67.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    67.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    67.7 + *
    67.8 + * This code is free software; you can redistribute it and/or modify it
    67.9 + * under the terms of the GNU General Public License version 2 only, as
   67.10 + * published by the Free Software Foundation.
   67.11 + *
   67.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   67.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   67.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   67.15 + * version 2 for more details (a copy is included in the LICENSE file that
   67.16 + * accompanied this code).
   67.17 + *
   67.18 + * You should have received a copy of the GNU General Public License version
   67.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   67.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   67.21 + *
   67.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   67.23 + * or visit www.oracle.com if you need additional information or have any
   67.24 + * questions.
   67.25 + */
   67.26 +
   67.27 +/*
   67.28 + * @test
   67.29 + * @bug 8012238
   67.30 + * @summary Nested method capture and inference
   67.31 + * @compile NestedCapture01.java
   67.32 + */
   67.33 +class NestedCapture01 {
   67.34 +
   67.35 +    void test(String s) {
   67.36 +       g(m(s.getClass()));
   67.37 +    }
   67.38 +
   67.39 +    <F extends String> F m(Class<F> cf) {
   67.40 +       return null;
   67.41 +    }
   67.42 +
   67.43 +    <P extends String> P g(P vo) {
   67.44 +       return null;
   67.45 +    }
   67.46 +}
    68.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.2 +++ b/test/tools/javac/lambda/NestedCapture02.java	Thu Jul 25 19:06:03 2013 +0100
    68.3 @@ -0,0 +1,43 @@
    68.4 +/*
    68.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    68.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    68.7 + *
    68.8 + * This code is free software; you can redistribute it and/or modify it
    68.9 + * under the terms of the GNU General Public License version 2 only, as
   68.10 + * published by the Free Software Foundation.
   68.11 + *
   68.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   68.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   68.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   68.15 + * version 2 for more details (a copy is included in the LICENSE file that
   68.16 + * accompanied this code).
   68.17 + *
   68.18 + * You should have received a copy of the GNU General Public License version
   68.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   68.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   68.21 + *
   68.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   68.23 + * or visit www.oracle.com if you need additional information or have any
   68.24 + * questions.
   68.25 + */
   68.26 +
   68.27 +/*
   68.28 + * @test
   68.29 + * @bug 8012238
   68.30 + * @summary Nested method capture and inference
   68.31 + * @compile NestedCapture02.java
   68.32 + */
   68.33 +class NestedCapture02<S,T> {
   68.34 +
   68.35 +     <S,T> NestedCapture02<S,T> create(NestedCapture02<? super S,?> first,
   68.36 +             NestedCapture02<? super S, T> second) {
   68.37 +         return null;
   68.38 +     }
   68.39 +
   68.40 +     <U> NestedCapture02<S, ? extends U> cast(Class<U> target) { return null; }
   68.41 +
   68.42 +     <U> NestedCapture02<S, ? extends U> test(Class<U> target,
   68.43 +             NestedCapture02<? super S, ?> first, NestedCapture02<? super S, T> second) {
   68.44 +        return create(first, second.cast(target));
   68.45 +     }
   68.46 +}
    69.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.2 +++ b/test/tools/javac/lambda/NestedCapture03.java	Thu Jul 25 19:06:03 2013 +0100
    69.3 @@ -0,0 +1,36 @@
    69.4 +/*
    69.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    69.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    69.7 + *
    69.8 + * This code is free software; you can redistribute it and/or modify it
    69.9 + * under the terms of the GNU General Public License version 2 only, as
   69.10 + * published by the Free Software Foundation.
   69.11 + *
   69.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   69.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   69.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   69.15 + * version 2 for more details (a copy is included in the LICENSE file that
   69.16 + * accompanied this code).
   69.17 + *
   69.18 + * You should have received a copy of the GNU General Public License version
   69.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   69.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   69.21 + *
   69.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   69.23 + * or visit www.oracle.com if you need additional information or have any
   69.24 + * questions.
   69.25 + */
   69.26 +
   69.27 +/*
   69.28 + * @test
   69.29 + * @bug 8012238
   69.30 + * @summary Nested method capture and inference
   69.31 + * @compile NestedCapture03.java
   69.32 + */
   69.33 +class NestedCapture03 {
   69.34 +    <T extends String> T factory(Class<T> c) { return null; }
   69.35 +
   69.36 +    void test(Class<?> c) {
   69.37 +        factory(c.asSubclass(String.class)).matches(null);
   69.38 +    }
   69.39 +}
    70.1 --- a/test/tools/javac/lambda/TargetType36.java	Wed Jul 24 15:18:33 2013 -0700
    70.2 +++ b/test/tools/javac/lambda/TargetType36.java	Thu Jul 25 19:06:03 2013 +0100
    70.3 @@ -23,11 +23,10 @@
    70.4  
    70.5  /*
    70.6   * @test
    70.7 - * @ignore 8013404: Test awaits spec clarification
    70.8 - * @bug 8003280
    70.9 + * @bug 8003280 8013404
   70.10   * @summary Add lambda tests
   70.11 - *  check that target type of cast is propagated to conditional subexpressions
   70.12 - * @compile TargetType36.java
   70.13 + *  check that target type of cast is not propagated to conditional subexpressions
   70.14 + * @compile/fail/ref=TargetType36.out -XDrawDiagnostics TargetType36.java
   70.15   */
   70.16  class TargetType36 { //awaits spec wording on cast vs. poly
   70.17  
    71.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.2 +++ b/test/tools/javac/lambda/TargetType36.out	Thu Jul 25 19:06:03 2013 +0100
    71.3 @@ -0,0 +1,3 @@
    71.4 +TargetType36.java:40:30: compiler.err.unexpected.lambda
    71.5 +TargetType36.java:40:43: compiler.err.unexpected.lambda
    71.6 +2 errors
    72.1 --- a/test/tools/javac/lambda/TargetType60.out	Wed Jul 24 15:18:33 2013 -0700
    72.2 +++ b/test/tools/javac/lambda/TargetType60.out	Thu Jul 25 19:06:03 2013 +0100
    72.3 @@ -1,7 +1,7 @@
    72.4  TargetType60.java:54:21: compiler.err.ref.ambiguous: g, kindname.method, g(TargetType60.Sam0), TargetType60, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60
    72.5  TargetType60.java:55:21: compiler.err.ref.ambiguous: g, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>g(TargetType60.Sam2<U,java.lang.String>), TargetType60
    72.6  TargetType60.java:60:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60
    72.7 -TargetType60.java:60:28: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.assignment.exists: U, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, n1, java.lang.String, TargetType60, kindname.class, TargetType60, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: TargetType60, java.lang.String)))))
    72.8 +TargetType60.java:60:29: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, n1(java.lang.String))
    72.9  TargetType60.java:61:29: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, n2(TargetType60,java.lang.String))
   72.10  TargetType60.java:62:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60
   72.11  TargetType60.java:63:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60
    73.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.2 +++ b/test/tools/javac/lambda/TargetType63.java	Thu Jul 25 19:06:03 2013 +0100
    73.3 @@ -0,0 +1,40 @@
    73.4 +/*
    73.5 + * @test /nodynamiccopyright/
    73.6 + * @summary smoke test for inference of throws type variables
    73.7 + * @compile/fail/ref=TargetType63.out -XDrawDiagnostics TargetType63.java
    73.8 + */
    73.9 +class TargetType63 {
   73.10 +
   73.11 +    interface F<T extends Throwable> {
   73.12 +        void m() throws T;
   73.13 +    }
   73.14 +
   73.15 +    void g1() { }
   73.16 +    void g2() throws ClassNotFoundException { }
   73.17 +    void g3() throws Exception { }
   73.18 +
   73.19 +    <Z extends Throwable> void m1(F<Z> fz) throws Z { }
   73.20 +    <Z extends ClassNotFoundException> void m2(F<Z> fz) throws Z { }
   73.21 +
   73.22 +    void test1() {
   73.23 +        m1(()->{ }); //ok (Z = RuntimeException)
   73.24 +        m1(this::g1); //ok (Z = RuntimeException)
   73.25 +    }
   73.26 +
   73.27 +    void test2() {
   73.28 +        m2(()->{ }); //fail (Z = ClassNotFoundException)
   73.29 +        m2(this::g1); //fail (Z = ClassNotFoundException)
   73.30 +    }
   73.31 +
   73.32 +    void test3() {
   73.33 +        m1(()->{ throw new ClassNotFoundException(); }); //fail (Z = ClassNotFoundException)
   73.34 +        m1(this::g2); //fail (Z = ClassNotFoundException)
   73.35 +        m2(()->{ throw new ClassNotFoundException(); }); //fail (Z = ClassNotFoundException)
   73.36 +        m2(this::g2); //fail (Z = ClassNotFoundException)
   73.37 +    }
   73.38 +
   73.39 +    void test4() {
   73.40 +        m1(()->{ throw new Exception(); }); //fail (Z = Exception)
   73.41 +        m1(this::g3); //fail (Z = Exception)
   73.42 +    }
   73.43 +}
    74.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.2 +++ b/test/tools/javac/lambda/TargetType63.out	Thu Jul 25 19:06:03 2013 +0100
    74.3 @@ -0,0 +1,9 @@
    74.4 +TargetType63.java:25:11: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.ClassNotFoundException
    74.5 +TargetType63.java:26:11: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.ClassNotFoundException
    74.6 +TargetType63.java:30:11: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.ClassNotFoundException
    74.7 +TargetType63.java:31:11: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.ClassNotFoundException
    74.8 +TargetType63.java:32:11: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.ClassNotFoundException
    74.9 +TargetType63.java:33:11: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.ClassNotFoundException
   74.10 +TargetType63.java:37:11: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
   74.11 +TargetType63.java:38:11: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
   74.12 +8 errors
    75.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.2 +++ b/test/tools/javac/lambda/TargetType75.java	Thu Jul 25 19:06:03 2013 +0100
    75.3 @@ -0,0 +1,41 @@
    75.4 +/*
    75.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    75.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    75.7 + *
    75.8 + * This code is free software; you can redistribute it and/or modify it
    75.9 + * under the terms of the GNU General Public License version 2 only, as
   75.10 + * published by the Free Software Foundation.
   75.11 + *
   75.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   75.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   75.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   75.15 + * version 2 for more details (a copy is included in the LICENSE file that
   75.16 + * accompanied this code).
   75.17 + *
   75.18 + * You should have received a copy of the GNU General Public License version
   75.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   75.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   75.21 + *
   75.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   75.23 + * or visit www.oracle.com if you need additional information or have any
   75.24 + * questions.
   75.25 + */
   75.26 +
   75.27 +/*
   75.28 + * @test
   75.29 + * @bug 8016060 8016059
   75.30 + * @summary Lambda isn't compiled with return statement
   75.31 + * @compile TargetType75.java
   75.32 + */
   75.33 +class TargetType75 {
   75.34 +    interface P<X> {
   75.35 +        void m(X x);
   75.36 +    }
   75.37 +
   75.38 +    <Z> void m(P<Z> r, Z z) { }
   75.39 +
   75.40 +    void test() {
   75.41 +        m(x->{ return; }, "");
   75.42 +        m(x->System.out.println(""), "");
   75.43 +    }
   75.44 +}
    76.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.2 +++ b/test/tools/javac/lambda/TargetType76.java	Thu Jul 25 19:06:03 2013 +0100
    76.3 @@ -0,0 +1,65 @@
    76.4 +/*
    76.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    76.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    76.7 + *
    76.8 + * This code is free software; you can redistribute it and/or modify it
    76.9 + * under the terms of the GNU General Public License version 2 only, as
   76.10 + * published by the Free Software Foundation.
   76.11 + *
   76.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   76.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   76.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   76.15 + * version 2 for more details (a copy is included in the LICENSE file that
   76.16 + * accompanied this code).
   76.17 + *
   76.18 + * You should have received a copy of the GNU General Public License version
   76.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   76.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   76.21 + *
   76.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   76.23 + * or visit www.oracle.com if you need additional information or have any
   76.24 + * questions.
   76.25 + */
   76.26 +
   76.27 +/*
   76.28 + * @test
   76.29 + * @bug 8016175
   76.30 + * @summary Add bottom-up type-checking support for unambiguous method references
   76.31 + * @compile TargetType76.java
   76.32 + */
   76.33 +class TargetType76 {
   76.34 +
   76.35 +    interface Function<X, Y> {
   76.36 +        Y m(X x);
   76.37 +    }
   76.38 +
   76.39 +    interface OfRef<T> { }
   76.40 +
   76.41 +    interface Supplier<X> {
   76.42 +        X make();
   76.43 +    }
   76.44 +
   76.45 +    interface Stream<X> { }
   76.46 +
   76.47 +    interface Node<E> {
   76.48 +        Spliterator<E> spliterator();
   76.49 +    }
   76.50 +
   76.51 +    interface Spliterator<X> {
   76.52 +        Spliterator<X> spliterator();
   76.53 +    }
   76.54 +
   76.55 +    class RefTestData<T, I> implements OfRef<T> {
   76.56 +        RefTestData(I state,
   76.57 +                    Function<I, Stream<T>> streamFn,
   76.58 +                    Function<I, Spliterator<T>> splitrFn) { }
   76.59 +    }
   76.60 +
   76.61 +    <O> OfRef<O> ofCollection(Node<O> collection) {
   76.62 +        return new RefTestData<>(collection,
   76.63 +                                 x->stream(x::spliterator),
   76.64 +                                 Node::spliterator);
   76.65 +    }
   76.66 +
   76.67 +    <S> Stream<S> stream(Supplier<? extends Spliterator<S>> supplier) { return null; }
   76.68 +}
    77.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.2 +++ b/test/tools/javac/meth/VarargsWarn.java	Thu Jul 25 19:06:03 2013 +0100
    77.3 @@ -0,0 +1,17 @@
    77.4 +/*
    77.5 + * @test /nodynamiccopyright/
    77.6 + * @bug 8019340
    77.7 + * @summary varargs-related warnings are meaningless on signature-polymorphic methods such as MethodHandle.invokeExact
    77.8 + *
    77.9 + * @compile/fail/ref=VarargsWarn.out -XDrawDiagnostics -Werror VarargsWarn.java
   77.10 + */
   77.11 +
   77.12 +import java.lang.invoke.*;
   77.13 +
   77.14 +class VarargsWarn {
   77.15 +    void test(MethodHandle mh) throws Throwable {
   77.16 +        mh.invokeExact((Integer[])null);
   77.17 +        mh.invoke((Integer[])null);
   77.18 +        mh.invokeWithArguments((Integer[])null); //not a sig poly method - warning here!
   77.19 +    }
   77.20 +}
    78.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.2 +++ b/test/tools/javac/meth/VarargsWarn.out	Thu Jul 25 19:06:03 2013 +0100
    78.3 @@ -0,0 +1,4 @@
    78.4 +VarargsWarn.java:15:32: compiler.warn.inexact.non-varargs.call: java.lang.Object, java.lang.Object[]
    78.5 +- compiler.err.warnings.and.werror
    78.6 +1 error
    78.7 +1 warning
    79.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.2 +++ b/test/tools/javac/warnings/6594914/Auxiliary.java	Thu Jul 25 19:06:03 2013 +0100
    79.3 @@ -0,0 +1,5 @@
    79.4 +import java.io.StringBufferInputStream;
    79.5 +
    79.6 +public class Auxiliary {
    79.7 +
    79.8 +}
    80.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    80.2 +++ b/test/tools/javac/warnings/6594914/ExplicitCompilation.out	Thu Jul 25 19:06:03 2013 +0100
    80.3 @@ -0,0 +1,2 @@
    80.4 +Auxiliary.java:1:15: compiler.warn.has.been.deprecated: java.io.StringBufferInputStream, java.io
    80.5 +1 warning
    81.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    81.2 +++ b/test/tools/javac/warnings/6594914/ImplicitCompilation.java	Thu Jul 25 19:06:03 2013 +0100
    81.3 @@ -0,0 +1,13 @@
    81.4 +/**
    81.5 + * @test /nodynamiccopyright/
    81.6 + * @bug 8020586
    81.7 + * @summary Warnings in the imports section should be attributed to the correct source file
    81.8 + * @clean Auxiliary ImplicitCompilation
    81.9 + * @compile/ref=ImplicitCompilation.out -XDrawDiagnostics -Xlint:deprecation -sourcepath . ImplicitCompilation.java
   81.10 + * @clean Auxiliary ImplicitCompilation
   81.11 + * @compile/ref=ExplicitCompilation.out -XDrawDiagnostics -Xlint:deprecation ImplicitCompilation.java Auxiliary.java
   81.12 + */
   81.13 +
   81.14 +public class ImplicitCompilation {
   81.15 +    private Auxiliary a;
   81.16 +}
    82.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    82.2 +++ b/test/tools/javac/warnings/6594914/ImplicitCompilation.out	Thu Jul 25 19:06:03 2013 +0100
    82.3 @@ -0,0 +1,2 @@
    82.4 +Auxiliary.java:1:15: compiler.warn.has.been.deprecated: java.io.StringBufferInputStream, java.io
    82.5 +1 warning
    83.1 --- a/test/tools/javap/8007907/JavapReturns0AfterClassNotFoundTest.java	Wed Jul 24 15:18:33 2013 -0700
    83.2 +++ b/test/tools/javap/8007907/JavapReturns0AfterClassNotFoundTest.java	Thu Jul 25 19:06:03 2013 +0100
    83.3 @@ -35,7 +35,7 @@
    83.4  public class JavapReturns0AfterClassNotFoundTest {
    83.5  
    83.6      static final String fileNotFoundErrorMsg =
    83.7 -            "Error:  class not found: Unexisting.class";
    83.8 +            "Error: class not found: Unexisting.class";
    83.9      static final String exitCodeClassNotFoundAssertionMsg =
   83.10              "Javap's exit code for class not found should be 1";
   83.11      static final String classNotFoundMsgAssertionMsg =

mercurial