changeset 2795:230c13955250 jdk9-b47

Merge
author lana
date Fri, 16 Jan 2015 12:34:58 -0800
parents e7cf0a7e1c03 a510d7536fa1
children 308d21ad93c9 52227644abfa
files test/tools/javac/diags/examples/NonStaticCantBeRefFragment.java test/tools/javac/diags/examples/StaticBoundMref.java test/tools/javac/diags/examples/StaticMethodInUnboundLookup.java
diffstat 54 files changed, 985 insertions(+), 558 deletions(-) [+]
line wrap: on
line diff
--- a/make/Tools.gmk	Thu Jan 15 13:09:52 2015 -0800
+++ b/make/Tools.gmk	Fri Jan 16 12:34:58 2015 -0800
@@ -40,6 +40,7 @@
     ADD_JAVAC_FLAGS := -Xprefer:source, \
     SRC := $(LANGTOOLS_TOPDIR)/make/tools, \
     INCLUDES := compileproperties propertiesparser, \
+    COPY := .properties, \
     BIN := $(BUILDTOOLS_OUTPUTDIR)/langtools_tools_classes))
 
 all: $(BUILD_TOOLS_LANGTOOLS)
--- a/make/gensrc/Gensrc-jdk.compiler.gmk	Thu Jan 15 13:09:52 2015 -0800
+++ b/make/gensrc/Gensrc-jdk.compiler.gmk	Fri Jan 16 12:34:58 2015 -0800
@@ -25,19 +25,19 @@
 
 include GensrcCommon.gmk
 
-$(eval $(call SetupVersionProperties,JAVAC_VERSION,\
+$(eval $(call SetupVersionProperties,JAVAC_VERSION, \
     com/sun/tools/javac/resources/version.properties))
 
-$(eval $(call SetupVersionProperties,JAVAH_VERSION,\
+$(eval $(call SetupVersionProperties,JAVAH_VERSION, \
     com/sun/tools/javah/resources/version.properties))
 
-$(eval $(call SetupVersionProperties,JAVAP_VERSION,\
+$(eval $(call SetupVersionProperties,JAVAP_VERSION, \
     com/sun/tools/javap/resources/version.properties))
 
-$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES,\
+$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
     $(JAVAC_VERSION) $(JAVAH_VERSION) $(JAVAP_VERSION)))
 
-$(eval $(call SetupParseProperties,PARSE_PROPERTIES,\
+$(eval $(call SetupParseProperties,PARSE_PROPERTIES, \
 	com/sun/tools/javac/resources/compiler.properties))
 
 all: $(COMPILE_PROPERTIES) $(PARSE_PROPERTIES)
--- a/make/gensrc/GensrcCommon.gmk	Thu Jan 15 13:09:52 2015 -0800
+++ b/make/gensrc/GensrcCommon.gmk	Fri Jan 16 12:34:58 2015 -0800
@@ -63,7 +63,8 @@
 # Param 2 - Extra properties files to process
 define SetupCompileProperties
   # Lookup the properties that need to be compiled into resource bundles.
-  PROPSOURCES := $2 $$(shell $(FIND) $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes -name "*.properties")
+  PROPSOURCES := $2 \
+      $$(shell $(FIND) $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes -name "*.properties")
 
   # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
   # to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
@@ -74,7 +75,7 @@
       $$(patsubst %.properties, %.java, \
       $$(subst /share/classes,, $$(PROPSOURCES))))
 
-  # Generate the package dirs for the tobe generated java files. Sort to remove
+  # Generate the package dirs for the to be generated java files. Sort to remove
   # duplicates.
   PROPDIRS := $$(sort $$(dir $$(PROPJAVAS)))
 
@@ -88,8 +89,8 @@
 
   # Now setup the rule for the generation of the resource bundles.
   $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props: $$(PROPSOURCES)
-	$(FIND) $$(@D) -name "*.java" $(FIND_DELETE)
 	$(MKDIR) -p $$(@D) $$(PROPDIRS)
+	$(FIND) $$(@D) -name "*.java" -a ! -name "*Properties.java" $(FIND_DELETE)
 	$(ECHO) Compiling $$(words $$(PROPSOURCES)) properties into resource bundles for $(MODULE)
 	$(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE)
 	$(TOUCH) $$@
@@ -102,11 +103,11 @@
 # Param 1 - Variable to add targets to
 # Param 2 - Extra properties files to process
 define SetupParseProperties
-  #property file to generate
-  PARSEPROPSOURCES := $$(foreach var,$2,$$(addsuffix $$(var),$(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes/))  
+  # property files to process
+  PARSEPROPSOURCES := $$(addprefix $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes/, $2)
 
-  PARSEPROPALLDIRS := $$(patsubst $(LANGTOOLS_TOPDIR)/src/%, \
-      $(SUPPORT_OUTPUTDIR)/gensrc/%, \
+  PARSEPROPALLDIRS := $$(patsubst $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes/%, \
+      $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/%, \
       $$(dir $$(PARSEPROPSOURCES)))
 
   PARSEPROPDIRS := $$(sort $$(PARSEPROPALLDIRS))
@@ -114,11 +115,11 @@
   PARSEPROPCMDLINE := $$(subst _SPACE_, $$(SPACE), \
     $$(join $$(foreach var,$$(PARSEPROPSOURCES),$$(addprefix -compile_SPACE_,$$(var))), \
     $$(addprefix _SPACE_, $$(PARSEPROPALLDIRS))))
-  
+
   # Now setup the rule for the generation of the resource bundles.
   $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props: $(PARSEPROPSOURCES)
-	$(CP) -r $(LANGTOOLS_TOPDIR)/make/tools/propertiesparser/resources $(BUILDTOOLS_OUTPUTDIR)/langtools_tools_classes/propertiesparser/resources
 	$(MKDIR) -p $$(@D) $$(PARSEPROPDIRS)
+	$(FIND) $$(@D) -name "*Properties.java" $(FIND_DELETE)
 	$(ECHO) Parsing $$(words $$(PARSEPROPSOURCES)) properties into enum-like class for $(MODULE)
 	$(TOOL_PARSEPROPS_CMD) $$(PARSEPROPCMDLINE)
 	$(TOUCH) $$@
--- a/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties	Thu Jan 15 13:09:52 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties	Fri Jan 16 12:34:58 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 # questions.
 #
 
-dc.anchor.already.defined = anchor already defined: {0}
+dc.anchor.already.defined = anchor already defined: "{0}"
 dc.anchor.value.missing = no value given for anchor
 dc.attr.lacks.value = attribute lacks value
 dc.attr.not.number = attribute value is not a number
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Fri Jan 16 12:34:58 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -98,6 +98,7 @@
 import com.sun.tools.javac.util.DefinedBy;
 import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.JCDiagnostic;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Log;
@@ -924,12 +925,7 @@
         try {
             switch (kind) {
             case ERROR:
-                boolean prev = log.multipleErrors;
-                try {
-                    log.error(pos, "proc.messager", msg.toString());
-                } finally {
-                    log.multipleErrors = prev;
-                }
+                log.error(DiagnosticFlag.MULTIPLE, pos, "proc.messager", msg.toString());
                 break;
 
             case WARNING:
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java	Fri Jan 16 12:34:58 2015 -0800
@@ -74,8 +74,7 @@
         WRONG_MTHS(Category.OVERLOAD, KindName.METHOD),
         WRONG_MTH(Category.OVERLOAD, KindName.METHOD),
         ABSENT_MTH(Category.OVERLOAD, KindName.METHOD),
-        ABSENT_TYP(Category.OVERLOAD, KindName.CLASS),
-        WRONG_STATICNESS(Category.OVERLOAD, KindName.METHOD);
+        ABSENT_TYP(Category.OVERLOAD, KindName.CLASS);
 
         // There are essentially two "levels" to the Kind datatype.
         // The first is a totally-ordered set of categories of
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Fri Jan 16 12:34:58 2015 -0800
@@ -1175,6 +1175,16 @@
             return v.visitClassSymbol(this, p);
         }
 
+        public void markAbstractIfNeeded(Types types) {
+            if (types.enter.getEnv(this) != null &&
+                (flags() & ENUM) != 0 && types.supertype(type).tsym == types.syms.enumSym &&
+                (flags() & (FINAL | ABSTRACT)) == 0) {
+                if (types.firstUnimplementedAbstract(this) != null)
+                    // add the ABSTRACT flag to an enum
+                    flags_field |= ABSTRACT;
+            }
+        }
+
         /**Resets the Symbol into the state good for next round of annotation processing.*/
         public void reset() {
             kind = TYP;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Fri Jan 16 12:34:58 2015 -0800
@@ -48,6 +48,7 @@
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 import static com.sun.tools.javac.code.Scope.*;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.Symbol.*;
 import static com.sun.tools.javac.code.Type.*;
 import static com.sun.tools.javac.code.TypeTag.*;
@@ -82,6 +83,7 @@
     final JavacMessages messages;
     final Names names;
     final boolean allowObjectToPrimitiveCast;
+    final boolean allowDefaultMethods;
     final Check chk;
     final Enter enter;
     JCDiagnostic.Factory diags;
@@ -105,6 +107,7 @@
         names = Names.instance(context);
         Source source = Source.instance(context);
         allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
+        allowDefaultMethods = source.allowDefaultMethods();
         chk = Check.instance(context);
         enter = Enter.instance(context);
         capturedName = names.fromString("<captured wildcard>");
@@ -805,13 +808,13 @@
             return true;
         }
 
-        // Generally, if 's' is a type variable, recur on lower bound; but
+        // Generally, if 's' is a lower-bounded type variable, recur on lower bound; but
         // for inference variables and intersections, we need to keep 's'
         // (see JLS 4.10.2 for intersections and 18.2.3 for inference vars)
         if (!t.hasTag(UNDETVAR) && !t.isCompound()) {
             // TODO: JDK-8039198, bounds checking sometimes passes in a wildcard as s
             Type lower = cvarLowerBound(wildLowerBound(s));
-            if (s != lower)
+            if (s != lower && !lower.hasTag(BOT))
                 return isSubtype(capture ? capture(t) : t, lower, false);
         }
 
@@ -2775,6 +2778,58 @@
     // </editor-fold>
 
 
+    /** Return first abstract member of class `sym'.
+     */
+    public MethodSymbol firstUnimplementedAbstract(ClassSymbol sym) {
+        try {
+            return firstUnimplementedAbstractImpl(sym, sym);
+        } catch (CompletionFailure ex) {
+            chk.completionError(enter.getEnv(sym).tree.pos(), ex);
+            return null;
+        }
+    }
+        //where:
+        private MethodSymbol firstUnimplementedAbstractImpl(ClassSymbol impl, ClassSymbol c) {
+            MethodSymbol undef = null;
+            // Do not bother to search in classes that are not abstract,
+            // since they cannot have abstract members.
+            if (c == impl || (c.flags() & (ABSTRACT | INTERFACE)) != 0) {
+                Scope s = c.members();
+                for (Symbol sym : s.getSymbols(NON_RECURSIVE)) {
+                    if (sym.kind == MTH &&
+                        (sym.flags() & (ABSTRACT|IPROXY|DEFAULT)) == ABSTRACT) {
+                        MethodSymbol absmeth = (MethodSymbol)sym;
+                        MethodSymbol implmeth = absmeth.implementation(impl, this, true);
+                        if (implmeth == null || implmeth == absmeth) {
+                            //look for default implementations
+                            if (allowDefaultMethods) {
+                                MethodSymbol prov = interfaceCandidates(impl.type, absmeth).head;
+                                if (prov != null && prov.overrides(absmeth, impl, this, true)) {
+                                    implmeth = prov;
+                                }
+                            }
+                        }
+                        if (implmeth == null || implmeth == absmeth) {
+                            undef = absmeth;
+                            break;
+                        }
+                    }
+                }
+                if (undef == null) {
+                    Type st = supertype(c.type);
+                    if (st.hasTag(CLASS))
+                        undef = firstUnimplementedAbstractImpl(impl, (ClassSymbol)st.tsym);
+                }
+                for (List<Type> l = interfaces(c.type);
+                     undef == null && l.nonEmpty();
+                     l = l.tail) {
+                    undef = firstUnimplementedAbstractImpl(impl, (ClassSymbol)l.head.tsym);
+                }
+            }
+            return undef;
+        }
+
+
     //where
     public List<MethodSymbol> interfaceCandidates(Type site, MethodSymbol ms) {
         Filter<Symbol> filter = new MethodFilter(ms, site);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Jan 16 12:34:58 2015 -0800
@@ -2640,8 +2640,7 @@
             try {
                 refResult = rs.resolveMemberReference(localEnv, that, that.expr.type,
                         that.name, argtypes, typeargtypes, referenceCheck,
-                        resultInfo.checkContext.inferenceContext(),
-                        resultInfo.checkContext.deferredAttrContext().mode);
+                        resultInfo.checkContext.inferenceContext(), rs.basicReferenceChooser);
             } finally {
                 resultInfo.checkContext.inferenceContext().rollback(saved_undet);
             }
@@ -2659,9 +2658,8 @@
                     case WRONG_MTHS:
                     case AMBIGUOUS:
                     case HIDDEN:
+                    case MISSING_ENCL:
                     case STATICERR:
-                    case MISSING_ENCL:
-                    case WRONG_STATICNESS:
                         targetError = true;
                         break;
                     default:
@@ -2722,15 +2720,6 @@
                     return;
                 }
 
-                if (that.sym.isStatic() && !TreeInfo.isStaticSelector(that.expr, names) &&
-                        !that.kind.isUnbound()) {
-                    //no static bound mrefs
-                    log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()),
-                            diags.fragment("static.bound.mref"));
-                    result = that.type = types.createErrorType(currentTarget);
-                    return;
-                }
-
                 if (!refSym.isStatic() && that.kind == JCMemberReference.ReferenceKind.SUPER) {
                     // Check that super-qualified symbols are not abstract (JLS)
                     rs.checkNonAbstract(that.pos(), that.sym);
@@ -4199,6 +4188,8 @@
             chk.validate(tree.implementing, env);
         }
 
+        c.markAbstractIfNeeded(types);
+
         // If this is a non-abstract class, check that it has no abstract
         // methods or unimplemented methods of an implemented interface.
         if ((c.flags() & (ABSTRACT | INTERFACE)) == 0) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Fri Jan 16 12:34:58 2015 -0800
@@ -2019,69 +2019,15 @@
      *  @param c            The class.
      */
     void checkAllDefined(DiagnosticPosition pos, ClassSymbol c) {
-        try {
-            MethodSymbol undef = firstUndef(c, c);
-            if (undef != null) {
-                if ((c.flags() & ENUM) != 0 &&
-                    types.supertype(c.type).tsym == syms.enumSym &&
-                    (c.flags() & FINAL) == 0) {
-                    // add the ABSTRACT flag to an enum
-                    c.flags_field |= ABSTRACT;
-                } else {
-                    MethodSymbol undef1 =
-                        new MethodSymbol(undef.flags(), undef.name,
-                                         types.memberType(c.type, undef), undef.owner);
-                    log.error(pos, "does.not.override.abstract",
-                              c, undef1, undef1.location());
-                }
-            }
-        } catch (CompletionFailure ex) {
-            completionError(pos, ex);
+        MethodSymbol undef = types.firstUnimplementedAbstract(c);
+        if (undef != null) {
+            MethodSymbol undef1 =
+                new MethodSymbol(undef.flags(), undef.name,
+                                 types.memberType(c.type, undef), undef.owner);
+            log.error(pos, "does.not.override.abstract",
+                      c, undef1, undef1.location());
         }
     }
-//where
-        /** Return first abstract member of class `c' that is not defined
-         *  in `impl', null if there is none.
-         */
-        private MethodSymbol firstUndef(ClassSymbol impl, ClassSymbol c) {
-            MethodSymbol undef = null;
-            // Do not bother to search in classes that are not abstract,
-            // since they cannot have abstract members.
-            if (c == impl || (c.flags() & (ABSTRACT | INTERFACE)) != 0) {
-                Scope s = c.members();
-                for (Symbol sym : s.getSymbols(NON_RECURSIVE)) {
-                    if (sym.kind == MTH &&
-                        (sym.flags() & (ABSTRACT|IPROXY|DEFAULT)) == ABSTRACT) {
-                        MethodSymbol absmeth = (MethodSymbol)sym;
-                        MethodSymbol implmeth = absmeth.implementation(impl, types, true);
-                        if (implmeth == null || implmeth == absmeth) {
-                            //look for default implementations
-                            if (allowDefaultMethods) {
-                                MethodSymbol prov = types.interfaceCandidates(impl.type, absmeth).head;
-                                if (prov != null && prov.overrides(absmeth, impl, types, true)) {
-                                    implmeth = prov;
-                                }
-                            }
-                        }
-                        if (implmeth == null || implmeth == absmeth) {
-                            undef = absmeth;
-                            break;
-                        }
-                    }
-                }
-                if (undef == null) {
-                    Type st = types.supertype(c.type);
-                    if (st.hasTag(CLASS))
-                        undef = firstUndef(impl, (ClassSymbol)st.tsym);
-                }
-                for (List<Type> l = types.interfaces(c.type);
-                     undef == null && l.nonEmpty();
-                     l = l.tail) {
-                    undef = firstUndef(impl, (ClassSymbol)l.head.tsym);
-                }
-            }
-            return undef;
-        }
 
     void checkNonCyclicDecl(JCClassDecl tree) {
         CycleChecker cc = new CycleChecker();
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Fri Jan 16 12:34:58 2015 -0800
@@ -27,6 +27,9 @@
 
 import com.sun.source.tree.LambdaExpressionTree.BodyKind;
 import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.comp.Resolve.ResolveError;
+import com.sun.tools.javac.resources.CompilerProperties;
+import com.sun.tools.javac.resources.CompilerProperties.Fragments;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.DefinedBy.Api;
@@ -37,6 +40,7 @@
 import com.sun.tools.javac.comp.Infer.InferenceContext;
 import com.sun.tools.javac.comp.Resolve.MethodResolutionPhase;
 import com.sun.tools.javac.tree.JCTree.*;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
 import com.sun.tools.javac.util.Log.DeferredDiagnosticHandler;
 
 import java.util.ArrayList;
@@ -786,16 +790,22 @@
                     JCMemberReference mref2 = new TreeCopier<Void>(make).copy(tree);
                     mref2.expr = exprTree;
                     Symbol lookupSym =
-                            rs.resolveMemberReferenceByArity(localEnv, mref2, exprTree.type,
-                                tree.name, argtypes.toList(), inferenceContext);
+                            rs.resolveMemberReference(localEnv, mref2, exprTree.type,
+                                    tree.name, argtypes.toList(), List.nil(), rs.arityMethodCheck,
+                                    inferenceContext, rs.structuralReferenceChooser).fst;
                     switch (lookupSym.kind) {
-                        //note: as argtypes are erroneous types, type-errors must
-                        //have been caused by arity mismatch
-                        case ABSENT_MTH:
                         case WRONG_MTH:
                         case WRONG_MTHS:
-                        case WRONG_STATICNESS:
-                           checkContext.report(tree, diags.fragment("incompatible.arg.types.in.mref"));
+                            //note: as argtypes are erroneous types, type-errors must
+                            //have been caused by arity mismatch
+                            checkContext.report(tree, diags.fragment(Fragments.IncompatibleArgTypesInMref));
+                            break;
+                        case ABSENT_MTH:
+                        case STATICERR:
+                            //if no method found, or method found with wrong staticness, report better message
+                            checkContext.report(tree, ((ResolveError)lookupSym).getDiagnostic(DiagnosticType.FRAGMENT,
+                                    tree, exprTree.type.tsym, exprTree.type, tree.name, argtypes.toList(), List.nil()));
+                            break;
                     }
                 }
             }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Fri Jan 16 12:34:58 2015 -0800
@@ -263,7 +263,7 @@
     @Override
     public void visitLambda(JCLambda tree) {
         LambdaTranslationContext localContext = (LambdaTranslationContext)context;
-        MethodSymbol sym = (MethodSymbol)localContext.translatedSym;
+        MethodSymbol sym = localContext.translatedSym;
         MethodType lambdaType = (MethodType) sym.type;
 
         {
@@ -875,11 +875,9 @@
          */
         private JCExpression expressionInvoke(VarSymbol rcvr) {
             JCExpression qualifier =
-                    tree.sym.isStatic() ?
-                        make.Type(tree.sym.owner.type) :
-                        (rcvr != null) ?
-                            makeReceiver(rcvr) :
-                            tree.getQualifierExpression();
+                    (rcvr != null) ?
+                        makeReceiver(rcvr) :
+                        tree.getQualifierExpression();
 
             //create the qualifier expression
             JCFieldAccess select = make.Select(qualifier, tree.sym.name);
@@ -1755,7 +1753,7 @@
             Map<LambdaSymbolKind, Map<Symbol, Symbol>> translatedSymbols;
 
             /** the synthetic symbol for the method hoisting the translated lambda */
-            Symbol translatedSym;
+            MethodSymbol translatedSym;
 
             List<JCVariableDecl> syntheticParams;
 
@@ -1997,6 +1995,7 @@
 
                 //compute synthetic params
                 ListBuffer<JCVariableDecl> params = new ListBuffer<>();
+                ListBuffer<VarSymbol> parameterSymbols = new ListBuffer<>();
 
                 // The signature of the method is augmented with the following
                 // synthetic parameters:
@@ -2005,19 +2004,16 @@
                 // 2) enclosing locals captured by the lambda expression
                 for (Symbol thisSym : getSymbolMap(CAPTURED_VAR).values()) {
                     params.append(make.VarDef((VarSymbol) thisSym, null));
-                }
-                if (methodReferenceReceiver != null) {
-                    params.append(make.VarDef(
-                            make.Modifiers(PARAMETER|FINAL),
-                            names.fromString("$rcvr$"),
-                            make.Type(methodReferenceReceiver.type),
-                            null));
+                    parameterSymbols.append((VarSymbol) thisSym);
                 }
                 for (Symbol thisSym : getSymbolMap(PARAM).values()) {
                     params.append(make.VarDef((VarSymbol) thisSym, null));
+                    parameterSymbols.append((VarSymbol) thisSym);
                 }
                 syntheticParams = params.toList();
 
+                translatedSym.params = parameterSymbols.toList();
+
                 // Compute and set the lambda name
                 translatedSym.name = isSerializable()
                         ? serializedLambdaName()
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Jan 16 12:34:58 2015 -0800
@@ -25,7 +25,6 @@
 
 package com.sun.tools.javac.comp;
 
-import com.sun.source.tree.MemberReferenceTree.ReferenceMode;
 import com.sun.tools.javac.api.Formattable.LocalizedString;
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Scope.WriteableScope;
@@ -40,6 +39,7 @@
 import com.sun.tools.javac.comp.Infer.FreeTypeListener;
 import com.sun.tools.javac.comp.Resolve.MethodResolutionContext.Candidate;
 import com.sun.tools.javac.comp.Resolve.MethodResolutionDiagHelper.Template;
+import com.sun.tools.javac.comp.Resolve.ReferenceLookupResult.StaticKind;
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.main.Option;
 import com.sun.tools.javac.tree.*;
@@ -65,6 +65,7 @@
 
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Flags.BLOCK;
+import static com.sun.tools.javac.code.Flags.STATIC;
 import static com.sun.tools.javac.code.Kinds.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 import static com.sun.tools.javac.code.TypeTag.*;
@@ -105,15 +106,10 @@
         context.put(resolveKey, this);
         syms = Symtab.instance(context);
 
-        varNotFound = new
-            SymbolNotFoundError(ABSENT_VAR);
-        methodNotFound = new
-            SymbolNotFoundError(ABSENT_MTH);
-        methodWithCorrectStaticnessNotFound = new
-            SymbolNotFoundError(WRONG_STATICNESS,
-                "method found has incorrect staticness");
-        typeNotFound = new
-            SymbolNotFoundError(ABSENT_TYP);
+        varNotFound = new SymbolNotFoundError(ABSENT_VAR);
+        methodNotFound = new SymbolNotFoundError(ABSENT_MTH);
+        typeNotFound = new SymbolNotFoundError(ABSENT_TYP);
+        referenceNotFound = new ReferenceLookupResult(methodNotFound, null);
 
         names = Names.instance(context);
         log = Log.instance(context);
@@ -145,9 +141,11 @@
      */
     private final SymbolNotFoundError varNotFound;
     private final SymbolNotFoundError methodNotFound;
-    private final SymbolNotFoundError methodWithCorrectStaticnessNotFound;
     private final SymbolNotFoundError typeNotFound;
 
+    /** empty reference lookup result */
+    private final ReferenceLookupResult referenceNotFound;
+
     public static Resolve instance(Context context) {
         Resolve instance = context.get(resolveKey);
         if (instance == null)
@@ -2680,69 +2678,16 @@
                                   List<Type> argtypes,
                                   List<Type> typeargtypes,
                                   MethodResolutionPhase maxPhase) {
-        ReferenceLookupHelper result;
         if (!name.equals(names.init)) {
             //method reference
-            result =
-                    new MethodReferenceLookupHelper(referenceTree, name, site, argtypes, typeargtypes, maxPhase);
+            return new MethodReferenceLookupHelper(referenceTree, name, site, argtypes, typeargtypes, maxPhase);
+        } else if (site.hasTag(ARRAY)) {
+            //array constructor reference
+            return new ArrayConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase);
         } else {
-            if (site.hasTag(ARRAY)) {
-                //array constructor reference
-                result =
-                        new ArrayConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase);
-            } else {
-                //class constructor reference
-                result =
-                        new ConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase);
-            }
+            //class constructor reference
+            return new ConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase);
         }
-        return result;
-    }
-
-    Symbol resolveMemberReferenceByArity(Env<AttrContext> env,
-                                  JCMemberReference referenceTree,
-                                  Type site,
-                                  Name name,
-                                  List<Type> argtypes,
-                                  InferenceContext inferenceContext) {
-
-        boolean isStaticSelector = TreeInfo.isStaticSelector(referenceTree.expr, names);
-        site = types.capture(site);
-
-        ReferenceLookupHelper boundLookupHelper = makeReferenceLookupHelper(
-                referenceTree, site, name, argtypes, null, VARARITY);
-        //step 1 - bound lookup
-        Env<AttrContext> boundEnv = env.dup(env.tree, env.info.dup());
-        Symbol boundSym = lookupMethod(boundEnv, env.tree.pos(), site.tsym,
-                arityMethodCheck, boundLookupHelper);
-        if (isStaticSelector &&
-            !name.equals(names.init) &&
-            !boundSym.isStatic() &&
-            !boundSym.kind.isOverloadError()) {
-            boundSym = methodNotFound;
-        }
-
-        //step 2 - unbound lookup
-        Symbol unboundSym = methodNotFound;
-        ReferenceLookupHelper unboundLookupHelper = null;
-        Env<AttrContext> unboundEnv = env.dup(env.tree, env.info.dup());
-        if (isStaticSelector) {
-            unboundLookupHelper = boundLookupHelper.unboundLookup(inferenceContext);
-            unboundSym = lookupMethod(unboundEnv, env.tree.pos(), site.tsym,
-                    arityMethodCheck, unboundLookupHelper);
-            if (unboundSym.isStatic() &&
-                !unboundSym.kind.isOverloadError()) {
-                unboundSym = methodNotFound;
-            }
-        }
-
-        //merge results
-        Symbol bestSym = choose(boundSym, unboundSym);
-        env.info.pendingResolutionPhase = bestSym == unboundSym ?
-                unboundEnv.info.pendingResolutionPhase :
-                boundEnv.info.pendingResolutionPhase;
-
-        return bestSym;
     }
 
     /**
@@ -2763,8 +2708,8 @@
      * the receiver argument type is used to infer an instantiation for the raw
      * qualifier type.
      *
-     * When a multi-step resolution process is exploited, it is an error
-     * if two candidates are found (ambiguity).
+     * When a multi-step resolution process is exploited, the process of picking
+     * the resulting symbol is delegated to an helper class {@link com.sun.tools.javac.comp.Resolve.ReferenceChooser}.
      *
      * This routine returns a pair (T,S), where S is the member reference symbol,
      * and T is the type of the class in which S is defined. This is necessary as
@@ -2779,7 +2724,7 @@
                                   List<Type> typeargtypes,
                                   MethodCheck methodCheck,
                                   InferenceContext inferenceContext,
-                                  AttrMode mode) {
+                                  ReferenceChooser referenceChooser) {
 
         site = types.capture(site);
         ReferenceLookupHelper boundLookupHelper = makeReferenceLookupHelper(
@@ -2787,102 +2732,29 @@
 
         //step 1 - bound lookup
         Env<AttrContext> boundEnv = env.dup(env.tree, env.info.dup());
-        Symbol origBoundSym;
-        boolean staticErrorForBound = false;
         MethodResolutionContext boundSearchResolveContext = new MethodResolutionContext();
         boundSearchResolveContext.methodCheck = methodCheck;
-        Symbol boundSym = origBoundSym = lookupMethod(boundEnv, env.tree.pos(),
+        Symbol boundSym = lookupMethod(boundEnv, env.tree.pos(),
                 site.tsym, boundSearchResolveContext, boundLookupHelper);
-        SearchResultKind boundSearchResultKind = SearchResultKind.NOT_APPLICABLE_MATCH;
-        boolean isStaticSelector = TreeInfo.isStaticSelector(referenceTree.expr, names);
-        boolean shouldCheckForStaticness = isStaticSelector &&
-                referenceTree.getMode() == ReferenceMode.INVOKE;
-        if (boundSym.kind != WRONG_MTHS && boundSym.kind != WRONG_MTH) {
-            if (shouldCheckForStaticness) {
-                if (!boundSym.isStatic()) {
-                    staticErrorForBound = true;
-                    if (hasAnotherApplicableMethod(
-                            boundSearchResolveContext, boundSym, true)) {
-                        boundSearchResultKind = SearchResultKind.BAD_MATCH_MORE_SPECIFIC;
-                    } else {
-                        boundSearchResultKind = SearchResultKind.BAD_MATCH;
-                        if (!boundSym.kind.isOverloadError()) {
-                            boundSym = methodWithCorrectStaticnessNotFound;
-                        }
-                    }
-                } else if (!boundSym.kind.isOverloadError()) {
-                    boundSearchResultKind = SearchResultKind.GOOD_MATCH;
-                }
-            }
-        }
+        ReferenceLookupResult boundRes = new ReferenceLookupResult(boundSym, boundSearchResolveContext);
 
         //step 2 - unbound lookup
-        Symbol origUnboundSym = null;
         Symbol unboundSym = methodNotFound;
-        ReferenceLookupHelper unboundLookupHelper = null;
         Env<AttrContext> unboundEnv = env.dup(env.tree, env.info.dup());
-        SearchResultKind unboundSearchResultKind = SearchResultKind.NOT_APPLICABLE_MATCH;
-        boolean staticErrorForUnbound = false;
-        if (isStaticSelector) {
-            unboundLookupHelper = boundLookupHelper.unboundLookup(inferenceContext);
+        ReferenceLookupHelper unboundLookupHelper = boundLookupHelper.unboundLookup(inferenceContext);
+        ReferenceLookupResult unboundRes = referenceNotFound;
+        if (unboundLookupHelper != null) {
             MethodResolutionContext unboundSearchResolveContext =
                     new MethodResolutionContext();
             unboundSearchResolveContext.methodCheck = methodCheck;
-            unboundSym = origUnboundSym = lookupMethod(unboundEnv, env.tree.pos(),
+            unboundSym = lookupMethod(unboundEnv, env.tree.pos(),
                     site.tsym, unboundSearchResolveContext, unboundLookupHelper);
-
-            if (unboundSym.kind != WRONG_MTH && unboundSym.kind != WRONG_MTHS) {
-                if (shouldCheckForStaticness) {
-                    if (unboundSym.isStatic()) {
-                        staticErrorForUnbound = true;
-                        if (hasAnotherApplicableMethod(
-                                unboundSearchResolveContext, unboundSym, false)) {
-                            unboundSearchResultKind = SearchResultKind.BAD_MATCH_MORE_SPECIFIC;
-                        } else {
-                            unboundSearchResultKind = SearchResultKind.BAD_MATCH;
-                            if (!unboundSym.kind.isOverloadError()) {
-                                unboundSym = methodWithCorrectStaticnessNotFound;
-                            }
-                        }
-                    } else if (!unboundSym.kind.isOverloadError()) {
-                        unboundSearchResultKind = SearchResultKind.GOOD_MATCH;
-                    }
-                }
-            }
+            unboundRes = new ReferenceLookupResult(unboundSym, unboundSearchResolveContext);
         }
 
         //merge results
         Pair<Symbol, ReferenceLookupHelper> res;
-        Symbol bestSym = choose(boundSym, unboundSym);
-        if (!bestSym.kind.isOverloadError() &&
-            (staticErrorForBound || staticErrorForUnbound)) {
-            if (staticErrorForBound) {
-                boundSym = methodWithCorrectStaticnessNotFound;
-            }
-            if (staticErrorForUnbound) {
-                unboundSym = methodWithCorrectStaticnessNotFound;
-            }
-            bestSym = choose(boundSym, unboundSym);
-        }
-        if (bestSym == methodWithCorrectStaticnessNotFound && mode == AttrMode.CHECK) {
-            Symbol symToPrint = origBoundSym;
-            String errorFragmentToPrint = "non-static.cant.be.ref";
-            if (staticErrorForBound && staticErrorForUnbound) {
-                if (unboundSearchResultKind == SearchResultKind.BAD_MATCH_MORE_SPECIFIC) {
-                    symToPrint = origUnboundSym;
-                    errorFragmentToPrint = "static.method.in.unbound.lookup";
-                }
-            } else {
-                if (!staticErrorForBound) {
-                    symToPrint = origUnboundSym;
-                    errorFragmentToPrint = "static.method.in.unbound.lookup";
-                }
-            }
-            log.error(referenceTree.expr.pos(), "invalid.mref",
-                Kinds.kindName(referenceTree.getMode()),
-                diags.fragment(errorFragmentToPrint,
-                Kinds.kindName(symToPrint), symToPrint));
-        }
+        Symbol bestSym = referenceChooser.result(boundRes, unboundRes);
         res = new Pair<>(bestSym,
                 bestSym == unboundSym ? unboundLookupHelper : boundLookupHelper);
         env.info.pendingResolutionPhase = bestSym == unboundSym ?
@@ -2892,67 +2764,213 @@
         return res;
     }
 
-    enum SearchResultKind {
-        GOOD_MATCH,                 //type I
-        BAD_MATCH_MORE_SPECIFIC,    //type II
-        BAD_MATCH,                  //type III
-        NOT_APPLICABLE_MATCH        //type IV
-    }
-
-    boolean hasAnotherApplicableMethod(MethodResolutionContext resolutionContext,
-            Symbol bestSoFar, boolean staticMth) {
-        for (Candidate c : resolutionContext.candidates) {
-            if (resolutionContext.step != c.step ||
-                !c.isApplicable() ||
-                c.sym == bestSoFar) {
-                continue;
-            } else {
-                if (c.sym.isStatic() == staticMth) {
-                    return true;
+    /**
+     * This class is used to represent a method reference lookup result. It keeps track of two
+     * things: (i) the symbol found during a method reference lookup and (ii) the static kind
+     * of the lookup (see {@link com.sun.tools.javac.comp.Resolve.ReferenceLookupResult.StaticKind}).
+     */
+    static class ReferenceLookupResult {
+
+        /**
+         * Static kind associated with a method reference lookup. Erroneous lookups end up with
+         * the UNDEFINED kind; successful lookups will end up with either STATIC, NON_STATIC,
+         * depending on whether all applicable candidates are static or non-static methods,
+         * respectively. If a successful lookup has both static and non-static applicable methods,
+         * its kind is set to BOTH.
+         */
+        enum StaticKind {
+            STATIC,
+            NON_STATIC,
+            BOTH,
+            UNDEFINED;
+
+            /**
+             * Retrieve the static kind associated with a given (method) symbol.
+             */
+            static StaticKind from(Symbol s) {
+                return s.isStatic() ?
+                        STATIC : NON_STATIC;
+            }
+
+            /**
+             * Merge two static kinds together.
+             */
+            static StaticKind reduce(StaticKind sk1, StaticKind sk2) {
+                if (sk1 == UNDEFINED) {
+                    return sk2;
+                } else if (sk2 == UNDEFINED) {
+                    return sk1;
+                } else {
+                    return sk1 == sk2 ? sk1 : BOTH;
                 }
             }
         }
-        return false;
-    }
-
-    //where
-        private Symbol choose(Symbol boundSym, Symbol unboundSym) {
-            if (lookupSuccess(boundSym) && lookupSuccess(unboundSym)) {
-                return ambiguityError(boundSym, unboundSym);
-            } else if (lookupSuccess(boundSym) ||
-                    (canIgnore(unboundSym) && !canIgnore(boundSym))) {
-                return boundSym;
-            } else if (lookupSuccess(unboundSym) ||
-                    (canIgnore(boundSym) && !canIgnore(unboundSym))) {
-                return unboundSym;
-            } else {
-                return boundSym;
+
+        /** The static kind. */
+        StaticKind staticKind;
+
+        /** The lookup result. */
+        Symbol sym;
+
+        ReferenceLookupResult(Symbol sym, MethodResolutionContext resolutionContext) {
+            this.staticKind = staticKind(sym, resolutionContext);
+            this.sym = sym;
+        }
+
+        private StaticKind staticKind(Symbol sym, MethodResolutionContext resolutionContext) {
+            switch (sym.kind) {
+                case MTH:
+                case AMBIGUOUS:
+                    return resolutionContext.candidates.stream()
+                            .filter(c -> c.isApplicable() && c.step == resolutionContext.step)
+                            .map(c -> StaticKind.from(c.sym))
+                            .reduce(StaticKind::reduce)
+                            .orElse(StaticKind.UNDEFINED);
+                case HIDDEN:
+                    return StaticKind.from(((AccessError)sym).sym);
+                default:
+                    return StaticKind.UNDEFINED;
             }
         }
 
-        private boolean lookupSuccess(Symbol s) {
-            return s.kind == MTH || s.kind == AMBIGUOUS;
+        /**
+         * Does this result corresponds to a successful lookup (i.e. one where a method has been found?)
+         */
+        boolean isSuccess() {
+            return staticKind != StaticKind.UNDEFINED;
         }
 
-        private boolean canIgnore(Symbol s) {
-            switch (s.kind) {
+        /**
+         * Does this result have given static kind?
+         */
+        boolean hasKind(StaticKind sk) {
+            return this.staticKind == sk;
+        }
+
+        /**
+         * Error recovery helper: can this lookup result be ignored (for the purpose of returning
+         * some 'better' result) ?
+         */
+        boolean canIgnore() {
+            switch (sym.kind) {
                 case ABSENT_MTH:
                     return true;
                 case WRONG_MTH:
                     InapplicableSymbolError errSym =
-                            (InapplicableSymbolError)s.baseSymbol();
+                            (InapplicableSymbolError)sym.baseSymbol();
                     return new Template(MethodCheckDiag.ARITY_MISMATCH.regex())
                             .matches(errSym.errCandidate().snd);
                 case WRONG_MTHS:
                     InapplicableSymbolsError errSyms =
-                            (InapplicableSymbolsError)s.baseSymbol();
+                            (InapplicableSymbolsError)sym.baseSymbol();
                     return errSyms.filterCandidates(errSyms.mapCandidates()).isEmpty();
-                case WRONG_STATICNESS:
-                    return false;
                 default:
                     return false;
             }
         }
+    }
+
+    /**
+     * This abstract class embodies the logic that converts one (bound lookup) or two (unbound lookup)
+     * {@code ReferenceLookupResult} objects into a (@code Symbol), which is then regarded as the
+     * result of method reference resolution.
+     */
+    abstract class ReferenceChooser {
+        /**
+         * Generate a result from a pair of lookup result objects. This method delegates to the
+         * appropriate result generation routine.
+         */
+        Symbol result(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
+            return unboundRes != referenceNotFound ?
+                    unboundResult(boundRes, unboundRes) :
+                    boundResult(boundRes);
+        }
+
+        /**
+         * Generate a symbol from a given bound lookup result.
+         */
+        abstract Symbol boundResult(ReferenceLookupResult boundRes);
+
+        /**
+         * Generate a symbol from a pair of bound/unbound lookup results.
+         */
+        abstract Symbol unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes);
+    }
+
+    /**
+     * This chooser implements the selection strategy used during a full lookup; this logic
+     * is described in JLS SE 8 (15.3.2).
+     */
+    ReferenceChooser basicReferenceChooser = new ReferenceChooser() {
+
+        @Override
+        Symbol boundResult(ReferenceLookupResult boundRes) {
+            return !boundRes.isSuccess() || boundRes.hasKind(StaticKind.NON_STATIC) ?
+                    boundRes.sym : //the search produces a non-static method
+                    new BadMethodReferenceError(boundRes.sym, false);
+        }
+
+        @Override
+        Symbol unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
+            if (boundRes.hasKind(StaticKind.STATIC) &&
+                    (!unboundRes.isSuccess() || unboundRes.hasKind(StaticKind.STATIC))) {
+                //the first search produces a static method and no non-static method is applicable
+                //during the second search
+                return boundRes.sym;
+            } else if (unboundRes.hasKind(StaticKind.NON_STATIC) &&
+                    (!boundRes.isSuccess() || boundRes.hasKind(StaticKind.NON_STATIC))) {
+                //the second search produces a non-static method and no static method is applicable
+                //during the first search
+                return unboundRes.sym;
+            } else if (boundRes.isSuccess() && unboundRes.isSuccess()) {
+                //both searches produce some result; ambiguity (error recovery)
+                return ambiguityError(boundRes.sym, unboundRes.sym);
+            } else if (boundRes.isSuccess() || unboundRes.isSuccess()) {
+                //Both searches failed to produce a result with correct staticness (i.e. first search
+                //produces an non-static method). Alternatively, a given search produced a result
+                //with the right staticness, but the other search has applicable methods with wrong
+                //staticness (error recovery)
+                return new BadMethodReferenceError(boundRes.isSuccess() ? boundRes.sym : unboundRes.sym, true);
+            } else {
+                //both searches fail to produce a result - pick 'better' error using heuristics (error recovery)
+                return (boundRes.canIgnore() && !unboundRes.canIgnore()) ?
+                        unboundRes.sym : boundRes.sym;
+            }
+        }
+    };
+
+    /**
+     * This chooser implements the selection strategy used during an arity-based lookup; this logic
+     * is described in JLS SE 8 (15.12.2.1).
+     */
+    ReferenceChooser structuralReferenceChooser = new ReferenceChooser() {
+
+        @Override
+        Symbol boundResult(ReferenceLookupResult boundRes) {
+            return (!boundRes.isSuccess() || !boundRes.hasKind(StaticKind.STATIC)) ?
+                    boundRes.sym : //the search has at least one applicable non-static method
+                    new BadMethodReferenceError(boundRes.sym, false);
+        }
+
+        @Override
+        Symbol unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
+            if (boundRes.isSuccess() && !boundRes.hasKind(StaticKind.NON_STATIC)) {
+                //the first serach has at least one applicable static method
+                return boundRes.sym;
+            } else if (unboundRes.isSuccess() && !unboundRes.hasKind(StaticKind.STATIC)) {
+                //the second search has at least one applicable non-static method
+                return unboundRes.sym;
+            } else if (boundRes.isSuccess() || unboundRes.isSuccess()) {
+                //either the first search produces a non-static method, or second search produces
+                //a non-static method (error recovery)
+                return new BadMethodReferenceError(boundRes.isSuccess() ? boundRes.sym : unboundRes.sym, true);
+            } else {
+                //both searches fail to produce a result - pick 'better' error using heuristics (error recovery)
+                return (boundRes.canIgnore() && !unboundRes.canIgnore()) ?
+                        unboundRes.sym : boundRes.sym;
+            }
+        }
+    };
 
     /**
      * Helper for defining custom method-like lookup logic; a lookup helper
@@ -3070,22 +3088,7 @@
          * method returns an dummy lookup helper.
          */
         ReferenceLookupHelper unboundLookup(InferenceContext inferenceContext) {
-            //dummy loopkup helper that always return 'methodNotFound'
-            return new ReferenceLookupHelper(referenceTree, name, site, argtypes, typeargtypes, maxPhase) {
-                @Override
-                ReferenceLookupHelper unboundLookup(InferenceContext inferenceContext) {
-                    return this;
-                }
-                @Override
-                Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) {
-                    return methodNotFound;
-                }
-                @Override
-                ReferenceKind referenceKind(Symbol sym) {
-                    Assert.error();
-                    return null;
-                }
-            };
+            return null;
         }
 
         /**
@@ -3124,12 +3127,31 @@
 
         @Override
         ReferenceLookupHelper unboundLookup(InferenceContext inferenceContext) {
-            if (TreeInfo.isStaticSelector(referenceTree.expr, names) &&
-                    argtypes.nonEmpty() &&
-                    (argtypes.head.hasTag(NONE) ||
-                    types.isSubtypeUnchecked(inferenceContext.asUndetVar(argtypes.head), site))) {
-                return new UnboundMethodReferenceLookupHelper(referenceTree, name,
-                        site, argtypes, typeargtypes, maxPhase);
+            if (TreeInfo.isStaticSelector(referenceTree.expr, names)) {
+                if (argtypes.nonEmpty() &&
+                        (argtypes.head.hasTag(NONE) ||
+                        types.isSubtypeUnchecked(inferenceContext.asUndetVar(argtypes.head), site))) {
+                    return new UnboundMethodReferenceLookupHelper(referenceTree, name,
+                            site, argtypes, typeargtypes, maxPhase);
+                } else {
+                    return new ReferenceLookupHelper(referenceTree, name, site, argtypes, typeargtypes, maxPhase) {
+                        @Override
+                        ReferenceLookupHelper unboundLookup(InferenceContext inferenceContext) {
+                            return this;
+                        }
+
+                        @Override
+                        Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) {
+                            return methodNotFound;
+                        }
+
+                        @Override
+                        ReferenceKind referenceKind(Symbol sym) {
+                            Assert.error();
+                            return null;
+                        }
+                    };
+                }
             } else {
                 return super.unboundLookup(inferenceContext);
             }
@@ -3231,16 +3253,10 @@
                 findDiamond(env, site, argtypes, typeargtypes, phase.isBoxingRequired(), phase.isVarargsRequired()) :
                 findMethod(env, site, name, argtypes, typeargtypes,
                         phase.isBoxingRequired(), phase.isVarargsRequired(), syms.operatorNames.contains(name));
-            return sym.kind != MTH ||
-                          site.getEnclosingType().hasTag(NONE) ||
-                          hasEnclosingInstance(env, site) ?
-                          sym : new InvalidSymbolError(MISSING_ENCL, sym, null) {
-                    @Override
-                    JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
-                       return diags.create(dkind, log.currentSource(), pos,
-                            "cant.access.inner.cls.constr", site.tsym.name, argtypes, site.getEnclosingType());
-                    }
-                };
+            return (sym.kind != MTH ||
+                    site.getEnclosingType().hasTag(NONE) ||
+                    hasEnclosingInstance(env, site)) ?
+                    sym : new BadConstructorReferenceError(sym);
         }
 
         @Override
@@ -3613,8 +3629,7 @@
                 hasLocation = !location.name.equals(names._this) &&
                         !location.name.equals(names._super);
             }
-            boolean isConstructor = (kind == ABSENT_MTH || kind == WRONG_STATICNESS) &&
-                    name == names.init;
+            boolean isConstructor = name == names.init;
             KindName kindname = isConstructor ? KindName.CONSTRUCTOR : kind.absentKind();
             Name idname = isConstructor ? site.tsym.name : name;
             String errKey = getErrorKey(kindname, typeargtypes.nonEmpty(), hasLocation);
@@ -4019,13 +4034,13 @@
             Name sname = s1.name;
             if (sname == names.init) sname = s1.owner.name;
             return diags.create(dkind, log.currentSource(),
-                      pos, "ref.ambiguous", sname,
-                      kindName(s1),
-                      s1,
-                      s1.location(site, types),
-                      kindName(s2),
-                      s2,
-                      s2.location(site, types));
+                    pos, "ref.ambiguous", sname,
+                    kindName(s1),
+                    s1,
+                    s1.location(site, types),
+                    kindName(s2),
+                    s2,
+                    s2.location(site, types));
         }
 
         /**
@@ -4108,6 +4123,52 @@
     }
 
     /**
+     * BadMethodReferenceError error class indicating that a method reference symbol has been found,
+     * but with the wrong staticness.
+     */
+    class BadMethodReferenceError extends StaticError {
+
+        boolean unboundLookup;
+
+        public BadMethodReferenceError(Symbol sym, boolean unboundLookup) {
+            super(sym);
+            this.unboundLookup = unboundLookup;
+        }
+
+        @Override
+        JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
+            final String key;
+            if (!unboundLookup) {
+                key = "bad.static.method.in.bound.lookup";
+            } else if (sym.isStatic()) {
+                key = "bad.static.method.in.unbound.lookup";
+            } else {
+                key = "bad.instance.method.in.unbound.lookup";
+            }
+            return sym.kind.isOverloadError() ?
+                    ((ResolveError)sym).getDiagnostic(dkind, pos, location, site, name, argtypes, typeargtypes) :
+                    diags.create(dkind, log.currentSource(), pos, key, Kinds.kindName(sym), sym);
+        }
+    }
+
+    /**
+     * BadConstructorReferenceError error class indicating that a constructor reference symbol has been found,
+     * but pointing to a class for which an enclosing instance is not available.
+     */
+    class BadConstructorReferenceError extends InvalidSymbolError {
+
+        public BadConstructorReferenceError(Symbol sym) {
+            super(MISSING_ENCL, sym, "BadConstructorReferenceError");
+        }
+
+        @Override
+        JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
+           return diags.create(dkind, log.currentSource(), pos,
+                "cant.access.inner.cls.constr", site.tsym.name, argtypes, site.getEnclosingType());
+        }
+    }
+
+    /**
      * Helper class for method resolution diagnostic simplification.
      * Certain resolution diagnostic are rewritten as simpler diagnostic
      * where the enclosing resolution diagnostic (i.e. 'inapplicable method')
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Fri Jan 16 12:34:58 2015 -0800
@@ -1000,6 +1000,7 @@
              l.nonEmpty();
              l = l.tail) {
             ClassSymbol inner = l.head;
+            inner.markAbstractIfNeeded(types);
             char flags = (char) adjustFlags(inner.flags_field);
             if ((flags & INTERFACE) != 0) flags |= ABSTRACT; // Interfaces are always ABSTRACT
             if (inner.name.isEmpty()) flags &= ~FINAL; // Anonymous class: unset FINAL flag
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Jan 16 12:34:58 2015 -0800
@@ -1209,15 +1209,7 @@
                             if (annos.nonEmpty()) {
                                 t = toP(F.at(pos).AnnotatedType(annos, t));
                             }
-                            // .class is only allowed if there were no annotations
-                            JCExpression nt = bracketsSuffix(t);
-                            if (nt != t && (annos.nonEmpty() || TreeInfo.containsTypeAnnotation(t))) {
-                                // t and nt are different if bracketsSuffix parsed a .class.
-                                // The check for nonEmpty covers the case when the whole array is annotated.
-                                // Helper method isAnnotated looks for annos deeply within t.
-                                syntaxError("no.annotations.on.dot.class");
-                            }
-                            t = nt;
+                            t = bracketsSuffix(t);
                         } else {
                             if ((mode & EXPR) != 0) {
                                 mode = EXPR;
@@ -1956,6 +1948,12 @@
                 }
                 t = F.at(pos).Erroneous(List.<JCTree>of(toP(F.at(pos).Select(t, name))));
             } else {
+                Tag tag = t.getTag();
+                // Type annotations are illegal on class literals. Annotated non array class literals
+                // are complained about directly in term3(), Here check for type annotations on dimensions
+                // taking care to handle some interior dimension(s) being annotated.
+                if ((tag == TYPEARRAY && TreeInfo.containsTypeAnnotation(t)) || tag == ANNOTATED_TYPE)
+                    syntaxError("no.annotations.on.dot.class");
                 t = toP(F.at(pos).Select(t, names._class));
             }
         } else if ((mode & TYPE) != 0) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacMessager.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacMessager.java	Fri Jan 16 12:34:58 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 import com.sun.tools.javac.model.JavacElements;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.DefinedBy.Api;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.*;
 import javax.lang.model.element.*;
@@ -113,13 +114,7 @@
             switch (kind) {
             case ERROR:
                 errorCount++;
-                boolean prev = log.multipleErrors;
-                log.multipleErrors = true;
-                try {
-                    log.error(pos, "proc.messager", msg.toString());
-                } finally {
-                    log.multipleErrors = prev;
-                }
+                log.error(DiagnosticFlag.MULTIPLE, pos, "proc.messager", msg.toString());
                 break;
 
             case WARNING:
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Jan 15 13:09:52 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Jan 16 12:34:58 2015 -0800
@@ -262,9 +262,6 @@
 compiler.misc.static.mref.with.targs=\
     parameterized qualifier on static method reference
 
-compiler.misc.static.bound.mref=\
-    static bound method reference
-
 # 0: symbol
 compiler.err.cant.assign.val.to.final.var=\
     cannot assign a value to final variable {0}
@@ -2050,12 +2047,16 @@
     non-static {0} {1} cannot be referenced from a static context
 
 # 0: symbol kind, 1: symbol
-compiler.misc.non-static.cant.be.ref=\
-    non-static {0} {1} cannot be referenced from a static context
+compiler.misc.bad.static.method.in.unbound.lookup=\
+    unexpected static {0} {1} found in unbound lookup
 
 # 0: symbol kind, 1: symbol
-compiler.misc.static.method.in.unbound.lookup=\
-    static {0} {1} found in unbound lookup
+compiler.misc.bad.instance.method.in.unbound.lookup=\
+    unexpected instance {0} {1} found in unbound lookup
+
+# 0: symbol kind, 1: symbol
+compiler.misc.bad.static.method.in.bound.lookup=\
+    unexpected static {0} {1} found in bound lookup
 
 ## Both arguments ({0}, {1}) are "kindname"s.  {0} is a comma-separated list
 ## of kindnames (the list should be identical to that provided in source.
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Fri Jan 16 12:34:58 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,7 +112,7 @@
          */
         public JCDiagnostic error(
                 DiagnosticFlag flag, DiagnosticSource source, DiagnosticPosition pos, Error errorKey) {
-            JCDiagnostic diag = create(null, defaultErrorFlags, source, pos, errorKey);
+            JCDiagnostic diag = create(null, EnumSet.copyOf(defaultErrorFlags), source, pos, errorKey);
             if (flag != null) {
                 diag.setFlag(flag);
             }
@@ -432,7 +432,10 @@
         SYNTAX,
         RECOVERABLE,
         NON_DEFERRABLE,
-        COMPRESSED
+        COMPRESSED,
+        /** Print multiple errors for same source locations.
+         */
+        MULTIPLE;
     }
 
     private final DiagnosticSource source;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/List.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/List.java	Fri Jan 16 12:34:58 2015 -0800
@@ -33,6 +33,7 @@
 import java.util.AbstractCollection;
 import java.util.ListIterator;
 import java.util.NoSuchElementException;
+import java.util.stream.Collector;
 
 /** A class for generic linked lists. Links are supposed to be
  *  immutable, the only exception being the incremental construction of
@@ -537,4 +538,14 @@
 
         return Collections.unmodifiableList(a);
     }
+
+    /**
+     * Collect elements into a new list (using a @code{ListBuffer})
+     */
+    public static <Z> Collector<Z, ListBuffer<Z>, List<Z>> collector() {
+        return Collector.of(ListBuffer::new,
+                (buf, el)->buf.add(el),
+                (buf1, buf2)-> { buf1.addAll(buf2); return buf1; },
+                buf->buf.toList());
+    }
 }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java	Fri Jan 16 12:34:58 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@
 import com.sun.tools.javac.main.Main;
 import com.sun.tools.javac.main.Option;
 import com.sun.tools.javac.tree.EndPosTable;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
 
@@ -191,10 +192,6 @@
      */
     public boolean dumpOnError;
 
-    /** Print multiple errors for same source locations.
-     */
-    public boolean multipleErrors;
-
     /**
      * Diagnostic listener, if provided through programmatic
      * interface to javac (JSR 199).
@@ -417,7 +414,7 @@
      * source name and pos.
      */
     protected boolean shouldReport(JavaFileObject file, int pos) {
-        if (multipleErrors || file == null)
+        if (file == null)
             return true;
 
         Pair<JavaFileObject,Integer> coords = new Pair<>(file, pos);
@@ -580,8 +577,9 @@
                 break;
 
             case ERROR:
-                if (nerrors < MaxErrors
-                    && shouldReport(diagnostic.getSource(), diagnostic.getIntPosition())) {
+                if (nerrors < MaxErrors &&
+                    (diagnostic.isFlagSet(DiagnosticFlag.MULTIPLE) ||
+                     shouldReport(diagnostic.getSource(), diagnostic.getIntPosition()))) {
                     writeDiagnostic(diagnostic);
                     nerrors++;
                 }
--- a/test/tools/doclint/AnchorTest.out	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/doclint/AnchorTest.out	Fri Jan 16 12:34:58 2015 -0800
@@ -1,4 +1,4 @@
-AnchorTest.java:19: error: anchor already defined: foo
+AnchorTest.java:19: error: anchor already defined: "foo"
      * <a name=foo></a>
           ^
 AnchorTest.java:24: error: invalid name for anchor: ""
@@ -10,28 +10,40 @@
 AnchorTest.java:34: error: no value given for anchor
      * <a name ></a>
           ^
-AnchorTest.java:46: error: anchor already defined: foo
+AnchorTest.java:46: error: anchor already defined: "foo"
      * <a id=foo></a>
           ^
 AnchorTest.java:51: error: invalid name for anchor: ""
      * <a id=></a>
           ^
+AnchorTest.java:51: error: anchor already defined: ""
+     * <a id=></a>
+          ^
 AnchorTest.java:56: error: invalid name for anchor: "123"
      * <a id=123 ></a>
           ^
+AnchorTest.java:56: error: anchor already defined: "123"
+     * <a id=123 ></a>
+          ^
 AnchorTest.java:61: error: no value given for anchor
      * <a id ></a>
           ^
-AnchorTest.java:73: error: anchor already defined: foo
+AnchorTest.java:73: error: anchor already defined: "foo"
      * <p id=foo>text</p>
           ^
 AnchorTest.java:78: error: invalid name for anchor: ""
      * <p id=>text</p>
           ^
+AnchorTest.java:78: error: anchor already defined: ""
+     * <p id=>text</p>
+          ^
 AnchorTest.java:83: error: invalid name for anchor: "123"
      * <p id=123 >text</p>
           ^
+AnchorTest.java:83: error: anchor already defined: "123"
+     * <p id=123 >text</p>
+          ^
 AnchorTest.java:88: error: no value given for anchor
      * <p id >text</p>
           ^
-12 errors
+16 errors
--- a/test/tools/doclint/AnchorTest2.out	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/doclint/AnchorTest2.out	Fri Jan 16 12:34:58 2015 -0800
@@ -1,4 +1,4 @@
-AnchorTest2.java:15: error: anchor already defined: AnchorTest2
+AnchorTest2.java:15: error: anchor already defined: "AnchorTest2"
     /** <a name="AnchorTest2"> </a> */
            ^
 1 error
--- a/test/tools/doclint/HtmlTagsTest.out	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/doclint/HtmlTagsTest.out	Fri Jan 16 12:34:58 2015 -0800
@@ -13,6 +13,9 @@
 HtmlTagsTest.java:28: error: element not allowed in documentation comments: <html>
      * <html>
        ^
+HtmlTagsTest.java:28: error: element not closed: html
+     * <html>
+       ^
 HtmlTagsTest.java:33: error: block element not allowed within inline element <span>: p
      * <span> <p> </span>
               ^
@@ -40,5 +43,5 @@
 HtmlTagsTest.java:64: error: tag not allowed here: <b>
      * <ul> <b>text</b> <li> ... </li> </ul>
             ^
-13 errors
-1 warning
+14 errors
+1 warning
\ No newline at end of file
--- a/test/tools/doclint/anchorTests/p/Test.javac.out	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/doclint/anchorTests/p/Test.javac.out	Fri Jan 16 12:34:58 2015 -0800
@@ -1,7 +1,7 @@
-Test.java:14:7: compiler.err.proc.messager: anchor already defined: dupTest
-Test.java:24:12: compiler.err.proc.messager: anchor already defined: dupTestField
-Test.java:27:12: compiler.err.proc.messager: anchor already defined: dupTestMethod
-Test.java:32:11: compiler.err.proc.messager: anchor already defined: dupNested
-Test.java:40:15: compiler.err.proc.messager: anchor already defined: dupNestedField
-Test.java:47:15: compiler.err.proc.messager: anchor already defined: dupNestedMethod
+Test.java:14:7: compiler.err.proc.messager: anchor already defined: "dupTest"
+Test.java:24:12: compiler.err.proc.messager: anchor already defined: "dupTestField"
+Test.java:27:12: compiler.err.proc.messager: anchor already defined: "dupTestMethod"
+Test.java:32:11: compiler.err.proc.messager: anchor already defined: "dupNested"
+Test.java:40:15: compiler.err.proc.messager: anchor already defined: "dupNestedField"
+Test.java:47:15: compiler.err.proc.messager: anchor already defined: "dupNestedMethod"
 6 errors
--- a/test/tools/doclint/anchorTests/p/Test.out	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/doclint/anchorTests/p/Test.out	Fri Jan 16 12:34:58 2015 -0800
@@ -1,19 +1,19 @@
-Test.java:14: error: anchor already defined: dupTest
+Test.java:14: error: anchor already defined: "dupTest"
  * <a name="dupTest">dupTest again</a>
       ^
-Test.java:24: error: anchor already defined: dupTestField
+Test.java:24: error: anchor already defined: "dupTestField"
     /** <a name="dupTestField">dupTestField again</a> */
            ^
-Test.java:27: error: anchor already defined: dupTestMethod
+Test.java:27: error: anchor already defined: "dupTestMethod"
     /** <a name="dupTestMethod">dupTestMethod again</a> */
            ^
-Test.java:32: error: anchor already defined: dupNested
+Test.java:32: error: anchor already defined: "dupNested"
      * <a name="dupNested">dupNested again</a>
           ^
-Test.java:40: error: anchor already defined: dupNestedField
+Test.java:40: error: anchor already defined: "dupNestedField"
          * <a name="dupNestedField">dupNestedField</a>
               ^
-Test.java:47: error: anchor already defined: dupNestedMethod
+Test.java:47: error: anchor already defined: "dupNestedMethod"
          * <a name="dupNestedMethod">dupNestedMethod</a>
               ^
 6 errors
--- a/test/tools/doclint/anchorTests/p/package-info.javac.out	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/doclint/anchorTests/p/package-info.javac.out	Fri Jan 16 12:34:58 2015 -0800
@@ -1,2 +1,2 @@
-package-info.java:12:7: compiler.err.proc.messager: anchor already defined: here
+package-info.java:12:7: compiler.err.proc.messager: anchor already defined: "here"
 1 error
--- a/test/tools/doclint/anchorTests/p/package-info.out	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/doclint/anchorTests/p/package-info.out	Fri Jan 16 12:34:58 2015 -0800
@@ -1,4 +1,4 @@
-package-info.java:12: error: anchor already defined: here
+package-info.java:12: error: anchor already defined: "here"
  * <a name=here>here again</a>
       ^
 1 error
--- a/test/tools/doclint/tidy/AnchorAlreadyDefined.out	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/doclint/tidy/AnchorAlreadyDefined.out	Fri Jan 16 12:34:58 2015 -0800
@@ -1,7 +1,7 @@
-AnchorAlreadyDefined.java:14: error: anchor already defined: here
+AnchorAlreadyDefined.java:14: error: anchor already defined: "here"
  * <a name="here">duplicate</a>
       ^
-AnchorAlreadyDefined.java:15: error: anchor already defined: here
+AnchorAlreadyDefined.java:15: error: anchor already defined: "here"
  * <h1 id="here">duplicate</h1>
        ^
 2 errors
--- a/test/tools/javac/6304921/TestLog.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/javac/6304921/TestLog.java	Fri Jan 16 12:34:58 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,10 +26,11 @@
  * @bug 6304912
  * @summary unit test for Log
  */
+import java.lang.reflect.Field;
 import java.io.InputStream;
-import java.io.IOException;
 import java.io.OutputStream;
 import java.net.URI;
+import java.util.Set;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
 import com.sun.tools.javac.file.JavacFileManager;
@@ -41,23 +42,34 @@
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.JCDiagnostic;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
+import com.sun.tools.javac.util.JCDiagnostic.Factory;
 import com.sun.tools.javac.util.Options;
 
 public class TestLog
 {
-    public static void main(String... args) throws IOException {
+    public static void main(String... args) throws Exception {
         test(false);
         test(true);
     }
 
-    static void test(boolean genEndPos) throws IOException {
+    static void test(boolean genEndPos) throws Exception {
         Context context = new Context();
 
         Options options = Options.instance(context);
         options.put("diags", "%b:%s/%o/%e:%_%t%m|%p%m");
 
         Log log = Log.instance(context);
-        log.multipleErrors = true;
+        Factory diagnosticFactory = JCDiagnostic.Factory.instance(context);
+        Field defaultErrorFlagsField =
+                JCDiagnostic.Factory.class.getDeclaredField("defaultErrorFlags");
+
+        defaultErrorFlagsField.setAccessible(true);
+
+        Set<DiagnosticFlag> defaultErrorFlags =
+                (Set<DiagnosticFlag>) defaultErrorFlagsField.get(diagnosticFactory);
+
+        defaultErrorFlags.add(DiagnosticFlag.MULTIPLE);
 
         JavacFileManager.preRegister(context);
         ParserFactory pfac = ParserFactory.instance(context);
--- a/test/tools/javac/MethodParameters/ClassFileVisitor.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/javac/MethodParameters/ClassFileVisitor.java	Fri Jan 16 12:34:58 2015 -0800
@@ -147,6 +147,7 @@
         public int mAttrs;
         public int mNumParams;
         public boolean mSynthetic;
+        public boolean mIsLambda;
         public boolean mIsConstructor;
         public boolean mIsClinit;
         public boolean mIsBridge;
@@ -165,6 +166,7 @@
             mIsClinit = mName.equals("<clinit>");
             prefix = cname + "." + mName + "() - ";
             mIsBridge = method.access_flags.is(AccessFlags.ACC_BRIDGE);
+            mIsLambda = mSynthetic && mName.startsWith("lambda$");
 
             if (mIsClinit) {
                 sb = new StringBuilder(); // Discard output
@@ -225,7 +227,7 @@
 
             // IMPL: Whether MethodParameters attributes will be generated
             // for some synthetics is unresolved. For now, assume no.
-            if (mSynthetic) {
+            if (mSynthetic && !mIsLambda) {
                 warn(prefix + "synthetic has MethodParameter attribute");
             }
 
@@ -349,10 +351,12 @@
             } else if (isEnum && mNumParams == 1 && index == 0 && mName.equals("valueOf")) {
                 expect = "name";
                 allowMandated = true;
-            } else if (mIsBridge) {
+            } else if (mIsBridge || mIsLambda) {
                 allowSynthetic = true;
                 /*  you can't expect an special name for bridges' parameters.
-                 *  The name of the original parameters are now copied.
+                 *  The name of the original parameters are now copied. Likewise
+                 *  for a method encoding the lambda expression, names are derived
+                 *  from source lambda's parameters and captured enclosing locals.
                  */
                 expect = null;
             }
--- a/test/tools/javac/MethodParameters/LambdaTest.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/javac/MethodParameters/LambdaTest.java	Fri Jan 16 12:34:58 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8006582
+ * @bug 8006582 8037546
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters LambdaTest.java
@@ -31,8 +31,8 @@
  */
 
 /**
- * Parameter names are not recorded for lambdas. This test verifies
- * that there are no MethodParameters attribute for lambdas.
+ * Post https://bugs.openjdk.java.net/browse/JDK-8037546, this test verifies
+ * that MethodParameters attribute for lambdas are emitted properly.
  */
 class LambdaTest {
 
--- a/test/tools/javac/MethodParameters/LambdaTest.out	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/javac/MethodParameters/LambdaTest.out	Fri Jan 16 12:34:58 2015 -0800
@@ -1,7 +1,7 @@
 class LambdaTest -- 
 LambdaTest.<init>()
 LambdaTest.foo(i)
-LambdaTest.lambda$static$1(arg0)/*synthetic*/
-LambdaTest.lambda$null$0(arg0, arg1)/*synthetic*/
+LambdaTest.lambda$static$1(x1/*synthetic*/)/*synthetic*/
+LambdaTest.lambda$null$0(final cap$0/*synthetic*/, x2/*synthetic*/)/*synthetic*/
 static interface LambdaTest$I -- inner
 LambdaTest$I.m(x)
--- a/test/tools/javac/MethodParameters/ReflectionVisitor.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/javac/MethodParameters/ReflectionVisitor.java	Fri Jan 16 12:34:58 2015 -0800
@@ -277,7 +277,7 @@
                     param = "final " + param;
                 }
                 sb.append(sep).append(param);
-                if (!m.isBridge() && !expect.equals(param)) {
+                if (!m.isBridge() && !m.getName().startsWith("lambda$") && !expect.equals(param)) {
                     error(prefix + "param[" + i + "]='"
                           + param + "' expected '" + expect + "'");
                     break;
--- a/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedClassExpr.java	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedClassExpr.java	Fri Jan 16 12:34:58 2015 -0800
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8027262
+ * @bug 8027262 8027888
  * @summary A class expression cannot be annotated.
  * @compile/fail/ref=AnnotatedClassExpr.out -XDrawDiagnostics AnnotatedClassExpr.java
  */
@@ -10,6 +10,12 @@
 class AnnotatedClassExpr {
   static void main() {
     Object o1 = @A int.class;
+    o1 = @A int [] . class;
+    o1 = int @A [] . class;
+    o1 = int [] @A [] . class;
+    o1 = AnnotatedClassExpr @A [] .class;
+    o1 = @A AnnotatedClassExpr @A [] .class;
+    o1 = @A AnnotatedClassExpr.class;
   }
 }
 
--- a/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedClassExpr.out	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedClassExpr.out	Fri Jan 16 12:34:58 2015 -0800
@@ -1,2 +1,8 @@
 AnnotatedClassExpr.java:12:29: compiler.err.no.annotations.on.dot.class
-1 error
+AnnotatedClassExpr.java:13:27: compiler.err.no.annotations.on.dot.class
+AnnotatedClassExpr.java:14:27: compiler.err.no.annotations.on.dot.class
+AnnotatedClassExpr.java:15:30: compiler.err.no.annotations.on.dot.class
+AnnotatedClassExpr.java:16:41: compiler.err.no.annotations.on.dot.class
+AnnotatedClassExpr.java:17:44: compiler.err.no.annotations.on.dot.class
+AnnotatedClassExpr.java:18:37: compiler.err.no.annotations.on.dot.class
+7 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/classfiles/InnerClasses/T8068517.java	Fri Jan 16 12:34:58 2015 -0800
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/** @test
+ *  @bug 8034854
+ *  @summary Verify that nested enums have correct abstract flag in the InnerClasses attribute.
+ *  @library /tools/lib
+ *  @build ToolBox T8068517
+ *  @run main T8068517
+ */
+
+import com.sun.tools.javac.util.Assert;
+import java.util.Arrays;
+import javax.tools.JavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+public class T8068517 {
+
+    public static void main(String[] args) throws Exception {
+        new T8068517().run();
+    }
+
+    void run() throws Exception {
+        runTest("class A {\n" +
+                "    enum AInner implements Runnable {\n" +
+                "        A {\n" +
+                "            public void run() {}\n" +
+                "        };\n" +
+                "    }\n" +
+                "}\n",
+                "class B {\n" +
+                "    A.AInner a;\n" +
+                "}");
+        runTest("class A {\n" +
+                "    enum AInner implements Runnable {\n" +
+                "        A {\n" +
+                "            public void run() {}\n" +
+                "        };\n" +
+                "    }\n" +
+                "    AInner aInner;\n" +
+                "}\n",
+                "class B {\n" +
+                "    void test(A a) {;\n" +
+                "        switch (a.aInner) {\n" +
+                "            case A: break;\n" +
+                "        }\n" +
+                "    };\n" +
+                "}");
+        runTest("class A {\n" +
+                "    enum AInner implements Runnable {\n" +
+                "        A {\n" +
+                "            public void run() {}\n" +
+                "        };\n" +
+                "    }\n" +
+                "    AInner aInner;\n" +
+                "}\n",
+                "class B {\n" +
+                "    void test(A a) {;\n" +
+                "        System.err.println(a.aInner.toString());\n" +
+                "    };\n" +
+                "}");
+        runTest("class A {\n" +
+                "    enum AInner implements Runnable {\n" +
+                "        A {\n" +
+                "            public void run() {}\n" +
+                "        };\n" +
+                "    }\n" +
+                "    AInner aInner() {\n" +
+                "        return null;\n" +
+                "    }\n" +
+                "}\n",
+                "class B {\n" +
+                "    void test(A a) {;\n" +
+                "        System.err.println(a.aInner().toString());\n" +
+                "    };\n" +
+                "}");
+    }
+
+    void runTest(String aJava, String bJava) throws Exception {
+        try (JavaFileManager fm = ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null)) {
+            ToolBox tb = new ToolBox();
+            ToolBox.MemoryFileManager memoryFM1 = new ToolBox.MemoryFileManager(fm);
+            tb.new JavacTask().fileManager(memoryFM1)
+                              .sources(aJava, bJava)
+                              .run();
+            ToolBox.MemoryFileManager memoryFM2 = new ToolBox.MemoryFileManager(fm);
+            tb.new JavacTask().fileManager(memoryFM2)
+                              .sources(bJava, aJava)
+                              .run();
+
+            Assert.check(Arrays.equals(memoryFM1.getFileBytes(StandardLocation.CLASS_OUTPUT, "B"),
+                                       memoryFM2.getFileBytes(StandardLocation.CLASS_OUTPUT, "B")));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/BadInstanceMethodInUnboundLookup.java	Fri Jan 16 12:34:58 2015 -0800
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.bad.instance.method.in.unbound.lookup
+// key: compiler.misc.invalid.mref
+// key: compiler.err.prob.found.req
+
+class BadInstanceMethodInUnboundLookup {
+
+    interface SAM {
+        void m(Integer u);
+    }
+
+    void f(Integer i) { }
+
+    static void test() {
+        SAM s = BadInstanceMethodInUnboundLookup::f;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/BadStaticMethodInBoundLookup.java	Fri Jan 16 12:34:58 2015 -0800
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.invalid.mref
+// key: compiler.misc.bad.static.method.in.bound.lookup
+// key: compiler.err.prob.found.req
+
+class BadStaticMethodInBoundLookup {
+
+    Runnable r = new BadStaticMethodInBoundLookup()::m;
+
+    static void m() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/BadStaticMethodInUnboundLookup.java	Fri Jan 16 12:34:58 2015 -0800
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.invalid.mref
+// key: compiler.misc.bad.static.method.in.unbound.lookup
+// key: compiler.err.prob.found.req
+
+class BadStaticMethodInUnboundLookup {
+
+    interface SAM {
+        void m(BadStaticMethodInUnboundLookup m);
+    }
+
+    SAM s = BadStaticMethodInUnboundLookup::m;
+
+    static void m() { }
+}
--- a/test/tools/javac/diags/examples/NonStaticCantBeRefFragment.java	Thu Jan 15 13:09:52 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.misc.non-static.cant.be.ref
-// key: compiler.err.invalid.mref
-
-class NonStaticCantBeRefFragment {
-
-    interface SAM {
-        void m(Integer u);
-    }
-
-    void f(Integer i) { }
-
-    static void test() {
-        SAM s = NonStaticCantBeRefFragment::f;
-    }
-}
--- a/test/tools/javac/diags/examples/StaticBoundMref.java	Thu Jan 15 13:09:52 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.invalid.mref
-// key: compiler.misc.static.bound.mref
-
-class StaticBoundMref {
-
-    Runnable r = new StaticBoundMref()::m;
-
-    static void m() { }
-}
--- a/test/tools/javac/diags/examples/StaticMethodInUnboundLookup.java	Thu Jan 15 13:09:52 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.invalid.mref
-// key: compiler.misc.static.method.in.unbound.lookup
-
-class StaticBoundMref {
-
-    interface SAM {
-        void m(StaticBoundMref m);
-    }
-
-    SAM s = StaticBoundMref::m;
-
-    static void m() { }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/LowerBoundBottomTypeTest.java	Fri Jan 16 12:34:58 2015 -0800
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8062358
+ * @summary ClassCastException in TransTypes.visitApply
+ * @compile LowerBoundBottomTypeTest.java
+*/
+
+public class LowerBoundBottomTypeTest {
+    void g() {
+        f().getInIntf3().getInIntf2().getInIntf1().getA();
+    }
+    interface IntfA {
+        int getA();
+    }
+
+    interface Intf1<A extends IntfA> {
+        A getInIntf1();
+    }
+
+    interface Intf2<B> {
+        Intf1<? extends B> getInIntf2();
+    }
+
+    interface Intf3<C> {
+        Intf2<? extends C> getInIntf3();
+    }
+
+    Intf3<?> f() {
+        return null;
+    }
+}
--- a/test/tools/javac/lambda/MethodReference22.out	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/javac/lambda/MethodReference22.out	Fri Jan 16 12:34:58 2015 -0800
@@ -1,9 +1,9 @@
-MethodReference22.java:40:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.String))
-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))
-MethodReference22.java:46:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String))
-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))
-MethodReference22.java:55:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m3(MethodReference22,java.lang.String))
-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))
+MethodReference22.java:40:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m1(java.lang.String)))
+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.bad.instance.method.in.unbound.lookup: kindname.method, m1(java.lang.String)))
+MethodReference22.java:46:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m4(java.lang.String)))
+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.bad.instance.method.in.unbound.lookup: kindname.method, m4(java.lang.String)))
+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))
+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.bad.instance.method.in.unbound.lookup: kindname.method, m3(MethodReference22,java.lang.String)))
 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))
 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)))
 MethodReference22.java:63:9: compiler.err.ref.ambiguous: call3, kindname.method, call3(MethodReference22.SAM1), MethodReference22, kindname.method, call3(MethodReference22.SAM2), MethodReference22
--- a/test/tools/javac/lambda/MethodReference28.out	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/javac/lambda/MethodReference28.out	Fri Jan 16 12:34:58 2015 -0800
@@ -1,7 +1,7 @@
 MethodReference28.java:31:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, static_m2, java.lang.Integer,java.lang.Integer, int, kindname.class, MethodReference28, (compiler.misc.arg.length.mismatch)))
 MethodReference28.java:32:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, static_m3, java.lang.String, int, kindname.class, MethodReference28, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))))
 MethodReference28.java:33:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, static_m4, java.lang.String[], int, kindname.class, MethodReference28, (compiler.misc.varargs.argument.mismatch: (compiler.misc.inconvertible.types: int, java.lang.String))))
-MethodReference28.java:37:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.Integer))
+MethodReference28.java:37:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m1(java.lang.Integer)))
 MethodReference28.java:38:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m2, java.lang.Integer,java.lang.Integer, int, kindname.class, MethodReference28, (compiler.misc.arg.length.mismatch)))
 MethodReference28.java:39:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m3, java.lang.String, int, kindname.class, MethodReference28, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))))
 MethodReference28.java:40:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m4, java.lang.String[], int, kindname.class, MethodReference28, (compiler.misc.varargs.argument.mismatch: (compiler.misc.inconvertible.types: int, java.lang.String))))
--- a/test/tools/javac/lambda/MethodReference51.out	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/javac/lambda/MethodReference51.out	Fri Jan 16 12:34:58 2015 -0800
@@ -2,6 +2,6 @@
 MethodReference51.java:40:21: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, f, java.lang.String, int, kindname.class, MethodReference51, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))))
 MethodReference51.java:41:21: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbols: kindname.method, g, int,{(compiler.misc.inapplicable.method: kindname.method, MethodReference51, g(java.lang.Integer,java.lang.Number), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, MethodReference51, g(java.lang.Number,java.lang.Integer), (compiler.misc.arg.length.mismatch))}))
 MethodReference51.java:42:32: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: g, kindname.method, g(java.lang.Integer,java.lang.Number), MethodReference51, kindname.method, g(java.lang.Number,java.lang.Integer), MethodReference51))
-MethodReference51.java:43:21: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, h(int))
+MethodReference51.java:43:21: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, h(int)))
 MethodReference51.java:44:21: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.not.def.access.class.intf.cant.access: j(int), MethodReference51.Foo))
 6 errors
--- a/test/tools/javac/lambda/MethodReference55.out	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/javac/lambda/MethodReference55.out	Fri Jan 16 12:34:58 2015 -0800
@@ -1,3 +1,3 @@
-MethodReference55.java:36:11: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.bound.mref)
-MethodReference55.java:39:11: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.bound.mref)
+MethodReference55.java:36:11: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.static.method.in.bound.lookup: kindname.method, m(java.lang.Object)))
+MethodReference55.java:39:9: compiler.err.cant.apply.symbol: kindname.method, g, MethodReference55.V, @1384, kindname.class, MethodReference55<X>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.static.method.in.bound.lookup: kindname.method, m(java.lang.Object))))
 2 errors
--- a/test/tools/javac/lambda/MethodReference68.out	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/javac/lambda/MethodReference68.out	Fri Jan 16 12:34:58 2015 -0800
@@ -1,3 +1,2 @@
 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)
-MethodReference68.java:21:12: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, getName())
-2 errors
+1 error
--- a/test/tools/javac/lambda/MethodReference73.out	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/javac/lambda/MethodReference73.out	Fri Jan 16 12:34:58 2015 -0800
@@ -2,12 +2,12 @@
 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))
 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))
 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))
-MethodReference73.java:100:18: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m9(MethodReference73,java.lang.String))
-MethodReference73.java:101:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m10(MethodReference73,java.lang.String))
-MethodReference73.java:102:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.method.in.unbound.lookup: kindname.method, m11(java.lang.String))
-MethodReference73.java:103:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.method.in.unbound.lookup: kindname.method, m12(java.lang.String))
-MethodReference73.java:104:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m13(MethodReference73,java.lang.String))
-MethodReference73.java:105:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.method.in.unbound.lookup: kindname.method, m14(java.lang.String))
-MethodReference73.java:106:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m15(MethodReference73,java.lang.String))
+MethodReference73.java:100:18: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m9, kindname.method, m9(MethodReference73,java.lang.String), MethodReference73, kindname.method, m9(java.lang.String), MethodReference73))
+MethodReference73.java:101:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m10(MethodReference73,java.lang.String)))
+MethodReference73.java:102:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m11, kindname.method, m11(MethodReference73,java.lang.String), MethodReference73, kindname.method, m11(java.lang.String), MethodReference73))
+MethodReference73.java:103:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.static.method.in.unbound.lookup: kindname.method, m12(java.lang.String)))
+MethodReference73.java:104:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m13(MethodReference73,java.lang.String)))
+MethodReference73.java:105:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.static.method.in.unbound.lookup: kindname.method, m14(java.lang.String)))
+MethodReference73.java:106:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m15, kindname.method, m15(MethodReference73,java.lang.String), MethodReference73, kindname.method, m15(java.lang.String), MethodReference73))
 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)))}))
 12 errors
--- a/test/tools/javac/lambda/TargetType60.out	Thu Jan 15 13:09:52 2015 -0800
+++ b/test/tools/javac/lambda/TargetType60.out	Fri Jan 16 12:34:58 2015 -0800
@@ -1,6 +1,6 @@
 TargetType60.java:54:21: compiler.err.ref.ambiguous: g, kindname.method, g(TargetType60.Sam0), TargetType60, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60
 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
-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)))))}
+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.bad.instance.method.in.unbound.lookup: kindname.method, n2(TargetType60,java.lang.String)))))}
 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
 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
 5 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/methodReferenceExecution/MethodReferencePackagePrivateQualifier.java	Fri Jan 16 12:34:58 2015 -0800
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8068254
+ * @summary Method reference uses wrong qualifying type
+ * @author srikanth
+ * @run main MethodReferencePackagePrivateQualifier
+ */
+import pkg.B;
+public class MethodReferencePackagePrivateQualifier {
+    public static void main(String... args) {
+        pkg.B.m();
+        Runnable r = pkg.B::m;
+        r.run();
+        r = B::m;
+        r.run();
+        if (!pkg.B.result.equals("A.m()A.m()A.m()"))
+            throw new AssertionError("Incorrect result");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/methodReferenceExecution/pkg/B.java	Fri Jan 16 12:34:58 2015 -0800
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package pkg;
+class A {
+    public static void m() {
+        B.result += "A.m()";
+    }
+}
+
+public class B extends A {
+    public static String result = "";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/TestMultipleErrors.java	Fri Jan 16 12:34:58 2015 -0800
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8066843
+ * @summary Annotation processors should be able to print multiple errors at the same location.
+ * @library /tools/javac/lib
+ * @build JavacTestingAbstractProcessor TestMultipleErrors
+ * @compile/fail/ref=TestMultipleErrors.out -XDrawDiagnostics -processor TestMultipleErrors TestMultipleErrors.java
+ */
+
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.element.*;
+import javax.tools.Diagnostic.Kind;
+import com.sun.source.util.TreePath;
+import com.sun.source.util.Trees;
+
+public class TestMultipleErrors extends JavacTestingAbstractProcessor {
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        for (Element root : roundEnv.getRootElements()) {
+            processingEnv.getMessager().printMessage(Kind.ERROR, "error1", root);
+            processingEnv.getMessager().printMessage(Kind.ERROR, "error2", root);
+
+            Trees trees = Trees.instance(processingEnv);
+            TreePath path = trees.getPath(root);
+
+            trees.printMessage(Kind.ERROR, "error3", path.getLeaf(), path.getCompilationUnit());
+            trees.printMessage(Kind.ERROR, "error4", path.getLeaf(), path.getCompilationUnit());
+        }
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/TestMultipleErrors.out	Fri Jan 16 12:34:58 2015 -0800
@@ -0,0 +1,5 @@
+TestMultipleErrors.java:41:8: compiler.err.proc.messager: error1
+TestMultipleErrors.java:41:8: compiler.err.proc.messager: error2
+TestMultipleErrors.java:41:8: compiler.err.proc.messager: error3
+TestMultipleErrors.java:41:8: compiler.err.proc.messager: error4
+4 errors