changeset 2835:99ff00581f36 jdk9-b53

Merge
author lana
date Thu, 26 Feb 2015 20:17:06 -0800
parents cdef738241cd d6ec687ad8fb
children 01d8ed7079f1 1e3266d870d6
files
diffstat 22 files changed, 436 insertions(+), 98 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java	Thu Feb 26 15:58:16 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java	Thu Feb 26 20:17:06 2015 -0800
@@ -798,6 +798,10 @@
             prependSubScope(new FilterImportScope(types, origin, null, filter, staticImport));
         }
 
+        public boolean isFilled() {
+            return subScopes.nonEmpty();
+        }
+
     }
 
     public interface ImportFilter {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java	Thu Feb 26 15:58:16 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java	Thu Feb 26 20:17:06 2015 -0800
@@ -477,6 +477,14 @@
             && (tsym.flags() & COMPOUND) != 0;
     }
 
+    public boolean isIntersection() {
+        return false;
+    }
+
+    public boolean isUnion() {
+        return false;
+    }
+
     public boolean isInterface() {
         return (tsym.flags() & INTERFACE) != 0;
     }
@@ -1079,6 +1087,11 @@
             return Collections.unmodifiableList(alternatives_field);
         }
 
+        @Override
+        public boolean isUnion() {
+            return true;
+        }
+
         @Override @DefinedBy(Api.LANGUAGE_MODEL)
         public TypeKind getKind() {
             return TypeKind.UNION;
@@ -1125,6 +1138,11 @@
             return interfaces_field.prepend(supertype_field);
         }
 
+        @Override
+        public boolean isIntersection() {
+            return true;
+        }
+
         public List<Type> getExplicitComponents() {
             return allInterfaces ?
                     interfaces_field :
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Thu Feb 26 15:58:16 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Thu Feb 26 20:17:06 2015 -0800
@@ -1402,8 +1402,7 @@
                     return isSameWildcard(t, s)
                         || isCaptureOf(s, t)
                         || ((t.isExtendsBound() || isSubtypeNoCapture(wildLowerBound(t), wildLowerBound(s))) &&
-                            // TODO: JDK-8039214, cvarUpperBound call here is incorrect
-                            (t.isSuperBound() || isSubtypeNoCapture(cvarUpperBound(wildUpperBound(s)), wildUpperBound(t))));
+                            (t.isSuperBound() || isSubtypeNoCapture(wildUpperBound(s), wildUpperBound(t))));
                 }
             }
 
@@ -1517,8 +1516,8 @@
                     }
                 }
 
-                if (t.isCompound() || s.isCompound()) {
-                    return !t.isCompound() ?
+                if (t.isIntersection() || s.isIntersection()) {
+                    return !t.isIntersection() ?
                             visitIntersectionType((IntersectionClassType)s, t, true) :
                             visitIntersectionType((IntersectionClassType)t, s, false);
                 }
@@ -2246,19 +2245,28 @@
     }
     // </editor-fold>
 
-    // <editor-fold defaultstate="collapsed" desc="makeCompoundType">
+    // <editor-fold defaultstate="collapsed" desc="makeIntersectionType">
     /**
-     * Make a compound type from non-empty list of types.  The list should be
-     * ordered according to {@link Symbol#precedes(TypeSymbol,Types)}.
+     * Make an intersection type from non-empty list of types.  The list should be ordered according to
+     * {@link TypeSymbol#precedes(TypeSymbol, Types)}. Note that this might cause a symbol completion.
+     * Hence, this version of makeIntersectionType may not be called during a classfile read.
      *
-     * @param bounds            the types from which the compound type is formed
-     * @param supertype         is objectType if all bounds are interfaces,
-     *                          null otherwise.
+     * @param bounds    the types from which the intersection type is formed
      */
-    public Type makeCompoundType(List<Type> bounds) {
-        return makeCompoundType(bounds, bounds.head.tsym.isInterface());
+    public IntersectionClassType makeIntersectionType(List<Type> bounds) {
+        return makeIntersectionType(bounds, bounds.head.tsym.isInterface());
     }
-    public Type makeCompoundType(List<Type> bounds, boolean allInterfaces) {
+
+    /**
+     * Make an intersection type from non-empty list of types.  The list should be ordered according to
+     * {@link TypeSymbol#precedes(TypeSymbol, Types)}. This does not cause symbol completion as
+     * an extra parameter indicates as to whether all bounds are interfaces - in which case the
+     * supertype is implicitly assumed to be 'Object'.
+     *
+     * @param bounds        the types from which the intersection type is formed
+     * @param allInterfaces are all bounds interface types?
+     */
+    public IntersectionClassType makeIntersectionType(List<Type> bounds, boolean allInterfaces) {
         Assert.check(bounds.nonEmpty());
         Type firstExplicitBound = bounds.head;
         if (allInterfaces) {
@@ -2271,23 +2279,13 @@
                                 : names.empty,
                             null,
                             syms.noSymbol);
-        bc.type = new IntersectionClassType(bounds, bc, allInterfaces);
+        IntersectionClassType intersectionType = new IntersectionClassType(bounds, bc, allInterfaces);
+        bc.type = intersectionType;
         bc.erasure_field = (bounds.head.hasTag(TYPEVAR)) ?
                 syms.objectType : // error condition, recover
                 erasure(firstExplicitBound);
         bc.members_field = WriteableScope.create(bc);
-        return bc.type;
-    }
-
-    /**
-     * A convenience wrapper for {@link #makeCompoundType(List)}; the
-     * arguments are converted to a list and passed to the other
-     * method.  Note that this might cause a symbol completion.
-     * Hence, this version of makeCompoundType may not be called
-     * during a classfile read.
-     */
-    public Type makeCompoundType(Type bound1, Type bound2) {
-        return makeCompoundType(List.of(bound1, bound2));
+        return intersectionType;
     }
     // </editor-fold>
 
@@ -2427,7 +2425,7 @@
         private final UnaryVisitor<List<Type>> directSupertypes = new UnaryVisitor<List<Type>>() {
 
             public List<Type> visitType(final Type type, final Void ignored) {
-                if (!type.isCompound()) {
+                if (!type.isIntersection()) {
                     final Type sup = supertype(type);
                     return (sup == Type.noType || sup == type || sup == null)
                         ? interfaces(type)
@@ -2481,30 +2479,32 @@
 
     // <editor-fold defaultstate="collapsed" desc="setBounds">
     /**
-     * Set the bounds field of the given type variable to reflect a
-     * (possibly multiple) list of bounds.
-     * @param t                 a type variable
-     * @param bounds            the bounds, must be nonempty
-     * @param supertype         is objectType if all bounds are interfaces,
-     *                          null otherwise.
+     * Same as {@link Types#setBounds(TypeVar, List, boolean)}, except that third parameter is computed directly,
+     * as follows: if all all bounds are interface types, the computed supertype is Object,otherwise
+     * the supertype is simply left null (in this case, the supertype is assumed to be the head of
+     * the bound list passed as second argument). Note that this check might cause a symbol completion.
+     * Hence, this version of setBounds may not be called during a classfile read.
+     *
+     * @param t         a type variable
+     * @param bounds    the bounds, must be nonempty
      */
     public void setBounds(TypeVar t, List<Type> bounds) {
         setBounds(t, bounds, bounds.head.tsym.isInterface());
     }
 
     /**
-     * Same as {@link #setBounds(Type.TypeVar,List,Type)}, except that
-     * third parameter is computed directly, as follows: if all
-     * all bounds are interface types, the computed supertype is Object,
-     * otherwise the supertype is simply left null (in this case, the supertype
-     * is assumed to be the head of the bound list passed as second argument).
-     * Note that this check might cause a symbol completion. Hence, this version of
-     * setBounds may not be called during a classfile read.
+     * Set the bounds field of the given type variable to reflect a (possibly multiple) list of bounds.
+     * This does not cause symbol completion as an extra parameter indicates as to whether all bounds
+     * are interfaces - in which case the supertype is implicitly assumed to be 'Object'.
+     *
+     * @param t             a type variable
+     * @param bounds        the bounds, must be nonempty
+     * @param allInterfaces are all bounds interface types?
      */
     public void setBounds(TypeVar t, List<Type> bounds, boolean allInterfaces) {
         t.bound = bounds.tail.isEmpty() ?
                 bounds.head :
-                makeCompoundType(bounds, allInterfaces);
+                makeIntersectionType(bounds, allInterfaces);
         t.rank_field = -1;
     }
     // </editor-fold>
@@ -3036,7 +3036,7 @@
                 if (st == supertype(t) && is == interfaces(t))
                     return t;
                 else
-                    return makeCompoundType(is.prepend(st));
+                    return makeIntersectionType(is.prepend(st));
             }
         }
 
@@ -3545,7 +3545,7 @@
         else if (compound.tail.isEmpty())
             return compound.head;
         else
-            return makeCompoundType(compound);
+            return makeIntersectionType(compound);
     }
 
     /**
@@ -3723,8 +3723,8 @@
                 synchronized (this) {
                     if (arraySuperType == null) {
                         // JLS 10.8: all arrays implement Cloneable and Serializable.
-                        arraySuperType = makeCompoundType(List.of(syms.serializableType,
-                                                                  syms.cloneableType), true);
+                        arraySuperType = makeIntersectionType(List.of(syms.serializableType,
+                                syms.cloneableType), true);
                     }
                 }
             }
@@ -3790,7 +3790,7 @@
                     return glbFlattened(union(bounds, lowers), errT);
             }
         }
-        return makeCompoundType(bounds);
+        return makeIntersectionType(bounds);
     }
     // </editor-fold>
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Feb 26 15:58:16 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Feb 26 20:17:06 2015 -0800
@@ -2355,7 +2355,7 @@
 
             @Override
             public Type visitClassType(ClassType t, DiagnosticPosition pos) {
-                return t.isCompound() ?
+                return t.isIntersection() ?
                         visitIntersectionClassType((IntersectionClassType)t, pos) : t;
             }
 
@@ -2386,8 +2386,7 @@
                     }
                     supertypes.append(i.tsym.type);
                 }
-                IntersectionClassType notionalIntf =
-                        (IntersectionClassType)types.makeCompoundType(supertypes.toList());
+                IntersectionClassType notionalIntf = types.makeIntersectionType(supertypes.toList());
                 notionalIntf.allparams_field = targs.toList();
                 notionalIntf.tsym.flags_field |= INTERFACE;
                 return notionalIntf.tsym;
@@ -3947,7 +3946,7 @@
         } else if (bounds.length() == 1) {
             return bounds.head.type;
         } else {
-            Type owntype = types.makeCompoundType(TreeInfo.types(bounds));
+            Type owntype = types.makeIntersectionType(TreeInfo.types(bounds));
             // ... the variable's bound is a class type flagged COMPOUND
             // (see comment for TypeVar.bound).
             // In this case, generate a class tree that represents the
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Thu Feb 26 15:58:16 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Thu Feb 26 20:17:06 2015 -0800
@@ -3528,7 +3528,7 @@
 
         for (Symbol sym : tsym.members().getSymbolsByName(name)) {
             if (sym.isStatic() &&
-                staticImportAccessible(sym, packge) &&
+                importAccessible(sym, packge) &&
                 sym.isMemberOf(origin, types)) {
                 return true;
             }
@@ -3538,17 +3538,23 @@
     }
 
     // is the sym accessible everywhere in packge?
-    public boolean staticImportAccessible(Symbol sym, PackageSymbol packge) {
-        int flags = (int)(sym.flags() & AccessFlags);
-        switch (flags) {
-        default:
-        case PUBLIC:
-            return true;
-        case PRIVATE:
+    public boolean importAccessible(Symbol sym, PackageSymbol packge) {
+        try {
+            int flags = (int)(sym.flags() & AccessFlags);
+            switch (flags) {
+            default:
+            case PUBLIC:
+                return true;
+            case PRIVATE:
+                return false;
+            case 0:
+            case PROTECTED:
+                return sym.packge() == packge;
+            }
+        } catch (ClassFinder.BadClassFile err) {
+            throw err;
+        } catch (CompletionFailure ex) {
             return false;
-        case 0:
-        case PROTECTED:
-            return sym.packge() == packge;
         }
     }
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Feb 26 15:58:16 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Feb 26 20:17:06 2015 -0800
@@ -417,7 +417,7 @@
             List<Type> upperBounds = uv.getBounds(InferenceBound.UPPER);
             if (Type.containsAny(upperBounds, vars)) {
                 TypeSymbol fresh_tvar = new TypeVariableSymbol(Flags.SYNTHETIC, uv.qtype.tsym.name, null, uv.qtype.tsym.owner);
-                fresh_tvar.type = new TypeVar(fresh_tvar, types.makeCompoundType(uv.getBounds(InferenceBound.UPPER)), null);
+                fresh_tvar.type = new TypeVar(fresh_tvar, types.makeIntersectionType(uv.getBounds(InferenceBound.UPPER)), null);
                 todo.append(uv);
                 uv.inst = fresh_tvar.type;
             } else if (upperBounds.nonEmpty()) {
@@ -670,7 +670,7 @@
         if (lubResult == syms.errType || lubResult == syms.botType) {
             return List.nil();
         }
-        List<Type> supertypesToCheck = lubResult.isCompound() ?
+        List<Type> supertypesToCheck = lubResult.isIntersection() ?
                 ((IntersectionClassType)lubResult).getComponents() :
                 List.of(lubResult);
         ListBuffer<Pair<Type, Type>> commonSupertypes = new ListBuffer<>();
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Thu Feb 26 15:58:16 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Thu Feb 26 20:17:06 2015 -0800
@@ -1667,7 +1667,7 @@
          * This class is used to store important information regarding translation of
          * lambda expression/method references (see subclasses).
          */
-        private abstract class TranslationContext<T extends JCFunctionalExpression> {
+        abstract class TranslationContext<T extends JCFunctionalExpression> {
 
             /** the underlying (untranslated) tree */
             final T tree;
@@ -1746,7 +1746,7 @@
          * and the used by the main translation routines in order to adjust references
          * to captured locals/members, etc.
          */
-        private class LambdaTranslationContext extends TranslationContext<JCLambda> {
+        class LambdaTranslationContext extends TranslationContext<JCLambda> {
 
             /** variable in the enclosing context to which this lambda is assigned */
             final Symbol self;
@@ -2040,7 +2040,7 @@
          * and the used by the main translation routines in order to adjust method
          * references (i.e. in case a bridge is needed)
          */
-        private final class ReferenceTranslationContext extends TranslationContext<JCMemberReference> {
+        final class ReferenceTranslationContext extends TranslationContext<JCMemberReference> {
 
             final boolean isSuper;
             final Symbol sigPolySym;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Feb 26 15:58:16 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Feb 26 20:17:06 2015 -0800
@@ -1098,10 +1098,17 @@
                     DeferredType.SpeculativeCache.Entry e =
                             dt.speculativeCache.get(deferredAttrContext.msym, deferredAttrContext.phase);
                     if (e != null && e.speculativeTree != deferredAttr.stuckTree) {
-                        return functionalInterfaceMostSpecific(found, req, e.speculativeTree, warn);
+                        return functionalInterfaceMostSpecific(found, req, e.speculativeTree);
                     }
                 }
-                return super.compatible(found, req, warn);
+                return compatibleBySubtyping(found, req);
+            }
+
+            private boolean compatibleBySubtyping(Type found, Type req) {
+                if (!strict && found.isPrimitive() != req.isPrimitive()) {
+                    found = found.isPrimitive() ? types.boxedClass(found).type : types.unboxedType(found);
+                }
+                return types.isSubtypeNoCapture(found, deferredAttrContext.inferenceContext.asUndetVar(req));
             }
 
             /** Whether {@code t} and {@code s} are unrelated functional interface types. */
@@ -1113,8 +1120,8 @@
             }
 
             /** Parameters {@code t} and {@code s} are unrelated functional interface types. */
-            private boolean functionalInterfaceMostSpecific(Type t, Type s, JCTree tree, Warner warn) {
-                FunctionalInterfaceMostSpecificChecker msc = new FunctionalInterfaceMostSpecificChecker(t, s, warn);
+            private boolean functionalInterfaceMostSpecific(Type t, Type s, JCTree tree) {
+                FunctionalInterfaceMostSpecificChecker msc = new FunctionalInterfaceMostSpecificChecker(t, s);
                 msc.scan(tree);
                 return msc.result;
             }
@@ -1127,14 +1134,12 @@
 
                 final Type t;
                 final Type s;
-                final Warner warn;
                 boolean result;
 
                 /** Parameters {@code t} and {@code s} are unrelated functional interface types. */
-                FunctionalInterfaceMostSpecificChecker(Type t, Type s, Warner warn) {
+                FunctionalInterfaceMostSpecificChecker(Type t, Type s) {
                     this.t = t;
                     this.s = s;
-                    this.warn = warn;
                     result = true;
                 }
 
@@ -1172,7 +1177,7 @@
                             result &= (retValIsPrimitive == ret_t.isPrimitive()) &&
                                       (retValIsPrimitive != ret_s.isPrimitive());
                         } else {
-                            result &= MostSpecificCheckContext.super.compatible(ret_t, ret_s, warn);
+                            result &= compatibleBySubtyping(ret_t, ret_s);
                         }
                     }
                 }
@@ -1195,7 +1200,7 @@
                             result &= false;
                         } else if (unrelatedFunctionalInterfaces(ret_t, ret_s)) {
                             for (JCExpression expr : lambdaResults(tree)) {
-                                result &= functionalInterfaceMostSpecific(ret_t, ret_s, expr, warn);
+                                result &= functionalInterfaceMostSpecific(ret_t, ret_s, expr);
                             }
                         } else if (ret_t.isPrimitive() != ret_s.isPrimitive()) {
                             for (JCExpression expr : lambdaResults(tree)) {
@@ -1204,7 +1209,7 @@
                                           (retValIsPrimitive != ret_s.isPrimitive());
                             }
                         } else {
-                            result &= MostSpecificCheckContext.super.compatible(ret_t, ret_s, warn);
+                            result &= compatibleBySubtyping(ret_t, ret_s);
                         }
                     }
                 }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java	Thu Feb 26 15:58:16 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java	Thu Feb 26 20:17:06 2015 -0800
@@ -764,7 +764,7 @@
                 ? typeCast.expr
                 : newExpression;
         }
-        if (originalTarget.isCompound()) {
+        if (originalTarget.isIntersection()) {
             Type.IntersectionClassType ict = (Type.IntersectionClassType)originalTarget;
             for (Type c : ict.getExplicitComponents()) {
                 Type ec = erasure(c);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Thu Feb 26 15:58:16 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Thu Feb 26 20:17:06 2015 -0800
@@ -160,7 +160,7 @@
         // if there remain any unimported toplevels (these must have
         // no classes at all), process their import statements as well.
         for (JCCompilationUnit tree : trees) {
-            if (tree.starImportScope.isEmpty()) {
+            if (!tree.starImportScope.isFilled()) {
                 Env<AttrContext> topEnv = enter.topLevelEnv(tree);
                 finishImports(tree, () -> { completeClass.resolveImports(tree, topEnv); });
             }
@@ -280,12 +280,7 @@
 
         Env<AttrContext> env;
         ImportFilter staticImportFilter;
-        ImportFilter typeImportFilter = new ImportFilter() {
-            @Override
-            public boolean accepts(Scope origin, Symbol t) {
-                return t.kind == TYP;
-            }
-        };
+        ImportFilter typeImportFilter;
 
         @Override
         protected void doRunPhase(Env<AttrContext> env) {
@@ -304,26 +299,26 @@
         }
 
         private void resolveImports(JCCompilationUnit tree, Env<AttrContext> env) {
-            if (!tree.starImportScope.isEmpty()) {
+            if (tree.starImportScope.isFilled()) {
                 // we must have already processed this toplevel
                 return;
             }
 
             ImportFilter prevStaticImportFilter = staticImportFilter;
+            ImportFilter prevTypeImportFilter = typeImportFilter;
             DiagnosticPosition prevLintPos = deferredLintHandler.immediate();
             Lint prevLint = chk.setLint(lint);
             Env<AttrContext> prevEnv = this.env;
             try {
                 this.env = env;
                 final PackageSymbol packge = env.toplevel.packge;
-                this.staticImportFilter = new ImportFilter() {
-                    @Override
-                    public boolean accepts(Scope origin, Symbol sym) {
-                        return sym.isStatic() &&
-                               chk.staticImportAccessible(sym, packge) &&
-                               sym.isMemberOf((TypeSymbol) origin.owner, types);
-                    }
-                };
+                this.staticImportFilter =
+                        (origin, sym) -> sym.isStatic() &&
+                                         chk.importAccessible(sym, packge) &&
+                                         sym.isMemberOf((TypeSymbol) origin.owner, types);
+                this.typeImportFilter =
+                        (origin, sym) -> sym.kind == TYP &&
+                                         chk.importAccessible(sym, packge);
 
                 // Import-on-demand java.lang.
                 importAll(tree.pos, syms.enterPackage(names.java_lang), env);
@@ -340,6 +335,7 @@
                 chk.setLint(prevLint);
                 deferredLintHandler.setPos(prevLintPos);
                 this.staticImportFilter = prevStaticImportFilter;
+                this.typeImportFilter = prevTypeImportFilter;
             }
         }
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/ct.properties	Thu Feb 26 15:58:16 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/ct.properties	Thu Feb 26 20:17:06 2015 -0800
@@ -687,7 +687,6 @@
 sun.rmi.transport.*: proprietary compact2
 sun.rmi.transport.proxy.*: proprietary compact2
 sun.rmi.transport.tcp.*: proprietary compact2
-sun.security.acl.*: proprietary compact1
 sun.security.action.*: proprietary compact1
 sun.security.jca.*: proprietary compact1
 sun.security.jgss.*: proprietary compact3
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/legacy.properties	Thu Feb 26 15:58:16 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/legacy.properties	Thu Feb 26 20:17:06 2015 -0800
@@ -532,7 +532,6 @@
 sun.rmi.transport = tiger legacy
 sun.rmi.transport.proxy = tiger legacy
 sun.rmi.transport.tcp = tiger legacy
-sun.security.acl = tiger legacy
 sun.security.action = tiger legacy
 sun.security.jca = tiger legacy
 sun.security.jgss = tiger legacy
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/RootDocImpl.java	Thu Feb 26 15:58:16 2015 -0800
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/RootDocImpl.java	Thu Feb 26 20:17:06 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -382,8 +382,9 @@
     }
 
     public boolean isFunctionalInterface(AnnotationDesc annotationDesc) {
-        return annotationDesc.annotationType().qualifiedName().equals(
-                env.syms.functionalInterfaceType.toString()) && env.source.allowLambda();
+        return env.source.allowLambda()
+            && annotationDesc.annotationType().qualifiedName().equals(
+                env.syms.functionalInterfaceType.toString());
     }
 
     public boolean showTagMessages() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/CaptureLowerBound.java	Thu Feb 26 20:17:06 2015 -0800
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014, 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 8039214
+ * @summary Capture variable as an inference variable's lower bound
+ * @compile CaptureLowerBound.java
+ */
+
+public class CaptureLowerBound {
+
+    interface I<X1,X2> {}
+    static class C<T> implements I<T,T> {}
+
+    <X> void m(I<? extends X, X> arg) {}
+
+    void test(C<?> arg) {
+      m(arg);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/CaptureLowerBoundNeg.java	Thu Feb 26 20:17:06 2015 -0800
@@ -0,0 +1,19 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8039214
+ * @summary Capture variable as an inference variable's lower bound
+ * @compile/fail/ref=CaptureLowerBoundNeg.out -XDrawDiagnostics CaptureLowerBoundNeg.java
+ */
+
+public class CaptureLowerBoundNeg {
+
+    static class D<T> {
+        void take(T arg) {}
+        static <T> D<T> make(Class<? extends T> c) { return new D<T>(); }
+    }
+
+    void test(Object o) {
+        D.make(o.getClass()).take(o);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/CaptureLowerBoundNeg.out	Thu Feb 26 20:17:06 2015 -0800
@@ -0,0 +1,2 @@
+CaptureLowerBoundNeg.java:16:29: compiler.err.cant.apply.symbol: kindname.method, take, compiler.misc.type.captureof: 1, ? extends java.lang.Object, java.lang.Object, kindname.class, CaptureLowerBoundNeg.D<T>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, compiler.misc.type.captureof: 1, ? extends java.lang.Object))
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/NestedCapture.java	Thu Feb 26 20:17:06 2015 -0800
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014, 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 8039214
+ * @summary Capture variable passed through multiple levels of nested inference
+ * @compile NestedCapture.java
+ */
+
+abstract class NestedCapture {
+  interface List<T> {}
+  abstract <T> List<T> copyOf(List<? extends T> lx);
+  abstract <E> List<E> filter(List<E> lx);
+
+  <U> void test1(List<U> lx) {
+    copyOf(filter(lx));
+  }
+
+  void test2(List<?> lx) {
+    copyOf(filter(lx));
+  }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/NestedWildcards.java	Thu Feb 26 20:17:06 2015 -0800
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014, 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 8039214
+ * @summary Nested generic methods that work on wildcard-parameterized types
+ * @compile NestedWildcards.java
+ */
+
+public class NestedWildcards {
+
+    public static void test(Box<String> b) {
+        foo(bar(b));
+    }
+    private static <X> Box<? extends X> foo(Box<? extends X> ts) {
+        return null;
+    }
+    public static <Y> Box<? extends Y> bar(Box<? extends Y> language) {
+        return null;
+    }
+
+    interface Box<T> {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/wildcards/SubtypeCaptureLeak.java	Thu Feb 26 20:17:06 2015 -0800
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, 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 8039214
+ * @summary Capture variables used for subtyping should not leak out of inference
+ * @compile SubtypeCaptureLeak.java
+ */
+
+public class SubtypeCaptureLeak {
+
+    interface Parent<T> {}
+    interface Child<T> extends Parent<T> {}
+    interface Box<T> {}
+    interface SubBox<T> extends Box<T> {}
+
+    // applicability inference
+
+    <T> void m1(Parent<? extends T> arg) {}
+
+    void testApplicable(Child<?> arg) {
+        m1(arg);
+    }
+
+    // applicability inference, nested
+
+    <T> void m2(Box<? extends Parent<? extends T>> arg) {}
+
+    void testApplicable(Box<Child<?>> arg) {
+        m2(arg);
+    }
+
+    // most specific inference
+
+    <T> void m3(Parent<? extends T> arg) {}
+    void m3(Child<?> arg) {}
+
+    void testMostSpecific(Child<?> arg) {
+        m3(arg);
+    }
+
+    // most specific inference, nested
+
+    <T> void m4(Box<? extends Parent<? extends T>> arg) {}
+    void m4(SubBox<Child<?>> arg) {}
+
+    void testMostSpecificNested(SubBox<Child<?>> arg) {
+        m4(arg);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/importscope/ImportInaccessible.java	Thu Feb 26 20:17:06 2015 -0800
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014, 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 8067886
+ * @summary Verify that type import on demand won't put inaccessible types into the Scope
+ * @compile/fail/ref=ImportInaccessible.out -XDrawDiagnostics ImportInaccessible.java
+ */
+package p;
+import p.ImportInaccessible.Nested.*;
+
+class ImportInaccessible {
+    static class Nested<X extends Inner> {
+        private static class Inner{}
+     }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/importscope/ImportInaccessible.out	Thu Feb 26 20:17:06 2015 -0800
@@ -0,0 +1,2 @@
+ImportInaccessible.java:34:35: compiler.err.cant.resolve.location: kindname.class, Inner, , , (compiler.misc.location: kindname.class, p.ImportInaccessible, null)
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/multicatch/8071291/T8071291.java	Thu Feb 26 20:17:06 2015 -0800
@@ -0,0 +1,49 @@
+/*
+ * 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 8071291
+ * @summary Compiler crashes trying to cast UnionType to IntersectionClassType
+ * @compile T8071291.java
+ */
+
+class T8071291 {
+
+    interface A { }
+    class Exception1 extends Exception implements A { }
+    class Exception2 extends Exception implements A { }
+
+    void test(boolean cond) {
+        try {
+            if (cond) {
+                throw new Exception1();
+            } else {
+                throw new Exception2();
+            }
+        }
+        catch (Exception1|Exception2 x) {
+            if (x instanceof Exception1) { }
+        }
+    }
+}