Merge jdk8-b117

Fri, 15 Nov 2013 07:15:51 -0800

author
lana
date
Fri, 15 Nov 2013 07:15:51 -0800
changeset 2194
19de039a03a6
parent 2177
64d119680f0a
parent 2193
d4cbb671de1c
child 2195
4fd6a7ff8c06

Merge

test/tools/javac/ArraysInIntersections.java file | annotate | diff | comparison | revisions
test/tools/javac/InferArraysInIntersections.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/InterfaceOrArrayExpected.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/javac/code/Kinds.java	Thu Nov 14 09:05:25 2013 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Kinds.java	Fri Nov 15 07:15:51 2013 -0800
     1.3 @@ -87,16 +87,17 @@
     1.4  
     1.5      /** Kinds for erroneous symbols that complement the above
     1.6       */
     1.7 -    public static final int ERRONEOUS = 1 << 7;
     1.8 -    public static final int AMBIGUOUS    = ERRONEOUS+1; // ambiguous reference
     1.9 -    public static final int HIDDEN       = ERRONEOUS+2; // hidden method or field
    1.10 -    public static final int STATICERR    = ERRONEOUS+3; // nonstatic member from static context
    1.11 -    public static final int MISSING_ENCL = ERRONEOUS+4; // missing enclosing class
    1.12 -    public static final int ABSENT_VAR   = ERRONEOUS+5; // missing variable
    1.13 -    public static final int WRONG_MTHS   = ERRONEOUS+6; // methods with wrong arguments
    1.14 -    public static final int WRONG_MTH    = ERRONEOUS+7; // one method with wrong arguments
    1.15 -    public static final int ABSENT_MTH   = ERRONEOUS+8; // missing method
    1.16 -    public static final int ABSENT_TYP   = ERRONEOUS+9; // missing type
    1.17 +    public static final int ERRONEOUS           = 1 << 7;
    1.18 +    public static final int AMBIGUOUS           = ERRONEOUS + 1;  // ambiguous reference
    1.19 +    public static final int HIDDEN              = ERRONEOUS + 2;  // hidden method or field
    1.20 +    public static final int STATICERR           = ERRONEOUS + 3;  // nonstatic member from static context
    1.21 +    public static final int MISSING_ENCL        = ERRONEOUS + 4;  // missing enclosing class
    1.22 +    public static final int ABSENT_VAR          = ERRONEOUS + 5;  // missing variable
    1.23 +    public static final int WRONG_MTHS          = ERRONEOUS + 6;  // methods with wrong arguments
    1.24 +    public static final int WRONG_MTH           = ERRONEOUS + 7;  // one method with wrong arguments
    1.25 +    public static final int ABSENT_MTH          = ERRONEOUS + 8;  // missing method
    1.26 +    public static final int ABSENT_TYP          = ERRONEOUS + 9;  // missing type
    1.27 +    public static final int WRONG_STATICNESS    = ERRONEOUS + 10; // wrong staticness for method references
    1.28  
    1.29      public enum KindName implements Formattable {
    1.30          ANNOTATION("kindname.annotation"),
    1.31 @@ -231,14 +232,14 @@
    1.32              return KindName.CLASS;
    1.33      }
    1.34  
    1.35 -    /** A KindName representing the kind of a a missing symbol, given an
    1.36 +    /** A KindName representing the kind of a missing symbol, given an
    1.37       *  error kind.
    1.38       * */
    1.39      public static KindName absentKind(int kind) {
    1.40          switch (kind) {
    1.41          case ABSENT_VAR:
    1.42              return KindName.VAR;
    1.43 -        case WRONG_MTHS: case WRONG_MTH: case ABSENT_MTH:
    1.44 +        case WRONG_MTHS: case WRONG_MTH: case ABSENT_MTH: case WRONG_STATICNESS:
    1.45              return KindName.METHOD;
    1.46          case ABSENT_TYP:
    1.47              return KindName.CLASS;
     2.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Nov 14 09:05:25 2013 -0800
     2.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Fri Nov 15 07:15:51 2013 -0800
     2.3 @@ -244,7 +244,7 @@
     2.4              public Type visitClassType(ClassType t, Symbol sym) {
     2.5                  if (t.tsym == sym)
     2.6                      return t;
     2.7 -                Type base = asSuper(sym.type, t);
     2.8 +                Type base = asSuper(sym.type, t.tsym);
     2.9                  if (base == null)
    2.10                      return null;
    2.11                  ListBuffer<Type> from = new ListBuffer<Type>();
    2.12 @@ -687,7 +687,7 @@
    2.13                          (t.flags() & SYNTHETIC) == 0;
    2.14              }
    2.15          };
    2.16 -        private boolean pendingBridges(ClassSymbol origin, TypeSymbol sym) {
    2.17 +        private boolean pendingBridges(ClassSymbol origin, TypeSymbol s) {
    2.18              //a symbol will be completed from a classfile if (a) symbol has
    2.19              //an associated file object with CLASS kind and (b) the symbol has
    2.20              //not been entered
    2.21 @@ -696,11 +696,11 @@
    2.22                      enter.getEnv(origin) == null) {
    2.23                  return false;
    2.24              }
    2.25 -            if (origin == sym) {
    2.26 +            if (origin == s) {
    2.27                  return true;
    2.28              }
    2.29              for (Type t : interfaces(origin.type)) {
    2.30 -                if (pendingBridges((ClassSymbol)t.tsym, sym)) {
    2.31 +                if (pendingBridges((ClassSymbol)t.tsym, s)) {
    2.32                      return true;
    2.33                  }
    2.34              }
    2.35 @@ -761,7 +761,7 @@
    2.36              } else if (t.hasTag(TYPEVAR)) {
    2.37                  return isSubtypeUnchecked(t.getUpperBound(), s, warn);
    2.38              } else if (!s.isRaw()) {
    2.39 -                Type t2 = asSuper(t, s);
    2.40 +                Type t2 = asSuper(t, s.tsym);
    2.41                  if (t2 != null && t2.isRaw()) {
    2.42                      if (isReifiable(s)) {
    2.43                          warn.silentWarn(LintCategory.UNCHECKED);
    2.44 @@ -914,7 +914,7 @@
    2.45  
    2.46              @Override
    2.47              public Boolean visitClassType(ClassType t, Type s) {
    2.48 -                Type sup = asSuper(t, s);
    2.49 +                Type sup = asSuper(t, s.tsym);
    2.50                  return sup != null
    2.51                      && sup.tsym == s.tsym
    2.52                      // You're not allowed to write
    2.53 @@ -1935,42 +1935,30 @@
    2.54       * @param t a type
    2.55       * @param sym a symbol
    2.56       */
    2.57 -    public Type asSuper(Type t, Symbol s) {
    2.58 -        return asSuper(t, s.type);
    2.59 -    }
    2.60 -
    2.61 -    public Type asSuper(Type t, Type s) {
    2.62 -        return asSuper.visit(t, s);
    2.63 +    public Type asSuper(Type t, Symbol sym) {
    2.64 +        return asSuper.visit(t, sym);
    2.65      }
    2.66      // where
    2.67 -        private SimpleVisitor<Type,Type> asSuper = new SimpleVisitor<Type,Type>() {
    2.68 -
    2.69 -            public Type visitType(Type t, Type s) {
    2.70 +        private SimpleVisitor<Type,Symbol> asSuper = new SimpleVisitor<Type,Symbol>() {
    2.71 +
    2.72 +            public Type visitType(Type t, Symbol sym) {
    2.73                  return null;
    2.74              }
    2.75  
    2.76              @Override
    2.77 -            public Type visitClassType(ClassType t, Type s) {
    2.78 -                if (t.tsym == s.tsym)
    2.79 +            public Type visitClassType(ClassType t, Symbol sym) {
    2.80 +                if (t.tsym == sym)
    2.81                      return t;
    2.82  
    2.83                  Type st = supertype(t);
    2.84 -
    2.85 -                switch(st.getTag()) {
    2.86 -                default: break;
    2.87 -                case CLASS:
    2.88 -                case ARRAY:
    2.89 -                case TYPEVAR:
    2.90 -                case ERROR: {
    2.91 -                    Type x = asSuper(st, s);
    2.92 +                if (st.hasTag(CLASS) || st.hasTag(TYPEVAR) || st.hasTag(ERROR)) {
    2.93 +                    Type x = asSuper(st, sym);
    2.94                      if (x != null)
    2.95                          return x;
    2.96 -                } break;
    2.97                  }
    2.98 -
    2.99 -                if ((s.tsym.flags() & INTERFACE) != 0) {
   2.100 +                if ((sym.flags() & INTERFACE) != 0) {
   2.101                      for (List<Type> l = interfaces(t); l.nonEmpty(); l = l.tail) {
   2.102 -                        Type x = asSuper(l.head, s);
   2.103 +                        Type x = asSuper(l.head, sym);
   2.104                          if (x != null)
   2.105                              return x;
   2.106                      }
   2.107 @@ -1979,20 +1967,22 @@
   2.108              }
   2.109  
   2.110              @Override
   2.111 -            public Type visitArrayType(ArrayType t, Type s) {
   2.112 -                return isSubtype(t, s) ? s : null;
   2.113 +            public Type visitArrayType(ArrayType t, Symbol sym) {
   2.114 +                return isSubtype(t, sym.type) ? sym.type : null;
   2.115              }
   2.116  
   2.117              @Override
   2.118 -            public Type visitTypeVar(TypeVar t, Type s) {
   2.119 -                if (t.tsym == s.tsym)
   2.120 +            public Type visitTypeVar(TypeVar t, Symbol sym) {
   2.121 +                if (t.tsym == sym)
   2.122                      return t;
   2.123                  else
   2.124 -                    return asSuper(t.bound, s);
   2.125 +                    return asSuper(t.bound, sym);
   2.126              }
   2.127  
   2.128              @Override
   2.129 -            public Type visitErrorType(ErrorType t, Type s) { return t; }
   2.130 +            public Type visitErrorType(ErrorType t, Symbol sym) {
   2.131 +                return t;
   2.132 +            }
   2.133          };
   2.134  
   2.135      /**
   2.136 @@ -3573,9 +3563,9 @@
   2.137              //step 3 - for each element G in MEC, compute lci(Inv(G))
   2.138              List<Type> candidates = List.nil();
   2.139              for (Type erasedSupertype : mec) {
   2.140 -                List<Type> lci = List.of(asSuper(ts.head, erasedSupertype));
   2.141 +                List<Type> lci = List.of(asSuper(ts.head, erasedSupertype.tsym));
   2.142                  for (Type t : ts) {
   2.143 -                    lci = intersect(lci, List.of(asSuper(t, erasedSupertype)));
   2.144 +                    lci = intersect(lci, List.of(asSuper(t, erasedSupertype.tsym)));
   2.145                  }
   2.146                  candidates = candidates.appendList(lci);
   2.147              }
   2.148 @@ -3995,7 +3985,7 @@
   2.149          // The arguments to the supers could be unified here to
   2.150          // get a more accurate analysis
   2.151          while (commonSupers.nonEmpty()) {
   2.152 -            Type t1 = asSuper(from, commonSupers.head);
   2.153 +            Type t1 = asSuper(from, commonSupers.head.tsym);
   2.154              Type t2 = commonSupers.head; // same as asSuper(to, commonSupers.head.tsym);
   2.155              if (disjointTypes(t1.getTypeArguments(), t2.getTypeArguments()))
   2.156                  return false;
   2.157 @@ -4026,7 +4016,7 @@
   2.158              from = target;
   2.159          }
   2.160          Assert.check((from.tsym.flags() & FINAL) != 0);
   2.161 -        Type t1 = asSuper(from, to);
   2.162 +        Type t1 = asSuper(from, to.tsym);
   2.163          if (t1 == null) return false;
   2.164          Type t2 = to;
   2.165          if (disjointTypes(t1.getTypeArguments(), t2.getTypeArguments()))
     3.1 --- a/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Thu Nov 14 09:05:25 2013 -0800
     3.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Fri Nov 15 07:15:51 2013 -0800
     3.3 @@ -255,6 +255,9 @@
     3.4                    : attr.attribType(a.annotationType, env));
     3.5          a.type = chk.checkType(a.annotationType.pos(), at, expected);
     3.6          if (a.type.isErroneous()) {
     3.7 +            // Need to make sure nested (anno)trees does not have null as .type
     3.8 +            attr.postAttr(a);
     3.9 +
    3.10              if (typeAnnotation) {
    3.11                  return new Attribute.TypeCompound(a.type, List.<Pair<MethodSymbol,Attribute>>nil(),
    3.12                          new TypeAnnotationPosition());
    3.13 @@ -265,6 +268,10 @@
    3.14          if ((a.type.tsym.flags() & Flags.ANNOTATION) == 0) {
    3.15              log.error(a.annotationType.pos(),
    3.16                        "not.annotation.type", a.type.toString());
    3.17 +
    3.18 +            // Need to make sure nested (anno)trees does not have null as .type
    3.19 +            attr.postAttr(a);
    3.20 +
    3.21              if (typeAnnotation) {
    3.22                  return new Attribute.TypeCompound(a.type, List.<Pair<MethodSymbol,Attribute>>nil(), null);
    3.23              } else {
    3.24 @@ -278,7 +285,7 @@
    3.25                  Assign(make.Ident(names.value), args.head);
    3.26          }
    3.27          ListBuffer<Pair<MethodSymbol,Attribute>> buf =
    3.28 -            new ListBuffer<Pair<MethodSymbol,Attribute>>();
    3.29 +            new ListBuffer<>();
    3.30          for (List<JCExpression> tl = args; tl.nonEmpty(); tl = tl.tail) {
    3.31              JCExpression t = tl.head;
    3.32              if (!t.hasTag(ASSIGN)) {
    3.33 @@ -304,8 +311,7 @@
    3.34              Type result = method.type.getReturnType();
    3.35              Attribute value = enterAttributeValue(result, assign.rhs, env);
    3.36              if (!method.type.isErroneous())
    3.37 -                buf.append(new Pair<MethodSymbol,Attribute>
    3.38 -                           ((MethodSymbol)method, value));
    3.39 +                buf.append(new Pair<>((MethodSymbol)method, value));
    3.40              t.type = result;
    3.41          }
    3.42          if (typeAnnotation) {
     4.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Nov 14 09:05:25 2013 -0800
     4.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Nov 15 07:15:51 2013 -0800
     4.3 @@ -58,7 +58,6 @@
     4.4  import static com.sun.tools.javac.code.Kinds.ERRONEOUS;
     4.5  import static com.sun.tools.javac.code.TypeTag.*;
     4.6  import static com.sun.tools.javac.code.TypeTag.WILDCARD;
     4.7 -import static com.sun.tools.javac.code.TypeTag.ARRAY;
     4.8  import static com.sun.tools.javac.tree.JCTree.Tag.*;
     4.9  
    4.10  /** This is the main context-dependent analysis phase in GJC. It
    4.11 @@ -806,44 +805,33 @@
    4.12          Type t = tree.type != null ?
    4.13              tree.type :
    4.14              attribType(tree, env);
    4.15 -        return checkBase(t, tree, env, classExpected, interfaceExpected, false, checkExtensible);
    4.16 +        return checkBase(t, tree, env, classExpected, interfaceExpected, checkExtensible);
    4.17      }
    4.18      Type checkBase(Type t,
    4.19                     JCTree tree,
    4.20                     Env<AttrContext> env,
    4.21                     boolean classExpected,
    4.22 -                   boolean interfacesOnlyExpected,
    4.23 -                   boolean interfacesOrArraysExpected,
    4.24 +                   boolean interfaceExpected,
    4.25                     boolean checkExtensible) {
    4.26          if (t.isErroneous())
    4.27              return t;
    4.28 -        if (t.hasTag(TYPEVAR) && !classExpected &&
    4.29 -            !interfacesOrArraysExpected && !interfacesOnlyExpected) {
    4.30 +        if (t.hasTag(TYPEVAR) && !classExpected && !interfaceExpected) {
    4.31              // check that type variable is already visible
    4.32              if (t.getUpperBound() == null) {
    4.33                  log.error(tree.pos(), "illegal.forward.ref");
    4.34                  return types.createErrorType(t);
    4.35              }
    4.36 -        } else if (classExpected) {
    4.37 +        } else {
    4.38              t = chk.checkClassType(tree.pos(), t, checkExtensible|!allowGenerics);
    4.39 -        } else {
    4.40 -            t = chk.checkClassOrArrayType(tree.pos(), t,
    4.41 -                                          checkExtensible|!allowGenerics);
    4.42          }
    4.43 -        if (interfacesOnlyExpected && !t.tsym.isInterface()) {
    4.44 +        if (interfaceExpected && (t.tsym.flags() & INTERFACE) == 0) {
    4.45              log.error(tree.pos(), "intf.expected.here");
    4.46              // return errType is necessary since otherwise there might
    4.47              // be undetected cycles which cause attribution to loop
    4.48              return types.createErrorType(t);
    4.49 -        } else if (interfacesOrArraysExpected &&
    4.50 -            !(t.tsym.isInterface() || t.getTag() == ARRAY)) {
    4.51 -            log.error(tree.pos(), "intf.or.array.expected.here");
    4.52 -            // return errType is necessary since otherwise there might
    4.53 -            // be undetected cycles which cause attribution to loop
    4.54 -            return types.createErrorType(t);
    4.55          } else if (checkExtensible &&
    4.56                     classExpected &&
    4.57 -                   t.tsym.isInterface()) {
    4.58 +                   (t.tsym.flags() & INTERFACE) != 0) {
    4.59              log.error(tree.pos(), "no.intf.expected.here");
    4.60              return types.createErrorType(t);
    4.61          }
    4.62 @@ -855,12 +843,6 @@
    4.63          chk.checkNonCyclic(tree.pos(), t);
    4.64          return t;
    4.65      }
    4.66 -    //where
    4.67 -        private Object asTypeParam(Type t) {
    4.68 -            return (t.hasTag(TYPEVAR))
    4.69 -                                    ? diags.fragment("type.parameter", t)
    4.70 -                                    : t;
    4.71 -        }
    4.72  
    4.73      Type attribIdentAsEnumType(Env<AttrContext> env, JCIdent id) {
    4.74          Assert.check((env.enclClass.sym.flags() & ENUM) != 0);
    4.75 @@ -2254,7 +2236,8 @@
    4.76          // empty annotations, if only declaration annotations were given.
    4.77          // This method will raise an error for such a type.
    4.78          for (JCAnnotation ai : annotations) {
    4.79 -            if (typeAnnotations.annotationType(ai.attribute, sym) == TypeAnnotations.AnnotationType.DECLARATION) {
    4.80 +            if (!ai.type.isErroneous() &&
    4.81 +                typeAnnotations.annotationType(ai.attribute, sym) == TypeAnnotations.AnnotationType.DECLARATION) {
    4.82                  log.error(ai.pos(), "annotation.type.not.applicable");
    4.83              }
    4.84          }
    4.85 @@ -2714,9 +2697,10 @@
    4.86              Pair<Symbol, Resolve.ReferenceLookupHelper> refResult = null;
    4.87              List<Type> saved_undet = resultInfo.checkContext.inferenceContext().save();
    4.88              try {
    4.89 -                refResult = rs.resolveMemberReference(that.pos(), localEnv, that, that.expr.type,
    4.90 -                        that.name, argtypes, typeargtypes, true, referenceCheck,
    4.91 -                        resultInfo.checkContext.inferenceContext());
    4.92 +                refResult = rs.resolveMemberReference(localEnv, that, that.expr.type,
    4.93 +                        that.name, argtypes, typeargtypes, referenceCheck,
    4.94 +                        resultInfo.checkContext.inferenceContext(),
    4.95 +                        resultInfo.checkContext.deferredAttrContext().mode);
    4.96              } finally {
    4.97                  resultInfo.checkContext.inferenceContext().rollback(saved_undet);
    4.98              }
    4.99 @@ -2736,6 +2720,7 @@
   4.100                      case HIDDEN:
   4.101                      case STATICERR:
   4.102                      case MISSING_ENCL:
   4.103 +                    case WRONG_STATICNESS:
   4.104                          targetError = true;
   4.105                          break;
   4.106                      default:
   4.107 @@ -2787,26 +2772,6 @@
   4.108                      chk.checkRaw(that.expr, localEnv);
   4.109                  }
   4.110  
   4.111 -                if (!that.kind.isUnbound() &&
   4.112 -                        that.getMode() == ReferenceMode.INVOKE &&
   4.113 -                        TreeInfo.isStaticSelector(that.expr, names) &&
   4.114 -                        !that.sym.isStatic()) {
   4.115 -                    log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()),
   4.116 -                            diags.fragment("non-static.cant.be.ref", Kinds.kindName(refSym), refSym));
   4.117 -                    result = that.type = types.createErrorType(target);
   4.118 -                    return;
   4.119 -                }
   4.120 -
   4.121 -                if (that.kind.isUnbound() &&
   4.122 -                        that.getMode() == ReferenceMode.INVOKE &&
   4.123 -                        TreeInfo.isStaticSelector(that.expr, names) &&
   4.124 -                        that.sym.isStatic()) {
   4.125 -                    log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()),
   4.126 -                            diags.fragment("static.method.in.unbound.lookup", Kinds.kindName(refSym), refSym));
   4.127 -                    result = that.type = types.createErrorType(target);
   4.128 -                    return;
   4.129 -                }
   4.130 -
   4.131                  if (that.sym.isStatic() && TreeInfo.isStaticSelector(that.expr, names) &&
   4.132                          exprType.getTypeArguments().nonEmpty()) {
   4.133                      //static ref with class type-args
   4.134 @@ -3984,7 +3949,7 @@
   4.135          Set<Type> boundSet = new HashSet<Type>();
   4.136          if (bounds.nonEmpty()) {
   4.137              // accept class or interface or typevar as first bound.
   4.138 -            bounds.head.type = checkBase(bounds.head.type, bounds.head, env, false, false, false, false);
   4.139 +            bounds.head.type = checkBase(bounds.head.type, bounds.head, env, false, false, false);
   4.140              boundSet.add(types.erasure(bounds.head.type));
   4.141              if (bounds.head.type.isErroneous()) {
   4.142                  return bounds.head.type;
   4.143 @@ -4000,7 +3965,7 @@
   4.144                  // if first bound was a class or interface, accept only interfaces
   4.145                  // as further bounds.
   4.146                  for (JCExpression bound : bounds.tail) {
   4.147 -                    bound.type = checkBase(bound.type, bound, env, false, false, true, false);
   4.148 +                    bound.type = checkBase(bound.type, bound, env, false, true, false);
   4.149                      if (bound.type.isErroneous()) {
   4.150                          bounds = List.of(bound);
   4.151                      }
   4.152 @@ -4619,9 +4584,8 @@
   4.153                          validateAnnotatedType(t, t.type);
   4.154                      }
   4.155                      repeat = false;
   4.156 -                } else if (enclTr.getKind() == JCTree.Kind.PRIMITIVE_TYPE) {
   4.157 -                    // This happens in test TargetTypeTest52.java
   4.158 -                    // Is there anything to do?
   4.159 +                } else if (enclTr.getKind() == JCTree.Kind.PRIMITIVE_TYPE ||
   4.160 +                           enclTr.getKind() == JCTree.Kind.ERRONEOUS) {
   4.161                      repeat = false;
   4.162                  } else {
   4.163                      Assert.error("Unexpected tree: " + enclTr + " with kind: " + enclTr.getKind() +
     5.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Nov 14 09:05:25 2013 -0800
     5.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Fri Nov 15 07:15:51 2013 -0800
     5.3 @@ -707,37 +707,6 @@
     5.4          return t;
     5.5      }
     5.6  
     5.7 -    // Analog of checkClassType that calls checkClassOrArrayType instead
     5.8 -    Type checkClassOrArrayType(DiagnosticPosition pos,
     5.9 -                               Type t, boolean noBounds) {
    5.10 -        t = checkClassOrArrayType(pos, t);
    5.11 -        if (noBounds && t.isParameterized()) {
    5.12 -            List<Type> args = t.getTypeArguments();
    5.13 -            while (args.nonEmpty()) {
    5.14 -                if (args.head.hasTag(WILDCARD))
    5.15 -                    return typeTagError(pos,
    5.16 -                                        diags.fragment("type.req.exact"),
    5.17 -                                        args.head);
    5.18 -                args = args.tail;
    5.19 -            }
    5.20 -        }
    5.21 -        return t;
    5.22 -    }
    5.23 -
    5.24 -    /** Check that type is a reifiable class, interface or array type.
    5.25 -     *  @param pos           Position to be used for error reporting.
    5.26 -     *  @param t             The type to be checked.
    5.27 -     */
    5.28 -    Type checkReifiableReferenceType(DiagnosticPosition pos, Type t) {
    5.29 -        t = checkClassOrArrayType(pos, t);
    5.30 -        if (!t.isErroneous() && !types.isReifiable(t)) {
    5.31 -            log.error(pos, "illegal.generic.type.for.instof");
    5.32 -            return types.createErrorType(t);
    5.33 -        } else {
    5.34 -            return t;
    5.35 -        }
    5.36 -    }
    5.37 -
    5.38      /** Check that type is a reference type, i.e. a class, interface or array type
    5.39       *  or a type variable.
    5.40       *  @param pos           Position to be used for error reporting.
    5.41 @@ -2253,9 +2222,6 @@
    5.42              seen = seen.prepend(tv);
    5.43              for (Type b : types.getBounds(tv))
    5.44                  checkNonCyclic1(pos, b, seen);
    5.45 -        } else if (t.hasTag(ARRAY)) {
    5.46 -            final ArrayType at = (ArrayType)t.unannotatedType();
    5.47 -            checkNonCyclic1(pos, at.elemtype, seen);
    5.48          }
    5.49      }
    5.50  
     6.1 --- a/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Thu Nov 14 09:05:25 2013 -0800
     6.2 +++ b/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Fri Nov 15 07:15:51 2013 -0800
     6.3 @@ -643,15 +643,16 @@
     6.4                      }
     6.5                      JCMemberReference mref2 = new TreeCopier<Void>(make).copy(tree);
     6.6                      mref2.expr = exprTree;
     6.7 -                    Pair<Symbol, ?> lookupRes =
     6.8 -                            rs.resolveMemberReference(tree, localEnv, mref2, exprTree.type,
     6.9 -                                tree.name, argtypes.toList(), null, true, rs.arityMethodCheck, inferenceContext);
    6.10 -                    switch (lookupRes.fst.kind) {
    6.11 +                    Symbol lookupSym =
    6.12 +                            rs.resolveMemberReferenceByArity(localEnv, mref2, exprTree.type,
    6.13 +                                tree.name, argtypes.toList(), inferenceContext);
    6.14 +                    switch (lookupSym.kind) {
    6.15                          //note: as argtypes are erroneous types, type-errors must
    6.16                          //have been caused by arity mismatch
    6.17                          case Kinds.ABSENT_MTH:
    6.18                          case Kinds.WRONG_MTH:
    6.19                          case Kinds.WRONG_MTHS:
    6.20 +                        case Kinds.WRONG_STATICNESS:
    6.21                             checkContext.report(tree, diags.fragment("incompatible.arg.types.in.mref"));
    6.22                      }
    6.23                  }
    6.24 @@ -1037,11 +1038,10 @@
    6.25                      attr.memberReferenceQualifierResult(tree));
    6.26              JCMemberReference mref2 = new TreeCopier<Void>(make).copy(tree);
    6.27              mref2.expr = exprTree;
    6.28 -            Pair<Symbol, ReferenceLookupHelper> lookupRes =
    6.29 -                    rs.resolveMemberReference(tree, localEnv, mref2, exprTree.type,
    6.30 -                        tree.name, List.<Type>nil(), null, true, rs.nilMethodCheck,
    6.31 -                        infer.emptyContext);
    6.32 -            Symbol res = tree.sym = lookupRes.fst;
    6.33 +            Symbol res =
    6.34 +                    rs.getMemberReference(tree, localEnv, mref2,
    6.35 +                        exprTree.type, tree.name);
    6.36 +            tree.sym = res;
    6.37              if (res.kind >= Kinds.ERRONEOUS ||
    6.38                      res.type.hasTag(FORALL) ||
    6.39                      (res.flags() & Flags.VARARGS) != 0 ||
     7.1 --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java	Thu Nov 14 09:05:25 2013 -0800
     7.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java	Fri Nov 15 07:15:51 2013 -0800
     7.3 @@ -1378,7 +1378,11 @@
     7.4              ref = make.Ident(sym);
     7.5              args = make.Idents(md.params);
     7.6          } else {
     7.7 -            ref = make.Select(make.Ident(md.params.head), sym);
     7.8 +            Symbol msym = sym;
     7.9 +            if (sym.owner.isInterface()) {
    7.10 +                msym = msym.clone(types.supertype(accessor.owner.type).tsym);
    7.11 +            }
    7.12 +            ref = make.Select(make.Ident(md.params.head), msym);
    7.13              args = make.Idents(md.params.tail);
    7.14          }
    7.15          JCStatement stat;          // The statement accessing the private symbol.
     8.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Nov 14 09:05:25 2013 -0800
     8.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Nov 15 07:15:51 2013 -0800
     8.3 @@ -25,6 +25,7 @@
     8.4  
     8.5  package com.sun.tools.javac.comp;
     8.6  
     8.7 +import com.sun.source.tree.MemberReferenceTree.ReferenceMode;
     8.8  import com.sun.tools.javac.api.Formattable.LocalizedString;
     8.9  import com.sun.tools.javac.code.*;
    8.10  import com.sun.tools.javac.code.Symbol.*;
    8.11 @@ -110,6 +111,9 @@
    8.12              SymbolNotFoundError(ABSENT_VAR);
    8.13          methodNotFound = new
    8.14              SymbolNotFoundError(ABSENT_MTH);
    8.15 +        methodWithCorrectStaticnessNotFound = new
    8.16 +            SymbolNotFoundError(WRONG_STATICNESS,
    8.17 +                "method found has incorrect staticness");
    8.18          typeNotFound = new
    8.19              SymbolNotFoundError(ABSENT_TYP);
    8.20  
    8.21 @@ -144,6 +148,7 @@
    8.22       */
    8.23      private final SymbolNotFoundError varNotFound;
    8.24      private final SymbolNotFoundError methodNotFound;
    8.25 +    private final SymbolNotFoundError methodWithCorrectStaticnessNotFound;
    8.26      private final SymbolNotFoundError typeNotFound;
    8.27  
    8.28      public static Resolve instance(Context context) {
    8.29 @@ -868,6 +873,12 @@
    8.30          }
    8.31      };
    8.32  
    8.33 +    /**
    8.34 +     * This class handles method reference applicability checks; since during
    8.35 +     * these checks it's sometime possible to have inference variables on
    8.36 +     * the actual argument types list, the method applicability check must be
    8.37 +     * extended so that inference variables are 'opened' as needed.
    8.38 +     */
    8.39      class MethodReferenceCheck extends AbstractMethodCheck {
    8.40  
    8.41          InferenceContext pendingInferenceContext;
    8.42 @@ -2674,6 +2685,97 @@
    8.43          return resolveOperator(pos, optag, env, List.of(left, right));
    8.44      }
    8.45  
    8.46 +    Symbol getMemberReference(DiagnosticPosition pos,
    8.47 +            Env<AttrContext> env,
    8.48 +            JCMemberReference referenceTree,
    8.49 +            Type site,
    8.50 +            Name name) {
    8.51 +
    8.52 +        site = types.capture(site);
    8.53 +
    8.54 +        ReferenceLookupHelper lookupHelper = makeReferenceLookupHelper(
    8.55 +                referenceTree, site, name, List.<Type>nil(), null, VARARITY);
    8.56 +
    8.57 +        Env<AttrContext> newEnv = env.dup(env.tree, env.info.dup());
    8.58 +        Symbol sym = lookupMethod(newEnv, env.tree.pos(), site.tsym,
    8.59 +                nilMethodCheck, lookupHelper);
    8.60 +
    8.61 +        env.info.pendingResolutionPhase = newEnv.info.pendingResolutionPhase;
    8.62 +
    8.63 +        return sym;
    8.64 +    }
    8.65 +
    8.66 +    ReferenceLookupHelper makeReferenceLookupHelper(JCMemberReference referenceTree,
    8.67 +                                  Type site,
    8.68 +                                  Name name,
    8.69 +                                  List<Type> argtypes,
    8.70 +                                  List<Type> typeargtypes,
    8.71 +                                  MethodResolutionPhase maxPhase) {
    8.72 +        ReferenceLookupHelper result;
    8.73 +        if (!name.equals(names.init)) {
    8.74 +            //method reference
    8.75 +            result =
    8.76 +                    new MethodReferenceLookupHelper(referenceTree, name, site, argtypes, typeargtypes, maxPhase);
    8.77 +        } else {
    8.78 +            if (site.hasTag(ARRAY)) {
    8.79 +                //array constructor reference
    8.80 +                result =
    8.81 +                        new ArrayConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase);
    8.82 +            } else {
    8.83 +                //class constructor reference
    8.84 +                result =
    8.85 +                        new ConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase);
    8.86 +            }
    8.87 +        }
    8.88 +        return result;
    8.89 +    }
    8.90 +
    8.91 +    Symbol resolveMemberReferenceByArity(Env<AttrContext> env,
    8.92 +                                  JCMemberReference referenceTree,
    8.93 +                                  Type site,
    8.94 +                                  Name name,
    8.95 +                                  List<Type> argtypes,
    8.96 +                                  InferenceContext inferenceContext) {
    8.97 +
    8.98 +        boolean isStaticSelector = TreeInfo.isStaticSelector(referenceTree.expr, names);
    8.99 +        site = types.capture(site);
   8.100 +
   8.101 +        ReferenceLookupHelper boundLookupHelper = makeReferenceLookupHelper(
   8.102 +                referenceTree, site, name, argtypes, null, VARARITY);
   8.103 +        //step 1 - bound lookup
   8.104 +        Env<AttrContext> boundEnv = env.dup(env.tree, env.info.dup());
   8.105 +        Symbol boundSym = lookupMethod(boundEnv, env.tree.pos(), site.tsym,
   8.106 +                arityMethodCheck, boundLookupHelper);
   8.107 +        if (isStaticSelector &&
   8.108 +            !name.equals(names.init) &&
   8.109 +            !boundSym.isStatic() &&
   8.110 +            boundSym.kind < ERRONEOUS) {
   8.111 +            boundSym = methodNotFound;
   8.112 +        }
   8.113 +
   8.114 +        //step 2 - unbound lookup
   8.115 +        Symbol unboundSym = methodNotFound;
   8.116 +        ReferenceLookupHelper unboundLookupHelper = null;
   8.117 +        Env<AttrContext> unboundEnv = env.dup(env.tree, env.info.dup());
   8.118 +        if (isStaticSelector) {
   8.119 +            unboundLookupHelper = boundLookupHelper.unboundLookup(inferenceContext);
   8.120 +            unboundSym = lookupMethod(unboundEnv, env.tree.pos(), site.tsym,
   8.121 +                    arityMethodCheck, unboundLookupHelper);
   8.122 +            if (unboundSym.isStatic() &&
   8.123 +                unboundSym.kind < ERRONEOUS) {
   8.124 +                unboundSym = methodNotFound;
   8.125 +            }
   8.126 +        }
   8.127 +
   8.128 +        //merge results
   8.129 +        Symbol bestSym = choose(boundSym, unboundSym);
   8.130 +        env.info.pendingResolutionPhase = bestSym == unboundSym ?
   8.131 +                unboundEnv.info.pendingResolutionPhase :
   8.132 +                boundEnv.info.pendingResolutionPhase;
   8.133 +
   8.134 +        return bestSym;
   8.135 +    }
   8.136 +
   8.137      /**
   8.138       * Resolution of member references is typically done as a single
   8.139       * overload resolution step, where the argument types A are inferred from
   8.140 @@ -2700,47 +2802,118 @@
   8.141       * the type T might be dynamically inferred (i.e. if constructor reference
   8.142       * has a raw qualifier).
   8.143       */
   8.144 -    Pair<Symbol, ReferenceLookupHelper> resolveMemberReference(DiagnosticPosition pos,
   8.145 -                                  Env<AttrContext> env,
   8.146 +    Pair<Symbol, ReferenceLookupHelper> resolveMemberReference(Env<AttrContext> env,
   8.147                                    JCMemberReference referenceTree,
   8.148                                    Type site,
   8.149 -                                  Name name, List<Type> argtypes,
   8.150 +                                  Name name,
   8.151 +                                  List<Type> argtypes,
   8.152                                    List<Type> typeargtypes,
   8.153 -                                  boolean boxingAllowed,
   8.154                                    MethodCheck methodCheck,
   8.155 -                                  InferenceContext inferenceContext) {
   8.156 -        MethodResolutionPhase maxPhase = boxingAllowed ? VARARITY : BASIC;
   8.157 +                                  InferenceContext inferenceContext,
   8.158 +                                  AttrMode mode) {
   8.159  
   8.160          site = types.capture(site);
   8.161 -
   8.162 -        ReferenceLookupHelper boundLookupHelper;
   8.163 -        if (!name.equals(names.init)) {
   8.164 -            //method reference
   8.165 -            boundLookupHelper =
   8.166 -                    new MethodReferenceLookupHelper(referenceTree, name, site, argtypes, typeargtypes, maxPhase);
   8.167 -        } else if (site.hasTag(ARRAY)) {
   8.168 -            //array constructor reference
   8.169 -            boundLookupHelper =
   8.170 -                    new ArrayConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase);
   8.171 -        } else {
   8.172 -            //class constructor reference
   8.173 -            boundLookupHelper =
   8.174 -                    new ConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase);
   8.175 -        }
   8.176 +        ReferenceLookupHelper boundLookupHelper = makeReferenceLookupHelper(
   8.177 +                referenceTree, site, name, argtypes, typeargtypes, VARARITY);
   8.178  
   8.179          //step 1 - bound lookup
   8.180          Env<AttrContext> boundEnv = env.dup(env.tree, env.info.dup());
   8.181 -        Symbol boundSym = lookupMethod(boundEnv, env.tree.pos(), site.tsym, methodCheck, boundLookupHelper);
   8.182 +        Symbol origBoundSym;
   8.183 +        boolean staticErrorForBound = false;
   8.184 +        MethodResolutionContext boundSearchResolveContext = new MethodResolutionContext();
   8.185 +        boundSearchResolveContext.methodCheck = methodCheck;
   8.186 +        Symbol boundSym = origBoundSym = lookupMethod(boundEnv, env.tree.pos(),
   8.187 +                site.tsym, boundSearchResolveContext, boundLookupHelper);
   8.188 +        SearchResultKind boundSearchResultKind = SearchResultKind.NOT_APPLICABLE_MATCH;
   8.189 +        boolean isStaticSelector = TreeInfo.isStaticSelector(referenceTree.expr, names);
   8.190 +        boolean shouldCheckForStaticness = isStaticSelector &&
   8.191 +                referenceTree.getMode() == ReferenceMode.INVOKE;
   8.192 +        if (boundSym.kind != WRONG_MTHS && boundSym.kind != WRONG_MTH) {
   8.193 +            if (shouldCheckForStaticness) {
   8.194 +                if (!boundSym.isStatic()) {
   8.195 +                    staticErrorForBound = true;
   8.196 +                    if (hasAnotherApplicableMethod(
   8.197 +                            boundSearchResolveContext, boundSym, true)) {
   8.198 +                        boundSearchResultKind = SearchResultKind.BAD_MATCH_MORE_SPECIFIC;
   8.199 +                    } else {
   8.200 +                        boundSearchResultKind = SearchResultKind.BAD_MATCH;
   8.201 +                        if (boundSym.kind < ERRONEOUS) {
   8.202 +                            boundSym = methodWithCorrectStaticnessNotFound;
   8.203 +                        }
   8.204 +                    }
   8.205 +                } else if (boundSym.kind < ERRONEOUS) {
   8.206 +                    boundSearchResultKind = SearchResultKind.GOOD_MATCH;
   8.207 +                }
   8.208 +            }
   8.209 +        }
   8.210  
   8.211          //step 2 - unbound lookup
   8.212 -        ReferenceLookupHelper unboundLookupHelper = boundLookupHelper.unboundLookup(inferenceContext);
   8.213 +        Symbol origUnboundSym = null;
   8.214 +        Symbol unboundSym = methodNotFound;
   8.215 +        ReferenceLookupHelper unboundLookupHelper = null;
   8.216          Env<AttrContext> unboundEnv = env.dup(env.tree, env.info.dup());
   8.217 -        Symbol unboundSym = lookupMethod(unboundEnv, env.tree.pos(), site.tsym, methodCheck, unboundLookupHelper);
   8.218 +        SearchResultKind unboundSearchResultKind = SearchResultKind.NOT_APPLICABLE_MATCH;
   8.219 +        boolean staticErrorForUnbound = false;
   8.220 +        if (isStaticSelector) {
   8.221 +            unboundLookupHelper = boundLookupHelper.unboundLookup(inferenceContext);
   8.222 +            MethodResolutionContext unboundSearchResolveContext =
   8.223 +                    new MethodResolutionContext();
   8.224 +            unboundSearchResolveContext.methodCheck = methodCheck;
   8.225 +            unboundSym = origUnboundSym = lookupMethod(unboundEnv, env.tree.pos(),
   8.226 +                    site.tsym, unboundSearchResolveContext, unboundLookupHelper);
   8.227 +
   8.228 +            if (unboundSym.kind != WRONG_MTH && unboundSym.kind != WRONG_MTHS) {
   8.229 +                if (shouldCheckForStaticness) {
   8.230 +                    if (unboundSym.isStatic()) {
   8.231 +                        staticErrorForUnbound = true;
   8.232 +                        if (hasAnotherApplicableMethod(
   8.233 +                                unboundSearchResolveContext, unboundSym, false)) {
   8.234 +                            unboundSearchResultKind = SearchResultKind.BAD_MATCH_MORE_SPECIFIC;
   8.235 +                        } else {
   8.236 +                            unboundSearchResultKind = SearchResultKind.BAD_MATCH;
   8.237 +                            if (unboundSym.kind < ERRONEOUS) {
   8.238 +                                unboundSym = methodWithCorrectStaticnessNotFound;
   8.239 +                            }
   8.240 +                        }
   8.241 +                    } else if (unboundSym.kind < ERRONEOUS) {
   8.242 +                        unboundSearchResultKind = SearchResultKind.GOOD_MATCH;
   8.243 +                    }
   8.244 +                }
   8.245 +            }
   8.246 +        }
   8.247  
   8.248          //merge results
   8.249          Pair<Symbol, ReferenceLookupHelper> res;
   8.250          Symbol bestSym = choose(boundSym, unboundSym);
   8.251 -        res = new Pair<Symbol, ReferenceLookupHelper>(bestSym,
   8.252 +        if (bestSym.kind < ERRONEOUS && (staticErrorForBound || staticErrorForUnbound)) {
   8.253 +            if (staticErrorForBound) {
   8.254 +                boundSym = methodWithCorrectStaticnessNotFound;
   8.255 +            }
   8.256 +            if (staticErrorForUnbound) {
   8.257 +                unboundSym = methodWithCorrectStaticnessNotFound;
   8.258 +            }
   8.259 +            bestSym = choose(boundSym, unboundSym);
   8.260 +        }
   8.261 +        if (bestSym == methodWithCorrectStaticnessNotFound && mode == AttrMode.CHECK) {
   8.262 +            Symbol symToPrint = origBoundSym;
   8.263 +            String errorFragmentToPrint = "non-static.cant.be.ref";
   8.264 +            if (staticErrorForBound && staticErrorForUnbound) {
   8.265 +                if (unboundSearchResultKind == SearchResultKind.BAD_MATCH_MORE_SPECIFIC) {
   8.266 +                    symToPrint = origUnboundSym;
   8.267 +                    errorFragmentToPrint = "static.method.in.unbound.lookup";
   8.268 +                }
   8.269 +            } else {
   8.270 +                if (!staticErrorForBound) {
   8.271 +                    symToPrint = origUnboundSym;
   8.272 +                    errorFragmentToPrint = "static.method.in.unbound.lookup";
   8.273 +                }
   8.274 +            }
   8.275 +            log.error(referenceTree.expr.pos(), "invalid.mref",
   8.276 +                Kinds.kindName(referenceTree.getMode()),
   8.277 +                diags.fragment(errorFragmentToPrint,
   8.278 +                Kinds.kindName(symToPrint), symToPrint));
   8.279 +        }
   8.280 +        res = new Pair<>(bestSym,
   8.281                  bestSym == unboundSym ? unboundLookupHelper : boundLookupHelper);
   8.282          env.info.pendingResolutionPhase = bestSym == unboundSym ?
   8.283                  unboundEnv.info.pendingResolutionPhase :
   8.284 @@ -2748,18 +2921,42 @@
   8.285  
   8.286          return res;
   8.287      }
   8.288 +
   8.289 +    enum SearchResultKind {
   8.290 +        GOOD_MATCH,                 //type I
   8.291 +        BAD_MATCH_MORE_SPECIFIC,    //type II
   8.292 +        BAD_MATCH,                  //type III
   8.293 +        NOT_APPLICABLE_MATCH        //type IV
   8.294 +    }
   8.295 +
   8.296 +    boolean hasAnotherApplicableMethod(MethodResolutionContext resolutionContext,
   8.297 +            Symbol bestSoFar, boolean staticMth) {
   8.298 +        for (Candidate c : resolutionContext.candidates) {
   8.299 +            if (resolutionContext.step != c.step ||
   8.300 +                !c.isApplicable() ||
   8.301 +                c.sym == bestSoFar) {
   8.302 +                continue;
   8.303 +            } else {
   8.304 +                if (c.sym.isStatic() == staticMth) {
   8.305 +                    return true;
   8.306 +                }
   8.307 +            }
   8.308 +        }
   8.309 +        return false;
   8.310 +    }
   8.311 +
   8.312      //where
   8.313 -        private Symbol choose(Symbol s1, Symbol s2) {
   8.314 -            if (lookupSuccess(s1) && lookupSuccess(s2)) {
   8.315 -                return ambiguityError(s1, s2);
   8.316 -            } else if (lookupSuccess(s1) ||
   8.317 -                    (canIgnore(s2) && !canIgnore(s1))) {
   8.318 -                return s1;
   8.319 -            } else if (lookupSuccess(s2) ||
   8.320 -                    (canIgnore(s1) && !canIgnore(s2))) {
   8.321 -                return s2;
   8.322 +        private Symbol choose(Symbol boundSym, Symbol unboundSym) {
   8.323 +            if (lookupSuccess(boundSym) && lookupSuccess(unboundSym)) {
   8.324 +                return ambiguityError(boundSym, unboundSym);
   8.325 +            } else if (lookupSuccess(boundSym) ||
   8.326 +                    (canIgnore(unboundSym) && !canIgnore(boundSym))) {
   8.327 +                return boundSym;
   8.328 +            } else if (lookupSuccess(unboundSym) ||
   8.329 +                    (canIgnore(boundSym) && !canIgnore(unboundSym))) {
   8.330 +                return unboundSym;
   8.331              } else {
   8.332 -                return s1;
   8.333 +                return boundSym;
   8.334              }
   8.335          }
   8.336  
   8.337 @@ -2780,6 +2977,8 @@
   8.338                      InapplicableSymbolsError errSyms =
   8.339                              (InapplicableSymbolsError)s;
   8.340                      return errSyms.filterCandidates(errSyms.mapCandidates()).isEmpty();
   8.341 +                case WRONG_STATICNESS:
   8.342 +                    return false;
   8.343                  default:
   8.344                      return false;
   8.345              }
   8.346 @@ -2894,7 +3093,6 @@
   8.347                  List<Type> argtypes, List<Type> typeargtypes, MethodResolutionPhase maxPhase) {
   8.348              super(name, site, argtypes, typeargtypes, maxPhase);
   8.349              this.referenceTree = referenceTree;
   8.350 -
   8.351          }
   8.352  
   8.353          /**
   8.354 @@ -3324,6 +3522,11 @@
   8.355              return false;
   8.356          }
   8.357  
   8.358 +        @Override
   8.359 +        public boolean isStatic() {
   8.360 +            return false;
   8.361 +        }
   8.362 +
   8.363          /**
   8.364           * Create an external representation for this erroneous symbol to be
   8.365           * used during attribution - by default this returns the symbol of a
   8.366 @@ -3398,7 +3601,11 @@
   8.367      class SymbolNotFoundError extends ResolveError {
   8.368  
   8.369          SymbolNotFoundError(int kind) {
   8.370 -            super(kind, "symbol not found error");
   8.371 +            this(kind, "symbol not found error");
   8.372 +        }
   8.373 +
   8.374 +        SymbolNotFoundError(int kind, String debugName) {
   8.375 +            super(kind, debugName);
   8.376          }
   8.377  
   8.378          @Override
   8.379 @@ -3436,7 +3643,8 @@
   8.380                  hasLocation = !location.name.equals(names._this) &&
   8.381                          !location.name.equals(names._super);
   8.382              }
   8.383 -            boolean isConstructor = kind == ABSENT_MTH && name == names.init;
   8.384 +            boolean isConstructor = (kind == ABSENT_MTH || kind == WRONG_STATICNESS) &&
   8.385 +                    name == names.init;
   8.386              KindName kindname = isConstructor ? KindName.CONSTRUCTOR : absentKind(kind);
   8.387              Name idname = isConstructor ? site.tsym.name : name;
   8.388              String errKey = getErrorKey(kindname, typeargtypes.nonEmpty(), hasLocation);
     9.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Code.java	Thu Nov 14 09:05:25 2013 -0800
     9.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Code.java	Fri Nov 15 07:15:51 2013 -0800
     9.3 @@ -483,17 +483,8 @@
     9.4      /** Emit an invokedynamic instruction.
     9.5       */
     9.6      public void emitInvokedynamic(int desc, Type mtype) {
     9.7 -        // N.B. this format is under consideration by the JSR 292 EG
     9.8          int argsize = width(mtype.getParameterTypes());
     9.9 -        int prevPos = pendingStatPos;
    9.10 -        try {
    9.11 -            //disable line number generation (we could have used 'emit1', that
    9.12 -            //bypasses stackmap generation - which is needed for indy calls)
    9.13 -            pendingStatPos = Position.NOPOS;
    9.14 -            emitop(invokedynamic);
    9.15 -        } finally {
    9.16 -            pendingStatPos = prevPos;
    9.17 -        }
    9.18 +        emitop(invokedynamic);
    9.19          if (!alive) return;
    9.20          emit2(desc);
    9.21          emit2(0);
    9.22 @@ -1790,8 +1781,9 @@
    9.23  
    9.24          void markInitialized(UninitializedType old) {
    9.25              Type newtype = old.initializedType();
    9.26 -            for (int i=0; i<stacksize; i++)
    9.27 +            for (int i=0; i<stacksize; i++) {
    9.28                  if (stack[i] == old) stack[i] = newtype;
    9.29 +            }
    9.30              for (int i=0; i<lvar.length; i++) {
    9.31                  LocalVar lv = lvar[i];
    9.32                  if (lv != null && lv.sym.type == old) {
    9.33 @@ -2112,7 +2104,6 @@
    9.34      private void endScope(int adr) {
    9.35          LocalVar v = lvar[adr];
    9.36          if (v != null) {
    9.37 -            lvar[adr] = null;
    9.38              if (v.isLastRangeInitialized()) {
    9.39                  char length = (char)(curCP() - v.lastRange().start_pc);
    9.40                  if (length < Character.MAX_VALUE) {
    9.41 @@ -2121,6 +2112,12 @@
    9.42                      fillLocalVarPosition(v);
    9.43                  }
    9.44              }
    9.45 +            /** the call to curCP() can implicitly adjust the current cp, if so
    9.46 +             * the alive range of local variables may be modified. Thus we need
    9.47 +             * all of them. For this reason assigning null to the given address
    9.48 +             * should be the last action to do.
    9.49 +             */
    9.50 +            lvar[adr] = null;
    9.51          }
    9.52          state.defined.excl(adr);
    9.53      }
    10.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Nov 14 09:05:25 2013 -0800
    10.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Nov 15 07:15:51 2013 -0800
    10.3 @@ -575,9 +575,6 @@
    10.4  compiler.err.intf.expected.here=\
    10.5      interface expected here
    10.6  
    10.7 -compiler.err.intf.or.array.expected.here=\
    10.8 -    interface or array type expected here
    10.9 -
   10.10  compiler.err.intf.meth.cant.have.body=\
   10.11      interface abstract methods cannot have body
   10.12  
    11.1 --- a/src/share/classes/com/sun/tools/javadoc/ConstructorDocImpl.java	Thu Nov 14 09:05:25 2013 -0800
    11.2 +++ b/src/share/classes/com/sun/tools/javadoc/ConstructorDocImpl.java	Fri Nov 15 07:15:51 2013 -0800
    11.3 @@ -73,15 +73,11 @@
    11.4      /**
    11.5       * Get the name.
    11.6       *
    11.7 -     * @return the name of the member qualified by class (but not package)
    11.8 +     * @return the name of the member.
    11.9       */
   11.10      public String name() {
   11.11          ClassSymbol c = sym.enclClass();
   11.12 -        String n = c.name.toString();
   11.13 -        for (c = c.owner.enclClass(); c != null; c = c.owner.enclClass()) {
   11.14 -            n = c.name.toString() + "." + n;
   11.15 -        }
   11.16 -        return n;
   11.17 +        return c.name.toString();
   11.18      }
   11.19  
   11.20      /**
    12.1 --- a/src/share/classes/javax/lang/model/util/SimpleTypeVisitor8.java	Thu Nov 14 09:05:25 2013 -0800
    12.2 +++ b/src/share/classes/javax/lang/model/util/SimpleTypeVisitor8.java	Fri Nov 15 07:15:51 2013 -0800
    12.3 @@ -27,6 +27,7 @@
    12.4  
    12.5  import javax.annotation.processing.SupportedSourceVersion;
    12.6  import javax.lang.model.SourceVersion;
    12.7 +import javax.lang.model.type.IntersectionType;
    12.8  import static javax.lang.model.SourceVersion.*;
    12.9  
   12.10  /**
   12.11 @@ -98,4 +99,17 @@
   12.12      protected SimpleTypeVisitor8(R defaultValue){
   12.13          super(defaultValue);
   12.14      }
   12.15 +
   12.16 +    /**
   12.17 +     * This implementation visits an {@code IntersectionType} by calling
   12.18 +     * {@code defaultAction}.
   12.19 +     *
   12.20 +     * @param t {@inheritDoc}
   12.21 +     * @param p {@inheritDoc}
   12.22 +     * @return  the result of {@code defaultAction}
   12.23 +     */
   12.24 +    @Override
   12.25 +    public R visitIntersection(IntersectionType t, P p){
   12.26 +        return defaultAction(t, p);
   12.27 +    }
   12.28  }
    13.1 --- a/src/share/classes/javax/lang/model/util/TypeKindVisitor8.java	Thu Nov 14 09:05:25 2013 -0800
    13.2 +++ b/src/share/classes/javax/lang/model/util/TypeKindVisitor8.java	Fri Nov 15 07:15:51 2013 -0800
    13.3 @@ -101,4 +101,17 @@
    13.4      protected TypeKindVisitor8(R defaultValue) {
    13.5          super(defaultValue);
    13.6      }
    13.7 +
    13.8 +    /**
    13.9 +     * This implementation visits an {@code IntersectionType} by calling
   13.10 +     * {@code defaultAction}.
   13.11 +     *
   13.12 +     * @param t  {@inheritDoc}
   13.13 +     * @param p  {@inheritDoc}
   13.14 +     * @return the result of {@code defaultAction}
   13.15 +     */
   13.16 +    @Override
   13.17 +    public R visitIntersection(IntersectionType t, P p) {
   13.18 +        return defaultAction(t, p);
   13.19 +    }
   13.20  }
    14.1 --- a/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java	Thu Nov 14 09:05:25 2013 -0800
    14.2 +++ b/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java	Fri Nov 15 07:15:51 2013 -0800
    14.3 @@ -23,7 +23,7 @@
    14.4  
    14.5  /*
    14.6   * @test
    14.7 - * @bug 8025633
    14.8 + * @bug 8025633 8025524
    14.9   * @summary Test for valid name attribute in HTML anchors.
   14.10   * @author Bhavesh Patel
   14.11   * @library ../lib/
   14.12 @@ -196,10 +196,10 @@
   14.13          //Test nested class
   14.14  
   14.15          {BUG_ID + FS + "pkg1" + FS + "RegClass._NestedClas$.html",
   14.16 -            "<a name=\"RegClass._NestedClas:D--\">"
   14.17 +            "<a name=\"Z:Z_NestedClas:D--\">"
   14.18          },
   14.19          {BUG_ID + FS + "pkg1" + FS + "RegClass._NestedClas$.html",
   14.20 -            "<a href=\"../pkg1/RegClass._NestedClas$.html#RegClass._NestedClas:D--\">"
   14.21 +            "<a href=\"../pkg1/RegClass._NestedClas$.html#Z:Z_NestedClas:D--\">"
   14.22          },
   14.23  
   14.24          //Test class use page
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/test/com/sun/javadoc/testConstructors/TestConstructors.java	Fri Nov 15 07:15:51 2013 -0800
    15.3 @@ -0,0 +1,120 @@
    15.4 +/*
    15.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    15.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    15.7 + *
    15.8 + * This code is free software; you can redistribute it and/or modify it
    15.9 + * under the terms of the GNU General Public License version 2 only, as
   15.10 + * published by the Free Software Foundation.
   15.11 + *
   15.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   15.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   15.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   15.15 + * version 2 for more details (a copy is included in the LICENSE file that
   15.16 + * accompanied this code).
   15.17 + *
   15.18 + * You should have received a copy of the GNU General Public License version
   15.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   15.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   15.21 + *
   15.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   15.23 + * or visit www.oracle.com if you need additional information or have any
   15.24 + * questions.
   15.25 + */
   15.26 +
   15.27 +/*
   15.28 + * @test
   15.29 + * @bug 8025524
   15.30 + * @summary Test for constructor name which should be a non-qualified name.
   15.31 + * @author Bhavesh Patel
   15.32 + * @library ../lib/
   15.33 + * @build JavadocTester TestConstructors
   15.34 + * @run main TestConstructors
   15.35 + */
   15.36 +
   15.37 +public class TestConstructors extends JavadocTester {
   15.38 +
   15.39 +    private static final String BUG_ID = "8025524";
   15.40 +
   15.41 +    //Input for string search tests.
   15.42 +    private static final String[][] TEST = {
   15.43 +        {BUG_ID + FS + "pkg1" + FS + "Outer.html",
   15.44 +            "<a href=\"../pkg1/Outer.html#Outer--\">Outer</a></span>()"
   15.45 +        },
   15.46 +        {BUG_ID + FS + "pkg1" + FS + "Outer.html",
   15.47 +            "<a name=\"Outer--\">"
   15.48 +        },
   15.49 +        {BUG_ID + FS + "pkg1" + FS + "Outer.html",
   15.50 +            "<a href=\"../pkg1/Outer.html#Outer-int-\">Outer</a></span>(int&nbsp;i)"
   15.51 +        },
   15.52 +        {BUG_ID + FS + "pkg1" + FS + "Outer.html",
   15.53 +            "<a name=\"Outer-int-\">"
   15.54 +        },
   15.55 +        {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.html",
   15.56 +            "<a href=\"../pkg1/Outer.Inner.html#Inner--\">Inner</a></span>()"
   15.57 +        },
   15.58 +        {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.html",
   15.59 +            "<a name=\"Inner--\">"
   15.60 +        },
   15.61 +        {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.html",
   15.62 +            "<a href=\"../pkg1/Outer.Inner.html#Inner-int-\">Inner</a></span>(int&nbsp;i)"
   15.63 +        },
   15.64 +        {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.html",
   15.65 +            "<a name=\"Inner-int-\">"
   15.66 +        },
   15.67 +        {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.NestedInner.html",
   15.68 +            "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\">NestedInner</a></span>()"
   15.69 +        },
   15.70 +        {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.NestedInner.html",
   15.71 +            "<a name=\"NestedInner--\">"
   15.72 +        },
   15.73 +        {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.NestedInner.html",
   15.74 +            "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\">NestedInner</a></span>(int&nbsp;i)"
   15.75 +        },
   15.76 +        {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.NestedInner.html",
   15.77 +            "<a name=\"NestedInner-int-\">"
   15.78 +        }
   15.79 +    };
   15.80 +
   15.81 +    private static final String[][] NEGATED_TEST = {
   15.82 +        {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.html",
   15.83 +            "Outer.Inner--"
   15.84 +        },
   15.85 +        {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.html",
   15.86 +            "Outer.Inner-int-"
   15.87 +        },
   15.88 +        {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.NestedInner.html",
   15.89 +            "Outer.Inner.NestedInner--"
   15.90 +        },
   15.91 +        {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.NestedInner.html",
   15.92 +            "Outer.Inner.NestedInner-int-"
   15.93 +        }
   15.94 +    };
   15.95 +
   15.96 +    private static final String[] ARGS = new String[] {
   15.97 +        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"
   15.98 +    };
   15.99 +
  15.100 +    /**
  15.101 +     * The entry point of the test.
  15.102 +     * @param args the array of command line arguments.
  15.103 +     */
  15.104 +    public static void main(String[] args) throws Exception {
  15.105 +        TestConstructors tester = new TestConstructors();
  15.106 +        run(tester, ARGS, TEST, NEGATED_TEST);
  15.107 +        tester.printSummary();
  15.108 +    }
  15.109 +
  15.110 +    /**
  15.111 +     * {@inheritDoc}
  15.112 +     */
  15.113 +    public String getBugId() {
  15.114 +        return BUG_ID;
  15.115 +    }
  15.116 +
  15.117 +    /**
  15.118 +     * {@inheritDoc}
  15.119 +     */
  15.120 +    public String getBugName() {
  15.121 +        return getClass().getName();
  15.122 +    }
  15.123 +}
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/test/com/sun/javadoc/testConstructors/pkg1/Outer.java	Fri Nov 15 07:15:51 2013 -0800
    16.3 @@ -0,0 +1,75 @@
    16.4 +/*
    16.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    16.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.7 + *
    16.8 + * This code is free software; you can redistribute it and/or modify it
    16.9 + * under the terms of the GNU General Public License version 2 only, as
   16.10 + * published by the Free Software Foundation.
   16.11 + *
   16.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   16.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   16.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   16.15 + * version 2 for more details (a copy is included in the LICENSE file that
   16.16 + * accompanied this code).
   16.17 + *
   16.18 + * You should have received a copy of the GNU General Public License version
   16.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   16.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   16.21 + *
   16.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   16.23 + * or visit www.oracle.com if you need additional information or have any
   16.24 + * questions.
   16.25 + */
   16.26 +
   16.27 +package pkg1;
   16.28 +
   16.29 +public class Outer {
   16.30 +
   16.31 +    /**
   16.32 +     * An outer constructor.
   16.33 +     */
   16.34 +    public Outer() {
   16.35 +    }
   16.36 +
   16.37 +    /**
   16.38 +     * Another outer constructor.
   16.39 +     */
   16.40 +    public Outer(int i) {
   16.41 +    }
   16.42 +
   16.43 +    /**
   16.44 +     * A nested class.
   16.45 +     */
   16.46 +    public class Inner {
   16.47 +
   16.48 +        /**
   16.49 +         * An inner constructor.
   16.50 +         */
   16.51 +        public Inner() {
   16.52 +        }
   16.53 +
   16.54 +        /**
   16.55 +         * Another inner constructor.
   16.56 +         */
   16.57 +        public Inner(int i) {
   16.58 +        }
   16.59 +
   16.60 +        /**
   16.61 +         * A nested inner class.
   16.62 +         */
   16.63 +        public class NestedInner {
   16.64 +
   16.65 +            /**
   16.66 +             * A nested inner constructor.
   16.67 +             */
   16.68 +            public NestedInner() {
   16.69 +            }
   16.70 +
   16.71 +            /**
   16.72 +             * Another nested inner constructor.
   16.73 +             */
   16.74 +            public NestedInner(int i) {
   16.75 +            }
   16.76 +        }
   16.77 +    }
   16.78 +}
    17.1 --- a/test/tools/javac/ArraysInIntersections.java	Thu Nov 14 09:05:25 2013 -0800
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,39 +0,0 @@
    17.4 -/*
    17.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    17.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    17.7 - *
    17.8 - * This code is free software; you can redistribute it and/or modify it
    17.9 - * under the terms of the GNU General Public License version 2 only, as
   17.10 - * published by the Free Software Foundation.
   17.11 - *
   17.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   17.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   17.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   17.15 - * version 2 for more details (a copy is included in the LICENSE file that
   17.16 - * accompanied this code).
   17.17 - *
   17.18 - * You should have received a copy of the GNU General Public License version
   17.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   17.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   17.21 - *
   17.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   17.23 - * or visit www.oracle.com if you need additional information or have any
   17.24 - * questions.
   17.25 - */
   17.26 -
   17.27 -/*
   17.28 - * @test
   17.29 - * @bug 8021339
   17.30 - * @summary Allow arrays in intersection types
   17.31 - * @compile ArraysInIntersections.java
   17.32 - */
   17.33 -
   17.34 -import java.io.Serializable;
   17.35 -
   17.36 -public class ArraysInIntersections<T extends Serializable & Integer[]> {
   17.37 -
   17.38 -    public <S extends Serializable & Integer[]> Object m() {
   17.39 -        return (Serializable & Integer[]) new Integer[1];
   17.40 -    }
   17.41 -
   17.42 -}
    18.1 --- a/test/tools/javac/InferArraysInIntersections.java	Thu Nov 14 09:05:25 2013 -0800
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,38 +0,0 @@
    18.4 -/*
    18.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    18.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    18.7 - *
    18.8 - * This code is free software; you can redistribute it and/or modify it
    18.9 - * under the terms of the GNU General Public License version 2 only, as
   18.10 - * published by the Free Software Foundation.
   18.11 - *
   18.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   18.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   18.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   18.15 - * version 2 for more details (a copy is included in the LICENSE file that
   18.16 - * accompanied this code).
   18.17 - *
   18.18 - * You should have received a copy of the GNU General Public License version
   18.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   18.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   18.21 - *
   18.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   18.23 - * or visit www.oracle.com if you need additional information or have any
   18.24 - * questions.
   18.25 - */
   18.26 -
   18.27 -/*
   18.28 - * @test
   18.29 - * @bug 8021339
   18.30 - * @summary Allow arrays in intersection types
   18.31 - * @compile -doe -XDrawDiagnostics InferArraysInIntersections.java
   18.32 - */
   18.33 -import java.util.*;
   18.34 -
   18.35 -class InferArraysInIntersections {
   18.36 -   <T> T m(List<? super T> t) { return null; }
   18.37 -
   18.38 -   void test(List<char[]> lc) {
   18.39 -      Runnable r = m(lc); //inference fails here
   18.40 -   }
   18.41 -}
    19.1 --- a/test/tools/javac/T7042623.java	Thu Nov 14 09:05:25 2013 -0800
    19.2 +++ b/test/tools/javac/T7042623.java	Fri Nov 15 07:15:51 2013 -0800
    19.3 @@ -2,7 +2,6 @@
    19.4   * @test /nodynamiccopyright/
    19.5   * @bug 7042623
    19.6   * @summary Regression: javac silently crash when attributing non-existent annotation
    19.7 - * @ignore
    19.8   * @compile/fail/ref=T7042623.out -XDrawDiagnostics -XDdev T7042623.java
    19.9   */
   19.10  
    20.1 --- a/test/tools/javac/T8019486/WrongLNTForLambdaTest.java	Thu Nov 14 09:05:25 2013 -0800
    20.2 +++ b/test/tools/javac/T8019486/WrongLNTForLambdaTest.java	Fri Nov 15 07:15:51 2013 -0800
    20.3 @@ -25,7 +25,7 @@
    20.4  
    20.5  /*
    20.6   * @test
    20.7 - * @bug 8019486 8026861
    20.8 + * @bug 8019486 8026861 8027142
    20.9   * @summary javac, generates erroneous LVT for a test case with lambda code
   20.10   * @library /tools/javac/lib
   20.11   * @build ToolBox
   20.12 @@ -68,7 +68,14 @@
   20.13      /* 22 */        "        Runnable r4 = super :: notify;\n" +
   20.14      /* 23 */        "    }\n" +
   20.15      /* 24 */        "    private void foo() {}\n" +
   20.16 -    /* 25 */        "}";
   20.17 +    /* 25 */        "    void assignLambda() {\n" +
   20.18 +    /* 26 */        "        Runnable r = () -> { };\n" +
   20.19 +    /* 27 */        "    }\n" +
   20.20 +    /* 28 */        "    void callLambda(int i, Runnable r) {\n" +
   20.21 +    /* 29 */        "        callLambda(0,\n" +
   20.22 +    /* 30 */        "                   () -> { });\n" +
   20.23 +    /* 31 */        "    }\n" +
   20.24 +    /* 32 */        "}";
   20.25  
   20.26      static final int[][] simpleLambdaExpectedLNT = {
   20.27      //  {line-number, start-pc},
   20.28 @@ -102,6 +109,18 @@
   20.29          {22,           0},       //number -> number / 1
   20.30      };
   20.31  
   20.32 +    static final int[][] assignmentExpectedLNT = {
   20.33 +    //  {line-number, start-pc},
   20.34 +        {26,           0},       //number -> number / 1
   20.35 +        {27,           6},       //number -> number / 1
   20.36 +    };
   20.37 +
   20.38 +    static final int[][] callExpectedLNT = {
   20.39 +    //  {line-number, start-pc},
   20.40 +        {29,           0},       //number -> number / 1
   20.41 +        {31,           10},       //number -> number / 1
   20.42 +    };
   20.43 +
   20.44      public static void main(String[] args) throws Exception {
   20.45          new WrongLNTForLambdaTest().run();
   20.46      }
   20.47 @@ -120,6 +139,10 @@
   20.48                  "Foo.class").toUri()), "$deserializeLambda$", deserializeExpectedLNT);
   20.49          checkClassFile(new File(Paths.get(System.getProperty("user.dir"),
   20.50                  "Foo.class").toUri()), "lambda$MR$variablesInLambdas$notify$8bc4f5bd$1", lambdaBridgeExpectedLNT);
   20.51 +        checkClassFile(new File(Paths.get(System.getProperty("user.dir"),
   20.52 +                "Foo.class").toUri()), "assignLambda", assignmentExpectedLNT);
   20.53 +        checkClassFile(new File(Paths.get(System.getProperty("user.dir"),
   20.54 +                "Foo.class").toUri()), "callLambda", callExpectedLNT);
   20.55      }
   20.56  
   20.57      void compileTestClass() throws Exception {
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/test/tools/javac/T8026963/TypeAnnotationsCrashWithErroneousTreeTest.java	Fri Nov 15 07:15:51 2013 -0800
    21.3 @@ -0,0 +1,10 @@
    21.4 +/*
    21.5 + * @test /nodynamiccopyright/
    21.6 + * @bug 8026963
    21.7 + * @summary type annotations code crashes for lambdas with void argument
    21.8 + * @compile/fail/ref=TypeAnnotationsCrashWithErroneousTreeTest.out -XDrawDiagnostics -XDshouldStopPolicy=FLOW TypeAnnotationsCrashWithErroneousTreeTest.java
    21.9 + */
   21.10 +
   21.11 +public class TypeAnnotationsCrashWithErroneousTreeTest {
   21.12 +    private void t(this) {}
   21.13 +}
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/test/tools/javac/T8026963/TypeAnnotationsCrashWithErroneousTreeTest.out	Fri Nov 15 07:15:51 2013 -0800
    22.3 @@ -0,0 +1,2 @@
    22.4 +TypeAnnotationsCrashWithErroneousTreeTest.java:9:20: compiler.err.illegal.start.of.type
    22.5 +1 error
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/test/tools/javac/TryWithResources/ResDeclOutsideTry.java	Fri Nov 15 07:15:51 2013 -0800
    23.3 @@ -0,0 +1,18 @@
    23.4 +/*
    23.5 + * @test  /nodynamiccopyright/
    23.6 + * @bug 8025113
    23.7 + * @author sogoel
    23.8 + * @summary Resources cannot be declared outside t-w-r block
    23.9 + * @compile/fail/ref=ResDeclOutsideTry.out -XDrawDiagnostics ResDeclOutsideTry.java
   23.10 + */
   23.11 +
   23.12 +public class ResDeclOutsideTry implements AutoCloseable {
   23.13 +    ResDeclOutsideTry tr1;
   23.14 +    ResDeclOutsideTry tr2 = new ResDeclOutsideTry();
   23.15 +
   23.16 +    String test1() {
   23.17 +        try (tr1 = new ResDeclOutsideTry(); tr2;) {
   23.18 +        }
   23.19 +    }
   23.20 +}
   23.21 +
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/test/tools/javac/TryWithResources/ResDeclOutsideTry.out	Fri Nov 15 07:15:51 2013 -0800
    24.3 @@ -0,0 +1,3 @@
    24.4 +ResDeclOutsideTry.java:14:17: compiler.err.expected: token.identifier
    24.5 +ResDeclOutsideTry.java:14:48: compiler.err.expected: token.identifier
    24.6 +2 errors
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/test/tools/javac/TryWithResources/ResInNestedExpr.java	Fri Nov 15 07:15:51 2013 -0800
    25.3 @@ -0,0 +1,195 @@
    25.4 +/*
    25.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    25.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    25.7 + *
    25.8 + * This code is free software; you can redistribute it and/or modify it
    25.9 + * under the terms of the GNU General Public License version 2 only, as
   25.10 + * published by the Free Software Foundation.
   25.11 + *
   25.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   25.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   25.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   25.15 + * version 2 for more details (a copy is included in the LICENSE file that
   25.16 + * accompanied this code).
   25.17 + *
   25.18 + * You should have received a copy of the GNU General Public License version
   25.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   25.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   25.21 + *
   25.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   25.23 + * or visit www.oracle.com if you need additional information or have any
   25.24 + * questions.
   25.25 + */
   25.26 +
   25.27 +/*
   25.28 + * @test
   25.29 + * @bug     8025113
   25.30 + * @author  sogoel
   25.31 + * @summary Resource creation in nested expressions
   25.32 + */
   25.33 +
   25.34 +/**
   25.35 + * This test checks for resource creation in nested expressions.
   25.36 + * test1() - Create 3 resource in nested new expressions, style 1
   25.37 + * test2() - Create 3 resource in nested new expressions, style 2
   25.38 + * test3() - Create 4 resources with resources as parameters: new expression; typeid & new expression
   25.39 + */
   25.40 +
   25.41 +public class ResInNestedExpr {
   25.42 +
   25.43 +    static final int expected = 5;
   25.44 +    static int closed = 0;
   25.45 +
   25.46 +    static void closing(String clazz) {
   25.47 +        closed++;
   25.48 +    }
   25.49 +
   25.50 +    static void checkClosedCount() {
   25.51 +        if (expected != closed) {
   25.52 +            throw new RuntimeException("Did not find enough closed resources."
   25.53 +               + "Expected " + expected + ", but found " + closed);
   25.54 +        }
   25.55 +    }
   25.56 +    /**
   25.57 +     * The "expected output" is each class name gotten with getSimpleName() to unclutter things.
   25.58 +     * Each test method returns a classname of the resource and that is compared with
   25.59 +     * values in this array.
   25.60 +     */
   25.61 +    static String[] expectedOutput = {
   25.62 +        "aResource::bResource::cResource", //test1
   25.63 +        "aResource::bResource::cResource&aResource::cResource", //test3
   25.64 +        "aResource::bResource::cResource&aResource::cResource"}; //test2
   25.65 +
   25.66 +    static void compare(String s1, String s2) {
   25.67 +        if (s1.compareTo(s2) != 0) {
   25.68 +            throw new RuntimeException(s1 + "!=" + s2);
   25.69 +        }
   25.70 +    }
   25.71 +
   25.72 +    String test1() {
   25.73 +        String ret = null;
   25.74 +        try (bResource br = new bResource(new cResource());
   25.75 +                aResource ar = new aResource(br)) {
   25.76 +            ret = ar.getClass().getSimpleName() + "::" +
   25.77 +                  ar.getB().getClass().getSimpleName() + "::" +
   25.78 +                  ar.getB().getC().getClass().getSimpleName();
   25.79 +        }
   25.80 +        return ret;
   25.81 +    }
   25.82 +
   25.83 +    String test2() {
   25.84 +        String ret = null;
   25.85 +        try (aResource ar = new aResource(new bResource(new cResource()), new cResource())) {
   25.86 +            String abc = ar.getClass().getSimpleName() + "::" +
   25.87 +                         ar.getB().getClass().getSimpleName() + "::" +
   25.88 +                         ar.getB().getC().getClass().getSimpleName();
   25.89 +            String ac = ar.getClass().getSimpleName() + "::" +
   25.90 +                        ar.getC().getClass().getSimpleName();
   25.91 +            ret = abc + "&" + ac;
   25.92 +        }
   25.93 +        return ret;
   25.94 +    }
   25.95 +
   25.96 +    String test3() {
   25.97 +        String ret = null;
   25.98 +        try (bResource br = new bResource(new cResource());
   25.99 +                aResource ar = new aResource(br, new cResource())) {
  25.100 +            String abc = ar.getClass().getSimpleName() + "::" +
  25.101 +                         ar.getB().getClass().getSimpleName() + "::" +
  25.102 +                         ar.getB().getC().getClass().getSimpleName();
  25.103 +            String ac = ar.getClass().getSimpleName() + "::" +
  25.104 +                        ar.getC().getClass().getSimpleName();
  25.105 +            ret = abc + "&" + ac;
  25.106 +        }
  25.107 +        return ret;
  25.108 +    }
  25.109 +
  25.110 +    public static void main(String... args) {
  25.111 +        ResInNestedExpr t = new ResInNestedExpr();
  25.112 +        int eo = 0;
  25.113 +        compare(expectedOutput[eo++], t.test1());
  25.114 +        compare(expectedOutput[eo++], t.test3());
  25.115 +        compare(expectedOutput[eo++], t.test2());
  25.116 +        ResInNestedExpr.checkClosedCount();
  25.117 +    }
  25.118 +
  25.119 +    /**
  25.120 +     * A resource to implement AutoCloseable
  25.121 +     * Contains two other resources as data items.
  25.122 +     */
  25.123 +    static class aResource implements AutoCloseable {
  25.124 +
  25.125 +        bResource bR;
  25.126 +        cResource cR;
  25.127 +
  25.128 +        public aResource() {
  25.129 +            bR = null;
  25.130 +            cR = null;
  25.131 +        }
  25.132 +
  25.133 +        public aResource(bResource br) {
  25.134 +            bR = br;
  25.135 +        }
  25.136 +
  25.137 +        public aResource(cResource cr) {
  25.138 +            cR = cr;
  25.139 +        }
  25.140 +
  25.141 +        public aResource(bResource br, cResource cr) {
  25.142 +            bR = br;
  25.143 +            cR = cr;
  25.144 +        }
  25.145 +
  25.146 +        public bResource getB() {
  25.147 +            return bR;
  25.148 +        }
  25.149 +
  25.150 +        public cResource getC() {
  25.151 +            return cR;
  25.152 +        }
  25.153 +
  25.154 +        @Override
  25.155 +        public void close() {
  25.156 +            ResInNestedExpr.closing(this.getClass().getName());
  25.157 +        }
  25.158 +    }
  25.159 +
  25.160 +    /**
  25.161 +     * A resource to implement AutoCloseable
  25.162 +     * Contains one other resources as a data item.
  25.163 +     */
  25.164 +    static class bResource implements AutoCloseable {
  25.165 +
  25.166 +        cResource cR;
  25.167 +
  25.168 +        public bResource() {
  25.169 +            cR = null;
  25.170 +        }
  25.171 +
  25.172 +        public bResource(cResource cr) {
  25.173 +            cR = cr;
  25.174 +        }
  25.175 +
  25.176 +        public cResource getC() {
  25.177 +            return cR;
  25.178 +        }
  25.179 +
  25.180 +        @Override
  25.181 +        public void close() {
  25.182 +            ResInNestedExpr.closing(this.getClass().getName());
  25.183 +        }
  25.184 +    }
  25.185 +
  25.186 +    /** A resource to implement AutoCloseable */
  25.187 +    static class cResource implements AutoCloseable {
  25.188 +
  25.189 +        public cResource() {
  25.190 +        }
  25.191 +
  25.192 +        @Override
  25.193 +        public void close() {
  25.194 +            ResInNestedExpr.closing(this.getClass().getName());
  25.195 +        }
  25.196 +    }
  25.197 +}
  25.198 +
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/test/tools/javac/TryWithResources/ResourceNameConflict.java	Fri Nov 15 07:15:51 2013 -0800
    26.3 @@ -0,0 +1,36 @@
    26.4 +/*
    26.5 + * @test  /nodynamiccopyright/
    26.6 + * @bug 8025113
    26.7 + * @author sogoel
    26.8 + * @summary Resource var cannot have same name as local variable
    26.9 + * @compile/fail/ref=ResourceNameConflict.out -XDrawDiagnostics ResourceNameConflict.java
   26.10 + */
   26.11 +
   26.12 +/**
   26.13 + * Test methods and their description
   26.14 + * test1() - negative test - local variable used as test resource
   26.15 + * test2() - negative test - test resource already defined in an enclosing for statement
   26.16 + */
   26.17 +
   26.18 +public class ResourceNameConflict implements AutoCloseable {
   26.19 +
   26.20 +    static final String str = "asdf";
   26.21 +
   26.22 +    void test1() {
   26.23 +        String tr = "A resource spec var cannot have same name as local var.";
   26.24 +        try (ResourceNameConflict tr = new ResourceNameConflict()) {
   26.25 +        }
   26.26 +    }
   26.27 +
   26.28 +    void test2(String... strArray) {
   26.29 +        for (String str : strArray) {
   26.30 +            try (ResourceNameConflict str = new ResourceNameConflict()) {
   26.31 +            }
   26.32 +        }
   26.33 +    }
   26.34 +
   26.35 +    @Override
   26.36 +    public void close() {
   26.37 +    }
   26.38 +}
   26.39 +
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/test/tools/javac/TryWithResources/ResourceNameConflict.out	Fri Nov 15 07:15:51 2013 -0800
    27.3 @@ -0,0 +1,3 @@
    27.4 +ResourceNameConflict.java:21:35: compiler.err.already.defined: kindname.variable, tr, kindname.method, test1()
    27.5 +ResourceNameConflict.java:27:39: compiler.err.already.defined: kindname.variable, str, kindname.method, test2(java.lang.String...)
    27.6 +2 errors
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/test/tools/javac/TryWithResources/ResourceRedecl.java	Fri Nov 15 07:15:51 2013 -0800
    28.3 @@ -0,0 +1,37 @@
    28.4 +/*
    28.5 + * @test    /nodynamiccopyright/
    28.6 + * @bug     8025113
    28.7 + * @author  sogoel
    28.8 + * @summary Redeclaration of resource variables
    28.9 + * @compile/fail/ref=ResourceRedecl.out -XDrawDiagnostics ResourceRedecl.java
   28.10 + */
   28.11 +
   28.12 +import java.io.*;
   28.13 +
   28.14 +public class ResourceRedecl {
   28.15 +
   28.16 +    public void test() {
   28.17 +        // compiler error if name of an exception param is redeclared within the Block of the catch clause as a local var;
   28.18 +        // or as an exception param of a catch clause in a try statement;
   28.19 +        // or as a resource in a try-with-resources statement
   28.20 +        try {
   28.21 +        } catch (Exception exParam1) {
   28.22 +            Object exParam1 = new Object();
   28.23 +            try (java.io.FileInputStream exParam1 = new java.io.FileInputStream("foo.txt")) {
   28.24 +                Object exParam1 = new Object();
   28.25 +            } catch (IOException exParam1) {
   28.26 +            }
   28.27 +        }
   28.28 +
   28.29 +        // compiler error if resource is redeclared within the try Block as a local var
   28.30 +        // or as an exception param of a catch clause in a try statement
   28.31 +        try (java.io.FileInputStream exParam2 = new java.io.FileInputStream("bar.txt")) {
   28.32 +            Object exParam2 = new Object();
   28.33 +            try (BufferedReader br = new BufferedReader(new FileReader("zee.txt"))) {
   28.34 +            } catch (IOException exParam2) {
   28.35 +            }
   28.36 +        } catch (Exception ex) {
   28.37 +        }
   28.38 +    }
   28.39 +}
   28.40 +
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/test/tools/javac/TryWithResources/ResourceRedecl.out	Fri Nov 15 07:15:51 2013 -0800
    29.3 @@ -0,0 +1,7 @@
    29.4 +ResourceRedecl.java:19:20: compiler.err.already.defined: kindname.variable, exParam1, kindname.method, test()
    29.5 +ResourceRedecl.java:20:42: compiler.err.already.defined: kindname.variable, exParam1, kindname.method, test()
    29.6 +ResourceRedecl.java:21:24: compiler.err.already.defined: kindname.variable, exParam1, kindname.method, test()
    29.7 +ResourceRedecl.java:22:34: compiler.err.already.defined: kindname.variable, exParam1, kindname.method, test()
    29.8 +ResourceRedecl.java:29:20: compiler.err.already.defined: kindname.variable, exParam2, kindname.method, test()
    29.9 +ResourceRedecl.java:31:34: compiler.err.already.defined: kindname.variable, exParam2, kindname.method, test()
   29.10 +6 errors
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/test/tools/javac/TryWithResources/ResourceShadow.java	Fri Nov 15 07:15:51 2013 -0800
    30.3 @@ -0,0 +1,119 @@
    30.4 +/*
    30.5 + * Copyright (c) 2010, 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     8025113
   30.30 + * @author  sogoel
   30.31 + * @summary Test shadowing of resource variable
   30.32 + */
   30.33 +
   30.34 +/*
   30.35 + * "...a variable declared in a resource specification
   30.36 + * may be shadowed (6.3.1) anywhere inside a class declaration nested
   30.37 + * within the Block of the try."
   30.38 + */
   30.39 +public class ResourceShadow {
   30.40 +
   30.41 +    static final String str = "asdf";  //this is okay
   30.42 +
   30.43 +    /**
   30.44 +     * Resource variable shadows switch and case variables
   30.45 +     */
   30.46 +    String test1() {
   30.47 +        String ret = null;
   30.48 +        switch (str) {
   30.49 +            case str: //this is okay
   30.50 +                try (SilentCloseable str = new SilentCloseable()) {
   30.51 +                    SilentCloseable tr = new SilentCloseable(str);
   30.52 +                    ret = str.getClass().getSimpleName();
   30.53 +                }
   30.54 +                break;
   30.55 +            default:
   30.56 +                ret = "";
   30.57 +        }
   30.58 +        return ret;
   30.59 +    }
   30.60 +
   30.61 +    /**
   30.62 +     * Resource variable may be shadowed (6.3.1) anywhere inside a class
   30.63 +     * declaration nested within the Block of the try
   30.64 +     */
   30.65 +    String test2() {
   30.66 +        String ret = null;
   30.67 +        try (SilentCloseable str = new SilentCloseable()) {
   30.68 +            class temp {
   30.69 +
   30.70 +                String str = "I am not a SilentCloseable";
   30.71 +
   30.72 +                public void printSTR() {
   30.73 +                    System.out.println(str);
   30.74 +                }
   30.75 +
   30.76 +                public String getSTR() {
   30.77 +                    return str;
   30.78 +                }
   30.79 +            }
   30.80 +            temp tmp = new temp();
   30.81 +            SilentCloseable tr = new SilentCloseable(tmp.getSTR());
   30.82 +            ret = tr.getMsg();
   30.83 +        }
   30.84 +        return ret;
   30.85 +    }
   30.86 +
   30.87 +    public static void main(String... args) {
   30.88 +        ResourceShadow t = new ResourceShadow();
   30.89 +        if (t.test1().compareTo("SilentCloseable") != 0) {
   30.90 +            throw new RuntimeException("FAIL-test1");
   30.91 +        }
   30.92 +        if (t.test2().compareTo("I am not a SilentCloseable") != 0) {
   30.93 +            throw new RuntimeException("FAIL-test2");
   30.94 +        }
   30.95 +    }
   30.96 +}
   30.97 +
   30.98 +class SilentCloseable implements AutoCloseable {
   30.99 +
  30.100 +    SilentCloseable testres = null;
  30.101 +    String msg = "default";
  30.102 +
  30.103 +    @Override
  30.104 +    public void close() {
  30.105 +    }
  30.106 +
  30.107 +    public SilentCloseable() {
  30.108 +    }
  30.109 +
  30.110 +    public SilentCloseable(String s) {
  30.111 +        msg = s;
  30.112 +    }
  30.113 +
  30.114 +    public SilentCloseable(SilentCloseable tr) {
  30.115 +        testres = tr;
  30.116 +    }
  30.117 +
  30.118 +    public String getMsg() {
  30.119 +        return msg;
  30.120 +    }
  30.121 +}
  30.122 +
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/test/tools/javac/TryWithResources/TestTwr09.java	Fri Nov 15 07:15:51 2013 -0800
    31.3 @@ -0,0 +1,129 @@
    31.4 +/*
    31.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    31.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    31.7 + *
    31.8 + * This code is free software; you can redistribute it and/or modify it
    31.9 + * under the terms of the GNU General Public License version 2 only, as
   31.10 + * published by the Free Software Foundation.
   31.11 + *
   31.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   31.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   31.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   31.15 + * version 2 for more details (a copy is included in the LICENSE file that
   31.16 + * accompanied this code).
   31.17 + *
   31.18 + * You should have received a copy of the GNU General Public License version
   31.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   31.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   31.21 + *
   31.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   31.23 + * or visit www.oracle.com if you need additional information or have any
   31.24 + * questions.
   31.25 + */
   31.26 +
   31.27 +/*
   31.28 + * @test
   31.29 + * @bug     8025113
   31.30 + * @author  sogoel
   31.31 + * @summary t-w-r completes abruptly if the initialization of resource completes abruptly
   31.32 + */
   31.33 +
   31.34 +import java.io.FileInputStream;
   31.35 +import java.io.IOException;
   31.36 +import java.io.File;
   31.37 +
   31.38 +/*
   31.39 + * If the initialization of the resource completes abruptly because of a
   31.40 + * throw of a value V ... and the automatic ->closing of the resource completes normally,
   31.41 + * then the try-with-resources statement completes abruptly because of the throw of value V.
   31.42 + */
   31.43 +public class TestTwr09 {
   31.44 +
   31.45 +    /**
   31.46 +     * throw from ctor of nested resource
   31.47 +     * Check first resource is not open.
   31.48 +     */
   31.49 +    String test1() {
   31.50 +        String ret = null;
   31.51 +        try (ResCloseable tr = new ResCloseable(new ResCloseable("throw from inner resource ctor",3))) {
   31.52 +            ret = "FAIL";
   31.53 +        } catch (RuntimeException re) {
   31.54 +            ret = re.getMessage();
   31.55 +        }
   31.56 +        return ret;
   31.57 +    }
   31.58 +
   31.59 +    /**
   31.60 +     * throw from ctor of 2nd resource.
   31.61 +     * 1st resource, FileInputStream should be automatically closed.
   31.62 +     */
   31.63 +    String test2() {
   31.64 +        String ret = null;
   31.65 +        byte[] buf = new byte[1];
   31.66 +        try (java.io.ByteArrayInputStream tr = new java.io.ByteArrayInputStream(buf);
   31.67 +            ResCloseable str = new ResCloseable("throw from inner resource ctor",3)) {
   31.68 +            ret = "FAIL";
   31.69 +        } catch (final IOException fe) {
   31.70 +            ret = "FAIL test2";
   31.71 +        } catch (RuntimeException re) {
   31.72 +            ret = "PASS test2";
   31.73 +        }
   31.74 +        System.out.println("Ret = " + ret);
   31.75 +        return ret;
   31.76 +    }
   31.77 +
   31.78 +    public static void main(String... args) {
   31.79 +        TestTwr09 t = new TestTwr09();
   31.80 +        if (t.test1().compareTo("throw from inner resource ctor") != 0) {
   31.81 +            throw new RuntimeException("FAIL-test1");
   31.82 +        }
   31.83 +        if (t.test2().compareTo("PASS test2") != 0) {
   31.84 +            throw new RuntimeException("FAIL-test2");
   31.85 +        }
   31.86 +    }
   31.87 +}
   31.88 +
   31.89 +/** a simple resource the implements AutoCloseable so it can be used
   31.90 + * in twr's resource specification block.
   31.91 + */
   31.92 +class ResCloseable implements AutoCloseable {
   31.93 +
   31.94 +    ResCloseable testres = null;
   31.95 +    String msg = "default";
   31.96 +    boolean bOpen = false;
   31.97 +
   31.98 +    public ResCloseable() {
   31.99 +        bOpen = true;
  31.100 +    }
  31.101 +
  31.102 +    public ResCloseable(ResCloseable tr) {
  31.103 +        bOpen = true;
  31.104 +        msg = tr.getMsg();
  31.105 +    }
  31.106 +
  31.107 +    public ResCloseable(String s) {
  31.108 +        bOpen = true;
  31.109 +        msg = s;
  31.110 +    }
  31.111 +
  31.112 +    public ResCloseable(String msg, int c) {
  31.113 +        bOpen = true;
  31.114 +        if (c == 3) {
  31.115 +            throw new RuntimeException(msg);
  31.116 +        }
  31.117 +    }
  31.118 +
  31.119 +    @Override
  31.120 +    public void close() {
  31.121 +        bOpen = false;
  31.122 +    }
  31.123 +
  31.124 +    public boolean isOpen() {
  31.125 +        return bOpen;
  31.126 +    }
  31.127 +
  31.128 +    public String getMsg() {
  31.129 +        return msg;
  31.130 +    }
  31.131 +}
  31.132 +
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/test/tools/javac/annotations/testCrashNestedAnnos/TestCrashNestedAnnos.java	Fri Nov 15 07:15:51 2013 -0800
    32.3 @@ -0,0 +1,14 @@
    32.4 +/* @test /nodynamiccopyright/
    32.5 + * @bug 8027375
    32.6 + * @summary Test that javac doesn't assert/crash when there are what looks to
    32.7 + *          be annotations nested inside erroneous annotations.
    32.8 + * @compile/fail/ref=TestCrashNestedAnnos.out -XDrawDiagnostics TestCrashNestedAnnos.java
    32.9 + */
   32.10 +public class TestCrashNestedAnnos {
   32.11 +    // A and B are not annotation types
   32.12 +    @A(@A1()) int foo() {}
   32.13 +    @B(@B1()) int bar() {}
   32.14 +}
   32.15 +
   32.16 +class B {}
   32.17 +class B1 {}
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/test/tools/javac/annotations/testCrashNestedAnnos/TestCrashNestedAnnos.out	Fri Nov 15 07:15:51 2013 -0800
    33.3 @@ -0,0 +1,3 @@
    33.4 +TestCrashNestedAnnos.java:9:6: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, TestCrashNestedAnnos, null)
    33.5 +TestCrashNestedAnnos.java:10:6: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: B, java.lang.annotation.Annotation)
    33.6 +2 errors
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/test/tools/javac/defaultMethods/super/TestDirectSuperInterfaceInvoke.java	Fri Nov 15 07:15:51 2013 -0800
    34.3 @@ -0,0 +1,107 @@
    34.4 +/*
    34.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    34.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    34.7 + *
    34.8 + * This code is free software; you can redistribute it and/or modify it
    34.9 + * under the terms of the GNU General Public License version 2 only, as
   34.10 + * published by the Free Software Foundation.
   34.11 + *
   34.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   34.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   34.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   34.15 + * version 2 for more details (a copy is included in the LICENSE file that
   34.16 + * accompanied this code).
   34.17 + *
   34.18 + * You should have received a copy of the GNU General Public License version
   34.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   34.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   34.21 + *
   34.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   34.23 + * or visit www.oracle.com if you need additional information or have any
   34.24 + * questions.
   34.25 + */
   34.26 +
   34.27 +/*
   34.28 + * @test
   34.29 + * @bug 8027281
   34.30 + * @summary As per JVMS 4.9.2, invokespecial can only refer to direct superinterfaces
   34.31 + * @compile TestDirectSuperInterfaceInvoke.java
   34.32 + * @run main TestDirectSuperInterfaceInvoke
   34.33 + */
   34.34 +
   34.35 +import java.io.File;
   34.36 +import com.sun.tools.classfile.Attribute;
   34.37 +import com.sun.tools.classfile.ClassFile;
   34.38 +import com.sun.tools.classfile.Code_attribute;
   34.39 +import com.sun.tools.classfile.ConstantPool.CPRefInfo;
   34.40 +import com.sun.tools.classfile.Instruction;
   34.41 +import com.sun.tools.classfile.Method;
   34.42 +import com.sun.tools.classfile.Opcode;
   34.43 +
   34.44 +interface BaseInterface {
   34.45 +    public default int testedMethod(){ return 1; }
   34.46 +}
   34.47 +
   34.48 +interface IntermediateInterface extends BaseInterface {
   34.49 +}
   34.50 +
   34.51 +interface TestInterface extends IntermediateInterface {
   34.52 +    public default void test() {
   34.53 +        IntermediateInterface.super.testedMethod();
   34.54 +    }
   34.55 +}
   34.56 +
   34.57 +abstract class BaseClass implements BaseInterface { }
   34.58 +
   34.59 +class TestClass extends BaseClass implements BaseInterface {
   34.60 +    public int testedMethod() {return 9;}
   34.61 +    public void test() {
   34.62 +        if (super.testedMethod() != 1)
   34.63 +            throw new IllegalStateException();
   34.64 +        if (TestClass.super.testedMethod() != 1)
   34.65 +            throw new IllegalStateException();
   34.66 +        new Runnable() {
   34.67 +            public void run() {
   34.68 +                if (TestClass.super.testedMethod() != 1)
   34.69 +                    throw new IllegalStateException();
   34.70 +            }
   34.71 +        }.run();
   34.72 +    }
   34.73 +}
   34.74 +
   34.75 +public class TestDirectSuperInterfaceInvoke {
   34.76 +    public static void main(String... args) throws Exception {
   34.77 +        new TestDirectSuperInterfaceInvoke().run();
   34.78 +    }
   34.79 +
   34.80 +    public void run() throws Exception {
   34.81 +        new TestClass().test();
   34.82 +        verifyDefaultBody("TestClass.class");
   34.83 +        new TestInterface() {}.test();
   34.84 +        verifyDefaultBody("TestInterface.class");
   34.85 +    }
   34.86 +
   34.87 +    void verifyDefaultBody(String classFile) {
   34.88 +        String workDir = System.getProperty("test.classes");
   34.89 +        File file = new File(workDir, classFile);
   34.90 +        try {
   34.91 +            final ClassFile cf = ClassFile.read(file);
   34.92 +            for (Method m : cf.methods) {
   34.93 +                Code_attribute codeAttr = (Code_attribute)m.attributes.get(Attribute.Code);
   34.94 +                for (Instruction instr : codeAttr.getInstructions()) {
   34.95 +                    if (instr.getOpcode() == Opcode.INVOKESPECIAL) {
   34.96 +                        int pc_index = instr.getShort(1);
   34.97 +                        CPRefInfo ref = (CPRefInfo)cf.constant_pool.get(pc_index);
   34.98 +                        String className = ref.getClassName();
   34.99 +                        if (className.equals("BaseInterface"))
  34.100 +                            throw new IllegalStateException("Must not directly refer to TestedInterface");
  34.101 +                    }
  34.102 +                }
  34.103 +            }
  34.104 +        } catch (Exception e) {
  34.105 +            e.printStackTrace();
  34.106 +            throw new Error("error reading " + file +": " + e);
  34.107 +        }
  34.108 +    }
  34.109 +
  34.110 +}
    35.1 --- a/test/tools/javac/diags/examples/InterfaceOrArrayExpected.java	Thu Nov 14 09:05:25 2013 -0800
    35.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.3 @@ -1,28 +0,0 @@
    35.4 -/*
    35.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    35.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    35.7 - *
    35.8 - * This code is free software; you can redistribute it and/or modify it
    35.9 - * under the terms of the GNU General Public License version 2 only, as
   35.10 - * published by the Free Software Foundation.
   35.11 - *
   35.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   35.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   35.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   35.15 - * version 2 for more details (a copy is included in the LICENSE file that
   35.16 - * accompanied this code).
   35.17 - *
   35.18 - * You should have received a copy of the GNU General Public License version
   35.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   35.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   35.21 - *
   35.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   35.23 - * or visit www.oracle.com if you need additional information or have any
   35.24 - * questions.
   35.25 - */
   35.26 -
   35.27 -// key: compiler.err.intf.or.array.expected.here
   35.28 -
   35.29 -import java.util.List;
   35.30 -
   35.31 -class InterfaceExpected<T extends List & String> { }
    36.1 --- a/test/tools/javac/flow/LVTHarness.java	Thu Nov 14 09:05:25 2013 -0800
    36.2 +++ b/test/tools/javac/flow/LVTHarness.java	Fri Nov 15 07:15:51 2013 -0800
    36.3 @@ -23,8 +23,10 @@
    36.4  
    36.5  /*
    36.6   * @test
    36.7 - * @bug 7047734
    36.8 - * @summary The LVT is not generated correctly during some try/catch scenarios
    36.9 + * @bug 7047734 8027660
   36.10 + * @summary The LVT is not generated correctly during some try/catch scenarios;
   36.11 + *          javac crash while creating LVT entry for a local variable defined in
   36.12 + *          an inner block
   36.13   * @library /tools/javac/lib
   36.14   * @build JavacTestingAbstractProcessor LVTHarness
   36.15   * @run main LVTHarness
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/test/tools/javac/flow/tests/TestCaseLocalInInnerBlock.java	Fri Nov 15 07:15:51 2013 -0800
    37.3 @@ -0,0 +1,41 @@
    37.4 +/*
    37.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    37.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    37.7 + *
    37.8 + * This code is free software; you can redistribute it and/or modify it
    37.9 + * under the terms of the GNU General Public License version 2 only, as
   37.10 + * published by the Free Software Foundation.
   37.11 + *
   37.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   37.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   37.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   37.15 + * version 2 for more details (a copy is included in the LICENSE file that
   37.16 + * accompanied this code).
   37.17 + *
   37.18 + * You should have received a copy of the GNU General Public License version
   37.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   37.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   37.21 + *
   37.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   37.23 + * or visit www.oracle.com if you need additional information or have any
   37.24 + * questions.
   37.25 + */
   37.26 +
   37.27 +public class TestCaseLocalInInnerBlock {
   37.28 +
   37.29 +    @AliveRange(varName="fm", bytecodeStart=23, bytecodeLength=10)
   37.30 +    @AliveRange(varName="newWidth", bytecodeStart=2, bytecodeLength=33)
   37.31 +    @AliveRange(varName="tc", bytecodeStart=5, bytecodeLength=30)
   37.32 +    int m() {
   37.33 +        int newWidth = 0;
   37.34 +        String tc = "b";
   37.35 +        if (tc != null) {
   37.36 +            String fm;
   37.37 +            if (tc.trim() != null) {
   37.38 +            } else if ((fm = "b") != null) {
   37.39 +                newWidth += fm.length();
   37.40 +            }
   37.41 +        }
   37.42 +        return newWidth;
   37.43 +    }
   37.44 +}
    38.1 --- a/test/tools/javac/generics/typevars/6680106/T6680106.out	Thu Nov 14 09:05:25 2013 -0800
    38.2 +++ b/test/tools/javac/generics/typevars/6680106/T6680106.out	Fri Nov 15 07:15:51 2013 -0800
    38.3 @@ -1,7 +1,13 @@
    38.4 -T6680106.java:11:14: compiler.err.cyclic.inheritance: T
    38.5 -T6680106.java:12:14: compiler.err.cyclic.inheritance: T
    38.6 -T6680106.java:13:14: compiler.err.cyclic.inheritance: T
    38.7 -T6680106.java:14:14: compiler.err.cyclic.inheritance: T
    38.8 -T6680106.java:15:14: compiler.err.cyclic.inheritance: T
    38.9 -T6680106.java:16:14: compiler.err.cyclic.inheritance: T
   38.10 -6 errors
   38.11 +T6680106.java:11:25: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
   38.12 +T6680106.java:12:25: compiler.err.type.found.req: S[], (compiler.misc.type.req.class)
   38.13 +T6680106.java:12:40: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
   38.14 +T6680106.java:13:25: compiler.err.type.found.req: S[], (compiler.misc.type.req.class)
   38.15 +T6680106.java:13:40: compiler.err.type.found.req: U[], (compiler.misc.type.req.class)
   38.16 +T6680106.java:13:55: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
   38.17 +T6680106.java:14:30: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
   38.18 +T6680106.java:15:30: compiler.err.type.found.req: S[], (compiler.misc.type.req.class)
   38.19 +T6680106.java:15:50: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
   38.20 +T6680106.java:16:30: compiler.err.type.found.req: S[], (compiler.misc.type.req.class)
   38.21 +T6680106.java:16:50: compiler.err.type.found.req: U[], (compiler.misc.type.req.class)
   38.22 +T6680106.java:16:70: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
   38.23 +12 errors
    39.1 --- a/test/tools/javac/lambda/MethodReference22.java	Thu Nov 14 09:05:25 2013 -0800
    39.2 +++ b/test/tools/javac/lambda/MethodReference22.java	Fri Nov 15 07:15:51 2013 -0800
    39.3 @@ -48,19 +48,19 @@
    39.4      }
    39.5  
    39.6      static void test2() {
    39.7 -        SAM2 s1 = MethodReference22::m1; //ambiguous
    39.8 -        call2(MethodReference22::m1); //ambiguous
    39.9 -        SAM2 s2 = MethodReference22::m2; //ambiguous
   39.10 -        call2(MethodReference22::m2); //ambiguous
   39.11 -        SAM2 s3 = MethodReference22::m3; //ambiguous
   39.12 -        call2(MethodReference22::m3); //ambiguous
   39.13 -        SAM2 s4 = MethodReference22::m4; //ambiguous
   39.14 -        call2(MethodReference22::m4); //ambiguous
   39.15 +        SAM2 s1 = MethodReference22::m1; //ok
   39.16 +        call2(MethodReference22::m1); //ok
   39.17 +        SAM2 s2 = MethodReference22::m2; //ok
   39.18 +        call2(MethodReference22::m2); //ok
   39.19 +        SAM2 s3 = MethodReference22::m3; //fail
   39.20 +        call2(MethodReference22::m3); //fail
   39.21 +        SAM2 s4 = MethodReference22::m4; //fail
   39.22 +        call2(MethodReference22::m4); //fail
   39.23      }
   39.24  
   39.25      static void test3() {
   39.26 -        call3(MethodReference22::m1); //fail
   39.27 -        call3(MethodReference22::m2); //ok
   39.28 +        call3(MethodReference22::m1); //ok
   39.29 +        call3(MethodReference22::m2); //ambiguous
   39.30          call3(MethodReference22::m3); //ok
   39.31          call3(MethodReference22::m4); //fail
   39.32      }
    40.1 --- a/test/tools/javac/lambda/MethodReference22.out	Thu Nov 14 09:05:25 2013 -0800
    40.2 +++ b/test/tools/javac/lambda/MethodReference22.out	Fri Nov 15 07:15:51 2013 -0800
    40.3 @@ -1,19 +1,11 @@
    40.4  MethodReference22.java:40:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.String))
    40.5 -MethodReference22.java:41:15: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.String))
    40.6 +MethodReference22.java:41:9: compiler.err.cant.apply.symbol: kindname.method, call1, MethodReference22.SAM1, @999, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.mref))
    40.7  MethodReference22.java:46:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String))
    40.8 -MethodReference22.java:47:15: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String))
    40.9 -MethodReference22.java:51:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m1, kindname.method, m1(MethodReference22,java.lang.String), MethodReference22, kindname.method, m1(java.lang.String), MethodReference22))
   40.10 -MethodReference22.java:52:14: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1401, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m1, kindname.method, m1(MethodReference22,java.lang.String), MethodReference22, kindname.method, m1(java.lang.String), MethodReference22)))
   40.11 -MethodReference22.java:53:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m2, kindname.method, m2(MethodReference22,java.lang.String), MethodReference22, kindname.method, m2(java.lang.String), MethodReference22))
   40.12 -MethodReference22.java:54:14: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1504, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m2, kindname.method, m2(MethodReference22,java.lang.String), MethodReference22, kindname.method, m2(java.lang.String), MethodReference22)))
   40.13 -MethodReference22.java:55:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m3, kindname.method, m3(MethodReference22,java.lang.String), MethodReference22, kindname.method, m3(java.lang.String), MethodReference22))
   40.14 -MethodReference22.java:56:14: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1607, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m3, kindname.method, m3(MethodReference22,java.lang.String), MethodReference22, kindname.method, m3(java.lang.String), MethodReference22)))
   40.15 +MethodReference22.java:47:9: compiler.err.cant.apply.symbol: kindname.method, call1, MethodReference22.SAM1, @1270, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.mref))
   40.16 +MethodReference22.java:55:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m3(MethodReference22,java.lang.String))
   40.17 +MethodReference22.java:56:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1574, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.mref))
   40.18  MethodReference22.java:57:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22))
   40.19 -MethodReference22.java:58:14: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1710, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22)))
   40.20 -MethodReference22.java:62:9: compiler.err.ref.ambiguous: call3, kindname.method, call3(MethodReference22.SAM1), MethodReference22, kindname.method, call3(MethodReference22.SAM2), MethodReference22
   40.21 -MethodReference22.java:62:15: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.String))
   40.22 +MethodReference22.java:58:14: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1667, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22)))
   40.23  MethodReference22.java:63:9: compiler.err.ref.ambiguous: call3, kindname.method, call3(MethodReference22.SAM1), MethodReference22, kindname.method, call3(MethodReference22.SAM2), MethodReference22
   40.24 -MethodReference22.java:64:9: compiler.err.ref.ambiguous: call3, kindname.method, call3(MethodReference22.SAM1), MethodReference22, kindname.method, call3(MethodReference22.SAM2), MethodReference22
   40.25 -MethodReference22.java:65:9: compiler.err.ref.ambiguous: call3, kindname.method, call3(MethodReference22.SAM1), MethodReference22, kindname.method, call3(MethodReference22.SAM2), MethodReference22
   40.26 -MethodReference22.java:65:15: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String))
   40.27 -18 errors
   40.28 +MethodReference22.java:65:14: compiler.err.cant.apply.symbol: kindname.method, call3, MethodReference22.SAM2, @1881, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22)))
   40.29 +10 errors
    41.1 --- a/test/tools/javac/lambda/MethodReference51.java	Thu Nov 14 09:05:25 2013 -0800
    41.2 +++ b/test/tools/javac/lambda/MethodReference51.java	Fri Nov 15 07:15:51 2013 -0800
    41.3 @@ -36,11 +36,11 @@
    41.4  
    41.5  
    41.6      static void test() {
    41.7 -        IntSam s1 = MethodReference51::unknown; //method not found
    41.8 -        IntSam s2 = MethodReference51::f; //inapplicable method
    41.9 -        IntSam s3 = MethodReference51::g; //inapplicable methods
   41.10 -        IntegerIntegerSam s4 = MethodReference51::g; //ambiguous
   41.11 -        IntSam s5 = MethodReference51::h; //static error
   41.12 -        IntSam s6 = MethodReference51.foo::j; //inaccessible method
   41.13 +        IntSam s1 = MethodReference51::unknown; //fail
   41.14 +        IntSam s2 = MethodReference51::f; //fail
   41.15 +        IntSam s3 = MethodReference51::g; //fail
   41.16 +        IntegerIntegerSam s4 = MethodReference51::g; //fail
   41.17 +        IntSam s5 = MethodReference51::h; //fail
   41.18 +        IntSam s6 = MethodReference51.foo::j; //fail
   41.19      }
   41.20  }
    42.1 --- a/test/tools/javac/lambda/MethodReference68.out	Thu Nov 14 09:05:25 2013 -0800
    42.2 +++ b/test/tools/javac/lambda/MethodReference68.out	Fri Nov 15 07:15:51 2013 -0800
    42.3 @@ -1,2 +1,3 @@
    42.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)
    42.5 -1 error
    42.6 +MethodReference68.java:21:12: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, getName())
    42.7 +2 errors
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/test/tools/javac/lambda/MethodReference73.java	Fri Nov 15 07:15:51 2013 -0800
    43.3 @@ -0,0 +1,110 @@
    43.4 +/*
    43.5 + * @test /nodynamiccopyright/
    43.6 + * @bug 8026231
    43.7 + * @summary Look at 'static' flag when checking method references
    43.8 + * @compile/fail/ref=MethodReference73.out -XDrawDiagnostics MethodReference73.java
    43.9 + */
   43.10 +
   43.11 +public class MethodReference73 {
   43.12 +
   43.13 +    interface SAM {
   43.14 +        void m(MethodReference73 rec, String x);
   43.15 +    }
   43.16 +
   43.17 +    void m1(MethodReference73 rec, String x) {}
   43.18 +    static void m1(MethodReference73 rec, Object x) {}
   43.19 +    void m1(String x) {}
   43.20 +
   43.21 +    static void m2(MethodReference73 rec, String x) {}
   43.22 +    void m2(Object x) {}
   43.23 +    static void m2(String x) {}
   43.24 +
   43.25 +    static void m3(MethodReference73 rec, String x) {}
   43.26 +    void m3(String x) {}
   43.27 +
   43.28 +    void m4(MethodReference73 rec, String x) {}
   43.29 +    static void m4(MethodReference73 rec, Object x) {}
   43.30 +    static void m4(String x) {}
   43.31 +    void m4(Object x) {}
   43.32 +
   43.33 +    static void m5(MethodReference73 rec, String x) {}
   43.34 +    static void m5(String x) {}
   43.35 +
   43.36 +    static void m6(MethodReference73 rec, String x) {}
   43.37 +    void m6(String x, int i) {}
   43.38 +
   43.39 +    void m7(MethodReference73 rec, String x) {}
   43.40 +    void m7(String x) {}
   43.41 +
   43.42 +    static void m8(MethodReference73 rec, String x, int i) {}
   43.43 +    void m8(String x) {}
   43.44 +
   43.45 +    void m9(MethodReference73 rec, String x) {}
   43.46 +    static void m9(MethodReference73 rec, Object x) {}
   43.47 +    static void m9(String x) {}
   43.48 +
   43.49 +    void m10(MethodReference73 rec, String x) {}
   43.50 +    static void m10(MethodReference73 rec, Object x) {}
   43.51 +    void m10(String x, int i) {}
   43.52 +
   43.53 +    void m11(MethodReference73 rec, String x) {}
   43.54 +    void m11(Object x) {}
   43.55 +    static void m11(String x) {}
   43.56 +
   43.57 +    static void m12(MethodReference73 rec, String x, int i) {}
   43.58 +    void m12(Object x) {}
   43.59 +    static void m12(String x) {}
   43.60 +
   43.61 +    void m13(MethodReference73 rec, String x) {}
   43.62 +    void m13(String x, int i) {}
   43.63 +
   43.64 +    static void m14(MethodReference73 rec, String x, int i) {}
   43.65 +    static void m14(String x) {}
   43.66 +
   43.67 +    void m15(MethodReference73 rec, String x) {}
   43.68 +    static void m15(String x) {}
   43.69 +
   43.70 +    static void m16(MethodReference73 rec, String x, int i) {}
   43.71 +    void m16(String x, int i) {}
   43.72 +
   43.73 +    /** For method references with a type selector two searches are performed.
   43.74 +     *  Each of them may yield one of the following results:
   43.75 +     *      I)   a good match
   43.76 +     *      II)  a bad match more specific than a good match
   43.77 +     *      III) a bad match with no good matches
   43.78 +     *      IV)  no applicable method found
   43.79 +     *
   43.80 +     *  Whether a match is considered to be good or not depends on the staticness
   43.81 +     *  of the matched method. The expected result of the first search is a static
   43.82 +     *  method. The expected result of the second search is an instance method.
   43.83 +     *
   43.84 +     *  If the most specific method has the wrong staticness but there is an
   43.85 +     *  applicable method with the right staticness then we have the (II) case.
   43.86 +     *  The (III) case is reserved for those cases when the most specific method
   43.87 +     *  has the wrong staticness but there is no applicable method with the right
   43.88 +     *  staticness.
   43.89 +     */
   43.90 +
   43.91 +    static void test() {
   43.92 +        SAM s1 = MethodReference73::m1;           //(II, I)       ambiguous
   43.93 +        SAM s2 = MethodReference73::m2;           //(I, II)       ambiguous
   43.94 +        SAM s3 = MethodReference73::m3;           //(I, I)        ambiguous
   43.95 +        SAM s4 = MethodReference73::m4;           //(II, II)      ambiguous
   43.96 +
   43.97 +        SAM s5 = MethodReference73::m5;           //(I, III)      first search's result gets selected
   43.98 +        SAM s6 = MethodReference73::m6;           //(I, IV)       first search's result gets selected
   43.99 +
  43.100 +        SAM s7 = MethodReference73::m7;           //(III, I)      second search's result gets selected
  43.101 +        SAM s8 = MethodReference73::m8;           //(IV, I)       second search's result gets selected
  43.102 +
  43.103 +        SAM s9 = MethodReference73::m9;           //(II, III)     method matched by first search has the wrong staticness
  43.104 +        SAM s10 = MethodReference73::m10;         //(II, IV)      method matched by first search has the wrong staticness
  43.105 +        SAM s11 = MethodReference73::m11;         //(III, II)     method matched by second search has the wrong staticness
  43.106 +        SAM s12 = MethodReference73::m12;         //(IV, II)      method matched by second search has the wrong staticness
  43.107 +        SAM s13 = MethodReference73::m13;         //(III, IV)     method matched by first search has the wrong staticness
  43.108 +        SAM s14 = MethodReference73::m14;         //(IV, III)     method matched by second search has the wrong staticness
  43.109 +        SAM s15 = MethodReference73::m15;         //(III, III)    method matched by first search has the wrong staticness
  43.110 +
  43.111 +        SAM s16 = MethodReference73::m16;         //(IV, IV)      incompatible types, invalid method reference
  43.112 +    }
  43.113 +}
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/test/tools/javac/lambda/MethodReference73.out	Fri Nov 15 07:15:51 2013 -0800
    44.3 @@ -0,0 +1,13 @@
    44.4 +MethodReference73.java:89:18: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m1, kindname.method, m1(MethodReference73,java.lang.String), MethodReference73, kindname.method, m1(java.lang.String), MethodReference73))
    44.5 +MethodReference73.java:90:18: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m2, kindname.method, m2(MethodReference73,java.lang.String), MethodReference73, kindname.method, m2(java.lang.String), MethodReference73))
    44.6 +MethodReference73.java:91:18: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m3, kindname.method, m3(MethodReference73,java.lang.String), MethodReference73, kindname.method, m3(java.lang.String), MethodReference73))
    44.7 +MethodReference73.java:92:18: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference73,java.lang.String), MethodReference73, kindname.method, m4(java.lang.String), MethodReference73))
    44.8 +MethodReference73.java:100:18: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m9(MethodReference73,java.lang.String))
    44.9 +MethodReference73.java:101:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m10(MethodReference73,java.lang.String))
   44.10 +MethodReference73.java:102:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.method.in.unbound.lookup: kindname.method, m11(java.lang.String))
   44.11 +MethodReference73.java:103:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.method.in.unbound.lookup: kindname.method, m12(java.lang.String))
   44.12 +MethodReference73.java:104:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m13(MethodReference73,java.lang.String))
   44.13 +MethodReference73.java:105:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.method.in.unbound.lookup: kindname.method, m14(java.lang.String))
   44.14 +MethodReference73.java:106:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m15(MethodReference73,java.lang.String))
   44.15 +MethodReference73.java:108:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbols: kindname.method, m16, MethodReference73,java.lang.String,{(compiler.misc.inapplicable.method: kindname.method, MethodReference73, m16(MethodReference73,java.lang.String,int), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, MethodReference73, m16(java.lang.String,int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: MethodReference73, java.lang.String)))}))
   44.16 +12 errors
    45.1 --- a/test/tools/javac/lambda/TargetType60.java	Thu Nov 14 09:05:25 2013 -0800
    45.2 +++ b/test/tools/javac/lambda/TargetType60.java	Fri Nov 15 07:15:51 2013 -0800
    45.3 @@ -57,7 +57,7 @@
    45.4  
    45.5      static void testUnbound() {
    45.6          TargetType60 s1 = u(TargetType60::n0); //ok - resolves to u(Sam1)
    45.7 -        TargetType60 s2 = u(TargetType60::n1); //ambiguous (u(Sam1), u(Sam2) apply)
    45.8 +        TargetType60 s2 = u(TargetType60::n1); //ok - resolves to u(Sam2)
    45.9          TargetType60 s3 = u(TargetType60::n2); //none is applicable
   45.10          TargetType60 s4 = u(TargetType60::n01);//ambiguous (u(Sam1), u(Sam2) apply)
   45.11          TargetType60 s5 = u(TargetType60::n012);//ambiguous (u(Sam1), u(Sam2) apply)
    46.1 --- a/test/tools/javac/lambda/TargetType60.out	Thu Nov 14 09:05:25 2013 -0800
    46.2 +++ b/test/tools/javac/lambda/TargetType60.out	Fri Nov 15 07:15:51 2013 -0800
    46.3 @@ -1,8 +1,6 @@
    46.4  TargetType60.java:54:21: compiler.err.ref.ambiguous: g, kindname.method, g(TargetType60.Sam0), TargetType60, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60
    46.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
    46.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
    46.7 -TargetType60.java:60:29: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, n1(java.lang.String))
    46.8 -TargetType60.java:61:29: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, n2(TargetType60,java.lang.String))
    46.9 +TargetType60.java:61:27: compiler.err.cant.apply.symbols: kindname.method, u, @1639,{(compiler.misc.inapplicable.method: kindname.method, TargetType60, <U>u(TargetType60.Sam1<U>), (compiler.misc.infer.no.conforming.assignment.exists: U, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, n2, TargetType60,java.lang.String, U, kindname.class, TargetType60, (compiler.misc.arg.length.mismatch))))),(compiler.misc.inapplicable.method: kindname.method, TargetType60, <U>u(TargetType60.Sam2<U,java.lang.String>), (compiler.misc.infer.no.conforming.assignment.exists: U, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.resolve.location.args: kindname.method, n2, , U,java.lang.String, (compiler.misc.location: kindname.class, TargetType60, null)))))}
   46.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
   46.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
   46.12 -7 errors
   46.13 +5 errors
    47.1 --- a/test/tools/javac/lambda/TestInvokeDynamic.java	Thu Nov 14 09:05:25 2013 -0800
    47.2 +++ b/test/tools/javac/lambda/TestInvokeDynamic.java	Fri Nov 15 07:15:51 2013 -0800
    47.3 @@ -356,7 +356,7 @@
    47.4              if (lnt == null) {
    47.5                  throw new Error("No LineNumberTable attribute");
    47.6              }
    47.7 -            if (lnt.line_number_table_length != 2) {
    47.8 +            if (lnt.line_number_table_length != 3) {
    47.9                  throw new Error("Wrong number of entries in LineNumberTable");
   47.10              }
   47.11          } catch (Exception e) {
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/test/tools/javac/processing/errors/CrashOnNonExistingAnnotation/Processor.java	Fri Nov 15 07:15:51 2013 -0800
    48.3 @@ -0,0 +1,208 @@
    48.4 +/*
    48.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    48.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    48.7 + *
    48.8 + * This code is free software; you can redistribute it and/or modify it
    48.9 + * under the terms of the GNU General Public License version 2 only, as
   48.10 + * published by the Free Software Foundation.
   48.11 + *
   48.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   48.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   48.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   48.15 + * version 2 for more details (a copy is included in the LICENSE file that
   48.16 + * accompanied this code).
   48.17 + *
   48.18 + * You should have received a copy of the GNU General Public License version
   48.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   48.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   48.21 + *
   48.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   48.23 + * or visit www.oracle.com if you need additional information or have any
   48.24 + * questions.
   48.25 + */
   48.26 +
   48.27 +import java.io.File;
   48.28 +import java.io.IOException;
   48.29 +import java.io.Writer;
   48.30 +import java.net.URI;
   48.31 +import java.net.URISyntaxException;
   48.32 +import java.util.Arrays;
   48.33 +import java.util.Comparator;
   48.34 +import java.util.Map;
   48.35 +import java.util.Map.Entry;
   48.36 +import java.util.Set;
   48.37 +import java.util.TreeMap;
   48.38 +import javax.annotation.processing.AbstractProcessor;
   48.39 +import javax.annotation.processing.RoundEnvironment;
   48.40 +import javax.annotation.processing.SupportedAnnotationTypes;
   48.41 +import javax.annotation.processing.SupportedOptions;
   48.42 +import javax.lang.model.element.TypeElement;
   48.43 +import javax.tools.Diagnostic;
   48.44 +import javax.tools.DiagnosticCollector;
   48.45 +import javax.tools.DiagnosticListener;
   48.46 +import javax.tools.FileObject;
   48.47 +import javax.tools.ForwardingJavaFileManager;
   48.48 +import javax.tools.JavaFileManager;
   48.49 +import javax.tools.JavaFileObject;
   48.50 +import javax.tools.JavaFileObject.Kind;
   48.51 +import javax.tools.SimpleJavaFileObject;
   48.52 +import com.sun.source.tree.AnnotationTree;
   48.53 +import com.sun.source.tree.CompilationUnitTree;
   48.54 +import com.sun.source.tree.LiteralTree;
   48.55 +import com.sun.source.util.JavacTask;
   48.56 +import com.sun.source.util.TreeScanner;
   48.57 +import com.sun.source.util.Trees;
   48.58 +import com.sun.tools.javac.api.JavacTool;
   48.59 +import com.sun.tools.javac.file.JavacFileManager;
   48.60 +import com.sun.tools.javac.util.Assert;
   48.61 +
   48.62 +@SupportedAnnotationTypes("*")
   48.63 +@SupportedOptions("target")
   48.64 +public class Processor extends AbstractProcessor {
   48.65 +
   48.66 +    private int round = 0;
   48.67 +    @Override
   48.68 +    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
   48.69 +        if (round++ == 0) {
   48.70 +            try (Writer out = processingEnv.getFiler()
   48.71 +                                                 .createSourceFile("Anno.java")
   48.72 +                                                 .openWriter()) {
   48.73 +                String target = processingEnv.getOptions().get("target");
   48.74 +                String code = "import java.lang.annotation.ElementType;\n" +
   48.75 +                              "import java.lang.annotation.Target;\n" +
   48.76 +                              "@Target(ElementType." + target + ")\n" +
   48.77 +                              "@interface Anno { public String value(); }\n";
   48.78 +                out.write(code);
   48.79 +            } catch (IOException exc) {
   48.80 +                throw new IllegalStateException(exc);
   48.81 +            }
   48.82 +        }
   48.83 +        return true;
   48.84 +    }
   48.85 +
   48.86 +    public static void main(String... args) throws IOException, URISyntaxException {
   48.87 +        if (args.length != 1) throw new IllegalStateException("Must provide class name!");
   48.88 +        String testContent = null;
   48.89 +        File testSrc = new File(System.getProperty("test.src"));
   48.90 +        File testFile = new File(testSrc, args[0]);
   48.91 +        if (!testFile.canRead()) throw new IllegalStateException("Cannot read the test source");
   48.92 +        JavacTool compiler = JavacTool.create();
   48.93 +        JavacFileManager fm = compiler.getStandardFileManager(null, null, null);
   48.94 +        testContent = fm.getRegularFile(testFile).getCharContent(true).toString();
   48.95 +        JavaFileObject testFileObject = new TestFO(new URI("mem://" + args[0]), testContent);
   48.96 +        TestFM testFileManager = new TestFM(fm);
   48.97 +        JavacTask task = compiler.getTask(null,
   48.98 +                                          testFileManager,
   48.99 +                                          new DiagnosticCollector<JavaFileObject>(),
  48.100 +                                          null,
  48.101 +                                          null,
  48.102 +                                          Arrays.asList(testFileObject));
  48.103 +        final Trees trees = Trees.instance(task);
  48.104 +        final CompilationUnitTree cut = task.parse().iterator().next();
  48.105 +
  48.106 +        final Map<int[], String> annotation2Target = new TreeMap<>(new Comparator<int[]>() {
  48.107 +            @Override public int compare(int[] o1, int[] o2) {
  48.108 +                return o2[0] - o1[0];
  48.109 +            }
  48.110 +        });
  48.111 +
  48.112 +        new TreeScanner<Void, Void>() {
  48.113 +            @Override
  48.114 +            public Void visitAnnotation(AnnotationTree node, Void p) {
  48.115 +                int endPos = (int) trees.getSourcePositions().getEndPosition(cut, node);
  48.116 +
  48.117 +                Assert.check(endPos >= 0);
  48.118 +
  48.119 +                int startPos = (int) trees.getSourcePositions().getStartPosition(cut, node);
  48.120 +                String target = ((LiteralTree) node.getArguments().get(0)).getValue().toString();
  48.121 +
  48.122 +                annotation2Target.put(new int[] {startPos, endPos}, target);
  48.123 +
  48.124 +                return super.visitAnnotation(node, p);
  48.125 +            }
  48.126 +        }.scan(cut.getTypeDecls().get(0), null);
  48.127 +
  48.128 +        DiagnosticListener<JavaFileObject> noErrors = new DiagnosticListener<JavaFileObject>() {
  48.129 +            @Override public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
  48.130 +                if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
  48.131 +                    throw new IllegalStateException(diagnostic.toString());
  48.132 +                }
  48.133 +            }
  48.134 +        };
  48.135 +
  48.136 +        for (Entry<int[], String> e : annotation2Target.entrySet()) {
  48.137 +            StringBuilder updatedContent = new StringBuilder();
  48.138 +            int last = testContent.length();
  48.139 +
  48.140 +            for (int[] toRemove : annotation2Target.keySet()) {
  48.141 +                if (toRemove == e.getKey()) continue;
  48.142 +                updatedContent.insert(0, testContent.substring(toRemove[1], last));
  48.143 +                last = toRemove[0];
  48.144 +            }
  48.145 +
  48.146 +            updatedContent.insert(0, testContent.substring(0, last));
  48.147 +
  48.148 +            JavaFileObject updatedFile = new TestFO(new URI("mem://" + args[0]),
  48.149 +                                                    updatedContent.toString());
  48.150 +            JavacTask testTask = compiler.getTask(null,
  48.151 +                                                  testFileManager,
  48.152 +                                                  noErrors,
  48.153 +                                                  Arrays.asList("-processor", "Processor",
  48.154 +                                                                "-Atarget=" + e.getValue()),
  48.155 +                                                  null,
  48.156 +                                                  Arrays.asList(updatedFile));
  48.157 +
  48.158 +            try {
  48.159 +                testTask.analyze();
  48.160 +            } catch (Throwable exc) {
  48.161 +                System.out.println("error while processing:");
  48.162 +                System.out.println(updatedContent);
  48.163 +                throw exc;
  48.164 +            }
  48.165 +
  48.166 +            JavacTask testTask2 = compiler.getTask(null,
  48.167 +                                                   testFileManager,
  48.168 +                                                   new DiagnosticCollector<JavaFileObject>(),
  48.169 +                                                   null,
  48.170 +                                                   null,
  48.171 +                                                   Arrays.asList(updatedFile));
  48.172 +
  48.173 +            try {
  48.174 +                testTask2.analyze();
  48.175 +            } catch (Throwable exc) {
  48.176 +                System.out.println("error while processing:");
  48.177 +                System.out.println(updatedContent);
  48.178 +                throw exc;
  48.179 +            }
  48.180 +        }
  48.181 +    }
  48.182 +
  48.183 +    private static final class TestFO extends SimpleJavaFileObject {
  48.184 +        private final String content;
  48.185 +        public TestFO(URI uri, String content) {
  48.186 +            super(uri, Kind.SOURCE);
  48.187 +            this.content = content;
  48.188 +        }
  48.189 +
  48.190 +        @Override public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
  48.191 +            return content;
  48.192 +        }
  48.193 +
  48.194 +        @Override public boolean isNameCompatible(String simpleName, Kind kind) {
  48.195 +            return true;
  48.196 +        }
  48.197 +    }
  48.198 +
  48.199 +    private static final class TestFM extends ForwardingJavaFileManager<JavaFileManager> {
  48.200 +
  48.201 +        public TestFM(JavaFileManager fileManager) {
  48.202 +            super(fileManager);
  48.203 +        }
  48.204 +
  48.205 +        @Override
  48.206 +        public boolean isSameFile(FileObject a, FileObject b) {
  48.207 +            return a.equals(b);
  48.208 +        }
  48.209 +
  48.210 +    }
  48.211 +}
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/test/tools/javac/processing/errors/CrashOnNonExistingAnnotation/Source.java	Fri Nov 15 07:15:51 2013 -0800
    49.3 @@ -0,0 +1,74 @@
    49.4 +/*
    49.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    49.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    49.7 + *
    49.8 + * This code is free software; you can redistribute it and/or modify it
    49.9 + * under the terms of the GNU General Public License version 2 only, as
   49.10 + * published by the Free Software Foundation.
   49.11 + *
   49.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   49.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   49.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   49.15 + * version 2 for more details (a copy is included in the LICENSE file that
   49.16 + * accompanied this code).
   49.17 + *
   49.18 + * You should have received a copy of the GNU General Public License version
   49.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   49.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   49.21 + *
   49.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   49.23 + * or visit www.oracle.com if you need additional information or have any
   49.24 + * questions.
   49.25 + */
   49.26 +
   49.27 +/*
   49.28 + * @test /nodynamiccopyright/
   49.29 + * @bug 8027310
   49.30 + * @summary Ensure no exceptions on unresolvable annotations
   49.31 + * @build Processor
   49.32 + * @run main Processor Source.java
   49.33 + */
   49.34 +
   49.35 +import java.util.List;
   49.36 +
   49.37 +@Anno("TYPE")
   49.38 +public class Source {
   49.39 +    @Anno("TYPE")
   49.40 +    class Inner {
   49.41 +        class InnerInner {
   49.42 +            public @Anno("CONSTRUCTOR") InnerInner(@Anno("TYPE_USE") Source. @Anno("TYPE_USE") Inner Inner.this,
   49.43 +                                                   @Anno("PARAMETER") java.lang. @Anno("TYPE_USE") Runnable p) {
   49.44 +                Runnable r = () -> {
   49.45 +                    @Anno("TYPE_USE") Object tested = null;
   49.46 +                    @Anno("TYPE_USE") boolean isAnnotated = tested instanceof @Anno("TYPE_USE") String;
   49.47 +                };
   49.48 +
   49.49 +                @Anno("TYPE_USE") Object tested = (@Anno("TYPE_USE") String @Anno("TYPE_USE") []) null;
   49.50 +                @Anno("TYPE_USE") boolean isAnnotated = tested instanceof@Anno("TYPE_USE") String;
   49.51 +
   49.52 +                tested = new java.lang. @Anno("TYPE_USE") Object();
   49.53 +                tested = new @Anno("TYPE_USE") Object();
   49.54 +            }
   49.55 +        }
   49.56 +    }
   49.57 +
   49.58 +    {
   49.59 +        Runnable r = () -> {
   49.60 +            @Anno("TYPE_USE") Object tested = null;
   49.61 +            @Anno("TYPE_USE") boolean isAnnotated = tested instanceof @Anno("TYPE_USE") String;
   49.62 +        };
   49.63 +
   49.64 +        @Anno("TYPE_USE") Object tested = (@Anno("TYPE_USE") String @Anno("TYPE_USE") []) null;
   49.65 +        @Anno("TYPE_USE") boolean isAnnotated = tested instanceof@Anno("TYPE_USE") String;
   49.66 +
   49.67 +        tested = new java.lang. @Anno("TYPE_USE") Object();
   49.68 +        tested = new @Anno("TYPE_USE") Object();
   49.69 +    }
   49.70 +
   49.71 +    @Anno("TYPE")
   49.72 +    @Anno("ANNOTATION_TYPE")
   49.73 +    @interface A { }
   49.74 +    abstract class Parameterized<@Anno("TYPE_PARAMETER") T extends @Anno("TYPE_USE") CharSequence &
   49.75 +                                                                   @Anno("TYPE_USE") Runnable>
   49.76 +        implements @Anno("TYPE_USE") List<@Anno("TYPE_USE") Runnable> { }
   49.77 +}
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/test/tools/javac/processing/model/util/TestIntersectionTypeVisitors.java	Fri Nov 15 07:15:51 2013 -0800
    50.3 @@ -0,0 +1,122 @@
    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     8027730
   50.30 + * @summary Test visitor support for intersection types
   50.31 + */
   50.32 +
   50.33 +import java.lang.annotation.Annotation;
   50.34 +import java.util.List;
   50.35 +import javax.lang.model.element.*;
   50.36 +import javax.lang.model.type.*;
   50.37 +import javax.lang.model.util.*;
   50.38 +
   50.39 +public class TestIntersectionTypeVisitors {
   50.40 +    public static void main(String... args) throws Exception {
   50.41 +        IntersectionType it = new TestIntersectionType();
   50.42 +
   50.43 +        boolean result = it.accept(new TypeKindVisitor8Child(), null) &&
   50.44 +            it.accept(new SimpleTypeVisitor8Child(), null) &&
   50.45 +            it.accept(new SimpleTypeVisitor6Child(), null);
   50.46 +
   50.47 +        if (!result)
   50.48 +            throw new RuntimeException();
   50.49 +    }
   50.50 +
   50.51 +    static class TestIntersectionType implements IntersectionType {
   50.52 +        TestIntersectionType() {}
   50.53 +
   50.54 +        @Override
   50.55 +        public List<? extends TypeMirror> getBounds() {
   50.56 +            throw new UnsupportedOperationException();
   50.57 +        }
   50.58 +
   50.59 +        @Override
   50.60 +        public <R,P> R accept(TypeVisitor<R,P> v,
   50.61 +                       P p) {
   50.62 +            return v.visitIntersection(this, p);
   50.63 +        }
   50.64 +
   50.65 +        @Override
   50.66 +        public TypeKind getKind() {
   50.67 +            return TypeKind.INTERSECTION;
   50.68 +        }
   50.69 +
   50.70 +        @Override
   50.71 +        public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
   50.72 +            throw new UnsupportedOperationException();
   50.73 +        }
   50.74 +
   50.75 +        @Override
   50.76 +        public List<? extends AnnotationMirror> getAnnotationMirrors() {
   50.77 +            throw new UnsupportedOperationException();
   50.78 +        }
   50.79 +
   50.80 +        @Override
   50.81 +        public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) {
   50.82 +            throw new UnsupportedOperationException();
   50.83 +        }
   50.84 +    }
   50.85 +
   50.86 +    static class TypeKindVisitor8Child extends TypeKindVisitor8<Boolean, Void> {
   50.87 +        TypeKindVisitor8Child() {
   50.88 +            super(false);
   50.89 +        }
   50.90 +
   50.91 +        @Override
   50.92 +        public Boolean visitIntersection(IntersectionType t, Void p) {
   50.93 +            super.visitIntersection(t, p); // Make sure overridden method doesn't throw an exception
   50.94 +            return true;
   50.95 +        }
   50.96 +    }
   50.97 +
   50.98 +    static class SimpleTypeVisitor8Child extends SimpleTypeVisitor8<Boolean, Void> {
   50.99 +        SimpleTypeVisitor8Child() {
  50.100 +            super(false);
  50.101 +        }
  50.102 +
  50.103 +        @Override
  50.104 +        public Boolean visitIntersection(IntersectionType t, Void p) {
  50.105 +            super.visitIntersection(t, p);  // Make sure overridden method doesn't throw an exception
  50.106 +            return true;
  50.107 +        }
  50.108 +    }
  50.109 +
  50.110 +    static class SimpleTypeVisitor6Child extends SimpleTypeVisitor6<Boolean, Void> {
  50.111 +        SimpleTypeVisitor6Child() {
  50.112 +            super(false);
  50.113 +        }
  50.114 +
  50.115 +        @Override
  50.116 +        public Boolean visitIntersection(IntersectionType t, Void p) {
  50.117 +            try {
  50.118 +                super.visitIntersection(t, p);
  50.119 +                return false;
  50.120 +            } catch (UnknownTypeException ute) {
  50.121 +                return true; // Expected
  50.122 +            }
  50.123 +        }
  50.124 +    }
  50.125 +}
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/test/tools/javadoc/api/basic/DocumentationToolLocationTest.java	Fri Nov 15 07:15:51 2013 -0800
    51.3 @@ -0,0 +1,73 @@
    51.4 +/*
    51.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    51.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    51.7 + *
    51.8 + * This code is free software; you can redistribute it and/or modify it
    51.9 + * under the terms of the GNU General Public License version 2 only, as
   51.10 + * published by the Free Software Foundation.
   51.11 + *
   51.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   51.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   51.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   51.15 + * version 2 for more details (a copy is included in the LICENSE file that
   51.16 + * accompanied this code).
   51.17 + *
   51.18 + * You should have received a copy of the GNU General Public License version
   51.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   51.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   51.21 + *
   51.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   51.23 + * or visit www.oracle.com if you need additional information or have any
   51.24 + * questions.
   51.25 + */
   51.26 +
   51.27 +/*
   51.28 + * @test
   51.29 + * @bug 8025844
   51.30 + * @summary test DocumentationTool.Location methods
   51.31 + * @build APITest
   51.32 + * @run main DocumentationToolLocationTest
   51.33 + */
   51.34 +
   51.35 +import javax.tools.DocumentationTool;
   51.36 +import java.util.Objects;
   51.37 +
   51.38 +/**
   51.39 + * Test for DocumentationTool.Location methods.
   51.40 + */
   51.41 +public class DocumentationToolLocationTest extends APITest {
   51.42 +    public static void main(String[] args) throws Exception {
   51.43 +        new DocumentationToolLocationTest().run();
   51.44 +    }
   51.45 +
   51.46 +    /**
   51.47 +     * Test getName() method
   51.48 +     */
   51.49 +    @Test
   51.50 +    public void testGetName() throws Exception {
   51.51 +        // getName() returns name(). This is for test coverage of getName.
   51.52 +        for (DocumentationTool.Location dl: DocumentationTool.Location.values()) {
   51.53 +            String expect = dl.name();
   51.54 +            String found = dl.getName();
   51.55 +            if (!Objects.equals(expect, found))
   51.56 +                throw new Exception("mismatch for " + dl + "; expected " + expect + ", found " + found);
   51.57 +        }
   51.58 +    }
   51.59 +
   51.60 +    /**
   51.61 +     * Test generated enum methods values() and valueOf()
   51.62 +     */
   51.63 +    @Test
   51.64 +    public void testEnumMethods() throws Exception {
   51.65 +        DocumentationTool.Location[] values = DocumentationTool.Location.values();
   51.66 +        if (values.length != 3)
   51.67 +            throw new Exception("unexpected number of values returned");
   51.68 +
   51.69 +        for (DocumentationTool.Location dl: values) {
   51.70 +            DocumentationTool.Location expect = dl;
   51.71 +            DocumentationTool.Location found = DocumentationTool.Location.valueOf(dl.name());
   51.72 +            if (!Objects.equals(expect, found))
   51.73 +                throw new Exception("mismatch for " + dl + "; expected " + expect + ", found " + found);
   51.74 +        }
   51.75 +    }
   51.76 +}
    52.1 --- a/test/tools/javadoc/generics/genericInnerAndOuter/expected.out	Thu Nov 14 09:05:25 2013 -0800
    52.2 +++ b/test/tools/javadoc/generics/genericInnerAndOuter/expected.out	Fri Nov 15 07:15:51 2013 -0800
    52.3 @@ -16,7 +16,7 @@
    52.4    superclass:
    52.5      java.lang.Object
    52.6    constructors:
    52.7 -    O.I()
    52.8 +    I()
    52.9    methods:
   52.10      void m1(O<String>.I<Number>)
   52.11  
   52.12 @@ -36,7 +36,7 @@
   52.13    superclass:
   52.14      java.lang.Object
   52.15    constructors:
   52.16 -    X.Y()
   52.17 +    Y()
   52.18  
   52.19  class pkg1.X<T>.Y.Z<S>
   52.20    name: Z / X.Y.Z / pkg1.X.Y.Z
   52.21 @@ -47,7 +47,7 @@
   52.22    superclass:
   52.23      java.lang.Object
   52.24    constructors:
   52.25 -    X.Y.Z()
   52.26 +    Z()
   52.27    methods:
   52.28      void m1(X<String>.Y.Z<Number>)
   52.29  
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/test/tools/javap/AccessModifiers.java	Fri Nov 15 07:15:51 2013 -0800
    53.3 @@ -0,0 +1,120 @@
    53.4 +/*
    53.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    53.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    53.7 + *
    53.8 + * This code is free software; you can redistribute it and/or modify it
    53.9 + * under the terms of the GNU General Public License version 2 only, as
   53.10 + * published by the Free Software Foundation.
   53.11 + *
   53.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   53.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   53.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   53.15 + * version 2 for more details (a copy is included in the LICENSE file that
   53.16 + * accompanied this code).
   53.17 + *
   53.18 + * You should have received a copy of the GNU General Public License version
   53.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   53.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   53.21 + *
   53.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   53.23 + * or visit www.oracle.com if you need additional information or have any
   53.24 + * questions.
   53.25 + */
   53.26 +
   53.27 +/*
   53.28 + * @test
   53.29 + * @bug 8027530
   53.30 + * @summary test -public, -protected, -package, -private options
   53.31 + */
   53.32 +
   53.33 +import java.io.*;
   53.34 +import java.util.*;
   53.35 +import java.lang.StringBuilder;
   53.36 +
   53.37 +public class AccessModifiers {
   53.38 +    public int errorCount;
   53.39 +    protected String protectedField;
   53.40 +    String packageField;
   53.41 +    private String privateField;
   53.42 +
   53.43 +    public static void main(String[] args) throws Exception {
   53.44 +        new AccessModifiers().run();
   53.45 +    }
   53.46 +
   53.47 +    private void run() throws Exception {
   53.48 +        List<String> pubMembers = new ArrayList<String>();
   53.49 +        pubMembers.add("public int errorCount");
   53.50 +        pubMembers.add("public AccessModifiers");
   53.51 +        pubMembers.add("public static void main");
   53.52 +
   53.53 +        List<String> proMembers = new ArrayList<String>();
   53.54 +        proMembers.add("protected java.lang.String protectedField");
   53.55 +        proMembers.add("protected java.lang.String runJavap");
   53.56 +
   53.57 +        List<String> pkgMembers = new ArrayList<String>();
   53.58 +        pkgMembers.add("java.lang.String packageField");
   53.59 +        pkgMembers.add("boolean verify");
   53.60 +        pkgMembers.add("void error");
   53.61 +
   53.62 +        List<String> priMembers = new ArrayList<String>();
   53.63 +        priMembers.add("private java.lang.String privateField");
   53.64 +        priMembers.add("private void run() throws java.lang.Exception");
   53.65 +        priMembers.add("private void test");
   53.66 +
   53.67 +        List<String> expectedList = new ArrayList<String>();
   53.68 +
   53.69 +        expectedList.addAll(pubMembers);
   53.70 +        test("-public", expectedList);
   53.71 +
   53.72 +        expectedList.addAll(proMembers);
   53.73 +        test("-protected", expectedList);
   53.74 +
   53.75 +        expectedList.addAll(pkgMembers);
   53.76 +        test("-package", expectedList);
   53.77 +
   53.78 +        expectedList.addAll(priMembers);
   53.79 +        test("-private", expectedList);
   53.80 +
   53.81 +        if (errorCount > 0)
   53.82 +            throw new Exception(errorCount + " errors received");
   53.83 +    }
   53.84 +
   53.85 +    private void test(String option, List<String> expectedStrs) throws Exception {
   53.86 +        String output = runJavap(0, option);
   53.87 +        if (verify(output, expectedStrs))
   53.88 +            System.out.println(option + " test passed");
   53.89 +    }
   53.90 +
   53.91 +    protected String runJavap(int expect, String... options) {
   53.92 +        // convert the varargs to a list in order to add class name
   53.93 +        List<String> optlist = new ArrayList<String>();
   53.94 +        optlist.addAll(Arrays.asList(options));
   53.95 +        optlist.add("AccessModifiers");
   53.96 +        String[] newoptions = optlist.toArray(new String[optlist.size()]);
   53.97 +        StringWriter sw = new StringWriter();
   53.98 +        PrintWriter pw = new PrintWriter(sw);
   53.99 +        System.out.printf("\nRun javap " + optlist + "\n\n");
  53.100 +        int rc = com.sun.tools.javap.Main.run(newoptions, pw);
  53.101 +        pw.close();
  53.102 +        System.out.println(sw);
  53.103 +        if (rc != expect)
  53.104 +           throw new Error("Expect to return " + expect + ", but return " + rc);
  53.105 +        return sw.toString();
  53.106 +    }
  53.107 +
  53.108 +    boolean verify(String output, List<String> expects) {
  53.109 +        boolean pass = true;
  53.110 +        for (String expect: expects) {
  53.111 +            if (!output.contains(expect)) {
  53.112 +                error(expect + " not found");
  53.113 +                pass = false;
  53.114 +            }
  53.115 +        }
  53.116 +        return pass;
  53.117 +    }
  53.118 +
  53.119 +    void error(String msg) {
  53.120 +        System.err.println(msg);
  53.121 +        errorCount++;
  53.122 +    }
  53.123 +}
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/test/tools/javap/InvalidOptions.java	Fri Nov 15 07:15:51 2013 -0800
    54.3 @@ -0,0 +1,78 @@
    54.4 +/*
    54.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    54.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    54.7 + *
    54.8 + * This code is free software; you can redistribute it and/or modify it
    54.9 + * under the terms of the GNU General Public License version 2 only, as
   54.10 + * published by the Free Software Foundation.
   54.11 + *
   54.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   54.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   54.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   54.15 + * version 2 for more details (a copy is included in the LICENSE file that
   54.16 + * accompanied this code).
   54.17 + *
   54.18 + * You should have received a copy of the GNU General Public License version
   54.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   54.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   54.21 + *
   54.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   54.23 + * or visit www.oracle.com if you need additional information or have any
   54.24 + * questions.
   54.25 + */
   54.26 +
   54.27 +/*
   54.28 + * @test
   54.29 + * @bug 8027411
   54.30 + * @summary test invalid options -h and -b
   54.31 + */
   54.32 +
   54.33 +import java.io.*;
   54.34 +import java.util.zip.*;
   54.35 +
   54.36 +public class InvalidOptions {
   54.37 +    int errorCount;
   54.38 +    String log;
   54.39 +
   54.40 +    public static void main(String[] args) throws Exception {
   54.41 +        new InvalidOptions().run();
   54.42 +    }
   54.43 +
   54.44 +    void run() throws Exception {
   54.45 +        test(2, "-h", "Error: -h is no longer available - use the javah program");
   54.46 +        test(2, "-b", "Error: unknown option: -b",
   54.47 +                      "Usage: javap <options> <classes>",
   54.48 +                      "use -help for a list of possible options");
   54.49 +        if (errorCount > 0)
   54.50 +            throw new Exception(errorCount + " errors received");
   54.51 +    }
   54.52 +
   54.53 +    void test(int expect, String option, String ... expectedOutput) {
   54.54 +        String output = runJavap(expect, option);
   54.55 +        verify(output, expectedOutput);
   54.56 +    }
   54.57 +
   54.58 +    String runJavap(int expect, String... option) {
   54.59 +        StringWriter sw = new StringWriter();
   54.60 +        PrintWriter pw = new PrintWriter(sw);
   54.61 +        int rc = com.sun.tools.javap.Main.run(option, pw);
   54.62 +        pw.close();
   54.63 +        System.out.println("javap prints:");
   54.64 +        System.out.println(sw);
   54.65 +        if (rc != expect)
   54.66 +           throw new Error("Expect to return " + expect + ", but return " + rc);
   54.67 +        return sw.toString();
   54.68 +    }
   54.69 +
   54.70 +    void verify(String output, String... expects) {
   54.71 +        for (String expect: expects) {
   54.72 +            if (!output.contains(expect))
   54.73 +                error(expect + " not found");
   54.74 +        }
   54.75 +    }
   54.76 +
   54.77 +    void error(String msg) {
   54.78 +        System.err.println(msg);
   54.79 +        errorCount++;
   54.80 +    }
   54.81 +}

mercurial