changeset 1699:2dd0e1a884ba

merge with jdk8-b68
author mcimadamore
date Fri, 14 Dec 2012 18:40:42 +0000
parents 9762de578ffd 13ccb5269f3d
children 6acec3010e26
files .hgtags src/share/classes/com/sun/source/tree/Tree.java src/share/classes/com/sun/source/tree/TreeVisitor.java src/share/classes/com/sun/source/util/SimpleTreeVisitor.java src/share/classes/com/sun/source/util/TreeScanner.java src/share/classes/com/sun/tools/javac/code/Source.java src/share/classes/com/sun/tools/javac/code/Type.java src/share/classes/com/sun/tools/javac/code/Types.java src/share/classes/com/sun/tools/javac/comp/Attr.java src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java src/share/classes/com/sun/tools/javac/comp/Lower.java src/share/classes/com/sun/tools/javac/comp/Resolve.java src/share/classes/com/sun/tools/javac/comp/TransTypes.java src/share/classes/com/sun/tools/javac/jvm/ClassReader.java src/share/classes/com/sun/tools/javac/jvm/Gen.java src/share/classes/com/sun/tools/javac/model/JavacTypes.java src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java src/share/classes/com/sun/tools/javac/parser/JavacParser.java src/share/classes/com/sun/tools/javac/resources/compiler.properties src/share/classes/com/sun/tools/javac/tree/JCTree.java src/share/classes/com/sun/tools/javac/tree/Pretty.java src/share/classes/com/sun/tools/javac/tree/TreeCopier.java src/share/classes/com/sun/tools/javac/tree/TreeInfo.java src/share/classes/com/sun/tools/javac/tree/TreeMaker.java src/share/classes/com/sun/tools/javac/tree/TreeScanner.java src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java src/share/classes/javax/lang/model/type/IntersectionType.java src/share/classes/javax/lang/model/type/TypeKind.java src/share/classes/javax/lang/model/type/TypeVisitor.java src/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java src/share/classes/javax/lang/model/util/AbstractTypeVisitor8.java test/tools/javac/cast/intersection/IntersectionTypeCastTest.java test/tools/javac/cast/intersection/model/Model01.java test/tools/javac/cast/intersection/model/ModelChecker.java test/tools/javac/defaultMethodExecution/DefaultMethodRegressionTests.java test/tools/javac/diags/examples.not-yet.txt test/tools/javac/diags/examples/InvalidGenericLambdaTarget.java test/tools/javac/lambda/FunctionalInterfaceConversionTest.java test/tools/javac/lambda/Intersection01.java test/tools/javac/lambda/Intersection01.out test/tools/javac/lambda/LambdaConv21.java test/tools/javac/lambda/LambdaConv21.out test/tools/javac/lambda/LambdaConversionTest.java test/tools/javac/lambda/LambdaParserTest.java test/tools/javac/lambda/MethodReference30.java test/tools/javac/lambda/MethodReference55.java test/tools/javac/lambda/MethodReference55.out test/tools/javac/lambda/MethodReference56.java test/tools/javac/lambda/MethodReference56.out test/tools/javac/lambda/MethodReference57.java test/tools/javac/lambda/MethodReference58.java test/tools/javac/lambda/MethodReference58.out test/tools/javac/lambda/VoidCompatibility.out test/tools/javac/lambda/intersection/IntersectionTargetTypeTest.java test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestKinds.java
diffstat 48 files changed, 1179 insertions(+), 555 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Dec 13 12:25:52 2012 +0000
+++ b/.hgtags	Fri Dec 14 18:40:42 2012 +0000
@@ -193,3 +193,4 @@
 5f2faba89cac665e365c05074064ffc934a495eb jdk8-b65
 20230f8b0eef92a57043735fc2ca00fea7e510a0 jdk8-b66
 303b09787a69136cd2019f9edfed3f308572e9fc jdk8-b67
+014a6a11dfe5ddc23ec8c76bb42ac998dbf49acb jdk8-b68
--- a/src/share/classes/com/sun/tools/classfile/Instruction.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/com/sun/tools/classfile/Instruction.java	Fri Dec 14 18:40:42 2012 +0000
@@ -71,11 +71,16 @@
         SHORT(3),
         /** Wide opcode is not followed by any operands. */
         WIDE_NO_OPERANDS(2),
+        /** Wide opcode is followed by a 2-byte index into the local variables array. */
+        WIDE_LOCAL(4),
         /** Wide opcode is followed by a 2-byte index into the constant pool. */
         WIDE_CPREF_W(4),
         /** Wide opcode is followed by a 2-byte index into the constant pool,
          *  and a signed short value. */
         WIDE_CPREF_W_SHORT(6),
+        /** Wide opcode is followed by a 2-byte reference to a local variable,
+         *  and a signed short value. */
+        WIDE_LOCAL_SHORT(6),
         /** Opcode was not recognized. */
         UNKNOWN(1);
 
@@ -101,7 +106,7 @@
         R visitConstantPoolRef(Instruction instr, int index, P p);
         /** See {@link Kind#CPREF_W_UBYTE}, {@link Kind#CPREF_W_UBYTE_ZERO}, {@link Kind#WIDE_CPREF_W_SHORT}. */
         R visitConstantPoolRefAndValue(Instruction instr, int index, int value, P p);
-        /** See {@link Kind#LOCAL}. */
+        /** See {@link Kind#LOCAL}, {@link Kind#WIDE_LOCAL}. */
         R visitLocal(Instruction instr, int index, P p);
         /** See {@link Kind#LOCAL_BYTE}. */
         R visitLocalAndValue(Instruction instr, int index, int value, P p);
@@ -315,6 +320,9 @@
             case WIDE_NO_OPERANDS:
                 return visitor.visitNoOperands(this, p);
 
+            case WIDE_LOCAL:
+                return visitor.visitLocal(this, getUnsignedShort(2), p);
+
             case WIDE_CPREF_W:
                 return visitor.visitConstantPoolRef(this, getUnsignedShort(2), p);
 
@@ -322,6 +330,10 @@
                 return visitor.visitConstantPoolRefAndValue(
                         this, getUnsignedShort(2), getUnsignedByte(4), p);
 
+            case WIDE_LOCAL_SHORT:
+                return visitor.visitLocalAndValue(
+                        this, getUnsignedShort(2), getShort(4), p);
+
             case UNKNOWN:
                 return visitor.visitUnknown(this, p);
 
--- a/src/share/classes/com/sun/tools/classfile/Opcode.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/com/sun/tools/classfile/Opcode.java	Fri Dec 14 18:40:42 2012 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -246,18 +246,18 @@
     // impdep 0xff: Picojava priv
 
     // wide opcodes
-    ILOAD_W(0xc415, WIDE_CPREF_W),
-    LLOAD_W(0xc416, WIDE_CPREF_W),
-    FLOAD_W(0xc417, WIDE_CPREF_W),
-    DLOAD_W(0xc418, WIDE_CPREF_W),
-    ALOAD_W(0xc419, WIDE_CPREF_W),
-    ISTORE_W(0xc436, WIDE_CPREF_W),
-    LSTORE_W(0xc437, WIDE_CPREF_W),
-    FSTORE_W(0xc438, WIDE_CPREF_W),
-    DSTORE_W(0xc439, WIDE_CPREF_W),
-    ASTORE_W(0xc43a, WIDE_CPREF_W),
-    IINC_W(0xc484, WIDE_CPREF_W_SHORT),
-    RET_W(0xc4a9, WIDE_CPREF_W),
+    ILOAD_W(0xc415, WIDE_LOCAL),
+    LLOAD_W(0xc416, WIDE_LOCAL),
+    FLOAD_W(0xc417, WIDE_LOCAL),
+    DLOAD_W(0xc418, WIDE_LOCAL),
+    ALOAD_W(0xc419, WIDE_LOCAL),
+    ISTORE_W(0xc436, WIDE_LOCAL),
+    LSTORE_W(0xc437, WIDE_LOCAL),
+    FSTORE_W(0xc438, WIDE_LOCAL),
+    DSTORE_W(0xc439, WIDE_LOCAL),
+    ASTORE_W(0xc43a, WIDE_LOCAL),
+    IINC_W(0xc484, WIDE_LOCAL_SHORT),
+    RET_W(0xc4a9, WIDE_LOCAL),
 
     // PicoJava nonpriv instructions
     LOAD_UBYTE(PICOJAVA, 0xfe00),
--- a/src/share/classes/com/sun/tools/javac/code/Source.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/com/sun/tools/javac/code/Source.java	Fri Dec 14 18:40:42 2012 +0000
@@ -218,6 +218,9 @@
     public boolean allowRepeatedAnnotations() {
         return compareTo(JDK1_8) >= 0;
     }
+    public boolean allowIntersectionTypesInCast() {
+        return compareTo(JDK1_8) >= 0;
+    }
     public boolean allowBetterInference() {
         return compareTo(JDK1_8) >= 0;
     }
--- a/src/share/classes/com/sun/tools/javac/code/Type.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/com/sun/tools/javac/code/Type.java	Fri Dec 14 18:40:42 2012 +0000
@@ -838,17 +838,17 @@
             return v.visitUnion(this, p);
         }
     }
-    
+
     // a clone of a ClassType that knows about the bounds of an intersection type.
     public static class IntersectionClassType extends ClassType implements IntersectionType {
-        
+
         public boolean allInterfaces;
-        
+
         public enum IntersectionKind {
             EXPLICIT,
             IMPLICT;
         }
-        
+
         public IntersectionKind intersectionKind;
 
         public IntersectionClassType(List<Type> bounds, ClassSymbol csym, boolean allInterfaces) {
@@ -864,7 +864,7 @@
         public java.util.List<? extends TypeMirror> getBounds() {
             return Collections.unmodifiableList(getComponents());
         }
-        
+
         public List<Type> getComponents() {
             return interfaces_field.prepend(supertype_field);
         }
--- a/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Fri Dec 14 18:40:42 2012 +0000
@@ -26,7 +26,13 @@
 package com.sun.tools.javac.code;
 
 import java.lang.ref.SoftReference;
-import java.util.*;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.WeakHashMap;
 
 import com.sun.tools.javac.code.Attribute.RetentionPolicy;
 import com.sun.tools.javac.code.Lint.LintCategory;
@@ -380,7 +386,7 @@
             else {
                 return e.cachedDescRes;
             }
-        }        
+        }
 
         /**
          * Compute the function descriptor associated with a given functional interface
@@ -548,7 +554,7 @@
         }
     }
     // </editor-fold>
-    
+
    /**
     * Scope filter used to skip methods that should be ignored (such as methods
     * overridden by j.l.Object) during function interface conversion/marker interface checks
@@ -569,9 +575,9 @@
                    (interfaceCandidates(origin.type, (MethodSymbol)sym).head.flags() & DEFAULT) == 0;
        }
     };
-    
+
     // <editor-fold defaultstate="collapsed" desc="isMarker">
-    
+
     /**
      * A cache that keeps track of marker interfaces
      */
@@ -2026,7 +2032,7 @@
         bc.erasure_field = (bounds.head.tag == TYPEVAR) ?
                 syms.objectType : // error condition, recover
                 erasure(firstExplicitBound);
-        bc.members_field = new Scope(bc);        
+        bc.members_field = new Scope(bc);
         return bc.type;
     }
 
@@ -2243,7 +2249,7 @@
      * Return list of bounds of the given type variable.
      */
     public List<Type> getBounds(TypeVar t) {
-		if (t.bound.hasTag(NONE))
+        if (t.bound.hasTag(NONE))
             return List.nil();
         else if (t.bound.isErroneous() || !t.bound.isCompound())
             return List.of(t.bound);
--- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Dec 14 18:40:42 2012 +0000
@@ -879,7 +879,7 @@
         try {
             deferredLintHandler.flush(tree.pos());
             chk.checkDeprecatedAnnotation(tree.pos(), m);
-            
+
             // Create a new environment with local scope
             // for attributing the method.
             Env<AttrContext> localEnv = memberEnter.methodEnv(tree, env);
@@ -2190,7 +2190,7 @@
                 target = Type.recoveryType;
                 lambdaType = fallbackDescriptorType(that);
             }
-            
+
             if (lambdaType.hasTag(FORALL)) {
                 //lambda expression target desc cannot be a generic method
                 resultInfo.checkContext.report(that, diags.fragment("invalid.generic.lambda.target",
@@ -2238,11 +2238,11 @@
             //if we are in a 'check' method context, and the lambda is not compatible
             //with the target-type, it will be recovered anyway in Attr.checkId
             needsRecovery = false;
-            
+
             FunctionalReturnContext funcContext = that.getBodyKind() == JCLambda.BodyKind.EXPRESSION ?
                     new ExpressionLambdaReturnContext((JCExpression)that.getBody(), resultInfo.checkContext) :
                     new FunctionalReturnContext(resultInfo.checkContext);
-            
+
             ResultInfo bodyResultInfo = lambdaType.getReturnType() == Type.recoveryType ?
                 recoveryInfo :
                 new ResultInfo(VAL, lambdaType.getReturnType(), funcContext);
@@ -2284,7 +2284,7 @@
 
     private Type checkIntersectionTarget(DiagnosticPosition pos, ResultInfo resultInfo) {
         Type pt = resultInfo.pt;
-        if (pt != Type.recoveryType && pt.isCompound()) {            
+        if (pt != Type.recoveryType && pt.isCompound()) {
             IntersectionClassType ict = (IntersectionClassType)pt;
             List<Type> bounds = ict.allInterfaces ?
                     ict.getComponents().tail :
@@ -2347,7 +2347,7 @@
          * context.
          */
         class FunctionalReturnContext extends Check.NestedCheckContext {
-            
+
             FunctionalReturnContext(CheckContext enclosingContext) {
                 super(enclosingContext);
             }
@@ -2363,9 +2363,9 @@
                 enclosingContext.report(pos, diags.fragment("incompatible.ret.type.in.lambda", details));
             }
         }
-        
+
         class ExpressionLambdaReturnContext extends FunctionalReturnContext {
-            
+
             JCExpression expr;
 
             ExpressionLambdaReturnContext(JCExpression expr, CheckContext enclosingContext) {
@@ -2534,7 +2534,7 @@
                     return;
                 }
             }
-            
+
             if (resultInfo.checkContext.deferredAttrContext().mode == AttrMode.CHECK) {
                 if (refSym.isStatic() && TreeInfo.isStaticSelector(that.expr, names) &&
                         exprType.getTypeArguments().nonEmpty()) {
@@ -3581,7 +3581,7 @@
         }
         tree.type = result = t;
     }
-    
+
     public void visitTypeIntersection(JCTypeIntersection tree) {
         attribTypes(tree.bounds, env);
         tree.type = result = checkIntersection(tree, tree.bounds);
@@ -3594,7 +3594,7 @@
             typeVar.bound = checkIntersection(tree, tree.bounds);
         }
     }
-    
+
     Type checkIntersection(JCTree tree, List<JCExpression> bounds) {
         Set<Type> boundSet = new HashSet<Type>();
         if (bounds.nonEmpty()) {
@@ -3625,7 +3625,7 @@
                 }
             }
         }
-        
+
         if (bounds.length() == 0) {
             return syms.objectType;
         } else if (bounds.length() == 1) {
@@ -3668,7 +3668,6 @@
         }
     }
 
-
     public void visitWildcard(JCWildcard tree) {
         //- System.err.println("visitWildcard("+tree+");");//DEBUG
         Type type = (tree.kind.kind == BoundKind.UNBOUND)
--- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Fri Dec 14 18:40:42 2012 +0000
@@ -288,20 +288,20 @@
         JCExpression init;
         switch(tree.kind) {
 
-            case IMPLICIT_INNER:    /** Inner # new */
-            case SUPER:             /** super # instMethod */
+            case IMPLICIT_INNER:    /** Inner :: new */
+            case SUPER:             /** super :: instMethod */
                 init = makeThis(
                     localContext.owner.owner.asType(),
                     localContext.owner);
                 break;
 
-            case BOUND:             /** Expr # instMethod */
+            case BOUND:             /** Expr :: instMethod */
                 init = tree.getQualifierExpression();
                 break;
-            
-            case UNBOUND:           /** Type # instMethod */
-            case STATIC:            /** Type # staticMethod */
-            case TOPLEVEL:          /** Top level # new */
+
+            case UNBOUND:           /** Type :: instMethod */
+            case STATIC:            /** Type :: staticMethod */
+            case TOPLEVEL:          /** Top level :: new */
                 init = null;
                 break;
 
--- a/src/share/classes/com/sun/tools/javac/comp/Lower.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java	Fri Dec 14 18:40:42 2012 +0000
@@ -138,6 +138,10 @@
      */
     Map<ClassSymbol, JCClassDecl> classdefs;
 
+    /** A hash table mapping local classes to a list of pruned trees.
+     */
+    public Map<ClassSymbol, List<JCTree>> prunedTree = new WeakHashMap<ClassSymbol, List<JCTree>>();
+
     /** A hash table mapping virtual accessed symbols in outer subclasses
      *  to the actually referred symbol in superclasses.
      */
@@ -1039,6 +1043,12 @@
         }
     }
 
+    private void addPrunedInfo(JCTree tree) {
+        List<JCTree> infoList = prunedTree.get(currentClass);
+        infoList = (infoList == null) ? List.of(tree) : infoList.prepend(tree);
+        prunedTree.put(currentClass, infoList);
+    }
+
     /** Ensure that identifier is accessible, return tree accessing the identifier.
      *  @param sym      The accessed symbol.
      *  @param tree     The tree referring to the symbol.
@@ -1111,7 +1121,10 @@
                     // Constants are replaced by their constant value.
                     if (sym.kind == VAR) {
                         Object cv = ((VarSymbol)sym).getConstValue();
-                        if (cv != null) return makeLit(sym.type, cv);
+                        if (cv != null) {
+                            addPrunedInfo(tree);
+                            return makeLit(sym.type, cv);
+                        }
                     }
 
                     // Private variables and methods are replaced by calls
@@ -2746,12 +2759,15 @@
 
     /** Visitor method for conditional expressions.
      */
+    @Override
     public void visitConditional(JCConditional tree) {
         JCTree cond = tree.cond = translate(tree.cond, syms.booleanType);
         if (cond.type.isTrue()) {
             result = convert(translate(tree.truepart, tree.type), tree.type);
+            addPrunedInfo(cond);
         } else if (cond.type.isFalse()) {
             result = convert(translate(tree.falsepart, tree.type), tree.type);
+            addPrunedInfo(cond);
         } else {
             // Condition is not a compile-time constant.
             tree.truepart = translate(tree.truepart, tree.type);
@@ -2760,14 +2776,14 @@
         }
     }
 //where
-        private JCTree convert(JCTree tree, Type pt) {
-            if (tree.type == pt || tree.type.hasTag(BOT))
-                return tree;
-            JCTree result = make_at(tree.pos()).TypeCast(make.Type(pt), (JCExpression)tree);
-            result.type = (tree.type.constValue() != null) ? cfolder.coerce(tree.type, pt)
-                                                           : pt;
-            return result;
-        }
+    private JCTree convert(JCTree tree, Type pt) {
+        if (tree.type == pt || tree.type.hasTag(BOT))
+            return tree;
+        JCTree result = make_at(tree.pos()).TypeCast(make.Type(pt), (JCExpression)tree);
+        result.type = (tree.type.constValue() != null) ? cfolder.coerce(tree.type, pt)
+                                                       : pt;
+        return result;
+    }
 
     /** Visitor method for if statements.
      */
@@ -2775,12 +2791,14 @@
         JCTree cond = tree.cond = translate(tree.cond, syms.booleanType);
         if (cond.type.isTrue()) {
             result = translate(tree.thenpart);
+            addPrunedInfo(cond);
         } else if (cond.type.isFalse()) {
             if (tree.elsepart != null) {
                 result = translate(tree.elsepart);
             } else {
                 result = make.Skip();
             }
+            addPrunedInfo(cond);
         } else {
             // Condition is not a compile-time constant.
             tree.thenpart = translate(tree.thenpart);
--- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Fri Dec 14 18:40:42 2012 +0000
@@ -71,6 +71,7 @@
     private final Map<Type,Symbol> stringBufferAppend;
     private Name accessDollar;
     private final Types types;
+    private final Lower lower;
 
     /** Switch: GJ mode?
      */
@@ -112,6 +113,7 @@
         stringBufferAppend = new HashMap<Type,Symbol>();
         accessDollar = names.
             fromString("access" + target.syntheticNameChar());
+        lower = Lower.instance(context);
 
         Options options = Options.instance(context);
         lineDebugInfo =
@@ -816,6 +818,62 @@
         }
     }
 
+    /** Visitor class for expressions which might be constant expressions.
+     *  This class is a subset of TreeScanner. Intended to visit trees pruned by
+     *  Lower as long as constant expressions looking for references to any
+     *  ClassSymbol. Any such reference will be added to the constant pool so
+     *  automated tools can detect class dependencies better.
+     */
+    class ClassReferenceVisitor extends JCTree.Visitor {
+
+        @Override
+        public void visitTree(JCTree tree) {}
+
+        @Override
+        public void visitBinary(JCBinary tree) {
+            tree.lhs.accept(this);
+            tree.rhs.accept(this);
+        }
+
+        @Override
+        public void visitSelect(JCFieldAccess tree) {
+            if (tree.selected.type.hasTag(CLASS)) {
+                makeRef(tree.selected.pos(), tree.selected.type);
+            }
+        }
+
+        @Override
+        public void visitIdent(JCIdent tree) {
+            if (tree.sym.owner instanceof ClassSymbol) {
+                pool.put(tree.sym.owner);
+            }
+        }
+
+        @Override
+        public void visitConditional(JCConditional tree) {
+            tree.cond.accept(this);
+            tree.truepart.accept(this);
+            tree.falsepart.accept(this);
+        }
+
+        @Override
+        public void visitUnary(JCUnary tree) {
+            tree.arg.accept(this);
+        }
+
+        @Override
+        public void visitParens(JCParens tree) {
+            tree.expr.accept(this);
+        }
+
+        @Override
+        public void visitTypeCast(JCTypeCast tree) {
+            tree.expr.accept(this);
+        }
+    }
+
+    private ClassReferenceVisitor classReferenceVisitor = new ClassReferenceVisitor();
+
     /** Visitor method: generate code for an expression, catching and reporting
      *  any completion failures.
      *  @param tree    The expression to be visited.
@@ -826,6 +884,7 @@
         try {
             if (tree.type.constValue() != null) {
                 // Short circuit any expressions which are constants
+                tree.accept(classReferenceVisitor);
                 checkStringConstant(tree.pos(), tree.type.constValue());
                 result = items.makeImmediateItem(tree.type, tree.type.constValue());
             } else {
@@ -2205,6 +2264,15 @@
         code.endScopes(limit);
     }
 
+    private void generateReferencesToPrunedTree(ClassSymbol classSymbol, Pool pool) {
+        List<JCTree> prunedInfo = lower.prunedTree.get(classSymbol);
+        if (prunedInfo != null) {
+            for (JCTree prunedTree: prunedInfo) {
+                prunedTree.accept(classReferenceVisitor);
+            }
+        }
+    }
+
 /* ************************************************************************
  * main method
  *************************************************************************/
@@ -2232,6 +2300,7 @@
             cdef.defs = normalizeDefs(cdef.defs, c);
             c.pool = pool;
             pool.reset();
+            generateReferencesToPrunedTree(c, pool);
             Env<GenContext> localEnv =
                 new Env<GenContext>(cdef, new GenContext());
             localEnv.toplevel = env.toplevel;
--- a/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java	Fri Dec 14 18:40:42 2012 +0000
@@ -348,8 +348,8 @@
     private void scanIdent() {
         boolean isJavaIdentifierPart;
         char high;
+        reader.putChar(true);
         do {
-            reader.putChar(true);
             switch (reader.ch) {
             case 'A': case 'B': case 'C': case 'D': case 'E':
             case 'F': case 'G': case 'H': case 'I': case 'J':
@@ -366,6 +366,7 @@
             case '$': case '_':
             case '0': case '1': case '2': case '3': case '4':
             case '5': case '6': case '7': case '8': case '9':
+                break;
             case '\u0000': case '\u0001': case '\u0002': case '\u0003':
             case '\u0004': case '\u0005': case '\u0006': case '\u0007':
             case '\u0008': case '\u000E': case '\u000F': case '\u0010':
@@ -373,26 +374,33 @@
             case '\u0015': case '\u0016': case '\u0017':
             case '\u0018': case '\u0019': case '\u001B':
             case '\u007F':
-                break;
+                reader.scanChar();
+                continue;
             case '\u001A': // EOI is also a legal identifier part
                 if (reader.bp >= reader.buflen) {
                     name = reader.name();
                     tk = tokens.lookupKind(name);
                     return;
                 }
-                break;
+                reader.scanChar();
+                continue;
             default:
                 if (reader.ch < '\u0080') {
                     // all ASCII range chars already handled, above
                     isJavaIdentifierPart = false;
                 } else {
-                    high = reader.scanSurrogates();
-                    if (high != 0) {
-                        reader.putChar(high);
-                        isJavaIdentifierPart = Character.isJavaIdentifierPart(
-                            Character.toCodePoint(high, reader.ch));
+                    if (Character.isIdentifierIgnorable(reader.ch)) {
+                        reader.scanChar();
+                        continue;
                     } else {
-                        isJavaIdentifierPart = Character.isJavaIdentifierPart(reader.ch);
+                        high = reader.scanSurrogates();
+                        if (high != 0) {
+                            reader.putChar(high);
+                            isJavaIdentifierPart = Character.isJavaIdentifierPart(
+                                Character.toCodePoint(high, reader.ch));
+                        } else {
+                            isJavaIdentifierPart = Character.isJavaIdentifierPart(reader.ch);
+                        }
                     }
                 }
                 if (!isJavaIdentifierPart) {
@@ -401,6 +409,7 @@
                     return;
                 }
             }
+            reader.putChar(true);
         } while (true);
     }
 
--- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Dec 14 18:40:42 2012 +0000
@@ -127,6 +127,8 @@
         this.allowMethodReferences = source.allowMethodReferences();
         this.allowDefaultMethods = source.allowDefaultMethods();
         this.allowStaticInterfaceMethods = source.allowStaticInterfaceMethods();
+        this.allowIntersectionTypesInCast =
+                source.allowIntersectionTypesInCast();
         this.keepDocComments = keepDocComments;
         docComments = newDocCommentTable(keepDocComments, fac);
         this.keepLineMap = keepLineMap;
@@ -204,6 +206,10 @@
      */
     boolean allowStaticInterfaceMethods;
 
+    /** Switch: should we allow intersection types in cast?
+     */
+    boolean allowIntersectionTypesInCast;
+
     /** Switch: should we keep docComments?
      */
     boolean keepDocComments;
@@ -235,16 +241,16 @@
     /* ---------- token management -------------- */
 
     protected Token token;
-    
-    protected Token token() {
+
+    public Token token() {
         return token;
     }
 
-    protected void nextToken() {
+    public void nextToken() {
         S.nextToken();
         token = S.token();
     }
-    
+
     protected boolean peekToken(TokenKind tk) {
         return peekToken(0, tk);
     }
@@ -252,7 +258,7 @@
     protected boolean peekToken(int lookahead, TokenKind tk) {
         return S.token(lookahead + 1).kind == tk;
     }
-    
+
     protected boolean peekToken(TokenKind tk1, TokenKind tk2) {
         return peekToken(0, tk1, tk2);
     }
@@ -261,7 +267,7 @@
         return S.token(lookahead + 1).kind == tk1 &&
                 S.token(lookahead + 2).kind == tk2;
     }
-    
+
     protected boolean peekToken(TokenKind tk1, TokenKind tk2, TokenKind tk3) {
         return peekToken(0, tk1, tk2, tk3);
     }
@@ -271,7 +277,7 @@
                 S.token(lookahead + 2).kind == tk2 &&
                 S.token(lookahead + 3).kind == tk3;
     }
-    
+
     protected boolean peekToken(TokenKind... kinds) {
         return peekToken(0, kinds);
     }
@@ -964,7 +970,7 @@
         int pos = token.pos;
         JCExpression t;
         List<JCExpression> typeArgs = typeArgumentsOpt(EXPR);
-        outer: switch (token.kind) {
+        switch (token.kind) {
         case QUES:
             if ((mode & TYPE) != 0 && (mode & (TYPEARG|NOPARAMS)) == TYPEARG) {
                 mode = TYPE;
@@ -988,7 +994,7 @@
             } else return illegal();
             break;
         case LPAREN:
-            if (typeArgs == null && (mode & EXPR) != 0) {                
+            if (typeArgs == null && (mode & EXPR) != 0) {
                 ParensResult pres = analyzeParens();
                 switch (pres) {
                     case CAST:
@@ -997,6 +1003,7 @@
                        int pos1 = pos;
                        List<JCExpression> targets = List.of(t = term3());
                        while (token.kind == AMP) {
+                           checkIntersectionTypesInCast();
                            accept(AMP);
                            targets = targets.prepend(term3());
                        }
@@ -1007,10 +1014,10 @@
                        mode = EXPR;
                        JCExpression t1 = term3();
                        return F.at(pos).TypeCast(t, t1);
-                    case IMPLICIT_LAMBDA:                        
+                    case IMPLICIT_LAMBDA:
                     case EXPLICIT_LAMBDA:
                         t = lambdaExpressionOrStatement(true, pres == ParensResult.EXPLICIT_LAMBDA, pos);
-                        break outer;
+                        break;
                     default: //PARENS
                         accept(LPAREN);
                         mode = EXPR;
@@ -1305,7 +1312,7 @@
             }
         }
     }
-    
+
     /**
      * If we see an identifier followed by a '&lt;' it could be an unbound
      * method reference or a binary expression. To disambiguate, look for a
@@ -1365,7 +1372,7 @@
                 case IDENTIFIER:
                     if (peekToken(lookahead, IDENTIFIER)) {
                         // Identifier, Identifier -> explicit lambda
-                        return ParensResult.EXPLICIT_LAMBDA;                        
+                        return ParensResult.EXPLICIT_LAMBDA;
                     } else if (peekToken(lookahead, RPAREN, ARROW)) {
                         // Identifier, ')' '->' -> implicit lambda
                         return ParensResult.IMPLICIT_LAMBDA;
@@ -1430,7 +1437,7 @@
             }
         }
     }
-    
+
     enum ParensResult {
         CAST,
         EXPLICIT_LAMBDA,
@@ -3487,6 +3494,12 @@
             allowStaticInterfaceMethods = true;
         }
     }
+    void checkIntersectionTypesInCast() {
+        if (!allowIntersectionTypesInCast) {
+            log.error(token.pos, "intersection.types.in.cast.not.supported.in.source", source.name);
+            allowIntersectionTypesInCast = true;
+        }
+    }
 
     /*
      * a functional source tree and end position mappings
--- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Dec 14 18:40:42 2012 +0000
@@ -207,6 +207,7 @@
 compiler.misc.no.suitable.functional.intf.inst=\
     cannot infer functional interface descriptor for {0}
 
+# 0: type
 compiler.misc.secondary.bound.must.be.marker.intf=\
     secondary bound {0} must be a marker interface
 
@@ -2211,6 +2212,11 @@
     static interface methods are not supported in -source {0}\n\
     (use -source 8 or higher to enable static interface methods)
 
+# 0: string
+compiler.err.intersection.types.in.cast.not.supported.in.source=\
+    intersection types in cast are not supported in -source {0}\n\
+    (use -source 8 or higher to enable default methods)
+
 ########################################
 # Diagnostics for verbose resolution
 # used by Resolve (debug only)
--- a/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Fri Dec 14 18:40:42 2012 +0000
@@ -2068,7 +2068,7 @@
             return TYPEUNION;
         }
     }
-    
+
     /**
      * An intersection type, T1 & T2 & ... Tn (used in cast expressions)
      */
--- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Fri Dec 14 18:40:42 2012 +0000
@@ -267,7 +267,7 @@
         return lambda.params.isEmpty() ||
                 lambda.params.head.vartype != null;
     }
-    
+
     /** Return true if the tree corresponds to an expression statement */
     public static boolean isExpressionStatement(JCExpression tree) {
         switch(tree.getTag()) {
@@ -285,7 +285,7 @@
                 return false;
         }
     }
-    
+
     /**
      * Return true if the AST corresponds to a static select of the kind A.B
      */
--- a/src/share/classes/javax/lang/model/type/TypeKind.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/javax/lang/model/type/TypeKind.java	Fri Dec 14 18:40:42 2012 +0000
@@ -145,7 +145,7 @@
       * @since 1.7
       */
     UNION,
-    
+
     /**
       * An intersection type.
       *
--- a/src/share/classes/javax/lang/model/type/TypeVisitor.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/javax/lang/model/type/TypeVisitor.java	Fri Dec 14 18:40:42 2012 +0000
@@ -172,7 +172,7 @@
      * @since 1.7
      */
     R visitUnion(UnionType t, P p);
-    
+
     /**
      * Visits an intersection type.
      *
--- a/src/share/classes/javax/lang/model/util/AbstractTypeVisitor8.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/javax/lang/model/util/AbstractTypeVisitor8.java	Fri Dec 14 18:40:42 2012 +0000
@@ -66,7 +66,7 @@
     protected AbstractTypeVisitor8() {
         super();
     }
-    
+
     /**
      * Visits an {@code IntersectionType} in a manner defined by a subclass.
      *
--- a/src/share/classes/javax/tools/JavaCompiler.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/src/share/classes/javax/tools/JavaCompiler.java	Fri Dec 14 18:40:42 2012 +0000
@@ -108,8 +108,8 @@
  *     example a recommended coding pattern:
  *
  *     <pre>
- *       Files[] files1 = ... ; // input for first compilation task
- *       Files[] files2 = ... ; // input for second compilation task
+ *       File[] files1 = ... ; // input for first compilation task
+ *       File[] files2 = ... ; // input for second compilation task
  *
  *       JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
  *       StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
@@ -165,7 +165,7 @@
  *       JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
  *       StandardJavaFileManager stdFileManager = compiler.getStandardFileManager(null, null, null);
  *       JavaFileManager fileManager = new ForwardingJavaFileManager(stdFileManager) {
- *           public void flush() {
+ *           public void flush() throws IOException {
  *               logger.entering(StandardJavaFileManager.class.getName(), "flush");
  *               super.flush();
  *               logger.exiting(StandardJavaFileManager.class.getName(), "flush");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7144981/IgnoreIgnorableCharactersInInput.java	Fri Dec 14 18:40:42 2012 +0000
@@ -0,0 +1,92 @@
+
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 7144981
+ * @summary javac should ignore ignorable characters in input
+ * @run main IgnoreIgnorableCharactersInInput
+ */
+
+import com.sun.source.util.JavacTask;
+import java.io.File;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Set;
+import java.util.TreeSet;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+public class IgnoreIgnorableCharactersInInput {
+
+    public static void main(String... args) throws Exception {
+        new IgnoreIgnorableCharactersInInput().run();
+    }
+
+    void run() throws Exception {
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        File classesDir = new File(System.getProperty("user.dir"), "classes");
+        classesDir.mkdirs();
+        JavaSource[] sources = new JavaSource[]{
+            new JavaSource("TestOneIgnorableChar", "AA\\u0000BB"),
+            new JavaSource("TestMultipleIgnorableChar", "AA\\u0000\\u0000\\u0000BB")};
+        JavacTask ct = (JavacTask)comp.getTask(null, null, null,
+                Arrays.asList("-d", classesDir.getPath()),
+                null, Arrays.asList(sources));
+        try {
+            if (!ct.call()) {
+                throw new AssertionError("Error thrown when compiling test cases");
+            }
+        } catch (Throwable ex) {
+            throw new AssertionError("Error thrown when compiling test cases");
+        }
+        check(classesDir,
+                "TestOneIgnorableChar.class",
+                "TestOneIgnorableChar$AABB.class",
+                "TestMultipleIgnorableChar.class",
+                "TestMultipleIgnorableChar$AABB.class");
+        if (errors > 0)
+            throw new AssertionError("There are some errors in the test check the error output");
+    }
+
+    /**
+     *  Check that a directory contains the expected files.
+     */
+    void check(File dir, String... paths) {
+        Set<String> found = new TreeSet<String>(Arrays.asList(dir.list()));
+        Set<String> expect = new TreeSet<String>(Arrays.asList(paths));
+        if (found.equals(expect))
+            return;
+        for (String f: found) {
+            if (!expect.contains(f))
+                error("Unexpected file found: " + f);
+        }
+        for (String e: expect) {
+            if (!found.contains(e))
+                error("Expected file not found: " + e);
+        }
+    }
+
+    int errors;
+
+    void error(String msg) {
+        System.err.println(msg);
+        errors++;
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String internalSource =
+            "public class #O {public class #I {} }";
+        public JavaSource(String outerClassName, String innerClassName) {
+            super(URI.create(outerClassName + ".java"), JavaFileObject.Kind.SOURCE);
+            internalSource =
+                    internalSource.replace("#O", outerClassName).replace("#I", innerClassName);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return internalSource;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7153958/CPoolRefClassContainingInlinedCts.java	Fri Dec 14 18:40:42 2012 +0000
@@ -0,0 +1,134 @@
+/*
+ * 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.  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 7153958
+ * @summary add constant pool reference to class containing inlined constants
+ * @compile pkg/ClassToBeStaticallyImported.java
+ * @run main CPoolRefClassContainingInlinedCts
+ */
+
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Class_info;
+import com.sun.tools.classfile.ConstantPool.CPInfo;
+import com.sun.tools.classfile.ConstantPoolException;
+import java.io.File;
+import java.io.IOException;
+
+import static pkg.ClassToBeStaticallyImported.staticField;
+
+public class CPoolRefClassContainingInlinedCts {
+
+    public static void main(String args[]) throws Exception {
+        new CPoolRefClassContainingInlinedCts().run();
+    }
+
+    void run() throws Exception {
+        checkReferences();
+    }
+
+    int numberOfReferencedClassesToBeChecked = 0;
+
+    void checkClassName(String className) {
+        switch (className) {
+            case "SimpleAssignClass" : case "BinaryExpClass":
+            case "UnaryExpClass" : case "CastClass":
+            case "ParensClass" : case "CondClass":
+            case "IfClass" : case "pkg/ClassToBeStaticallyImported":
+                numberOfReferencedClassesToBeChecked++;
+        }
+    }
+
+    void checkReferences() throws IOException, ConstantPoolException {
+        File testClasses = new File(System.getProperty("test.classes"));
+        File file = new File(testClasses,
+                CPoolRefClassContainingInlinedCts.class.getName() + ".class");
+        ClassFile classFile = ClassFile.read(file);
+        int i = 1;
+        CPInfo cpInfo;
+        while (i < classFile.constant_pool.size()) {
+            cpInfo = classFile.constant_pool.get(i);
+            if (cpInfo instanceof CONSTANT_Class_info) {
+                checkClassName(((CONSTANT_Class_info)cpInfo).getName());
+            }
+            i += cpInfo.size();
+        }
+        if (numberOfReferencedClassesToBeChecked != 8) {
+            throw new AssertionError("Class reference missing in the constant pool");
+        }
+    }
+
+    private int assign = SimpleAssignClass.x;
+    private int binary = BinaryExpClass.x + 1;
+    private int unary = -UnaryExpClass.x;
+    private int cast = (int)CastClass.x;
+    private int parens = (ParensClass.x);
+    private int cond = (CondClass.x == 1) ? 1 : 2;
+    private static int ifConstant;
+    private static int importStatic;
+    static {
+        if (IfClass.x == 1) {
+            ifConstant = 1;
+        } else {
+            ifConstant = 2;
+        }
+    }
+    static {
+        if (staticField == 1) {
+            importStatic = 1;
+        } else {
+            importStatic = 2;
+        }
+    }
+}
+
+class SimpleAssignClass {
+    public static final int x = 1;
+}
+
+class BinaryExpClass {
+    public static final int x = 1;
+}
+
+class UnaryExpClass {
+    public static final int x = 1;
+}
+
+class CastClass {
+    public static final int x = 1;
+}
+
+class ParensClass {
+    public static final int x = 1;
+}
+
+class CondClass {
+    public static final int x = 1;
+}
+
+class IfClass {
+    public static final int x = 1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7153958/pkg/ClassToBeStaticallyImported.java	Fri Dec 14 18:40:42 2012 +0000
@@ -0,0 +1,29 @@
+/*
+ * 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.  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;
+
+public class ClassToBeStaticallyImported {
+    public static final int staticField = 1;
+}
--- a/test/tools/javac/cast/intersection/IntersectionTypeCastTest.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/test/tools/javac/cast/intersection/IntersectionTypeCastTest.java	Fri Dec 14 18:40:42 2012 +0000
@@ -23,7 +23,8 @@
 
 /*
  * @test
- * @summary intersection type cast test
+ * @bug 8002099
+ * @summary Add support for intersection types in cast expression
  */
 
 import com.sun.source.util.JavacTask;
@@ -41,7 +42,7 @@
 public class IntersectionTypeCastTest {
 
     static int checkCount = 0;
-    
+
     interface Type {
         boolean subtypeOf(Type that);
         String asString();
@@ -84,7 +85,7 @@
             return true;
         }
     }
-    
+
     enum ClassKind implements Type {
         OBJECT(null, "Object"),
         CA("#M class CA implements A { }\n", "CA", InterfaceKind.A),
@@ -94,7 +95,7 @@
         CCA("#M class CCA implements C, A { }\n", "CCA", InterfaceKind.C, InterfaceKind.A),
         CCB("#M class CCB implements C, B { }\n", "CCB", InterfaceKind.C, InterfaceKind.A, InterfaceKind.B),
         CCAB("#M class CCAB implements C, A, B { }\n", "CCAB", InterfaceKind.C, InterfaceKind.A, InterfaceKind.B);
-        
+
         String declTemplate;
         String typeStr;
         List<InterfaceKind> superInterfaces;
@@ -104,7 +105,7 @@
             this.typeStr = typeStr;
             this.superInterfaces = List.from(superInterfaces);
         }
-        
+
         String getDecl(ModifierKind mod) {
             return declTemplate != null ?
                     declTemplate.replaceAll("#M", mod.modStr) :
@@ -115,12 +116,12 @@
         public boolean subtypeOf(Type that) {
             return this == that || superInterfaces.contains(that) || that == OBJECT;
         }
-        
+
         @Override
         public String asString() {
             return typeStr;
         }
-        
+
         @Override
         public boolean isClass() {
             return true;
@@ -131,25 +132,25 @@
             return false;
         }
     }
-    
+
     enum ModifierKind {
         NONE(""),
         FINAL("final");
-        
+
         String modStr;
 
         ModifierKind(String modStr) {
             this.modStr = modStr;
         }
     }
-    
+
     enum CastKind {
         CLASS("(#C)", 0),
         INTERFACE("(#I0)", 1),
         INTERSECTION2("(#C & #I0)", 1),
         INTERSECTION3("(#C & #I0 & #I1)", 2);
         //INTERSECTION4("(#C & #I0 & #I1 & #I2)", 3);
-        
+
         String castTemplate;
         int interfaceBounds;
 
@@ -158,7 +159,7 @@
             this.interfaceBounds = interfaceBounds;
         }
     }
-    
+
     static class CastInfo {
         CastKind kind;
         Type[] types;
@@ -167,7 +168,7 @@
             this.kind = kind;
             this.types = types;
         }
-        
+
         String getCast() {
             String temp = kind.castTemplate.replaceAll("#C", types[0].asString());
             for (int i = 0; i < kind.interfaceBounds ; i++) {
@@ -175,7 +176,7 @@
             }
             return temp;
         }
-        
+
         boolean hasDuplicateTypes() {
             for (int i = 0 ; i < types.length ; i++) {
                 for (int j = 0 ; j < types.length ; j++) {
@@ -186,7 +187,7 @@
             }
             return false;
         }
-        
+
         boolean compatibleWith(ModifierKind mod, CastInfo that) {
             for (Type t1 : types) {
                 for (Type t2 : that.types) {
@@ -216,7 +217,7 @@
         }
         System.out.println("Total check executed: " + checkCount);
     }
-    
+
     static List<CastInfo> allCastInfo() {
         ListBuffer<CastInfo> buf = ListBuffer.lb();
         for (CastKind kind : CastKind.values()) {
@@ -250,7 +251,7 @@
         }
         return buf.toList();
     }
-    
+
     ModifierKind mod;
     CastInfo cast1, cast2;
     JavaSource source;
@@ -275,7 +276,7 @@
 
         public JavaSource() {
             super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
-            for (ClassKind ck : ClassKind.values()) {                
+            for (ClassKind ck : ClassKind.values()) {
                 source += ck.getDecl(mod);
             }
             for (InterfaceKind ik : InterfaceKind.values()) {
@@ -305,7 +306,7 @@
         checkCount++;
 
         boolean errorExpected = cast1.hasDuplicateTypes() || cast2.hasDuplicateTypes();
-        
+
         errorExpected |= !cast2.compatibleWith(mod, cast1);
 
         if (errorExpected != diagChecker.errorFound) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/cast/intersection/IntersectionTypeParserTest.java	Fri Dec 14 18:40:42 2012 +0000
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8002099
+ * @summary Add support for intersection types in cast expression
+ */
+
+import com.sun.source.util.JavacTask;
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.Diagnostic;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+public class IntersectionTypeParserTest {
+
+    static int checkCount = 0;
+
+    enum TypeKind {
+        SIMPLE("A"),
+        GENERIC("A<X>"),
+        WILDCARD("A<? super X, ? extends Y>");
+
+        String typeStr;
+
+        TypeKind(String typeStr) {
+            this.typeStr = typeStr;
+        }
+    }
+
+    enum ArrayKind {
+        NONE(""),
+        SINGLE("[]"),
+        DOUBLE("[][]");
+
+        String arrStr;
+
+        ArrayKind(String arrStr) {
+            this.arrStr = arrStr;
+        }
+    }
+
+    static class Type {
+        TypeKind tk;
+        ArrayKind ak;
+
+        Type(TypeKind tk, ArrayKind ak) {
+            this.tk = tk;
+            this.ak = ak;
+        }
+
+        String asString() {
+            return tk.typeStr + ak.arrStr;
+        }
+    }
+
+    enum CastKind {
+        ONE("(#T0)", 1),
+        TWO("(#T0 & T1)", 2),
+        THREE("(#T0 & #T1 & #T2)", 3);
+
+        String castTemplate;
+        int nBounds;
+
+        CastKind(String castTemplate, int nBounds) {
+            this.castTemplate = castTemplate;
+            this.nBounds = nBounds;
+        }
+
+        String asString(Type... types) {
+            String res = castTemplate;
+            for (int i = 0; i < nBounds ; i++) {
+                res = res.replaceAll(String.format("#T%d", i), types[i].asString());
+            }
+            return res;
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+        //create default shared JavaCompiler - reused across multiple compilations
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+
+        for (CastKind ck : CastKind.values()) {
+            for (TypeKind t1 : TypeKind.values()) {
+                for (ArrayKind ak1 : ArrayKind.values()) {
+                    Type typ1 = new Type(t1, ak1);
+                    if (ck.nBounds == 1) {
+                        new IntersectionTypeParserTest(ck, typ1).run(comp, fm);
+                        continue;
+                    }
+                    for (TypeKind t2 : TypeKind.values()) {
+                        for (ArrayKind ak2 : ArrayKind.values()) {
+                            Type typ2 = new Type(t2, ak2);
+                            if (ck.nBounds == 2) {
+                                new IntersectionTypeParserTest(ck, typ1, typ2).run(comp, fm);
+                                continue;
+                            }
+                            for (TypeKind t3 : TypeKind.values()) {
+                                for (ArrayKind ak3 : ArrayKind.values()) {
+                                    Type typ3 = new Type(t3, ak3);
+                                    new IntersectionTypeParserTest(ck, typ1, typ2, typ3).run(comp, fm);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        System.out.println("Total check executed: " + checkCount);
+    }
+
+    CastKind ck;
+    Type[] types;
+    JavaSource source;
+    DiagnosticChecker diagChecker;
+
+    IntersectionTypeParserTest(CastKind ck, Type... types) {
+        this.ck = ck;
+        this.types = types;
+        this.source = new JavaSource();
+        this.diagChecker = new DiagnosticChecker();
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String bodyTemplate = "class Test {\n" +
+                              "   void test() {\n" +
+                              "      Object o = #Cnull;\n" +
+                              "   } }";
+
+        String source = "";
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source += bodyTemplate.replaceAll("#C", ck.asString(types));
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
+        checkCount++;
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+                Arrays.asList("-XDallowIntersectionTypes"), null, Arrays.asList(source));
+        ct.parse();
+        if (diagChecker.errorFound) {
+            throw new Error("Unexpected parser error for source:\n" +
+                source.getCharContent(true));
+        }
+    }
+
+    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        boolean errorFound;
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
+                errorFound = true;
+            }
+        }
+    }
+}
--- a/test/tools/javac/cast/intersection/model/Model01.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/test/tools/javac/cast/intersection/model/Model01.java	Fri Dec 14 18:40:42 2012 +0000
@@ -21,6 +21,15 @@
  * questions.
  */
 
+/*
+ * @test
+ * @bug 8002099
+ * @summary Add support for intersection types in cast expression
+ * @library ../../../lib
+ * @build JavacTestingAbstractProcessor ModelChecker
+ * @compile -processor ModelChecker Model01.java
+ */
+
 import javax.lang.model.element.ElementKind;
 
 @Check
@@ -30,7 +39,7 @@
         @Member(ElementKind.METHOD)
         public void m1();
     }
-    
+
     interface B {
         @Member(ElementKind.METHOD)
         public void m2();
--- a/test/tools/javac/cast/intersection/model/ModelChecker.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/test/tools/javac/cast/intersection/model/ModelChecker.java	Fri Dec 14 18:40:42 2012 +0000
@@ -21,15 +21,6 @@
  * questions.
  */
 
-/*
- * @test
- * @bug 6993963 7025809
- * @summary Project Coin: Use precise exception analysis for effectively final catch parameters
- * @library ../../../lib
- * @build JavacTestingAbstractProcessor ModelChecker
- * @compile -processor ModelChecker Model01.java
- */
-
 import com.sun.source.tree.ExpressionTree;
 import com.sun.source.tree.Tree;
 import com.sun.source.tree.TypeCastTree;
@@ -80,39 +71,39 @@
 
         @Override
         public Void visitVariable(VariableTree node, Void p) {
-            
+
             TreePath varPath = new TreePath(getCurrentPath(), node);
             Element v = trees.getElement(varPath);
-            
+
             IntersectionTypeInfo it = v.getAnnotation(IntersectionTypeInfo.class);
             assertTrue(it != null, "IntersectionType annotation must be present");
 
             ExpressionTree varInit = node.getInitializer();
             assertTrue(varInit != null && varInit.getKind() == Tree.Kind.TYPE_CAST,
                     "variable must have be initialized to an expression containing an intersection type cast");
-            
+
             TypeMirror t = ((JCExpression)((TypeCastTree)varInit).getType()).type;
-            
+
             validateIntersectionTypeInfo(t, it);
-            
+
             for (Element e2 : types.asElement(t).getEnclosedElements()) {
                 assertTrue(false, "an intersection type has no declared members");
             }
-            
+
             for (Element e2 : elements.getAllMembers((TypeElement)types.asElement(t))) {
                 Member m = e2.getAnnotation(Member.class);
                 if (m != null) {
                     assertTrue(e2.getKind() == m.value(), "Expected " + m.value() + " - found " + e2.getKind());
                 }
             }
-            
+
             assertTrue(assertionCount == 10, "Expected 10 assertions - found " + assertionCount);
             return super.visitVariable(node, p);
         }
     }
 
     private void validateIntersectionTypeInfo(TypeMirror expectedIntersectionType, IntersectionTypeInfo it) {
-        
+
         assertTrue(expectedIntersectionType.getKind() == TypeKind.INTERSECTION, "INTERSECTION kind expected");
 
         try {
@@ -121,7 +112,7 @@
         } catch (UnknownTypeException ute) {
             ; // Expected
         }
-        
+
         try {
             new SimpleTypeVisitor7<Void, Void>(){}.visit(expectedIntersectionType);
             throw new RuntimeException("Expected UnknownTypeException not thrown.");
--- a/test/tools/javac/defaultMethodExecution/DefaultMethodRegressionTests.java	Thu Dec 13 12:25:52 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +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.  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 8003639
- * @summary convert lambda testng tests to jtreg and add them
- * @run testng DefaultMethodRegressionTests
- */
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.*;
-
-/**
- * This set of classes/interfaces (K/I/C) is specially designed to expose a
- * bug in the JVM where it did not find some overloaded methods in some
- * specific situations. (fixed by hotspot changeset ffb9316fd9ed)
- */
-interface K {
-    int bbb(Long l);
-}
-
-interface I extends K {
-    default void aaa() {}
-    default void aab() {}
-    default void aac() {}
-
-    default int bbb(Integer i) { return 22; }
-    default int bbb(Float f) { return 33; }
-    default int bbb(Long l) { return 44; }
-    default int bbb(Double d) { return 55; }
-    default int bbb(String s) { return 66; }
-
-    default void caa() {}
-    default void cab() {}
-    default void cac() {}
-}
-
-class C implements I {}
-
-public class DefaultMethodRegressionTests {
-
-    @Test(groups = "vm")
-    public void testLostOverloadedMethod() {
-        C c = new C();
-        assertEquals(c.bbb(new Integer(1)), 22);
-        assertEquals(c.bbb(new Float(1.1)), 33);
-        assertEquals(c.bbb(new Long(1L)), 44);
-        assertEquals(c.bbb(new Double(0.01)), 55);
-        assertEquals(c.bbb(new String("")), 66);
-    }
-
-    // Test to ensure that the inference verifier accepts older classfiles
-    // with classes that implement interfaces with defaults.
-    @Test(groups = "vm")
-    public void testInferenceVerifier() {
-        // interface I { int m() default { return 99; } }
-        byte I_bytes[] = {
-            (byte)0xca, (byte)0xfe, (byte)0xba, (byte)0xbe, 0x00, 0x00, 0x00, 0x33,
-            0x00, 0x08, 0x07, 0x00, 0x06, 0x07, 0x00, 0x07,
-            0x01, 0x00, 0x03, 0x66, 0x6f, 0x6f, 0x01, 0x00,
-            0x03, 0x28, 0x29, 0x49, 0x01, 0x00, 0x04, 0x43,
-            0x6f, 0x64, 0x65, 0x01, 0x00, 0x01, 0x49, 0x01,
-            0x00, 0x10, 0x6a, 0x61, 0x76, 0x61, 0x2f, 0x6c,
-            0x61, 0x6e, 0x67, 0x2f, 0x4f, 0x62, 0x6a, 0x65,
-            0x63, 0x74, 0x06, 0x00, 0x00, 0x01, 0x00, 0x02,
-            0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x01,
-            0x00, 0x03, 0x00, 0x04, 0x00, 0x01, 0x00, 0x05,
-            0x00, 0x00, 0x00, 0x0f, 0x00, 0x01, 0x00, 0x01,
-            0x00, 0x00, 0x00, 0x03, 0x10, 0x63, (byte)0xac, 0x00,
-            0x00, 0x00, 0x00, 0x00, 0x00
-        };
-        // public class C implements I {}  /* -target 1.5 */
-        byte C_bytes[] = {
-            (byte)0xca, (byte)0xfe, (byte)0xba, (byte)0xbe, 0x00, 0x00, 0x00, 0x31,
-            0x00, 0x0c, 0x0a, 0x00, 0x03, 0x00, 0x08, 0x07,
-            0x00, 0x09, 0x07, 0x00, 0x0a, 0x07, 0x00, 0x0b,
-            0x01, 0x00, 0x06, 0x3c, 0x69, 0x6e, 0x69, 0x74,
-            0x3e, 0x01, 0x00, 0x03, 0x28, 0x29, 0x56, 0x01,
-            0x00, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x0c, 0x00,
-            0x05, 0x00, 0x06, 0x01, 0x00, 0x01, 0x43, 0x01,
-            0x00, 0x10, 0x6a, 0x61, 0x76, 0x61, 0x2f, 0x6c,
-            0x61, 0x6e, 0x67, 0x2f, 0x4f, 0x62, 0x6a, 0x65,
-            0x63, 0x74, 0x01, 0x00, 0x01, 0x49, 0x00, 0x21,
-            0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04,
-            0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x05,
-            0x00, 0x06, 0x00, 0x01, 0x00, 0x07, 0x00, 0x00,
-            0x00, 0x11, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
-            0x00, 0x05, 0x2a, (byte)0xb7, 0x00, 0x01, (byte)0xb1, 0x00,
-            0x00, 0x00, 0x00, 0x00, 0x00
-        };
-
-        ClassLoader cl = new ClassLoader() {
-            protected Class<?> findClass(String name) {
-                if (name.equals("I")) {
-                    return defineClass("I", I_bytes, 0, I_bytes.length);
-                } else if (name.equals("C")) {
-                    return defineClass("C", C_bytes, 0, C_bytes.length);
-                } else {
-                    return null;
-                }
-            }
-        };
-        try {
-            Class.forName("C", true, cl);
-        } catch (Exception e) {
-            // unmodified verifier will throw VerifyError
-            fail("No exception should be thrown");
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/defaultMethods/defaultMethodExecution/DefaultMethodRegressionTests.java	Fri Dec 14 18:40:42 2012 +0000
@@ -0,0 +1,138 @@
+/*
+ * 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.  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
+ * @ignore 8004360
+ * @bug 8003639
+ * @summary convert lambda testng tests to jtreg and add them
+ * @run testng DefaultMethodRegressionTests
+ */
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.*;
+
+/**
+ * This set of classes/interfaces (K/I/C) is specially designed to expose a
+ * bug in the JVM where it did not find some overloaded methods in some
+ * specific situations. (fixed by hotspot changeset ffb9316fd9ed)
+ */
+interface K {
+    int bbb(Long l);
+}
+
+interface I extends K {
+    default void aaa() {}
+    default void aab() {}
+    default void aac() {}
+
+    default int bbb(Integer i) { return 22; }
+    default int bbb(Float f) { return 33; }
+    default int bbb(Long l) { return 44; }
+    default int bbb(Double d) { return 55; }
+    default int bbb(String s) { return 66; }
+
+    default void caa() {}
+    default void cab() {}
+    default void cac() {}
+}
+
+class C implements I {}
+
+public class DefaultMethodRegressionTests {
+
+    @Test(groups = "vm")
+    public void testLostOverloadedMethod() {
+        C c = new C();
+        assertEquals(c.bbb(new Integer(1)), 22);
+        assertEquals(c.bbb(new Float(1.1)), 33);
+        assertEquals(c.bbb(new Long(1L)), 44);
+        assertEquals(c.bbb(new Double(0.01)), 55);
+        assertEquals(c.bbb(new String("")), 66);
+    }
+
+    // Test to ensure that the inference verifier accepts older classfiles
+    // with classes that implement interfaces with defaults.
+    @Test(groups = "vm")
+    public void testInferenceVerifier() {
+        // interface I { int m() default { return 99; } }
+        byte I_bytes[] = {
+            (byte)0xca, (byte)0xfe, (byte)0xba, (byte)0xbe, 0x00, 0x00, 0x00, 0x33,
+            0x00, 0x08, 0x07, 0x00, 0x06, 0x07, 0x00, 0x07,
+            0x01, 0x00, 0x03, 0x66, 0x6f, 0x6f, 0x01, 0x00,
+            0x03, 0x28, 0x29, 0x49, 0x01, 0x00, 0x04, 0x43,
+            0x6f, 0x64, 0x65, 0x01, 0x00, 0x01, 0x49, 0x01,
+            0x00, 0x10, 0x6a, 0x61, 0x76, 0x61, 0x2f, 0x6c,
+            0x61, 0x6e, 0x67, 0x2f, 0x4f, 0x62, 0x6a, 0x65,
+            0x63, 0x74, 0x06, 0x00, 0x00, 0x01, 0x00, 0x02,
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x01,
+            0x00, 0x03, 0x00, 0x04, 0x00, 0x01, 0x00, 0x05,
+            0x00, 0x00, 0x00, 0x0f, 0x00, 0x01, 0x00, 0x01,
+            0x00, 0x00, 0x00, 0x03, 0x10, 0x63, (byte)0xac, 0x00,
+            0x00, 0x00, 0x00, 0x00, 0x00
+        };
+        // public class C implements I {}  /* -target 1.5 */
+        byte C_bytes[] = {
+            (byte)0xca, (byte)0xfe, (byte)0xba, (byte)0xbe, 0x00, 0x00, 0x00, 0x31,
+            0x00, 0x0c, 0x0a, 0x00, 0x03, 0x00, 0x08, 0x07,
+            0x00, 0x09, 0x07, 0x00, 0x0a, 0x07, 0x00, 0x0b,
+            0x01, 0x00, 0x06, 0x3c, 0x69, 0x6e, 0x69, 0x74,
+            0x3e, 0x01, 0x00, 0x03, 0x28, 0x29, 0x56, 0x01,
+            0x00, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x0c, 0x00,
+            0x05, 0x00, 0x06, 0x01, 0x00, 0x01, 0x43, 0x01,
+            0x00, 0x10, 0x6a, 0x61, 0x76, 0x61, 0x2f, 0x6c,
+            0x61, 0x6e, 0x67, 0x2f, 0x4f, 0x62, 0x6a, 0x65,
+            0x63, 0x74, 0x01, 0x00, 0x01, 0x49, 0x00, 0x21,
+            0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04,
+            0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x05,
+            0x00, 0x06, 0x00, 0x01, 0x00, 0x07, 0x00, 0x00,
+            0x00, 0x11, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
+            0x00, 0x05, 0x2a, (byte)0xb7, 0x00, 0x01, (byte)0xb1, 0x00,
+            0x00, 0x00, 0x00, 0x00, 0x00
+        };
+
+        ClassLoader cl = new ClassLoader() {
+            protected Class<?> findClass(String name) {
+                if (name.equals("I")) {
+                    return defineClass("I", I_bytes, 0, I_bytes.length);
+                } else if (name.equals("C")) {
+                    return defineClass("C", C_bytes, 0, C_bytes.length);
+                } else {
+                    return null;
+                }
+            }
+        };
+        try {
+            Class.forName("C", true, cl);
+        } catch (Exception e) {
+            // unmodified verifier will throw VerifyError
+            fail("No exception should be thrown");
+        }
+    }
+}
--- a/test/tools/javac/diags/examples.not-yet.txt	Thu Dec 13 12:25:52 2012 +0000
+++ b/test/tools/javac/diags/examples.not-yet.txt	Fri Dec 14 18:40:42 2012 +0000
@@ -106,7 +106,4 @@
 compiler.warn.unexpected.archive.file                   # Paths: zip file with unknown extn
 compiler.warn.unknown.enum.constant                     # in bad class file
 compiler.warn.unknown.enum.constant.reason              # in bad class file
-compiler.misc.static.mref.with.targs                                             #LAMBDA
-compiler.misc.static.bound.mref                                                  #LAMBDA
-compiler.misc.secondary.bound.must.be.marker.intf                                #LAMBDA
 compiler.err.static.intf.methods.not.supported.in.source                         #LAMBDA
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/IntersectionTypesInCastNotSupported.java	Fri Dec 14 18:40:42 2012 +0000
@@ -0,0 +1,29 @@
+/*
+ * 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.intersection.types.in.cast.not.supported.in.source
+// options: -source 7 -Xlint:-options
+
+interface IntersectionTypesInCastNotSupported {
+    Object o = (A & B)null;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/SecondaryBoundMustBeMarkerIntf.java	Fri Dec 14 18:40:42 2012 +0000
@@ -0,0 +1,30 @@
+/*
+ * 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.prob.found.req
+// key: compiler.misc.secondary.bound.must.be.marker.intf
+// options: -XDallowIntersectionTypes
+
+class SecondaryBoundMustBeMarkerInterface {
+    Runnable r = (Runnable & Comparable<?>)()->{};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/StaticBoundMref.java	Fri Dec 14 18:40:42 2012 +0000
@@ -0,0 +1,32 @@
+/*
+ * 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() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/StaticMrefWithTargs.java	Fri Dec 14 18:40:42 2012 +0000
@@ -0,0 +1,32 @@
+/*
+ * 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.mref.with.targs
+
+class StaticMrefWithTargs<X> {
+
+    Runnable r = StaticMrefWithTargs<String>::m;
+
+    static void m() { }
+}
--- a/test/tools/javac/lambda/FunctionalInterfaceConversionTest.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/test/tools/javac/lambda/FunctionalInterfaceConversionTest.java	Fri Dec 14 18:40:42 2012 +0000
@@ -23,7 +23,9 @@
 
 /**
  * @test
- * @summary perform several automated checks in lambda conversion, esp. around accessibility
+ * @bug 8003280 8004102
+ * @summary Add lambda tests
+ *  perform several automated checks in lambda conversion, esp. around accessibility
  * @author  Maurizio Cimadamore
  * @run main FunctionalInterfaceConversionTest
  */
@@ -62,7 +64,7 @@
                 "import " + pkg + ".*;";
         }
     }
-    
+
     enum SamKind {
         CLASS("public class Sam {  }"),
         ABSTACT_CLASS("public abstract class Sam {  }"),
@@ -106,11 +108,11 @@
             this.typeStr = typeStr;
         }
     }
-    
+
     enum ExprKind {
         LAMBDA("x -> null"),
         MREF("this::m");
-        
+
         String exprStr;
 
         private ExprKind(String exprStr) {
--- a/test/tools/javac/lambda/Intersection01.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/test/tools/javac/lambda/Intersection01.java	Fri Dec 14 18:40:42 2012 +0000
@@ -23,11 +23,12 @@
 
 /*
  * @test
- * @summary check that additional interface bounds are thrown away during Attr (temporary workaround!)
+ * @bug 8002099
+ * @summary Add support for intersection types in cast expression
  * @compile/fail/ref=Intersection01.out -XDrawDiagnostics Intersection01.java
  */
 class Intersection01 {
-    
+
     interface SAM {
         void m();
     }
--- a/test/tools/javac/lambda/Intersection01.out	Thu Dec 13 12:25:52 2012 +0000
+++ b/test/tools/javac/lambda/Intersection01.out	Fri Dec 14 18:40:42 2012 +0000
@@ -1,3 +1,3 @@
-Intersection01.java:35:45: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, java.io.Serializable))
-Intersection01.java:37:45: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, java.io.Serializable))
+Intersection01.java:36:45: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, java.io.Serializable))
+Intersection01.java:38:45: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, java.io.Serializable))
 2 errors
--- a/test/tools/javac/lambda/LambdaConversionTest.java	Thu Dec 13 12:25:52 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,246 +0,0 @@
-/*
- * Copyright (c) 2011, 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 8003280
- * @summary Add lambda tests
- *  perform several automated checks in lambda conversion, esp. around accessibility
- * @author  Maurizio Cimadamore
- * @run main LambdaConversionTest
- */
-
-import com.sun.source.util.JavacTask;
-import java.net.URI;
-import java.util.Arrays;
-import javax.tools.Diagnostic;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileObject;
-import javax.tools.SimpleJavaFileObject;
-import javax.tools.ToolProvider;
-
-public class LambdaConversionTest {
-
-    enum PackageKind {
-        NO_PKG(""),
-        PKG_A("a");
-
-        String pkg;
-
-        PackageKind(String pkg) {
-            this.pkg = pkg;
-        }
-
-        String getPkgDecl() {
-            return this == NO_PKG ?
-                "" :
-                "package " + pkg + ";";
-        }
-
-        String getImportStat() {
-            return this == NO_PKG ?
-                "" :
-                "import " + pkg + ".*;";
-        }
-    }
-
-    enum SamKind {
-        CLASS("public class Sam {  }"),
-        ABSTACT_CLASS("public abstract class Sam {  }"),
-        ANNOTATION("public @interface Sam {  }"),
-        ENUM("public enum Sam { }"),
-        INTERFACE("public interface Sam { \n #METH; \n }");
-
-        String sam_str;
-
-        SamKind(String sam_str) {
-            this.sam_str = sam_str;
-        }
-
-        String getSam(String methStr) {
-            return sam_str.replaceAll("#METH", methStr);
-        }
-    }
-
-    enum ModifierKind {
-        PUBLIC("public"),
-        PACKAGE("");
-
-        String modifier_str;
-
-        ModifierKind(String modifier_str) {
-            this.modifier_str = modifier_str;
-        }
-
-        boolean stricterThan(ModifierKind that) {
-            return this.ordinal() > that.ordinal();
-        }
-    }
-
-    enum TypeKind {
-        EXCEPTION("Exception"),
-        PKG_CLASS("PackageClass");
-
-        String typeStr;
-
-        private TypeKind(String typeStr) {
-            this.typeStr = typeStr;
-        }
-    }
-
-    enum MethodKind {
-        NONE(""),
-        NON_GENERIC("public #R m(#ARG s) throws #T;"),
-        GENERIC("public <X> #R m(#ARG s) throws #T;");
-
-        String methodTemplate;
-
-        private MethodKind(String methodTemplate) {
-            this.methodTemplate = methodTemplate;
-        }
-
-        String getMethod(TypeKind retType, TypeKind argType, TypeKind thrownType) {
-            return methodTemplate.replaceAll("#R", retType.typeStr).
-                    replaceAll("#ARG", argType.typeStr).
-                    replaceAll("#T", thrownType.typeStr);
-        }
-    }
-
-    public static void main(String[] args) throws Exception {
-        for (PackageKind samPkg : PackageKind.values()) {
-            for (ModifierKind modKind : ModifierKind.values()) {
-                for (SamKind samKind : SamKind.values()) {
-                    for (MethodKind meth : MethodKind.values()) {
-                        for (TypeKind retType : TypeKind.values()) {
-                            for (TypeKind argType : TypeKind.values()) {
-                                for (TypeKind thrownType : TypeKind.values()) {
-                                    new LambdaConversionTest(samPkg, modKind, samKind,
-                                            meth, retType, argType, thrownType).test();
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    PackageKind samPkg;
-    ModifierKind modKind;
-    SamKind samKind;
-    MethodKind meth;
-    TypeKind retType;
-    TypeKind argType;
-    TypeKind thrownType;
-
-    SourceFile samSourceFile = new SourceFile("Sam.java", "#P \n #C") {
-        public String toString() {
-            return template.replaceAll("#P", samPkg.getPkgDecl()).
-                    replaceAll("#C", samKind.getSam(meth.getMethod(retType, argType, thrownType)));
-        }
-    };
-
-    SourceFile pkgClassSourceFile = new SourceFile("PackageClass.java",
-                                                   "#P\n #M class PackageClass extends Exception { }") {
-        public String toString() {
-            return template.replaceAll("#P", samPkg.getPkgDecl()).
-                    replaceAll("#M", modKind.modifier_str);
-        }
-    };
-
-    SourceFile clientSourceFile = new SourceFile("Client.java",
-                                                 "#I\n class Client { Sam s = x -> null; }") {
-        public String toString() {
-            return template.replaceAll("#I", samPkg.getImportStat());
-        }
-    };
-
-    LambdaConversionTest(PackageKind samPkg, ModifierKind modKind, SamKind samKind,
-            MethodKind meth, TypeKind retType, TypeKind argType, TypeKind thrownType) {
-        this.samPkg = samPkg;
-        this.modKind = modKind;
-        this.samKind = samKind;
-        this.meth = meth;
-        this.retType = retType;
-        this.argType = argType;
-        this.thrownType = thrownType;
-    }
-
-    void test() throws Exception {
-        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
-        DiagnosticChecker dc = new DiagnosticChecker();
-        JavacTask ct = (JavacTask)tool.getTask(null, null, dc,
-                null, null, Arrays.asList(samSourceFile, pkgClassSourceFile, clientSourceFile));
-        ct.analyze();
-        if (dc.errorFound == checkSamConversion()) {
-            throw new AssertionError(samSourceFile + "\n\n" + pkgClassSourceFile + "\n\n" + clientSourceFile);
-        }
-    }
-
-    boolean checkSamConversion() {
-        if (samKind != SamKind.INTERFACE) {
-            //sam type must be an interface
-            return false;
-        } else if (meth != MethodKind.NON_GENERIC) {
-            //target method must be non-generic
-            return false;
-        } else if (samPkg != PackageKind.NO_PKG &&
-                modKind != ModifierKind.PUBLIC &&
-                (retType == TypeKind.PKG_CLASS ||
-                argType == TypeKind.PKG_CLASS ||
-                thrownType == TypeKind.PKG_CLASS)) {
-            //target must not contain inaccessible types
-            return false;
-        } else {
-            return true;
-        }
-    }
-
-    abstract class SourceFile extends SimpleJavaFileObject {
-
-        protected String template;
-
-        public SourceFile(String filename, String template) {
-            super(URI.create("myfo:/" + filename), JavaFileObject.Kind.SOURCE);
-            this.template = template;
-        }
-
-        @Override
-        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
-            return toString();
-        }
-
-        public abstract String toString();
-    }
-
-    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
-
-        boolean errorFound = false;
-
-        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
-            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
-                errorFound = true;
-            }
-        }
-    }
-}
--- a/test/tools/javac/lambda/LambdaParserTest.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/test/tools/javac/lambda/LambdaParserTest.java	Fri Dec 14 18:40:42 2012 +0000
@@ -27,6 +27,7 @@
  * @bug 8003280
  * @summary Add lambda tests
  *  Add parser support for lambda expressions
+ * @run main/timeout=360 LambdaParserTest
  */
 
 import com.sun.source.util.JavacTask;
@@ -92,9 +93,14 @@
     enum LambdaParameterKind {
         IMPLICIT(""),
         EXPLIICT_SIMPLE("A"),
+        EXPLIICT_SIMPLE_ARR1("A[]"),
+        EXPLIICT_SIMPLE_ARR2("A[][]"),
         EXPLICIT_VARARGS("A..."),
         EXPLICIT_GENERIC1("A<X>"),
-        EXPLICIT_GENERIC3("A<? extends X, ? super Y>");
+        EXPLICIT_GENERIC2("A<? extends X, ? super Y>"),
+        EXPLICIT_GENERIC2_VARARGS("A<? extends X, ? super Y>..."),
+        EXPLICIT_GENERIC2_ARR1("A<? extends X, ? super Y>[]"),
+        EXPLICIT_GENERIC2_ARR2("A<? extends X, ? super Y>[][]");
 
         String parameterType;
 
@@ -105,6 +111,11 @@
         boolean explicit() {
             return this != IMPLICIT;
         }
+
+        boolean isVarargs() {
+            return this == EXPLICIT_VARARGS ||
+                    this == EXPLICIT_GENERIC2_VARARGS;
+        }
     }
     
     enum AnnotationKind {
@@ -283,7 +294,7 @@
         
         if (lk.arity() == 2 &&
                 (pk1.explicit() != pk2.explicit() ||
-                pk1 == LambdaParameterKind.EXPLICIT_VARARGS)) {
+                pk1.isVarargs())) {
             errorExpected = true;
         }
 
--- a/test/tools/javac/lambda/MethodReference55.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/test/tools/javac/lambda/MethodReference55.java	Fri Dec 14 18:40:42 2012 +0000
@@ -23,7 +23,8 @@
 
 /*
  * @test
- * @summary static bound method reference should be rejected
+ * @bug 8004101
+ * @summary Add checks for method reference well-formedness
  * @compile/fail/ref=MethodReference55.out -XDrawDiagnostics MethodReference55.java
  */
 class MethodReference55<X> {
@@ -31,7 +32,7 @@
     interface V {
         void m(Object o);
     }
-    
+
     V v = new MethodReference55<String>()::m;
 
     void test() {
--- a/test/tools/javac/lambda/MethodReference55.out	Thu Dec 13 12:25:52 2012 +0000
+++ b/test/tools/javac/lambda/MethodReference55.out	Fri Dec 14 18:40:42 2012 +0000
@@ -1,3 +1,3 @@
-MethodReference55.java:35:11: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.bound.mref)
-MethodReference55.java:38:11: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.bound.mref)
+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)
 2 errors
--- a/test/tools/javac/lambda/MethodReference56.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/test/tools/javac/lambda/MethodReference56.java	Fri Dec 14 18:40:42 2012 +0000
@@ -23,7 +23,8 @@
 
 /*
  * @test
- * @summary parameterized qualifier to static method reference should be rejected
+ * @bug 8004101
+ * @summary Add checks for method reference well-formedness
  * @compile/fail/ref=MethodReference56.out -XDrawDiagnostics MethodReference56.java
  */
 class MethodReference56<X> {
@@ -31,7 +32,7 @@
     interface V {
         void m(Object o);
     }
-    
+
     V v = MethodReference56<String>::m;
 
     void test() {
--- a/test/tools/javac/lambda/MethodReference56.out	Thu Dec 13 12:25:52 2012 +0000
+++ b/test/tools/javac/lambda/MethodReference56.out	Fri Dec 14 18:40:42 2012 +0000
@@ -1,3 +1,3 @@
-MethodReference56.java:35:28: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.mref.with.targs)
-MethodReference56.java:38:28: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.mref.with.targs)
+MethodReference56.java:36:28: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.mref.with.targs)
+MethodReference56.java:39:28: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.mref.with.targs)
 2 errors
--- a/test/tools/javac/lambda/MethodReference57.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/test/tools/javac/lambda/MethodReference57.java	Fri Dec 14 18:40:42 2012 +0000
@@ -23,7 +23,8 @@
 
 /*
  * @test
- * @summary non-generic method reference compatible with generic descriptors
+ * @bug 8004102
+ * @summary Add support for generic functional descriptors
  * @compile MethodReference57.java
  */
 class MethodReference57 {
--- a/test/tools/javac/lambda/MethodReference58.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/test/tools/javac/lambda/MethodReference58.java	Fri Dec 14 18:40:42 2012 +0000
@@ -23,7 +23,8 @@
 
 /*
  * @test
- * @summary non-generic method reference compatible with generic descriptors
+ * @bug 8004102
+ * @summary Add support for generic functional descriptors
  * @compile/fail/ref=MethodReference58.out -XDrawDiagnostics MethodReference58.java
  */
 class MethodReference58 {
@@ -31,7 +32,7 @@
     interface F_Object {
         <X> void m(X x);
     }
-    
+
     interface F_Integer {
         <X extends Integer> void m(X x);
     }
--- a/test/tools/javac/lambda/MethodReference58.out	Thu Dec 13 12:25:52 2012 +0000
+++ b/test/tools/javac/lambda/MethodReference58.out	Fri Dec 14 18:40:42 2012 +0000
@@ -1,2 +1,2 @@
-MethodReference58.java:40:23: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, g, Z, X, kindname.class, MethodReference58, (compiler.misc.inferred.do.not.conform.to.upper.bounds: X, java.lang.Number)))
+MethodReference58.java:41:23: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, g, Z, X, kindname.class, MethodReference58, (compiler.misc.inferred.do.not.conform.to.upper.bounds: X, java.lang.Number)))
 1 error
--- a/test/tools/javac/lambda/intersection/IntersectionTargetTypeTest.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/test/tools/javac/lambda/intersection/IntersectionTargetTypeTest.java	Fri Dec 14 18:40:42 2012 +0000
@@ -23,7 +23,8 @@
 
 /*
  * @test
- * @summary intersection target type test for functional expressions
+ * @bug 8002099
+ * @summary Add support for intersection types in cast expression
  */
 
 import com.sun.source.util.JavacTask;
@@ -41,14 +42,14 @@
 public class IntersectionTargetTypeTest {
 
     static int checkCount = 0;
-    
+
     enum BoundKind {
         INTF,
         CLASS,
         SAM,
         ZAM;
     }
-    
+
     enum MethodKind {
         NONE,
         ABSTRACT,
@@ -76,7 +77,7 @@
             this.typeStr = typeStr;
             this.boundKind = boundKind;
         }
-        
+
         boolean compatibleSupertype(TypeKind tk) {
             if (tk == this) return true;
             switch (tk) {
@@ -94,12 +95,12 @@
             }
         }
     }
-    
+
     enum CastKind {
         ONE_ARY("(#B0)", 1),
         TWO_ARY("(#B0 & #B1)", 2),
         THREE_ARY("(#B0 & #B1 & #B2)", 3);
-        
+
         String castTemplate;
         int nbounds;
 
@@ -108,14 +109,14 @@
             this.nbounds = nbounds;
         }
     }
-    
+
     enum ExpressionKind {
         LAMBDA("()->{}", true),
         MREF("this::m", true),
         //COND_LAMBDA("(true ? ()->{} : ()->{})", true), re-enable if spec allows this
         //COND_MREF("(true ? this::m : this::m)", true),
         STANDALONE("null", false);
-        
+
         String exprString;
         boolean isFunctional;
 
@@ -124,7 +125,7 @@
             this.isFunctional = isFunctional;
         }
     }
-    
+
     static class CastInfo {
         CastKind kind;
         TypeKind[] types;
@@ -133,7 +134,7 @@
             this.kind = kind;
             this.types = types;
         }
-        
+
         String getCast() {
             String temp = kind.castTemplate;
             for (int i = 0; i < kind.nbounds ; i++) {
@@ -141,7 +142,7 @@
             }
             return temp;
         }
-        
+
         boolean wellFormed() {
             //check for duplicate types
             for (int i = 0 ; i < types.length ; i++) {
@@ -260,7 +261,7 @@
         checkCount++;
 
         boolean errorExpected = !cInfo.wellFormed();
-        
+
         if (ek.isFunctional) {
             //first bound must be a SAM
             errorExpected |= cInfo.types[0].boundKind != BoundKind.SAM;
--- a/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestKinds.java	Thu Dec 13 12:25:52 2012 +0000
+++ b/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestKinds.java	Fri Dec 14 18:40:42 2012 +0000
@@ -128,17 +128,7 @@
         SN1 var = MethodReferenceTestKindsBase::new;
         assertEquals(var.make("name").toString(), "MethodReferenceTestKindsBase(name)");
     }
-/* unbound inner case not supported anymore (dropped by EG)
-    public void testMRUnboundInner() {
-        SXN0 var = MethodReferenceTestKinds.In::new;
-        assertEquals(var.make(inst("out")).toString(), "In(blank)");
-    }
 
-   public void testMRUnboundInnerArg() {
-        SXN1 var = MethodReferenceTestKinds.In::new;
-        assertEquals(var.make(inst("out"), "name").toString(), "In(name)");
-    }
-*/
     public void testMRImplicitInner() {
         SN0 var = MethodReferenceTestKinds.In::new;
         assertEquals(var.make().toString(), "In(blank)");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/T7190862.java	Fri Dec 14 18:40:42 2012 +0000
@@ -0,0 +1,157 @@
+
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7190862 7109747
+ * @summary javap shows an incorrect type for operands if the 'wide' prefix is used
+ */
+
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javap.JavapFileManager;
+import com.sun.tools.javap.JavapTask;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+public class T7190862 {
+
+    enum TypeWideInstructionMap {
+        INT("int", new String[]{"istore_w", "iload_w"}),
+        LONG("long", new String[]{"lstore_w", "lload_w"}),
+        FLOAT("float", new String[]{"fstore_w", "fload_w"}),
+        DOUBLE("double", new String[]{"dstore_w", "dload_w"}),
+        OBJECT("Object", new String[]{"astore_w", "aload_w"});
+
+        String type;
+        String[] instructions;
+
+        TypeWideInstructionMap(String type, String[] instructions) {
+            this.type = type;
+            this.instructions = instructions;
+        }
+    }
+
+    JavaSource source;
+
+    public static void main(String[] args) {
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        new T7190862().run(comp);
+    }
+
+    private void run(JavaCompiler comp) {
+        String code;
+        for (TypeWideInstructionMap typeInstructionMap: TypeWideInstructionMap.values()) {
+            if (typeInstructionMap != TypeWideInstructionMap.OBJECT) {
+                code = createWideLocalSource(typeInstructionMap.type, 300);
+            } else {
+                code = createWideLocalSourceForObject(300);
+            }
+            source = new JavaSource(code);
+            compile(comp);
+            check(typeInstructionMap.instructions);
+        }
+
+        //an extra test for the iinc instruction
+        code = createIincSource();
+        source = new JavaSource(code);
+        compile(comp);
+        check(new String[]{"iinc_w"});
+    }
+
+    private void compile(JavaCompiler comp) {
+        JavacTask ct = (JavacTask)comp.getTask(null, null, null, null, null, Arrays.asList(source));
+        try {
+            if (!ct.call()) {
+                throw new AssertionError("Error thrown when compiling the following source:\n" + source.getCharContent(true));
+            }
+        } catch (Throwable ex) {
+            throw new AssertionError("Error thrown when compiling the following source:\n" + source.getCharContent(true));
+        }
+    }
+
+    private void check(String[] instructions) {
+        String out = javap(Arrays.asList("-c"), Arrays.asList("Test.class"));
+        for (String line: out.split(System.getProperty("line.separator"))) {
+            line = line.trim();
+            for (String instruction: instructions) {
+                if (line.contains(instruction) && line.contains("#")) {
+                    throw new Error("incorrect type for operands for instruction " + instruction);
+                }
+            }
+        }
+    }
+
+    private String javap(List<String> args, List<String> classes) {
+        DiagnosticCollector<JavaFileObject> dc = new DiagnosticCollector<JavaFileObject>();
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        JavaFileManager fm = JavapFileManager.create(dc, pw);
+        JavapTask t = new JavapTask(pw, fm, dc, args, classes);
+        boolean ok = t.run();
+        if (!ok)
+            throw new Error("javap failed unexpectedly");
+
+        List<Diagnostic<? extends JavaFileObject>> diags = dc.getDiagnostics();
+        for (Diagnostic<? extends JavaFileObject> d: diags) {
+            if (d.getKind() == Diagnostic.Kind.ERROR)
+                throw new Error(d.getMessage(Locale.ENGLISH));
+        }
+        return sw.toString();
+
+    }
+
+    private String createWideLocalSource(String type, int numberOfVars) {
+        String result = "    " + type + " x0 = 0;\n";
+        for (int i = 1; i < numberOfVars; i++) {
+            result += "        " + type + " x" + i + " = x" + (i - 1) + " + 1;\n";
+        }
+        return result;
+    }
+
+    private String createWideLocalSourceForObject(int numberOfVars) {
+        String result = "    Object x0 = new Object();\n";
+        for (int i = 1; i < numberOfVars; i++) {
+            result += "        Object x" + i + " = x0;\n";
+        }
+        return result;
+    }
+
+    private String createIincSource() {
+        return "    int i = 0;\n"
+                + "        i += 1;\n"
+                + "        i += 51;\n"
+                + "        i += 101;\n"
+                + "        i += 151;\n";
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String template = "class Test {\n" +
+                          "    public static void main(String[] args)\n" +
+                          "    {\n" +
+                          "        #C" +
+                          "    }\n" +
+                          "}";
+
+        String source;
+
+        public JavaSource(String code) {
+            super(URI.create("Test.java"), JavaFileObject.Kind.SOURCE);
+            source = template.replaceAll("#C", code);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+}