Merge
authorlana
Fri, 28 Jan 2011 10:06:08 -0800
changeset 8050 4b78c27c217f
parent 8030 0074833e36c6 (current diff)
parent 8049 6f996a6c9b02 (diff)
child 8051 85a8fae9d6e0
Merge
langtools/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java
langtools/src/share/classes/com/sun/tools/classfile/RuntimeInvisibleTypeAnnotations_attribute.java
langtools/src/share/classes/com/sun/tools/classfile/RuntimeTypeAnnotations_attribute.java
langtools/src/share/classes/com/sun/tools/classfile/RuntimeVisibleTypeAnnotations_attribute.java
langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
langtools/src/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java
langtools/test/tools/javac/diags/examples/EnumConstRequired.java
langtools/test/tools/javac/diags/examples/TypeParameterOnPolymorphicSignature.java
langtools/test/tools/javac/meth/InvokeDynTrans.out
langtools/test/tools/javac/meth/InvokeMHTrans.java
langtools/test/tools/javac/meth/InvokeMHTrans.out
--- a/langtools/make/build.xml	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/make/build.xml	Fri Jan 28 10:06:08 2011 -0800
@@ -352,6 +352,45 @@
         </java>
     </target>
 
+    <!-- a patching facility to speed up incorporating the langtools' classfiles
+         into a jdk of your choice. Either target.java.home or patch.jdk can be
+         set on the command line; setting target.java.home has the advantage of
+         patching the jdk used for jtreg and other tests.
+    -->
+    <target name="patch" depends="build-all-classes">
+        <condition property="patch.jdk" value="${target.java.home}">
+            <available file="${target.java.home}" type="dir"/>
+        </condition>
+        <fail message="patch.jdk or target.java.home is not set, please set target.java.home, or patch.jdk for an alternate jdk image to patch">
+            <condition>
+                <not>
+                    <isset property="patch.jdk"/>
+                </not>
+            </condition>
+        </fail>
+        <property name="patch.tools.jar" location="${patch.jdk}/lib/tools.jar"/>
+        <property name="patch.rt.jar" location="${patch.jdk}/jre/lib/rt.jar"/>
+        <fail message="patch.jdk or target.java.home must point to a valid jdk image: missing tools.jar">
+            <condition>
+                <not>
+                    <available file="${patch.tools.jar}" type="file"/>
+                </not>
+            </condition>
+        </fail>
+        <fail message="patch.jdk or target.java.home must point to a valid jdk image: missing rt.jar">
+            <condition>
+                <not>
+                    <available file="${patch.rt.jar}" type="file"/>
+                </not>
+            </condition>
+        </fail>
+        <zip zipfile="${patch.tools.jar}" update="true">
+            <zipfileset dir="${build.classes.dir}" includes="com/**"/>
+        </zip>
+        <zip zipfile="${patch.rt.jar}" update="true">
+            <zipfileset dir="${build.classes.dir}" includes="javax/**"/>
+        </zip>
+    </target>
 
     <!--
     **** Debugging/diagnostic targets.
--- a/langtools/src/share/classes/com/sun/source/tree/MethodTree.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/source/tree/MethodTree.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -53,7 +53,6 @@
     Tree getReturnType();
     List<? extends TypeParameterTree> getTypeParameters();
     List<? extends VariableTree> getParameters();
-//308    List<? extends AnnotationTree> getReceiverAnnotations();
     List<? extends ExpressionTree> getThrows();
     BlockTree getBody();
     Tree getDefaultValue(); // for annotation types
--- a/langtools/src/share/classes/com/sun/source/tree/Tree.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/source/tree/Tree.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -46,8 +46,6 @@
      */
     public enum Kind {
 
-//308        ANNOTATED_TYPE(AnnotatedTypeTree.class),
-
         /**
          * Used for instances of {@link AnnotationTree}.
          */
--- a/langtools/src/share/classes/com/sun/source/tree/TreeVisitor.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/source/tree/TreeVisitor.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -57,7 +57,6 @@
  * @since 1.6
  */
 public interface TreeVisitor<R,P> {
-//308    R visitAnnotatedType(AnnotatedTypeTree node, P p);
     R visitAnnotation(AnnotationTree node, P p);
     R visitMethodInvocation(MethodInvocationTree node, P p);
     R visitAssert(AssertTree node, P p);
--- a/langtools/src/share/classes/com/sun/source/tree/TypeParameterTree.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/source/tree/TypeParameterTree.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -47,5 +47,4 @@
 public interface TypeParameterTree extends Tree {
     Name getName();
     List<? extends Tree> getBounds();
-//308    List<? extends AnnotationTree> getAnnotations();
 }
--- a/langtools/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -248,10 +248,6 @@
         return defaultAction(node, p);
     }
 
-//308    public R visitAnnotatedType(AnnotatedTypeTree node, P p) {
-//308        return defaultAction(node, p);
-//308    }
-
     public R visitErroneous(ErroneousTree node, P p) {
         return defaultAction(node, p);
     }
--- a/langtools/src/share/classes/com/sun/source/util/TreeScanner.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/source/util/TreeScanner.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -138,7 +138,6 @@
         r = scanAndReduce(node.getReturnType(), p, r);
         r = scanAndReduce(node.getTypeParameters(), p, r);
         r = scanAndReduce(node.getParameters(), p, r);
-//308        r = scanAndReduce(node.getReceiverAnnotations(), p, r);
         r = scanAndReduce(node.getThrows(), p, r);
         r = scanAndReduce(node.getBody(), p, r);
         r = scanAndReduce(node.getDefaultValue(), p, r);
@@ -362,7 +361,6 @@
 
     public R visitTypeParameter(TypeParameterTree node, P p) {
         R r = scan(node.getBounds(), p);
-//308        R r = scanAndReduce(node.getAnnotations(), p, r);
         return r;
     }
 
@@ -380,12 +378,6 @@
         return r;
     }
 
-//308   public R visitAnnotatedType(AnnotatedTypeTree node, P p) {
-//308       R r = scan(node.getAnnotations(), p);
-//308       r = scanAndReduce(node.getUnderlyingType(), p, r);
-//308       return r;
-//308   }
-
     public R visitOther(Tree node, P p) {
         return null;
     }
--- a/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -39,6 +39,7 @@
 
 public abstract class Attribute {
     public static final String AnnotationDefault        = "AnnotationDefault";
+    public static final String BootstrapMethods         = "BootstrapMethods";
     public static final String CharacterRangeTable      = "CharacterRangeTable";
     public static final String Code                     = "Code";
     public static final String ConstantValue            = "ConstantValue";
@@ -54,8 +55,6 @@
     public static final String RuntimeInvisibleAnnotations = "RuntimeInvisibleAnnotations";
     public static final String RuntimeVisibleParameterAnnotations = "RuntimeVisibleParameterAnnotations";
     public static final String RuntimeInvisibleParameterAnnotations = "RuntimeInvisibleParameterAnnotations";
-    public static final String RuntimeVisibleTypeAnnotations = "RuntimeVisibleTypeAnnotations";
-    public static final String RuntimeInvisibleTypeAnnotations = "RuntimeInvisibleTypeAnnotations";
     public static final String Signature                = "Signature";
     public static final String SourceDebugExtension     = "SourceDebugExtension";
     public static final String SourceFile               = "SourceFile";
@@ -101,6 +100,7 @@
         protected void init() {
             standardAttributes = new HashMap<String,Class<? extends Attribute>>();
             standardAttributes.put(AnnotationDefault, AnnotationDefault_attribute.class);
+            standardAttributes.put(BootstrapMethods, BootstrapMethods_attribute.class);
             standardAttributes.put(CharacterRangeTable, CharacterRangeTable_attribute.class);
             standardAttributes.put(Code,              Code_attribute.class);
             standardAttributes.put(ConstantValue,     ConstantValue_attribute.class);
@@ -118,8 +118,6 @@
                 standardAttributes.put(RuntimeInvisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations_attribute.class);
                 standardAttributes.put(RuntimeVisibleAnnotations, RuntimeVisibleAnnotations_attribute.class);
                 standardAttributes.put(RuntimeVisibleParameterAnnotations, RuntimeVisibleParameterAnnotations_attribute.class);
-                standardAttributes.put(RuntimeVisibleTypeAnnotations, RuntimeVisibleTypeAnnotations_attribute.class);
-                standardAttributes.put(RuntimeInvisibleTypeAnnotations, RuntimeInvisibleTypeAnnotations_attribute.class);
                 standardAttributes.put(Signature,     Signature_attribute.class);
                 standardAttributes.put(SourceID, SourceID_attribute.class);
             }
@@ -159,6 +157,7 @@
 
 
     public interface Visitor<R,P> {
+        R visitBootstrapMethods(BootstrapMethods_attribute attr, P p);
         R visitDefault(DefaultAttribute attr, P p);
         R visitAnnotationDefault(AnnotationDefault_attribute attr, P p);
         R visitCharacterRangeTable(CharacterRangeTable_attribute attr, P p);
@@ -176,8 +175,6 @@
         R visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, P p);
         R visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, P p);
         R visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, P p);
-        R visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, P p);
-        R visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, P p);
         R visitSignature(Signature_attribute attr, P p);
         R visitSourceDebugExtension(SourceDebugExtension_attribute attr, P p);
         R visitSourceFile(SourceFile_attribute attr, P p);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/classfile/BootstrapMethods_attribute.java	Fri Jan 28 10:06:08 2011 -0800
@@ -0,0 +1,90 @@
+/*
+ * 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.  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 com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS3 <TBD>
+ * http://cr.openjdk.java.net/~jrose/pres/indy-javadoc-mlvm/
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class BootstrapMethods_attribute extends Attribute {
+    public final BootstrapMethodSpecifier[] bootstrap_method_specifiers;
+
+    BootstrapMethods_attribute(ClassReader cr, int name_index, int length)
+            throws IOException, AttributeException {
+        super(name_index, length);
+        int bootstrap_method_count = cr.readUnsignedShort();
+        bootstrap_method_specifiers = new BootstrapMethodSpecifier[bootstrap_method_count];
+        for (int i = 0; i < bootstrap_method_specifiers.length; i++)
+            bootstrap_method_specifiers[i] = new BootstrapMethodSpecifier(cr);
+    }
+
+    public  BootstrapMethods_attribute(int name_index, BootstrapMethodSpecifier[] bootstrap_method_specifiers) {
+        super(name_index, length(bootstrap_method_specifiers));
+        this.bootstrap_method_specifiers = bootstrap_method_specifiers;
+    }
+
+    public static int length(BootstrapMethodSpecifier[] bootstrap_method_specifiers) {
+        int n = 2;
+        for (BootstrapMethodSpecifier b : bootstrap_method_specifiers)
+            n += b.length();
+        return n;
+    }
+
+    @Override
+    public <R, P> R accept(Visitor<R, P> visitor, P p) {
+        return visitor.visitBootstrapMethods(this, p);
+    }
+
+    public static class BootstrapMethodSpecifier {
+        public int bootstrap_method_ref;
+        public int[] bootstrap_arguments;
+
+        public BootstrapMethodSpecifier(int bootstrap_method_ref, int[] bootstrap_arguments) {
+            this.bootstrap_method_ref = bootstrap_method_ref;
+            this.bootstrap_arguments = bootstrap_arguments;
+        }
+        BootstrapMethodSpecifier(ClassReader cr) throws IOException {
+            bootstrap_method_ref = cr.readUnsignedShort();
+            int method_count = cr.readUnsignedShort();
+            bootstrap_arguments = new int[method_count];
+            for (int i = 0; i < bootstrap_arguments.length; i++) {
+                bootstrap_arguments[i] = cr.readUnsignedShort();
+            }
+        }
+
+        int length() {
+            // u2 (method_ref) + u2 (argc) + u2 * argc
+            return 2 + 2 + (bootstrap_arguments.length * 2);
+        }
+    }
+}
--- a/langtools/src/share/classes/com/sun/tools/classfile/ClassTranslator.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ClassTranslator.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -31,7 +31,10 @@
 import com.sun.tools.classfile.ConstantPool.CONSTANT_Float_info;
 import com.sun.tools.classfile.ConstantPool.CONSTANT_Integer_info;
 import com.sun.tools.classfile.ConstantPool.CONSTANT_InterfaceMethodref_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_InvokeDynamic_info;
 import com.sun.tools.classfile.ConstantPool.CONSTANT_Long_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_MethodHandle_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_MethodType_info;
 import com.sun.tools.classfile.ConstantPool.CONSTANT_Methodref_info;
 import com.sun.tools.classfile.ConstantPool.CONSTANT_NameAndType_info;
 import com.sun.tools.classfile.ConstantPool.CONSTANT_String_info;
@@ -304,6 +307,20 @@
         return info;
     }
 
+    public CPInfo visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Map<Object, Object> translations) {
+        CONSTANT_InvokeDynamic_info info2 = (CONSTANT_InvokeDynamic_info) translations.get(info);
+        if (info2 == null) {
+            ConstantPool cp2 = translate(info.cp, translations);
+            if (cp2 == info.cp) {
+                info2 = info;
+            } else {
+                info2 = new CONSTANT_InvokeDynamic_info(cp2, info.bootstrap_method_attr_index, info.name_and_type_index);
+            }
+            translations.put(info, info2);
+        }
+        return info;
+    }
+
     public CPInfo visitLong(CONSTANT_Long_info info, Map<Object, Object> translations) {
         CONSTANT_Long_info info2 = (CONSTANT_Long_info) translations.get(info);
         if (info2 == null) {
@@ -339,6 +356,34 @@
         return info;
     }
 
+    public CPInfo visitMethodHandle(CONSTANT_MethodHandle_info info, Map<Object, Object> translations) {
+        CONSTANT_MethodHandle_info info2 = (CONSTANT_MethodHandle_info) translations.get(info);
+        if (info2 == null) {
+            ConstantPool cp2 = translate(info.cp, translations);
+            if (cp2 == info.cp) {
+                info2 = info;
+            } else {
+                info2 = new CONSTANT_MethodHandle_info(cp2, info.reference_kind, info.reference_index);
+            }
+            translations.put(info, info2);
+        }
+        return info;
+    }
+
+    public CPInfo visitMethodType(CONSTANT_MethodType_info info, Map<Object, Object> translations) {
+        CONSTANT_MethodType_info info2 = (CONSTANT_MethodType_info) translations.get(info);
+        if (info2 == null) {
+            ConstantPool cp2 = translate(info.cp, translations);
+            if (cp2 == info.cp) {
+                info2 = info;
+            } else {
+                info2 = new CONSTANT_MethodType_info(cp2, info.descriptor_index);
+            }
+            translations.put(info, info2);
+        }
+        return info;
+    }
+
     public CPInfo visitString(CONSTANT_String_info info, Map<Object, Object> translations) {
         CONSTANT_String_info info2 = (CONSTANT_String_info) translations.get(info);
         if (info2 == null) {
--- a/langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,6 +1,6 @@
 
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -267,6 +267,12 @@
             return 1;
         }
 
+        public Integer visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, ClassOutputStream out) {
+            out.writeShort(info.bootstrap_method_attr_index);
+            out.writeShort(info.name_and_type_index);
+            return 1;
+        }
+
         public Integer visitLong(CONSTANT_Long_info info, ClassOutputStream out) {
             out.writeLong(info.value);
             return 2;
@@ -278,6 +284,17 @@
             return 1;
         }
 
+        public Integer visitMethodHandle(CONSTANT_MethodHandle_info info, ClassOutputStream out) {
+            out.writeByte(info.reference_kind.tag);
+            out.writeShort(info.reference_index);
+            return 1;
+        }
+
+        public Integer visitMethodType(CONSTANT_MethodType_info info, ClassOutputStream out) {
+            out.writeShort(info.descriptor_index);
+            return 1;
+        }
+
         public Integer visitMethodref(CONSTANT_Methodref_info info, ClassOutputStream out) {
             return writeRef(info, out);
         }
@@ -332,6 +349,19 @@
             return null;
         }
 
+        public Void visitBootstrapMethods(BootstrapMethods_attribute attr, ClassOutputStream out) {
+            out.writeShort(attr.bootstrap_method_specifiers.length);
+            for (BootstrapMethods_attribute.BootstrapMethodSpecifier bsm : attr.bootstrap_method_specifiers) {
+                out.writeShort(bsm.bootstrap_method_ref);
+                int bsm_args_count = bsm.bootstrap_arguments.length;
+                out.writeShort(bsm_args_count);
+                for (int i : bsm.bootstrap_arguments) {
+                    out.writeShort(i);
+                }
+            }
+            return null;
+        }
+
         public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr, ClassOutputStream out) {
             out.writeShort(attr.character_range_table.length);
             for (CharacterRangeTable_attribute.Entry e: attr.character_range_table)
@@ -459,16 +489,6 @@
             return null;
         }
 
-        public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
-            annotationWriter.write(attr.annotations, out);
-            return null;
-        }
-
-        public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
-            annotationWriter.write(attr.annotations, out);
-            return null;
-        }
-
         public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, ClassOutputStream out) {
             out.writeByte(attr.parameter_annotations.length);
             for (Annotation[] annos: attr.parameter_annotations)
@@ -628,12 +648,6 @@
                 write(anno, out);
         }
 
-        public void write(ExtendedAnnotation[] annos, ClassOutputStream out) {
-            out.writeShort(annos.length);
-            for (ExtendedAnnotation anno: annos)
-                write(anno, out);
-        }
-
         public void write(Annotation anno, ClassOutputStream out) {
             out.writeShort(anno.type_index);
             out.writeShort(anno.element_value_pairs.length);
@@ -641,11 +655,6 @@
                 write(p, out);
         }
 
-        public void write(ExtendedAnnotation anno, ClassOutputStream out) {
-            write(anno.annotation, out);
-            write(anno.position, out);
-        }
-
         public void write(element_value_pair pair, ClassOutputStream out) {
             out.writeShort(pair.element_name_index);
             write(pair.value, out);
@@ -684,95 +693,5 @@
             return null;
         }
 
-        private void write(ExtendedAnnotation.Position p, ClassOutputStream out) {
-            out.writeByte(p.type.targetTypeValue());
-            switch (p.type) {
-            // type case
-            case TYPECAST:
-            case TYPECAST_GENERIC_OR_ARRAY:
-            // object creation
-            case INSTANCEOF:
-            case INSTANCEOF_GENERIC_OR_ARRAY:
-            // new expression
-            case NEW:
-            case NEW_GENERIC_OR_ARRAY:
-            case NEW_TYPE_ARGUMENT:
-            case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-                out.writeShort(p.offset);
-                break;
-             // local variable
-            case LOCAL_VARIABLE:
-            case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-                int table_length = p.lvarOffset.length;
-                out.writeShort(table_length);
-                for (int i = 0; i < table_length; ++i) {
-                    out.writeShort(1);  // for table length
-                    out.writeShort(p.lvarOffset[i]);
-                    out.writeShort(p.lvarLength[i]);
-                    out.writeShort(p.lvarIndex[i]);
-                }
-                break;
-             // method receiver
-            case METHOD_RECEIVER:
-                // Do nothing
-                break;
-            // type parameters
-            case CLASS_TYPE_PARAMETER:
-            case METHOD_TYPE_PARAMETER:
-                out.writeByte(p.parameter_index);
-                break;
-            // type parameters bounds
-            case CLASS_TYPE_PARAMETER_BOUND:
-            case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            case METHOD_TYPE_PARAMETER_BOUND:
-            case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-                out.writeByte(p.parameter_index);
-                out.writeByte(p.bound_index);
-                break;
-             // wildcards
-            case WILDCARD_BOUND:
-            case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-                write(p.wildcard_position, out);
-                break;
-            // Class extends and implements clauses
-            case CLASS_EXTENDS:
-            case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-                out.writeByte(p.type_index);
-                break;
-            // throws
-            case THROWS:
-                out.writeByte(p.type_index);
-                break;
-            case CLASS_LITERAL:
-            case CLASS_LITERAL_GENERIC_OR_ARRAY:
-                out.writeShort(p.offset);
-                break;
-            // method parameter: not specified
-            case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-                out.writeByte(p.parameter_index);
-                break;
-            // method type argument: wasn't specified
-            case METHOD_TYPE_ARGUMENT:
-            case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-                out.writeShort(p.offset);
-                out.writeByte(p.type_index);
-                break;
-            // We don't need to worry abut these
-            case METHOD_RETURN_GENERIC_OR_ARRAY:
-            case FIELD_GENERIC_OR_ARRAY:
-                break;
-            case UNKNOWN:
-                break;
-            default:
-                throw new AssertionError("unknown type: " + p);
-            }
-
-            // Append location data for generics/arrays.
-            if (p.type.hasLocation()) {
-                out.writeShort(p.location.size());
-                for (int i : p.location)
-                    out.writeByte((byte)i);
-            }
-        }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -114,6 +114,54 @@
     public static final int CONSTANT_Methodref = 10;
     public static final int CONSTANT_InterfaceMethodref = 11;
     public static final int CONSTANT_NameAndType = 12;
+    public static final int CONSTANT_MethodHandle = 15;
+    public static final int CONSTANT_MethodType = 16;
+    public static final int CONSTANT_InvokeDynamic = 18;
+
+    public static enum RefKind {
+        REF_getField(1, "getfield"),
+        REF_getStatic(2, "getstatic"),
+        REF_putField(3, "putfield"),
+        REF_putStatic(4, "putstatic"),
+        REF_invokeVirtual(5, "invokevirtual"),
+        REF_invokeStatic(6, "invokestatic"),
+        REF_invokeSpecial(7, "invokespecial"),
+        REF_newInvokeSpecial(8, "newinvokespecial"),
+        REF_invokeInterface(9, "invokeinterface");
+
+        public final int tag;
+        public final String name;
+
+        RefKind(int tag, String name) {
+            this.tag = tag;
+            this.name = name;
+        }
+
+        static RefKind getRefkind(int tag) {
+            switch(tag) {
+                case 1:
+                    return REF_getField;
+                case 2:
+                    return REF_getStatic;
+                case 3:
+                    return REF_putField;
+                case 4:
+                    return REF_putStatic;
+                case 5:
+                    return REF_invokeVirtual;
+                case 6:
+                    return REF_invokeStatic;
+                case 7:
+                    return REF_invokeSpecial;
+                case 8:
+                    return REF_newInvokeSpecial;
+                case 9:
+                    return REF_invokeInterface;
+                default:
+                    return null;
+            }
+        }
+    }
 
     ConstantPool(ClassReader cr) throws IOException, InvalidEntry {
         int count = cr.readUnsignedShort();
@@ -146,11 +194,23 @@
                 pool[i] = new CONSTANT_InterfaceMethodref_info(this, cr);
                 break;
 
+            case CONSTANT_InvokeDynamic:
+                pool[i] = new CONSTANT_InvokeDynamic_info(this, cr);
+                break;
+
             case CONSTANT_Long:
                 pool[i] = new CONSTANT_Long_info(cr);
                 i++;
                 break;
 
+            case CONSTANT_MethodHandle:
+                pool[i] = new CONSTANT_MethodHandle_info(this, cr);
+                break;
+
+            case CONSTANT_MethodType:
+                pool[i] = new CONSTANT_MethodType_info(this, cr);
+                break;
+
             case CONSTANT_Methodref:
                 pool[i] = new CONSTANT_Methodref_info(this, cr);
                 break;
@@ -279,9 +339,12 @@
         R visitFloat(CONSTANT_Float_info info, P p);
         R visitInteger(CONSTANT_Integer_info info, P p);
         R visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, P p);
+        R visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, P p);
         R visitLong(CONSTANT_Long_info info, P p);
         R visitNameAndType(CONSTANT_NameAndType_info info, P p);
         R visitMethodref(CONSTANT_Methodref_info info, P p);
+        R visitMethodHandle(CONSTANT_MethodHandle_info info, P p);
+        R visitMethodType(CONSTANT_MethodType_info info, P p);
         R visitString(CONSTANT_String_info info, P p);
         R visitUtf8(CONSTANT_Utf8_info info, P p);
     }
@@ -548,6 +611,44 @@
         }
     }
 
+    public static class CONSTANT_InvokeDynamic_info extends CPInfo {
+        CONSTANT_InvokeDynamic_info(ConstantPool cp, ClassReader cr) throws IOException {
+            super(cp);
+            bootstrap_method_attr_index = cr.readUnsignedShort();
+            name_and_type_index = cr.readUnsignedShort();
+        }
+
+        public CONSTANT_InvokeDynamic_info(ConstantPool cp, int bootstrap_method_index, int name_and_type_index) {
+            super(cp);
+            this.bootstrap_method_attr_index = bootstrap_method_index;
+            this.name_and_type_index = name_and_type_index;
+        }
+
+        public int getTag() {
+            return CONSTANT_InvokeDynamic;
+        }
+
+        public int byteLength() {
+            return 5;
+        }
+
+        @Override
+        public String toString() {
+            return "CONSTANT_InvokeDynamic_info[bootstrap_method_index: " + bootstrap_method_attr_index + ", name_and_type_index: " + name_and_type_index + "]";
+        }
+
+        public <R, D> R accept(Visitor<R, D> visitor, D data) {
+            return visitor.visitInvokeDynamic(this, data);
+        }
+
+        public CONSTANT_NameAndType_info getNameAndTypeInfo() throws ConstantPoolException {
+            return cp.getNameAndTypeInfo(name_and_type_index);
+        }
+
+        public final int bootstrap_method_attr_index;
+        public final int name_and_type_index;
+    }
+
     public static class CONSTANT_Long_info extends CPInfo {
         CONSTANT_Long_info(ClassReader cr) throws IOException {
             value = cr.readLong();
@@ -582,6 +683,87 @@
         public final long value;
     }
 
+    public static class CONSTANT_MethodHandle_info extends CPInfo {
+        CONSTANT_MethodHandle_info(ConstantPool cp, ClassReader cr) throws IOException {
+            super(cp);
+            reference_kind =  RefKind.getRefkind(cr.readUnsignedByte());
+            reference_index = cr.readUnsignedShort();
+        }
+
+        public CONSTANT_MethodHandle_info(ConstantPool cp, RefKind ref_kind, int member_index) {
+            super(cp);
+            this.reference_kind = ref_kind;
+            this.reference_index = member_index;
+        }
+
+        public int getTag() {
+            return CONSTANT_MethodHandle;
+        }
+
+        public int byteLength() {
+            return 4;
+        }
+
+        @Override
+        public String toString() {
+            return "CONSTANT_MethodHandle_info[ref_kind: " + reference_kind + ", member_index: " + reference_index + "]";
+        }
+
+        public <R, D> R accept(Visitor<R, D> visitor, D data) {
+            return visitor.visitMethodHandle(this, data);
+        }
+
+        public CPRefInfo getCPRefInfo() throws ConstantPoolException {
+            int expected = CONSTANT_Methodref;
+            int actual = cp.get(reference_index).getTag();
+            // allow these tag types also:
+            switch (actual) {
+                case CONSTANT_Fieldref:
+                case CONSTANT_InterfaceMethodref:
+                    expected = actual;
+            }
+            return (CPRefInfo) cp.get(reference_index, expected);
+        }
+
+        public final RefKind reference_kind;
+        public final int reference_index;
+    }
+
+    public static class CONSTANT_MethodType_info extends CPInfo {
+        CONSTANT_MethodType_info(ConstantPool cp, ClassReader cr) throws IOException {
+            super(cp);
+            descriptor_index = cr.readUnsignedShort();
+        }
+
+        public CONSTANT_MethodType_info(ConstantPool cp, int signature_index) {
+            super(cp);
+            this.descriptor_index = signature_index;
+        }
+
+        public int getTag() {
+            return CONSTANT_MethodType;
+        }
+
+        public int byteLength() {
+            return 3;
+        }
+
+        @Override
+        public String toString() {
+            return "CONSTANT_MethodType_info[signature_index: " + descriptor_index + "]";
+        }
+
+        public <R, D> R accept(Visitor<R, D> visitor, D data) {
+            return visitor.visitMethodType(this, data);
+        }
+
+        public String getType() throws ConstantPoolException {
+            return cp.getUTF8Value(descriptor_index);
+        }
+
+        public final int descriptor_index;
+    }
+
     public static class CONSTANT_Methodref_info extends CPRefInfo {
         CONSTANT_Methodref_info(ConstantPool cp, ClassReader cr) throws IOException {
             super(cp, cr, CONSTANT_Methodref);
@@ -729,5 +911,4 @@
         public final String value;
     }
 
-
 }
--- a/langtools/src/share/classes/com/sun/tools/classfile/Dependencies.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Dependencies.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -626,10 +626,26 @@
                 return visitRef(info, p);
             }
 
+            public Void visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
+                return null;
+            }
+
             public Void visitLong(CONSTANT_Long_info info, Void p) {
                 return null;
             }
 
+            public Void visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
+                return null;
+            }
+
+            public Void visitMethodType(CONSTANT_MethodType_info info, Void p) {
+                return null;
+            }
+
+            public Void visitMethodref(CONSTANT_Methodref_info info, Void p) {
+                return visitRef(info, p);
+            }
+
             public Void visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
                 try {
                     new Signature(info.type_index).getType(constant_pool).accept(this, null);
@@ -639,10 +655,6 @@
                 }
             }
 
-            public Void visitMethodref(CONSTANT_Methodref_info info, Void p) {
-                return visitRef(info, p);
-            }
-
             public Void visitString(CONSTANT_String_info info, Void p) {
                 return null;
             }
--- a/langtools/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java	Thu Jan 27 17:28:57 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,612 +0,0 @@
-/*
- * Copyright (c) 2009, 2010, 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 com.sun.tools.classfile;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Set;
-
-import static com.sun.tools.classfile.ExtendedAnnotation.TargetAttribute.*;
-
-/**
- * See JSR 308 specification, section 4.1
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class ExtendedAnnotation {
-    ExtendedAnnotation(ClassReader cr) throws IOException, Annotation.InvalidAnnotation {
-        annotation = new Annotation(cr);
-        position = read_position(cr);
-    }
-
-    public ExtendedAnnotation(ConstantPool constant_pool,
-            Annotation annotation, Position position) {
-        this.annotation = annotation;
-        this.position = position;
-    }
-
-    public int length() {
-        int n = annotation.length();
-        n += position_length(position);
-        return n;
-    }
-
-    public final Annotation annotation;
-    public final Position position;
-
-    private static Position read_position(ClassReader cr) throws IOException, Annotation.InvalidAnnotation {
-        // Copied from ClassReader
-        int tag = (byte)cr.readUnsignedByte();  // cast to introduce signedness
-        if (!TargetType.isValidTargetTypeValue(tag))
-            throw new Annotation.InvalidAnnotation("invalid type annotation target type value: " + tag);
-
-        TargetType type = TargetType.fromTargetTypeValue(tag);
-
-        Position position = new Position();
-        position.type = type;
-
-        switch (type) {
-        // type case
-        case TYPECAST:
-        case TYPECAST_GENERIC_OR_ARRAY:
-        // object creation
-        case INSTANCEOF:
-        case INSTANCEOF_GENERIC_OR_ARRAY:
-        // new expression
-        case NEW:
-        case NEW_GENERIC_OR_ARRAY:
-            position.offset = cr.readUnsignedShort();
-            break;
-         // local variable
-        case LOCAL_VARIABLE:
-        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-            int table_length = cr.readUnsignedShort();
-            position.lvarOffset = new int[table_length];
-            position.lvarLength = new int[table_length];
-            position.lvarIndex = new int[table_length];
-            for (int i = 0; i < table_length; ++i) {
-                position.lvarOffset[i] = cr.readUnsignedShort();
-                position.lvarLength[i] = cr.readUnsignedShort();
-                position.lvarIndex[i] = cr.readUnsignedShort();
-            }
-            break;
-         // method receiver
-        case METHOD_RECEIVER:
-            // Do nothing
-            break;
-        // type parameters
-        case CLASS_TYPE_PARAMETER:
-        case METHOD_TYPE_PARAMETER:
-            position.parameter_index = cr.readUnsignedByte();
-            break;
-        // type parameter bounds
-        case CLASS_TYPE_PARAMETER_BOUND:
-        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_PARAMETER_BOUND:
-        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            position.parameter_index = cr.readUnsignedByte();
-            position.bound_index = cr.readUnsignedByte();
-            break;
-         // wildcards
-        case WILDCARD_BOUND:
-        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-            position.wildcard_position = read_position(cr);
-            break;
-         // Class extends and implements clauses
-        case CLASS_EXTENDS:
-        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            int in = cr.readUnsignedShort();
-            if (in == 0xFFFF)
-                in = -1;
-            position.type_index = in;
-            break;
-        // throws
-        case THROWS:
-            position.type_index = cr.readUnsignedShort();
-            break;
-        case CLASS_LITERAL:
-        case CLASS_LITERAL_GENERIC_OR_ARRAY:
-            position.offset = cr.readUnsignedShort();
-            break;
-        // method parameter: not specified
-        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-            position.parameter_index = cr.readUnsignedByte();
-            break;
-        // method type argument: wasn't specified
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_ARGUMENT:
-        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            position.offset = cr.readUnsignedShort();
-            position.type_index = cr.readUnsignedByte();
-            break;
-        // We don't need to worry abut these
-        case METHOD_RETURN_GENERIC_OR_ARRAY:
-        case FIELD_GENERIC_OR_ARRAY:
-            break;
-        case UNKNOWN:
-            break;
-        default:
-            throw new AssertionError("Cannot be here");
-        }
-
-        if (type.hasLocation()) {
-            int len = cr.readUnsignedShort();
-            List<Integer> loc = new ArrayList<Integer>(len);
-            for (int i = 0; i < len; i++)
-                loc.add(cr.readUnsignedByte());
-            position.location = loc;
-        }
-        return position;
-    }
-
-    private static int position_length(Position pos) {
-        int n = 0;
-        n += 1; // target_type
-        switch (pos.type) {
-        // type case
-        case TYPECAST:
-        case TYPECAST_GENERIC_OR_ARRAY:
-        // object creation
-        case INSTANCEOF:
-        case INSTANCEOF_GENERIC_OR_ARRAY:
-        // new expression
-        case NEW:
-        case NEW_GENERIC_OR_ARRAY:
-            n += 2;
-            break;
-         // local variable
-        case LOCAL_VARIABLE:
-        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-            n += 2; // table_length;
-            int table_length = pos.lvarOffset.length;
-            n += 2 * table_length; // offset
-            n += 2 * table_length; // length;
-            n += 2 * table_length; // index
-            break;
-         // method receiver
-        case METHOD_RECEIVER:
-            // Do nothing
-            break;
-        // type parameters
-        case CLASS_TYPE_PARAMETER:
-        case METHOD_TYPE_PARAMETER:
-            n += 1; // parameter_index;
-            break;
-        // type parameter bounds
-        case CLASS_TYPE_PARAMETER_BOUND:
-        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_PARAMETER_BOUND:
-        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            n += 1; // parameter_index
-            n += 1; // bound_index
-            break;
-        case WILDCARD_BOUND:
-        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-            n += position_length(pos.wildcard_position);
-            break;
-         // Class extends and implements clauses
-        case CLASS_EXTENDS:
-        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            n += 2; // type_index
-            break;
-        // throws
-        case THROWS:
-            n += 2; // type_index
-            break;
-        case CLASS_LITERAL:
-        case CLASS_LITERAL_GENERIC_OR_ARRAY:
-            n += 1; // offset
-            break;
-        // method parameter: not specified
-        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-            n += 1; // parameter_index
-            break;
-        // method type argument: wasn't specified
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_ARGUMENT:
-        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            n += 2; // offset
-            n += 1; // type index
-            break;
-        // We don't need to worry abut these
-        case METHOD_RETURN_GENERIC_OR_ARRAY:
-        case FIELD_GENERIC_OR_ARRAY:
-            break;
-        case UNKNOWN:
-            break;
-        default:
-        }
-
-        if (pos.type.hasLocation()) {
-            n += 2; // length
-            n += 1 * pos.location.size(); // actual array size
-        }
-
-        return n;
-    }
-
-    // Code duplicated from com.sun.tools.javac.code.TypeAnnotations.Position
-    public static class Position {
-
-        public TargetType type = TargetType.UNKNOWN;
-
-        // For generic/array types.
-        public List<Integer> location = new ArrayList<Integer>();
-
-        // For typecasts, type tests, new (and locals, as start_pc).
-        public int offset = -1;
-
-        // For locals.
-        public int[] lvarOffset = null;
-        public int[] lvarLength = null;
-        public int[] lvarIndex = null;
-
-        // For type parameter bound
-        public int bound_index = Integer.MIN_VALUE;
-
-        // For type parameter and method parameter
-        public int parameter_index = Integer.MIN_VALUE;
-
-        // For class extends, implements, and throws classes
-        public int type_index = Integer.MIN_VALUE;
-
-        // For wildcards
-        public Position wildcard_position = null;
-
-        @Override
-        public String toString() {
-            StringBuilder sb = new StringBuilder();
-            sb.append('[');
-            sb.append(type);
-
-            switch (type) {
-            // type case
-            case TYPECAST:
-            case TYPECAST_GENERIC_OR_ARRAY:
-            // object creation
-            case INSTANCEOF:
-            case INSTANCEOF_GENERIC_OR_ARRAY:
-            // new expression
-            case NEW:
-            case NEW_GENERIC_OR_ARRAY:
-            case NEW_TYPE_ARGUMENT:
-            case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-                sb.append(", offset = ");
-                sb.append(offset);
-                break;
-             // local variable
-            case LOCAL_VARIABLE:
-            case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-                sb.append(", {");
-                for (int i = 0; i < lvarOffset.length; ++i) {
-                    if (i != 0) sb.append("; ");
-                    sb.append(", start_pc = ");
-                    sb.append(lvarOffset[i]);
-                    sb.append(", length = ");
-                    sb.append(lvarLength[i]);
-                    sb.append(", index = ");
-                    sb.append(lvarIndex[i]);
-                }
-                sb.append("}");
-                break;
-             // method receiver
-            case METHOD_RECEIVER:
-                // Do nothing
-                break;
-            // type parameters
-            case CLASS_TYPE_PARAMETER:
-            case METHOD_TYPE_PARAMETER:
-                sb.append(", param_index = ");
-                sb.append(parameter_index);
-                break;
-            // type parameters bound
-            case CLASS_TYPE_PARAMETER_BOUND:
-            case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            case METHOD_TYPE_PARAMETER_BOUND:
-            case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-                sb.append(", param_index = ");
-                sb.append(parameter_index);
-                sb.append(", bound_index = ");
-                sb.append(bound_index);
-                break;
-             // wildcard
-            case WILDCARD_BOUND:
-            case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-                sb.append(", wild_card = ");
-                sb.append(wildcard_position);
-                break;
-             // Class extends and implements clauses
-            case CLASS_EXTENDS:
-            case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-                sb.append(", type_index = ");
-                sb.append(type_index);
-                break;
-            // throws
-            case THROWS:
-                sb.append(", type_index = ");
-                sb.append(type_index);
-                break;
-            case CLASS_LITERAL:
-            case CLASS_LITERAL_GENERIC_OR_ARRAY:
-                sb.append(", offset = ");
-                sb.append(offset);
-                break;
-            // method parameter: not specified
-            case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-                sb.append(", param_index = ");
-                sb.append(parameter_index);
-                break;
-            // method type argument: wasn't specified
-            case METHOD_TYPE_ARGUMENT:
-            case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-                sb.append(", offset = ");
-                sb.append(offset);
-                sb.append(", type_index = ");
-                sb.append(type_index);
-                break;
-            // We don't need to worry abut these
-            case METHOD_RETURN_GENERIC_OR_ARRAY:
-            case FIELD_GENERIC_OR_ARRAY:
-                break;
-            case UNKNOWN:
-                break;
-            default:
-                throw new AssertionError("unknown type: " + type);
-            }
-
-            // Append location data for generics/arrays.
-            if (type.hasLocation()) {
-                sb.append(", location = (");
-                sb.append(location);
-                sb.append(")");
-            }
-
-            sb.append(']');
-            return sb.toString();
-        }
-    }
-
-    // Code duplicated from com.sun.tools.javac.comp.TargetType
-    public enum TargetType {
-
-        /** For annotations on typecasts. */
-        TYPECAST(0x00),
-
-        /** For annotations on a type argument or nested array of a typecast. */
-        TYPECAST_GENERIC_OR_ARRAY(0x01, HasLocation),
-
-        /** For annotations on type tests. */
-        INSTANCEOF(0x02),
-
-        /** For annotations on a type argument or nested array of a type test. */
-        INSTANCEOF_GENERIC_OR_ARRAY(0x03, HasLocation),
-
-        /** For annotations on object creation expressions. */
-        NEW(0x04),
-
-        /**
-         * For annotations on a type argument or nested array of an object creation
-         * expression.
-         */
-        NEW_GENERIC_OR_ARRAY(0x05, HasLocation),
-
-
-        /** For annotations on the method receiver. */
-        METHOD_RECEIVER(0x06),
-
-        // invalid location
-        // METHOD_RECEIVER_GENERIC_OR_ARRAY(0x07, HasLocation),
-
-        /** For annotations on local variables. */
-        LOCAL_VARIABLE(0x08),
-
-        /** For annotations on a type argument or nested array of a local. */
-        LOCAL_VARIABLE_GENERIC_OR_ARRAY(0x09, HasLocation),
-
-        // already handled by regular annotations
-        // METHOD_RETURN(0x0A),
-
-        /**
-         * For annotations on a type argument or nested array of a method return
-         * type.
-         */
-        METHOD_RETURN_GENERIC_OR_ARRAY(0x0B, HasLocation),
-
-        // already handled by regular annotations
-        // METHOD_PARAMETER(0x0C),
-
-        /** For annotations on a type argument or nested array of a method parameter. */
-        METHOD_PARAMETER_GENERIC_OR_ARRAY(0x0D, HasLocation),
-
-        // already handled by regular annotations
-        // FIELD(0x0E),
-
-        /** For annotations on a type argument or nested array of a field. */
-        FIELD_GENERIC_OR_ARRAY(0x0F, HasLocation),
-
-        /** For annotations on a bound of a type parameter of a class. */
-        CLASS_TYPE_PARAMETER_BOUND(0x10, HasBound, HasParameter),
-
-        /**
-         * For annotations on a type argument or nested array of a bound of a type
-         * parameter of a class.
-         */
-        CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY(0x11, HasBound, HasLocation, HasParameter),
-
-        /** For annotations on a bound of a type parameter of a method. */
-        METHOD_TYPE_PARAMETER_BOUND(0x12, HasBound, HasParameter),
-
-        /**
-         * For annotations on a type argument or nested array of a bound of a type
-         * parameter of a method.
-         */
-        METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY(0x13, HasBound, HasLocation, HasParameter),
-
-        /** For annotations on the type of an "extends" or "implements" clause. */
-        CLASS_EXTENDS(0x14),
-
-        /** For annotations on the inner type of an "extends" or "implements" clause. */
-        CLASS_EXTENDS_GENERIC_OR_ARRAY(0x15, HasLocation),
-
-        /** For annotations on a throws clause in a method declaration. */
-        THROWS(0x16),
-
-        // invalid location
-        // THROWS_GENERIC_OR_ARRAY(0x17, HasLocation),
-
-        /** For annotations in type arguments of object creation expressions. */
-        NEW_TYPE_ARGUMENT(0x18),
-        NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY(0x19, HasLocation),
-
-        METHOD_TYPE_ARGUMENT(0x1A),
-        METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY(0x1B, HasLocation),
-
-        WILDCARD_BOUND(0x1C, HasBound),
-        WILDCARD_BOUND_GENERIC_OR_ARRAY(0x1D, HasBound, HasLocation),
-
-        CLASS_LITERAL(0x1E),
-        CLASS_LITERAL_GENERIC_OR_ARRAY(0x1F, HasLocation),
-
-        METHOD_TYPE_PARAMETER(0x20, HasParameter),
-
-        // invalid location
-        // METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY(0x21, HasLocation, HasParameter),
-
-        CLASS_TYPE_PARAMETER(0x22, HasParameter),
-
-        // invalid location
-        // CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY(0x23, HasLocation, HasParameter),
-
-        /** For annotations with an unknown target. */
-        UNKNOWN(-1);
-
-        static final int MAXIMUM_TARGET_TYPE_VALUE = 0x22;
-
-        private final int targetTypeValue;
-        private Set<TargetAttribute> flags;
-
-        TargetType(int targetTypeValue, TargetAttribute... attrs) {
-            if (targetTypeValue < Byte.MIN_VALUE
-                || targetTypeValue > Byte.MAX_VALUE)
-                throw new AssertionError("attribute type value needs to be a byte: " + targetTypeValue);
-            this.targetTypeValue = (byte)targetTypeValue;
-            this.flags = EnumSet.noneOf(TargetAttribute.class);
-            for (TargetAttribute attr : attrs)
-                this.flags.add(attr);
-        }
-
-        /**
-         * Returns whether or not this TargetType represents an annotation whose
-         * target is an inner type of a generic or array type.
-         *
-         * @return true if this TargetType represents an annotation on an inner
-         *         type, false otherwise
-         */
-        public boolean hasLocation() {
-            return flags.contains(HasLocation);
-        }
-
-        public TargetType getGenericComplement() {
-            if (hasLocation())
-                return this;
-            else
-                return fromTargetTypeValue(targetTypeValue() + 1);
-        }
-
-        /**
-         * Returns whether or not this TargetType represents an annotation whose
-         * target has a parameter index.
-         *
-         * @return true if this TargetType has a parameter index,
-         *         false otherwise
-         */
-        public boolean hasParameter() {
-            return flags.contains(HasParameter);
-        }
-
-        /**
-         * Returns whether or not this TargetType represents an annotation whose
-         * target is a type parameter bound.
-         *
-         * @return true if this TargetType represents an type parameter bound
-         *         annotation, false otherwise
-         */
-        public boolean hasBound() {
-            return flags.contains(HasBound);
-        }
-
-        public int targetTypeValue() {
-            return this.targetTypeValue;
-        }
-
-        private static TargetType[] targets = null;
-
-        private static TargetType[] buildTargets() {
-            TargetType[] targets = new TargetType[MAXIMUM_TARGET_TYPE_VALUE + 1];
-            TargetType[] alltargets = values();
-            for (TargetType target : alltargets)
-                if (target.targetTypeValue >= 0)
-                    targets[target.targetTypeValue] = target;
-            for (int i = 0; i <= MAXIMUM_TARGET_TYPE_VALUE; ++i)
-                if (targets[i] == null)
-                    targets[i] = UNKNOWN;
-            return targets;
-        }
-
-        public static boolean isValidTargetTypeValue(int tag) {
-            if (targets == null)
-                targets = buildTargets();
-
-            if (((byte)tag) == ((byte)UNKNOWN.targetTypeValue))
-                return true;
-
-            return (tag >= 0 && tag < targets.length);
-        }
-
-        public static TargetType fromTargetTypeValue(int tag) {
-            if (targets == null)
-                targets = buildTargets();
-
-            if (((byte)tag) == ((byte)UNKNOWN.targetTypeValue))
-                return UNKNOWN;
-
-            if (tag < 0 || tag >= targets.length)
-                throw new IllegalArgumentException("Unknown TargetType: " + tag);
-            return targets[tag];
-        }
-    }
-
-    static enum TargetAttribute {
-        HasLocation, HasParameter, HasBound;
-    }
-}
--- a/langtools/src/share/classes/com/sun/tools/classfile/RuntimeInvisibleTypeAnnotations_attribute.java	Thu Jan 27 17:28:57 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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 com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JSR 308 specification, section 4.1
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class RuntimeInvisibleTypeAnnotations_attribute extends RuntimeTypeAnnotations_attribute {
-    RuntimeInvisibleTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
-            throws IOException, Annotation.InvalidAnnotation {
-        super(cr, name_index, length);
-    }
-
-    public RuntimeInvisibleTypeAnnotations_attribute(ConstantPool cp, ExtendedAnnotation[] annotations)
-            throws ConstantPoolException {
-        this(cp.getUTF8Index(Attribute.RuntimeInvisibleTypeAnnotations), annotations);
-    }
-
-    public RuntimeInvisibleTypeAnnotations_attribute(int name_index, ExtendedAnnotation[] annotations) {
-        super(name_index, annotations);
-    }
-
-    public <R, P> R accept(Visitor<R, P> visitor, P p) {
-        return visitor.visitRuntimeInvisibleTypeAnnotations(this, p);
-    }
-}
--- a/langtools/src/share/classes/com/sun/tools/classfile/RuntimeTypeAnnotations_attribute.java	Thu Jan 27 17:28:57 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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 com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JSR 308 specification, section 4
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public abstract class RuntimeTypeAnnotations_attribute extends Attribute {
-    protected RuntimeTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
-            throws IOException, Annotation.InvalidAnnotation {
-        super(name_index, length);
-        int num_annotations = cr.readUnsignedShort();
-        annotations = new ExtendedAnnotation[num_annotations];
-        for (int i = 0; i < annotations.length; i++)
-            annotations[i] = new ExtendedAnnotation(cr);
-    }
-
-    protected RuntimeTypeAnnotations_attribute(int name_index, ExtendedAnnotation[] annotations) {
-        super(name_index, length(annotations));
-        this.annotations = annotations;
-    }
-
-    private static int length(ExtendedAnnotation[] annos) {
-        int n = 2;
-        for (ExtendedAnnotation anno: annos)
-            n += anno.length();
-        return n;
-    }
-
-    public final ExtendedAnnotation[] annotations;
-}
--- a/langtools/src/share/classes/com/sun/tools/classfile/RuntimeVisibleTypeAnnotations_attribute.java	Thu Jan 27 17:28:57 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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 com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JSR 308 specification, section 4.1
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class RuntimeVisibleTypeAnnotations_attribute extends RuntimeTypeAnnotations_attribute {
-    RuntimeVisibleTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
-            throws IOException, Annotation.InvalidAnnotation {
-        super(cr, name_index, length);
-    }
-
-    public RuntimeVisibleTypeAnnotations_attribute(ConstantPool cp, ExtendedAnnotation[] annotations)
-            throws ConstantPoolException {
-        this(cp.getUTF8Index(Attribute.RuntimeVisibleTypeAnnotations), annotations);
-    }
-
-    public RuntimeVisibleTypeAnnotations_attribute(int name_index, ExtendedAnnotation[] annotations) {
-        super(name_index, annotations);
-    }
-
-    public <R, P> R accept(Visitor<R, P> visitor, P p) {
-        return visitor.visitRuntimeVisibleTypeAnnotations(this, p);
-    }
-}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Fri Jan 28 10:06:08 2011 -0800
@@ -755,22 +755,30 @@
         if (!isInline() && !endsWithNewLine(contentBuilder))
             contentBuilder.append(DocletConstants.NL);
         String tagString = htmlTag.toString();
-        contentBuilder.append("<" + tagString);
+        contentBuilder.append("<");
+        contentBuilder.append(tagString);
         Iterator<HtmlAttr> iterator = attrs.keySet().iterator();
         HtmlAttr key;
         String value = "";
         while (iterator.hasNext()) {
             key = iterator.next();
             value = attrs.get(key);
-            contentBuilder.append(" " + key.toString());
-            if (!value.isEmpty())
-                contentBuilder.append("=\"" + value + "\"");
+            contentBuilder.append(" ");
+            contentBuilder.append(key.toString());
+            if (!value.isEmpty()) {
+                contentBuilder.append("=\"");
+                contentBuilder.append(value);
+                contentBuilder.append("\"");
+            }
         }
         contentBuilder.append(">");
         for (Content c : content)
             c.write(contentBuilder);
-        if (htmlTag.endTagRequired())
-            contentBuilder.append("</" + tagString + ">");
+        if (htmlTag.endTagRequired()) {
+            contentBuilder.append("</");
+            contentBuilder.append(tagString);
+            contentBuilder.append(">");
+        }
         if (!isInline())
             contentBuilder.append(DocletConstants.NL);
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java	Fri Jan 28 10:06:08 2011 -0800
@@ -99,8 +99,24 @@
      * @param contentBuilder content to test for newline character at the end
      * @return true if the content ends with newline.
      */
-    public boolean endsWithNewLine(StringBuilder contentBuilder) {
-        return ((contentBuilder.length() == 0) ||
-                (contentBuilder.toString().endsWith(DocletConstants.NL)));
+    protected boolean endsWithNewLine(StringBuilder contentBuilder) {
+        int contentLength = contentBuilder.length();
+        if (contentLength == 0) {
+            return true;
+        }
+        int nlLength = DocletConstants.NL.length();
+        if (contentLength < nlLength) {
+            return false;
+        }
+        int contentIndex = contentLength - 1;
+        int nlIndex = nlLength - 1;
+        while (nlIndex >= 0) {
+            if (contentBuilder.charAt(contentIndex) != DocletConstants.NL.charAt(nlIndex)) {
+                return false;
+            }
+            contentIndex--;
+            nlIndex--;
+        }
+        return true;
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/Main.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/Main.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -43,12 +43,6 @@
  */
 public class Main {
 
-    static {
-        ClassLoader loader = Main.class.getClassLoader();
-        if (loader != null)
-            loader.setPackageAssertionStatus("com.sun.tools.javac", true);
-    }
-
     /** Unsupported command line interface.
      * @param args   The command line parameters.
      */
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -204,21 +204,6 @@
         }
     }
 
-    public static class TypeCompound extends Compound {
-        public TypeAnnotationPosition position;
-        public TypeCompound(Compound compound,
-                TypeAnnotationPosition position) {
-            this(compound.type, compound.values, position);
-        }
-        public TypeCompound(Type type,
-                List<Pair<MethodSymbol, Attribute>> values,
-                TypeAnnotationPosition position) {
-            super(type, values);
-            this.position = position;
-        }
-
-    }
-
     /** The value for an annotation element of an array type.
      */
     public static class Array extends Attribute {
@@ -255,8 +240,7 @@
         public VarSymbol value;
         public Enum(Type type, VarSymbol value) {
             super(type);
-            assert value != null;
-            this.value = value;
+            this.value = Assert.checkNonNull(value);
         }
         public void accept(Visitor v) { v.visitEnum(this); }
         public String toString() {
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Scope.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Scope.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -133,7 +133,7 @@
      */
     private Scope(Scope next, Symbol owner, Entry[] table, ScopeCounter scopeCounter) {
         this.next = next;
-        assert emptyScope == null || owner != null;
+        Assert.check(emptyScope == null || owner != null);
         this.owner = owner;
         this.table = table;
         this.hashMask = table.length - 1;
@@ -191,16 +191,16 @@
      *  with next.
      */
     public Scope leave() {
-        assert shared == 0;
+        Assert.check(shared == 0);
         if (table != next.table) return next;
         while (elems != null) {
             int hash = getIndex(elems.sym.name);
             Entry e = table[hash];
-            assert e == elems : elems.sym;
+            Assert.check(e == elems, elems.sym);
             table[hash] = elems.shadowed;
             elems = elems.sibling;
         }
-        assert next.shared > 0;
+        Assert.check(next.shared > 0);
         next.shared--;
         next.nelems = nelems;
         // System.out.println("====> leaving scope " + this.hashCode() + " owned by " + this.owner + " to " + next.hashCode());
@@ -211,12 +211,12 @@
     /** Double size of hash table.
      */
     private void dble() {
-        assert shared == 0;
+        Assert.check(shared == 0);
         Entry[] oldtable = table;
         Entry[] newtable = new Entry[oldtable.length * 2];
         for (Scope s = this; s != null; s = s.next) {
             if (s.table == oldtable) {
-                assert s == this || s.shared != 0;
+                Assert.check(s == this || s.shared != 0);
                 s.table = newtable;
                 s.hashMask = newtable.length - 1;
             }
@@ -237,7 +237,7 @@
     /** Enter symbol sym in this scope.
      */
     public void enter(Symbol sym) {
-        assert shared == 0;
+        Assert.check(shared == 0);
         enter(sym, this);
     }
 
@@ -251,7 +251,7 @@
      * arguments are only used in import scopes.
      */
     public void enter(Symbol sym, Scope s, Scope origin) {
-        assert shared == 0;
+        Assert.check(shared == 0);
         if (nelems * 3 >= hashMask * 2)
             dble();
         int hash = getIndex(sym.name);
@@ -274,7 +274,7 @@
      *  attribute tells us that the class isn't a package member.
      */
     public void remove(Symbol sym) {
-        assert shared == 0;
+        Assert.check(shared == 0);
         Entry e = lookup(sym.name);
         if (e.scope == null) return;
 
@@ -314,7 +314,7 @@
     /** Enter symbol sym in this scope if not already there.
      */
     public void enterIfAbsent(Symbol sym) {
-        assert shared == 0;
+        Assert.check(shared == 0);
         Entry e = lookup(sym.name);
         while (e.scope == this && e.sym.kind != sym.kind) e = e.next();
         if (e.scope != this) enter(sym);
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -81,8 +81,7 @@
      *  method to make sure that the class symbol is loaded.
      */
     public List<Attribute.Compound> getAnnotationMirrors() {
-        assert attributes_field != null;
-        return attributes_field;
+        return Assert.checkNonNull(attributes_field);
     }
 
     /** Fetch a particular annotation from a symbol. */
@@ -100,17 +99,6 @@
      */
     public Type type;
 
-    /** The type annotations targeted to a tree directly owned by this symbol
-     */
-    // type annotations are stored here for two purposes:
-    //  - convenient location to store annotations for generation after erasure
-    //  - a private interface for accessing type annotations parsed from
-    //    classfiles
-    //  the field is populated for the following declaration only
-    //  class, field, variable and type parameters
-    //
-    public List<Attribute.TypeCompound> typeAnnotations;
-
     /** The owner of this symbol.
      */
     public Symbol owner;
@@ -133,7 +121,6 @@
         this.completer = null;
         this.erasure_field = null;
         this.attributes_field = List.nil();
-        this.typeAnnotations = List.nil();
         this.name = name;
     }
 
@@ -608,7 +595,7 @@
         }
 
         public <R, P> R accept(ElementVisitor<R, P> v, P p) {
-            assert type.tag == TYPEVAR; // else override will be invoked
+            Assert.check(type.tag == TYPEVAR); // else override will be invoked
             return v.visitTypeParameter(this, p);
         }
 
@@ -682,8 +669,7 @@
                 if (attributes_field.isEmpty())
                     attributes_field = package_info.attributes_field;
             }
-            assert attributes_field != null;
-            return attributes_field;
+            return Assert.checkNonNull(attributes_field);
         }
 
         /** A package "exists" if a type or package that exists has
@@ -780,8 +766,7 @@
 
         public List<Attribute.Compound> getAnnotationMirrors() {
             if (completer != null) complete();
-            assert attributes_field != null;
-            return attributes_field;
+            return Assert.checkNonNull(attributes_field);
         }
 
         public Type erasure(Types types) {
@@ -1032,7 +1017,7 @@
         }
 
         public void setData(Object data) {
-            assert !(data instanceof Env<?>) : this;
+            Assert.check(!(data instanceof Env<?>), this);
             this.data = data;
         }
 
@@ -1064,7 +1049,7 @@
          */
         public MethodSymbol(long flags, Name name, Type type, Symbol owner) {
             super(MTH, flags, name, type, owner);
-            assert owner.type.tag != TYPEVAR : owner + "." + name;
+            if (owner.type.tag == TYPEVAR) Assert.error(owner + "." + name);
         }
 
         /** Clone this symbol with new owner.
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Fri Jan 28 10:06:08 2011 -0800
@@ -126,7 +126,6 @@
     public final Type serializableType;
     public final Type methodHandleType;
     public final Type polymorphicSignatureType;
-    public final Type invokeDynamicType;
     public final Type throwableType;
     public final Type errorType;
     public final Type illegalArgumentExceptionType;
@@ -422,7 +421,6 @@
         serializableType = enterClass("java.io.Serializable");
         methodHandleType = enterClass("java.dyn.MethodHandle");
         polymorphicSignatureType = enterClass("java.dyn.MethodHandle$PolymorphicSignature");
-        invokeDynamicType = enterClass("java.dyn.InvokeDynamic");
         errorType = enterClass("java.lang.Error");
         illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
         exceptionType = enterClass("java.lang.Exception");
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -138,7 +138,7 @@
      */
     public Type constType(Object constValue) {
         final Object value = constValue;
-        assert tag <= BOOLEAN;
+        Assert.check(tag <= BOOLEAN);
         return new Type(tag, tsym) {
                 @Override
                 public Object constValue() {
@@ -202,13 +202,13 @@
      * The constant value of this type, converted to String
      */
     public String stringValue() {
-        assert constValue() != null;
+        Object cv = Assert.checkNonNull(constValue());
         if (tag == BOOLEAN)
-            return ((Integer) constValue()).intValue() == 0 ? "false" : "true";
+            return ((Integer) cv).intValue() == 0 ? "false" : "true";
         else if (tag == CHAR)
-            return String.valueOf((char) ((Integer) constValue()).intValue());
+            return String.valueOf((char) ((Integer) cv).intValue());
         else
-            return constValue().toString();
+            return cv.toString();
     }
 
     /**
@@ -365,6 +365,16 @@
         return false;
     }
 
+    public static List<Type> filter(List<Type> ts, Filter<Type> tf) {
+        ListBuffer<Type> buf = ListBuffer.lb();
+        for (Type t : ts) {
+            if (tf.accepts(t)) {
+                buf.append(t);
+            }
+        }
+        return buf.toList();
+    }
+
     public boolean isSuperBound() { return false; }
     public boolean isExtendsBound() { return false; }
     public boolean isUnbound() { return false; }
@@ -428,9 +438,8 @@
 
         public WildcardType(Type type, BoundKind kind, TypeSymbol tsym) {
             super(WILDCARD, tsym);
-            assert(type != null);
+            this.type = Assert.checkNonNull(type);
             this.kind = kind;
-            this.type = type;
         }
         public WildcardType(WildcardType t, TypeVar bound) {
             this(t.type, t.kind, t.tsym, bound);
@@ -1021,9 +1030,8 @@
                             Type lower,
                             WildcardType wildcard) {
             super(name, owner, lower);
-            assert lower != null;
+            this.lower = Assert.checkNonNull(lower);
             this.bound = upper;
-            this.lower = lower;
             this.wildcard = wildcard;
         }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Thu Jan 27 17:28:57 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,403 +0,0 @@
-/*
- * Copyright (c) 2009, 2010, 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 com.sun.tools.javac.code;
-
-import javax.lang.model.element.ElementKind;
-
-import com.sun.tools.javac.code.Symbol.VarSymbol;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.TreeInfo;
-import com.sun.tools.javac.tree.TreeScanner;
-import com.sun.tools.javac.tree.JCTree.*;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
-
-/**
- * Contains operations specific to processing type annotations
- */
-public class TypeAnnotations {
-    private static final Context.Key<TypeAnnotations> key
-        = new Context.Key<TypeAnnotations>();
-
-    public static TypeAnnotations instance(Context context) {
-        TypeAnnotations instance = context.get(key);
-        if (instance == null)
-            instance = new TypeAnnotations(context);
-        return instance;
-    }
-
-    protected TypeAnnotations(Context context) {
-        context.put(key, this);
-    }
-
-    public void taFillAndLift(JCClassDecl tree, boolean visitBodies) {
-//308        new TypeAnnotationPositions().scan(tree);
-//308        new TypeAnnotationLift().scan(tree);
-    }
-
-    private static class TypeAnnotationPositions extends TreeScanner {
-
-        private ListBuffer<JCTree> frames = ListBuffer.lb();
-        private void push(JCTree t) { frames = frames.prepend(t); }
-        private JCTree pop() { return frames.next(); }
-        private JCTree peek2() { return frames.toList().tail.head; }
-
-        @Override
-        public void scan(JCTree tree) {
-            push(tree);
-            super.scan(tree);
-            pop();
-        }
-
-        private boolean inClass = false;
-
-        @Override
-        public void visitClassDef(JCClassDecl tree) {
-           if (!inClass) {
-               // Do not recurse into nested and inner classes since
-               // TransTypes.visitClassDef makes an invocation for each class
-               // separately.
-               inClass = true;
-               try {
-                   super.visitClassDef(tree);
-               } finally {
-                   inClass = false;
-               }
-           }
-        }
-
-        private TypeAnnotationPosition resolveFrame(JCTree tree, JCTree frame,
-                List<JCTree> path, TypeAnnotationPosition p) {
-            switch (frame.getKind()) {
-                case TYPE_CAST:
-                    p.type = TargetType.TYPECAST;
-                    p.pos = frame.pos;
-                    return p;
-
-                case INSTANCE_OF:
-                    p.type = TargetType.INSTANCEOF;
-                    p.pos = frame.pos;
-                    return p;
-
-                case NEW_CLASS:
-                    p.type = TargetType.NEW;
-                    p.pos = frame.pos;
-                    return p;
-
-                case NEW_ARRAY:
-                    p.type = TargetType.NEW;
-                    p.pos = frame.pos;
-                    return p;
-
-                case ANNOTATION_TYPE:
-                case CLASS:
-                case ENUM:
-                case INTERFACE:
-                    p.pos = frame.pos;
-                    if (((JCClassDecl)frame).extending == tree) {
-                        p.type = TargetType.CLASS_EXTENDS;
-                        p.type_index = -1;
-                    } else if (((JCClassDecl)frame).implementing.contains(tree)) {
-                        p.type = TargetType.CLASS_EXTENDS;
-                        p.type_index = ((JCClassDecl)frame).implementing.indexOf(tree);
-                    } else if (((JCClassDecl)frame).typarams.contains(tree)) {
-                        p.type = TargetType.CLASS_TYPE_PARAMETER;
-                        p.parameter_index = ((JCClassDecl)frame).typarams.indexOf(tree);
-                    } else
-                        throw new AssertionError();
-                    return p;
-
-                case METHOD: {
-                    JCMethodDecl frameMethod = (JCMethodDecl)frame;
-                    p.pos = frame.pos;
-                    if (frameMethod.receiverAnnotations.contains(tree))
-                        p.type = TargetType.METHOD_RECEIVER;
-                    else if (frameMethod.thrown.contains(tree)) {
-                        p.type = TargetType.THROWS;
-                        p.type_index = frameMethod.thrown.indexOf(tree);
-                    } else if (((JCMethodDecl)frame).restype == tree) {
-                        p.type = TargetType.METHOD_RETURN_GENERIC_OR_ARRAY;
-                    } else if (frameMethod.typarams.contains(tree)) {
-                        p.type = TargetType.METHOD_TYPE_PARAMETER;
-                        p.parameter_index = frameMethod.typarams.indexOf(tree);
-                    } else
-                        throw new AssertionError();
-                    return p;
-                }
-                case MEMBER_SELECT: {
-                    JCFieldAccess fieldFrame = (JCFieldAccess)frame;
-                    if ("class".contentEquals(fieldFrame.name)) {
-                        p.type = TargetType.CLASS_LITERAL;
-                        p.pos = TreeInfo.innermostType(fieldFrame.selected).pos;
-                    } else
-                        throw new AssertionError();
-                    return p;
-                }
-                case PARAMETERIZED_TYPE: {
-                    TypeAnnotationPosition nextP;
-                    if (((JCTypeApply)frame).clazz == tree)
-                        nextP = p; // generic: RAW; noop
-                    else if (((JCTypeApply)frame).arguments.contains(tree))
-                        p.location = p.location.prepend(
-                                ((JCTypeApply)frame).arguments.indexOf(tree));
-                    else
-                        throw new AssertionError();
-
-                    List<JCTree> newPath = path.tail;
-                    return resolveFrame(newPath.head, newPath.tail.head, newPath, p);
-                }
-
-                case ARRAY_TYPE: {
-                    p.location = p.location.prepend(0);
-                    List<JCTree> newPath = path.tail;
-                    return resolveFrame(newPath.head, newPath.tail.head, newPath, p);
-                }
-
-                case TYPE_PARAMETER:
-                    if (path.tail.tail.head.getTag() == JCTree.CLASSDEF) {
-                        JCClassDecl clazz = (JCClassDecl)path.tail.tail.head;
-                        p.type = TargetType.CLASS_TYPE_PARAMETER_BOUND;
-                        p.parameter_index = clazz.typarams.indexOf(path.tail.head);
-                        p.bound_index = ((JCTypeParameter)frame).bounds.indexOf(tree);
-                    } else if (path.tail.tail.head.getTag() == JCTree.METHODDEF) {
-                        JCMethodDecl method = (JCMethodDecl)path.tail.tail.head;
-                        p.type = TargetType.METHOD_TYPE_PARAMETER_BOUND;
-                        p.parameter_index = method.typarams.indexOf(path.tail.head);
-                        p.bound_index = ((JCTypeParameter)frame).bounds.indexOf(tree);
-                    } else
-                        throw new AssertionError();
-                    p.pos = frame.pos;
-                    return p;
-
-                case VARIABLE:
-                    VarSymbol v = ((JCVariableDecl)frame).sym;
-                    p.pos = frame.pos;
-                    switch (v.getKind()) {
-                        case LOCAL_VARIABLE:
-                            p.type = TargetType.LOCAL_VARIABLE; break;
-                        case FIELD:
-                            p.type = TargetType.FIELD_GENERIC_OR_ARRAY; break;
-                        case PARAMETER:
-                            p.type = TargetType.METHOD_PARAMETER_GENERIC_OR_ARRAY;
-                            p.parameter_index = methodParamIndex(path, frame);
-                            break;
-                        default: throw new AssertionError();
-                    }
-                    return p;
-
-//308                case ANNOTATED_TYPE: {
-//308                    List<JCTree> newPath = path.tail;
-//308                    return resolveFrame(newPath.head, newPath.tail.head,
-//308                            newPath, p);
-//308                }
-
-                case METHOD_INVOCATION: {
-                    JCMethodInvocation invocation = (JCMethodInvocation)frame;
-                    if (!invocation.typeargs.contains(tree))
-                        throw new AssertionError("{" + tree + "} is not an argument in the invocation: " + invocation);
-                    p.type = TargetType.METHOD_TYPE_ARGUMENT;
-                    p.pos = invocation.pos;
-                    p.type_index = invocation.typeargs.indexOf(tree);
-                    return p;
-                }
-
-                case EXTENDS_WILDCARD:
-                case SUPER_WILDCARD: {
-                    p.type = TargetType.WILDCARD_BOUND;
-                    List<JCTree> newPath = path.tail;
-
-                    TypeAnnotationPosition wildcard =
-                        resolveFrame(newPath.head, newPath.tail.head, newPath,
-                                new TypeAnnotationPosition());
-                    if (!wildcard.location.isEmpty())
-                        wildcard.type = wildcard.type.getGenericComplement();
-                    p.wildcard_position = wildcard;
-                    p.pos = frame.pos;
-                    return p;
-                }
-            }
-            return p;
-        }
-
-        private void setTypeAnnotationPos(List<JCTypeAnnotation> annotations, TypeAnnotationPosition position) {
-            for (JCTypeAnnotation anno : annotations) {
-                anno.annotation_position = position;
-                anno.attribute_field.position = position;
-            }
-        }
-
-        @Override
-        public void visitNewArray(JCNewArray tree) {
-            findPosition(tree, tree, tree.annotations);
-            int dimAnnosCount = tree.dimAnnotations.size();
-
-            // handle annotations associated with dimentions
-            for (int i = 0; i < dimAnnosCount; ++i) {
-                TypeAnnotationPosition p = new TypeAnnotationPosition();
-                p.type = TargetType.NEW_GENERIC_OR_ARRAY;
-                p.pos = tree.pos;
-                p.location = p.location.append(i);
-                setTypeAnnotationPos(tree.dimAnnotations.get(i), p);
-            }
-
-            // handle "free" annotations
-            int i = dimAnnosCount == 0 ? 0 : dimAnnosCount - 1;
-            JCExpression elemType = tree.elemtype;
-            while (elemType != null) {
-                if (elemType.getTag() == JCTree.ANNOTATED_TYPE) {
-                    JCAnnotatedType at = (JCAnnotatedType)elemType;
-                    TypeAnnotationPosition p = new TypeAnnotationPosition();
-                    p.type = TargetType.NEW_GENERIC_OR_ARRAY;
-                    p.pos = tree.pos;
-                    p.location = p.location.append(i);
-                    setTypeAnnotationPos(at.annotations, p);
-                    elemType = at.underlyingType;
-                } else if (elemType.getTag() == JCTree.TYPEARRAY) {
-                    ++i;
-                    elemType = ((JCArrayTypeTree)elemType).elemtype;
-                } else
-                    break;
-            }
-
-            // find annotations locations of initializer elements
-            scan(tree.elems);
-        }
-
-        @Override
-        public void visitAnnotatedType(JCAnnotatedType tree) {
-            findPosition(tree, peek2(), tree.annotations);
-            super.visitAnnotatedType(tree);
-        }
-
-        @Override
-        public void visitMethodDef(JCMethodDecl tree) {
-            TypeAnnotationPosition p = new TypeAnnotationPosition();
-            p.type = TargetType.METHOD_RECEIVER;
-            setTypeAnnotationPos(tree.receiverAnnotations, p);
-            super.visitMethodDef(tree);
-        }
-        @Override
-        public void visitTypeParameter(JCTypeParameter tree) {
-            findPosition(tree, peek2(), tree.annotations);
-            super.visitTypeParameter(tree);
-        }
-
-        void findPosition(JCTree tree, JCTree frame, List<JCTypeAnnotation> annotations) {
-            if (!annotations.isEmpty()) {
-                TypeAnnotationPosition p =
-                        resolveFrame(tree, frame, frames.toList(),
-                                new TypeAnnotationPosition());
-                if (!p.location.isEmpty())
-                    p.type = p.type.getGenericComplement();
-                setTypeAnnotationPos(annotations, p);
-            }
-        }
-
-        private int methodParamIndex(List<JCTree> path, JCTree param) {
-            List<JCTree> curr = path;
-            if (curr.head != param)
-                curr = path.tail;
-            JCMethodDecl method = (JCMethodDecl)curr.tail.head;
-            return method.params.indexOf(param);
-        }
-    }
-
-    private static class TypeAnnotationLift extends TreeScanner {
-        List<Attribute.TypeCompound> recordedTypeAnnotations = List.nil();
-
-        boolean isInner = false;
-        @Override
-        public void visitClassDef(JCClassDecl tree) {
-            if (isInner) {
-                // tree is an inner class tree.  stop now.
-                // TransTypes.visitClassDef makes an invocation for each class
-                // separately.
-                return;
-            }
-            isInner = true;
-            List<Attribute.TypeCompound> prevTAs = recordedTypeAnnotations;
-            recordedTypeAnnotations = List.nil();
-            try {
-                super.visitClassDef(tree);
-            } finally {
-                tree.sym.typeAnnotations = tree.sym.typeAnnotations.appendList(recordedTypeAnnotations);
-                recordedTypeAnnotations = prevTAs;
-            }
-        }
-
-        @Override
-        public void visitMethodDef(JCMethodDecl tree) {
-            List<Attribute.TypeCompound> prevTAs = recordedTypeAnnotations;
-            recordedTypeAnnotations = List.nil();
-            try {
-                super.visitMethodDef(tree);
-            } finally {
-                tree.sym.typeAnnotations = tree.sym.typeAnnotations.appendList(recordedTypeAnnotations);
-                recordedTypeAnnotations = prevTAs;
-            }
-        }
-
-        @Override
-        public void visitVarDef(JCVariableDecl tree) {
-            List<Attribute.TypeCompound> prevTAs = recordedTypeAnnotations;
-            recordedTypeAnnotations = List.nil();
-            ElementKind kind = tree.sym.getKind();
-            if (kind == ElementKind.LOCAL_VARIABLE && tree.mods.annotations.nonEmpty()) {
-                // need to lift the annotations
-                TypeAnnotationPosition position = new TypeAnnotationPosition();
-                position.pos = tree.pos;
-                position.type = TargetType.LOCAL_VARIABLE;
-                for (Attribute.Compound attribute : tree.sym.attributes_field) {
-                    Attribute.TypeCompound tc =
-                        new Attribute.TypeCompound(attribute.type, attribute.values, position);
-                    recordedTypeAnnotations = recordedTypeAnnotations.append(tc);
-                }
-            }
-            try {
-                super.visitVarDef(tree);
-            } finally {
-                if (kind.isField() || kind == ElementKind.LOCAL_VARIABLE)
-                    tree.sym.typeAnnotations = tree.sym.typeAnnotations.appendList(recordedTypeAnnotations);
-                recordedTypeAnnotations = kind.isField() ? prevTAs : prevTAs.appendList(recordedTypeAnnotations);
-            }
-        }
-
-        @Override
-        public void visitApply(JCMethodInvocation tree) {
-            scan(tree.meth);
-            scan(tree.typeargs);
-            scan(tree.args);
-        }
-
-        public void visitAnnotation(JCAnnotation tree) {
-            if (tree instanceof JCTypeAnnotation)
-                recordedTypeAnnotations = recordedTypeAnnotations.append(((JCTypeAnnotation)tree).attribute_field);
-            super.visitAnnotation(tree);
-        }
-    }
-
-}
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -1061,8 +1061,9 @@
                             highSub = (lowSub == null) ? null : asSub(bHigh, aHigh.tsym);
                         }
                         if (highSub != null) {
-                            assert a.tsym == highSub.tsym && a.tsym == lowSub.tsym
-                                : a.tsym + " != " + highSub.tsym + " != " + lowSub.tsym;
+                            if (!(a.tsym == highSub.tsym && a.tsym == lowSub.tsym)) {
+                                Assert.error(a.tsym + " != " + highSub.tsym + " != " + lowSub.tsym);
+                            }
                             if (!disjointTypes(aHigh.allparams(), highSub.allparams())
                                 && !disjointTypes(aHigh.allparams(), lowSub.allparams())
                                 && !disjointTypes(aLow.allparams(), highSub.allparams())
@@ -1703,9 +1704,9 @@
             bt.supertype_field = bounds.head;
             bt.interfaces_field = bounds.tail;
         }
-        assert bt.supertype_field.tsym.completer != null
-            || !bt.supertype_field.isInterface()
-            : bt.supertype_field;
+        Assert.check(bt.supertype_field.tsym.completer != null
+                || !bt.supertype_field.isInterface(),
+            bt.supertype_field);
         return bt;
     }
 
@@ -1834,7 +1835,7 @@
                         // t.interfaces_field is null after
                         // completion, we can assume that t is not the
                         // type of a class/interface declaration.
-                        assert t != t.tsym.type : t.toString();
+                        Assert.check(t != t.tsym.type, t);
                         List<Type> actuals = t.allparams();
                         List<Type> formals = t.tsym.type.allparams();
                         if (t.hasErasedSupertypes()) {
@@ -2646,7 +2647,7 @@
                 act2 = act2.tail;
                 typarams = typarams.tail;
             }
-            assert(act1.isEmpty() && act2.isEmpty() && typarams.isEmpty());
+            Assert.check(act1.isEmpty() && act2.isEmpty() && typarams.isEmpty());
             return new ClassType(class1.getEnclosingType(), merged.toList(), class1.tsym);
         }
 
@@ -2758,7 +2759,7 @@
             // calculate lub(A, B)
             while (ts.head.tag != CLASS && ts.head.tag != TYPEVAR)
                 ts = ts.tail;
-            assert !ts.isEmpty();
+            Assert.check(!ts.isEmpty());
             List<Type> cl = closure(ts.head);
             for (Type t : ts.tail) {
                 if (t.tag == CLASS || t.tag == TYPEVAR)
@@ -3138,7 +3139,7 @@
         boolean reverse = false;
         Type target = to;
         if ((to.tsym.flags() & INTERFACE) == 0) {
-            assert (from.tsym.flags() & INTERFACE) != 0;
+            Assert.check((from.tsym.flags() & INTERFACE) != 0);
             reverse = true;
             to = from;
             from = target;
@@ -3173,12 +3174,12 @@
         boolean reverse = false;
         Type target = to;
         if ((to.tsym.flags() & INTERFACE) == 0) {
-            assert (from.tsym.flags() & INTERFACE) != 0;
+            Assert.check((from.tsym.flags() & INTERFACE) != 0);
             reverse = true;
             to = from;
             from = target;
         }
-        assert (from.tsym.flags() & FINAL) != 0;
+        Assert.check((from.tsym.flags() & FINAL) != 0);
         Type t1 = asSuper(from, to.tsym);
         if (t1 == null) return false;
         Type t2 = to;
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -563,7 +563,7 @@
             if (bound != null && bound.tsym instanceof ClassSymbol) {
                 ClassSymbol c = (ClassSymbol)bound.tsym;
                 if ((c.flags_field & COMPOUND) != 0) {
-                    assert (c.flags_field & UNATTRIBUTED) != 0 : c;
+                    Assert.check((c.flags_field & UNATTRIBUTED) != 0, c);
                     attribClass(typaram.pos(), c);
                 }
             }
@@ -905,7 +905,10 @@
             // or perhaps expr implements Iterable<T>?
             Type base = types.asSuper(exprType, syms.iterableType.tsym);
             if (base == null) {
-                log.error(tree.expr.pos(), "foreach.not.applicable.to.type");
+                log.error(tree.expr.pos(),
+                        "foreach.not.applicable.to.type",
+                        exprType,
+                        diags.fragment("type.req.array.or.iterable"));
                 elemtype = types.createErrorType(exprType);
             } else {
                 List<Type> iterableParams = base.allparams();
@@ -970,7 +973,7 @@
                 if (enumSwitch) {
                     Symbol sym = enumConstant(c.pat, seltype);
                     if (sym == null) {
-                        log.error(c.pat.pos(), "enum.const.req");
+                        log.error(c.pat.pos(), "enum.label.must.be.unqualified.enum");
                     } else if (!labels.add(sym)) {
                         log.error(c.pos(), "duplicate.case.label");
                     }
@@ -1334,7 +1337,6 @@
 
         // The types of the actual method type arguments.
         List<Type> typeargtypes = null;
-        boolean typeargtypesNonRefOK = false;
 
         Name methName = TreeInfo.name(tree.meth);
 
@@ -1434,7 +1436,7 @@
             localEnv.info.varArgs = false;
             Type mtype = attribExpr(tree.meth, localEnv, mpt);
             if (localEnv.info.varArgs)
-                assert mtype.isErroneous() || tree.varargsElement != null;
+                Assert.check(mtype.isErroneous() || tree.varargsElement != null);
 
             // Compute the result type.
             Type restype = mtype.getReturnType();
@@ -1463,21 +1465,7 @@
                               restype.tsym);
             }
 
-            // Special case logic for JSR 292 types.
-            if (rs.allowTransitionalJSR292 &&
-                    tree.meth.getTag() == JCTree.SELECT &&
-                    !typeargtypes.isEmpty()) {
-                JCFieldAccess mfield = (JCFieldAccess) tree.meth;
-                // MethodHandle.<T>invoke(abc) and InvokeDynamic.<T>foo(abc)
-                // has type <T>, and T can be a primitive type.
-                if (mfield.sym != null &&
-                        mfield.sym.isPolymorphicSignatureInstance())
-                    typeargtypesNonRefOK = true;
-            }
-
-            if (!(rs.allowTransitionalJSR292 && typeargtypesNonRefOK)) {
-                chk.checkRefTypes(tree.typeargs, typeargtypes);
-            }
+            chk.checkRefTypes(tree.typeargs, typeargtypes);
 
             // Check that value of resulting type is admissible in the
             // current context.  Also, capture the return type
@@ -1667,7 +1655,7 @@
                         typeargtypes,
                         localEnv.info.varArgs);
                 if (localEnv.info.varArgs)
-                    assert tree.constructorType.isErroneous() || tree.varargsElement != null;
+                    Assert.check(tree.constructorType.isErroneous() || tree.varargsElement != null);
             }
 
             if (cdef != null) {
@@ -1727,7 +1715,7 @@
                 Symbol sym = rs.resolveConstructor(
                     tree.pos(), localEnv, clazztype, argtypes,
                     typeargtypes, true, tree.varargsElement != null);
-                assert sym.kind < AMBIGUOUS || tree.constructor.type.isErroneous();
+                Assert.check(sym.kind < AMBIGUOUS || tree.constructor.type.isErroneous());
                 tree.constructor = sym;
                 if (tree.constructor.kind > ERRONEOUS) {
                     tree.constructorType =  syms.errType;
@@ -2243,10 +2231,10 @@
 
         // Determine the symbol represented by the selection.
         env.info.varArgs = false;
-        Symbol sym = selectSym(tree, site, env, pt, pkind);
+        Symbol sym = selectSym(tree, sitesym, site, env, pt, pkind);
         if (sym.exists() && !isType(sym) && (pkind & (PCK | TYP)) != 0) {
             site = capture(site);
-            sym = selectSym(tree, site, env, pt, pkind);
+            sym = selectSym(tree, sitesym, site, env, pt, pkind);
         }
         boolean varArgs = env.info.varArgs;
         tree.sym = sym;
@@ -2335,6 +2323,14 @@
          *  @param pkind  The expected kind(s) of the Select expression.
          */
         private Symbol selectSym(JCFieldAccess tree,
+                                     Type site,
+                                     Env<AttrContext> env,
+                                     Type pt,
+                                     int pkind) {
+            return selectSym(tree, site.tsym, site, env, pt, pkind);
+        }
+        private Symbol selectSym(JCFieldAccess tree,
+                                 Symbol location,
                                  Type site,
                                  Env<AttrContext> env,
                                  Type pt,
@@ -2346,12 +2342,12 @@
             case PACKAGE:
                 return rs.access(
                     rs.findIdentInPackage(env, site.tsym, name, pkind),
-                    pos, site, name, true);
+                    pos, location, site, name, true);
             case ARRAY:
             case CLASS:
                 if (pt.tag == METHOD || pt.tag == FORALL) {
                     return rs.resolveQualifiedMethod(
-                        pos, env, site, name, pt.getParameterTypes(), pt.getTypeArguments());
+                        pos, env, location, site, name, pt.getParameterTypes(), pt.getTypeArguments());
                 } else if (name == names._this || name == names._super) {
                     return rs.resolveSelf(pos, env, site.tsym, name);
                 } else if (name == names._class) {
@@ -2368,7 +2364,7 @@
                     // We are seeing a plain identifier as selector.
                     Symbol sym = rs.findIdentInType(env, site, name, pkind);
                     if ((pkind & ERRONEOUS) == 0)
-                        sym = rs.access(sym, pos, site, name, true);
+                        sym = rs.access(sym, pos, location, site, name, true);
                     return sym;
                 }
             case WILDCARD:
@@ -2376,12 +2372,12 @@
             case TYPEVAR:
                 // Normally, site.getUpperBound() shouldn't be null.
                 // It should only happen during memberEnter/attribBase
-                // when determining the super type which *must* be
+                // when determining the super type which *must* beac
                 // done before attributing the type variables.  In
                 // other words, we are seeing this illegal program:
                 // class B<T> extends A<T.foo> {}
                 Symbol sym = (site.getUpperBound() != null)
-                    ? selectSym(tree, capture(site.getUpperBound()), env, pt, pkind)
+                    ? selectSym(tree, location, capture(site.getUpperBound()), env, pt, pkind)
                     : null;
                 if (sym == null) {
                     log.error(pos, "type.var.cant.be.deref");
@@ -2390,7 +2386,7 @@
                     Symbol sym2 = (sym.flags() & Flags.PRIVATE) != 0 ?
                         rs.new AccessError(env, site, sym) :
                                 sym;
-                    rs.access(sym2, pos, site, name, true);
+                    rs.access(sym2, pos, location, site, name, true);
                     return sym;
                 }
             case ERROR:
@@ -2961,7 +2957,7 @@
                 extending, implementing, List.<JCTree>nil());
 
             ClassSymbol c = (ClassSymbol)a.getUpperBound().tsym;
-            assert (c.flags() & COMPOUND) != 0;
+            Assert.check((c.flags() & COMPOUND) != 0);
             cd.sym = c;
             c.sourcefile = env.toplevel.sourcefile;
 
@@ -2989,10 +2985,6 @@
         result = tree.type = syms.errType;
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        result = tree.type = attribType(tree.getUnderlyingType(), env);
-    }
-
     public void visitErroneous(JCErroneous tree) {
         if (tree.errs != null)
             for (JCTree err : tree.errs)
@@ -3097,7 +3089,7 @@
     /** Finish the attribution of a class. */
     private void attribClassBody(Env<AttrContext> env, ClassSymbol c) {
         JCClassDecl tree = (JCClassDecl)env.tree;
-        assert c == tree.sym;
+        Assert.check(c == tree.sym);
 
         // Validate annotations
         chk.validateAnnotations(tree.mods.annotations, c);
@@ -3138,12 +3130,9 @@
 
         tree.type = c.type;
 
-        boolean assertsEnabled = false;
-        assert assertsEnabled = true;
-        if (assertsEnabled) {
-            for (List<JCTypeParameter> l = tree.typarams;
-                 l.nonEmpty(); l = l.tail)
-                assert env.info.scope.lookup(l.head.name).scope != null;
+        for (List<JCTypeParameter> l = tree.typarams;
+             l.nonEmpty(); l = l.tail) {
+             Assert.checkNonNull(env.info.scope.lookup(l.head.name).scope);
         }
 
         // Check that a generic class doesn't extend Throwable
@@ -3167,7 +3156,7 @@
                 if (sym == null ||
                     sym.kind != VAR ||
                     ((VarSymbol) sym).getConstValue() == null)
-                    log.error(l.head.pos(), "icls.cant.have.static.decl");
+                    log.error(l.head.pos(), "icls.cant.have.static.decl", sym.location());
             }
         }
 
@@ -3184,9 +3173,6 @@
             (c.flags() & ABSTRACT) == 0) {
             checkSerialVersionUID(tree, c);
         }
-
-        // Check type annotations applicability rules
-        validateTypeAnnotations(tree);
     }
         // where
         /** check if a class is a subtype of Serializable, if that is available. */
@@ -3234,35 +3220,6 @@
         return types.capture(type);
     }
 
-    private void validateTypeAnnotations(JCTree tree) {
-        tree.accept(typeAnnotationsValidator);
-    }
-    //where
-    private final JCTree.Visitor typeAnnotationsValidator =
-        new TreeScanner() {
-        public void visitAnnotation(JCAnnotation tree) {
-            if (tree instanceof JCTypeAnnotation) {
-                chk.validateTypeAnnotation((JCTypeAnnotation)tree, false);
-            }
-            super.visitAnnotation(tree);
-        }
-        public void visitTypeParameter(JCTypeParameter tree) {
-            chk.validateTypeAnnotations(tree.annotations, true);
-            // don't call super. skip type annotations
-            scan(tree.bounds);
-        }
-        public void visitMethodDef(JCMethodDecl tree) {
-            // need to check static methods
-            if ((tree.sym.flags() & Flags.STATIC) != 0) {
-                for (JCTypeAnnotation a : tree.receiverAnnotations) {
-                    if (chk.isTypeAnnotation(a, false))
-                        log.error(a.pos(), "annotation.type.not.applicable");
-                }
-            }
-            super.visitMethodDef(tree);
-        }
-    };
-
     // <editor-fold desc="post-attribution visitor">
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -506,43 +506,18 @@
      *  @param a             The type that should be bounded by bs.
      *  @param bs            The bound.
      */
-    private void checkExtends(DiagnosticPosition pos, Type a, TypeVar bs) {
+    private boolean checkExtends(Type a, TypeVar bs) {
          if (a.isUnbound()) {
-             return;
+             return true;
          } else if (a.tag != WILDCARD) {
              a = types.upperBound(a);
-             for (List<Type> l = types.getBounds(bs); l.nonEmpty(); l = l.tail) {
-                 if (!types.isSubtype(a, l.head)) {
-                     log.error(pos, "not.within.bounds", a);
-                     return;
-                 }
-             }
+             return types.isSubtype(a, bs.bound);
          } else if (a.isExtendsBound()) {
-             if (!types.isCastable(bs.getUpperBound(), types.upperBound(a), Warner.noWarnings))
-                 log.error(pos, "not.within.bounds", a);
+             return types.isCastable(bs.getUpperBound(), types.upperBound(a), Warner.noWarnings);
          } else if (a.isSuperBound()) {
-             if (types.notSoftSubtype(types.lowerBound(a), bs.getUpperBound()))
-                 log.error(pos, "not.within.bounds", a);
+             return !types.notSoftSubtype(types.lowerBound(a), bs.getUpperBound());
          }
-     }
-
-    /** Check that a type is within some bounds.
-     *
-     *  Used in TypeApply to verify that, e.g., X in V<X> is a valid
-     *  type argument.
-     *  @param pos           Position to be used for error reporting.
-     *  @param a             The type that should be bounded by bs.
-     *  @param bs            The bound.
-     */
-    private void checkCapture(JCTypeApply tree) {
-        List<JCExpression> args = tree.getTypeArguments();
-        for (Type arg : types.capture(tree.type).getTypeArguments()) {
-            if (arg.tag == TYPEVAR && arg.getUpperBound().isErroneous()) {
-                log.error(args.head.pos, "not.within.bounds", args.head.type);
-                break;
-            }
-            args = args.tail;
-        }
+         return true;
      }
 
     /** Check that type is different from 'void'.
@@ -775,6 +750,79 @@
         }
     }
 
+    /**
+     * Check that type 't' is a valid instantiation of a generic class
+     * (see JLS 4.5)
+     *
+     * @param t class type to be checked
+     * @return true if 't' is well-formed
+     */
+    public boolean checkValidGenericType(Type t) {
+        return firstIncompatibleTypeArg(t) == null;
+    }
+    //WHERE
+        private Type firstIncompatibleTypeArg(Type type) {
+            List<Type> formals = type.tsym.type.allparams();
+            List<Type> actuals = type.allparams();
+            List<Type> args = type.getTypeArguments();
+            List<Type> forms = type.tsym.type.getTypeArguments();
+            ListBuffer<Type> tvars_buf = new ListBuffer<Type>();
+
+            // For matching pairs of actual argument types `a' and
+            // formal type parameters with declared bound `b' ...
+            while (args.nonEmpty() && forms.nonEmpty()) {
+                // exact type arguments needs to know their
+                // bounds (for upper and lower bound
+                // calculations).  So we create new TypeVars with
+                // bounds substed with actuals.
+                tvars_buf.append(types.substBound(((TypeVar)forms.head),
+                                                  formals,
+                                                  actuals));
+                args = args.tail;
+                forms = forms.tail;
+            }
+
+            args = type.getTypeArguments();
+            List<Type> tvars_cap = types.substBounds(formals,
+                                      formals,
+                                      types.capture(type).allparams());
+            while (args.nonEmpty() && tvars_cap.nonEmpty()) {
+                // Let the actual arguments know their bound
+                args.head.withTypeVar((TypeVar)tvars_cap.head);
+                args = args.tail;
+                tvars_cap = tvars_cap.tail;
+            }
+
+            args = type.getTypeArguments();
+            List<Type> tvars = tvars_buf.toList();
+
+            while (args.nonEmpty() && tvars.nonEmpty()) {
+                Type actual = types.subst(args.head,
+                    type.tsym.type.getTypeArguments(),
+                    tvars_buf.toList());
+                if (!checkExtends(actual, (TypeVar)tvars.head) &&
+                        !tvars.head.getUpperBound().isErroneous()) {
+                    return args.head;
+                }
+                args = args.tail;
+                tvars = tvars.tail;
+            }
+
+            args = type.getTypeArguments();
+            tvars = tvars_buf.toList();
+
+            for (Type arg : types.capture(type).getTypeArguments()) {
+                if (arg.tag == TYPEVAR &&
+                        arg.getUpperBound().isErroneous() &&
+                        !tvars.head.getUpperBound().isErroneous()) {
+                    return args.head;
+                }
+                tvars = tvars.tail;
+            }
+
+            return null;
+        }
+
     /** Check that given modifiers are legal for given symbol and
      *  return modifiers together with any implicit modififiers for that symbol.
      *  Warning: we can't use flags() here since this method
@@ -987,11 +1035,20 @@
         @Override
         public void visitTypeApply(JCTypeApply tree) {
             if (tree.type.tag == CLASS) {
-                List<Type> formals = tree.type.tsym.type.allparams();
-                List<Type> actuals = tree.type.allparams();
                 List<JCExpression> args = tree.arguments;
                 List<Type> forms = tree.type.tsym.type.getTypeArguments();
-                ListBuffer<Type> tvars_buf = new ListBuffer<Type>();
+
+                Type incompatibleArg = firstIncompatibleTypeArg(tree.type);
+                if (incompatibleArg != null) {
+                    for (JCTree arg : tree.arguments) {
+                        if (arg.type == incompatibleArg) {
+                            log.error(arg, "not.within.bounds", incompatibleArg, forms.head);
+                        }
+                        forms = forms.tail;
+                     }
+                 }
+
+                forms = tree.type.tsym.type.getTypeArguments();
 
                 boolean is_java_lang_Class = tree.type.tsym.flatName() == names.java_lang_Class;
 
@@ -1001,46 +1058,10 @@
                     validateTree(args.head,
                             !(isOuter && is_java_lang_Class),
                             false);
-
-                    // exact type arguments needs to know their
-                    // bounds (for upper and lower bound
-                    // calculations).  So we create new TypeVars with
-                    // bounds substed with actuals.
-                    tvars_buf.append(types.substBound(((TypeVar)forms.head),
-                                                      formals,
-                                                      actuals));
-
                     args = args.tail;
                     forms = forms.tail;
                 }
 
-                args = tree.arguments;
-                List<Type> tvars_cap = types.substBounds(formals,
-                                          formals,
-                                          types.capture(tree.type).allparams());
-                while (args.nonEmpty() && tvars_cap.nonEmpty()) {
-                    // Let the actual arguments know their bound
-                    args.head.type.withTypeVar((TypeVar)tvars_cap.head);
-                    args = args.tail;
-                    tvars_cap = tvars_cap.tail;
-                }
-
-                args = tree.arguments;
-                List<Type> tvars = tvars_buf.toList();
-
-                while (args.nonEmpty() && tvars.nonEmpty()) {
-                    Type actual = types.subst(args.head.type,
-                        tree.type.tsym.type.getTypeArguments(),
-                        tvars_buf.toList());
-                    checkExtends(args.head.pos(),
-                                 actual,
-                                 (TypeVar)tvars.head);
-                    args = args.tail;
-                    tvars = tvars.tail;
-                }
-
-                checkCapture(tree);
-
                 // Check that this type is either fully parameterized, or
                 // not parameterized at all.
                 if (tree.type.getEnclosingType().isRaw())
@@ -1086,11 +1107,6 @@
             }
         }
 
-        @Override
-        public void visitAnnotatedType(JCAnnotatedType tree) {
-            tree.underlyingType.accept(this);
-        }
-
         /** Default visitor method: do nothing.
          */
         @Override
@@ -2239,14 +2255,6 @@
             validateAnnotation(a, s);
     }
 
-    /** Check the type annotations
-     */
-    public void validateTypeAnnotations(List<JCTypeAnnotation> annotations, boolean isTypeParameter) {
-        if (skipAnnotations) return;
-        for (JCTypeAnnotation a : annotations)
-            validateTypeAnnotation(a, isTypeParameter);
-    }
-
     /** Check an annotation of a symbol.
      */
     public void validateAnnotation(JCAnnotation a, Symbol s) {
@@ -2261,15 +2269,6 @@
         }
     }
 
-    public void validateTypeAnnotation(JCTypeAnnotation a, boolean isTypeParameter) {
-        if (a.type == null)
-            throw new AssertionError("annotation tree hasn't been attributed yet: " + a);
-        validateAnnotationTree(a);
-
-        if (!isTypeAnnotation(a, isTypeParameter))
-            log.error(a.pos(), "annotation.type.not.applicable");
-    }
-
     /** Is s a method symbol that overrides a method in a superclass? */
     boolean isOverrider(Symbol s) {
         if (s.kind != MTH || s.isStatic())
@@ -2288,25 +2287,6 @@
         return false;
     }
 
-    /** Is the annotation applicable to type annotations */
-    boolean isTypeAnnotation(JCTypeAnnotation a, boolean isTypeParameter) {
-        Attribute.Compound atTarget =
-            a.annotationType.type.tsym.attribute(syms.annotationTargetType.tsym);
-        if (atTarget == null) return true;
-        Attribute atValue = atTarget.member(names.value);
-        if (!(atValue instanceof Attribute.Array)) return true; // error recovery
-        Attribute.Array arr = (Attribute.Array) atValue;
-        for (Attribute app : arr.values) {
-            if (!(app instanceof Attribute.Enum)) return true; // recovery
-            Attribute.Enum e = (Attribute.Enum) app;
-            if (!isTypeParameter && e.value.name == names.TYPE_USE)
-                return true;
-            else if (isTypeParameter && e.value.name == names.TYPE_PARAMETER)
-                return true;
-        }
-        return false;
-    }
-
     /** Is the annotation applicable to the symbol? */
     boolean annotationApplicable(JCAnnotation a, Symbol s) {
         Attribute.Compound atTarget =
@@ -2438,7 +2418,7 @@
      */
     void checkNonCyclicElements(JCClassDecl tree) {
         if ((tree.sym.flags_field & ANNOTATION) == 0) return;
-        assert (tree.sym.flags_field & LOCKED) == 0;
+        Assert.check((tree.sym.flags_field & LOCKED) == 0);
         try {
             tree.sym.flags_field |= LOCKED;
             for (JCTree def : tree.defs) {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -37,7 +37,6 @@
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 
 import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.comp.Resolve;
 import com.sun.tools.javac.tree.JCTree.*;
 
 import static com.sun.tools.javac.code.Flags.*;
@@ -709,7 +708,7 @@
 
         lint = lint.augment(tree.sym.attributes_field);
 
-        assert pendingExits.isEmpty();
+        Assert.check(pendingExits.isEmpty());
 
         try {
             boolean isInitialConstructor =
@@ -747,7 +746,7 @@
                 PendingExit exit = exits.head;
                 exits = exits.tail;
                 if (exit.thrown == null) {
-                    assert exit.tree.getTag() == JCTree.RETURN;
+                    Assert.check(exit.tree.getTag() == JCTree.RETURN);
                     if (isInitialConstructor) {
                         inits = exit.inits;
                         for (int i = firstadr; i < nextadr; i++)
@@ -1350,11 +1349,6 @@
         }
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        // annotations don't get scanned
-        tree.underlyingType.accept(this);
-    }
-
     public void visitIdent(JCIdent tree) {
         if (tree.sym.kind == VAR) {
             checkInit(tree.pos(), (VarSymbol)tree.sym);
@@ -1373,7 +1367,6 @@
         if (!tree.type.isErroneous()
             && lint.isEnabled(Lint.LintCategory.CAST)
             && types.isSameType(tree.expr.type, tree.clazz.type)
-            && !(ignoreAnnotatedCasts && containsTypeAnnotation(tree.clazz))
             && !is292targetTypeCast(tree)) {
             log.warning(Lint.LintCategory.CAST,
                     tree.pos(), "redundant.cast", tree.expr.type);
@@ -1382,8 +1375,9 @@
     //where
         private boolean is292targetTypeCast(JCTypeCast tree) {
             boolean is292targetTypeCast = false;
-            if (tree.expr.getTag() == JCTree.APPLY) {
-                JCMethodInvocation apply = (JCMethodInvocation)tree.expr;
+            JCExpression expr = TreeInfo.skipParens(tree.expr);
+            if (expr.getTag() == JCTree.APPLY) {
+                JCMethodInvocation apply = (JCMethodInvocation)expr;
                 Symbol sym = TreeInfo.symbol(apply.meth);
                 is292targetTypeCast = sym != null &&
                     sym.kind == MTH &&
@@ -1397,23 +1391,6 @@
     }
 
 /**************************************************************************
- * utility methods for ignoring type-annotated casts lint checking
- *************************************************************************/
-    private static final boolean ignoreAnnotatedCasts = true;
-    private static class AnnotationFinder extends TreeScanner {
-        public boolean foundTypeAnno = false;
-        public void visitAnnotation(JCAnnotation tree) {
-            foundTypeAnno = foundTypeAnno || (tree instanceof JCTypeAnnotation);
-        }
-    }
-
-    private boolean containsTypeAnnotation(JCTree e) {
-        AnnotationFinder finder = new AnnotationFinder();
-        finder.scan(e);
-        return finder.foundTypeAnno;
-    }
-
-/**************************************************************************
  * main method
  *************************************************************************/
 
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Fri Jan 28 10:06:08 2011 -0800
@@ -27,6 +27,7 @@
 
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCTypeCast;
+import com.sun.tools.javac.tree.TreeInfo;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.code.*;
@@ -204,19 +205,20 @@
      *  Throw a NoInstanceException if this not possible.
      */
     void maximizeInst(UndetVar that, Warner warn) throws NoInstanceException {
+        List<Type> hibounds = Type.filter(that.hibounds, errorFilter);
         if (that.inst == null) {
-            if (that.hibounds.isEmpty())
+            if (hibounds.isEmpty())
                 that.inst = syms.objectType;
-            else if (that.hibounds.tail.isEmpty())
-                that.inst = that.hibounds.head;
+            else if (hibounds.tail.isEmpty())
+                that.inst = hibounds.head;
             else
-                that.inst = types.glb(that.hibounds);
+                that.inst = types.glb(hibounds);
         }
         if (that.inst == null ||
             that.inst.isErroneous())
             throw ambiguousNoInstanceException
                 .setMessage("no.unique.maximal.instance.exists",
-                            that.qtype, that.hibounds);
+                            that.qtype, hibounds);
     }
     //where
         private boolean isSubClass(Type t, final List<Type> ts) {
@@ -240,37 +242,46 @@
             return true;
         }
 
+    private Filter<Type> errorFilter = new Filter<Type>() {
+        @Override
+        public boolean accepts(Type t) {
+            return !t.isErroneous();
+        }
+    };
+
     /** Instantiate undetermined type variable to the lub of all its lower bounds.
      *  Throw a NoInstanceException if this not possible.
      */
     void minimizeInst(UndetVar that, Warner warn) throws NoInstanceException {
+        List<Type> lobounds = Type.filter(that.lobounds, errorFilter);
         if (that.inst == null) {
-            if (that.lobounds.isEmpty())
+            if (lobounds.isEmpty())
                 that.inst = syms.botType;
-            else if (that.lobounds.tail.isEmpty())
-                that.inst = that.lobounds.head.isPrimitive() ? syms.errType : that.lobounds.head;
+            else if (lobounds.tail.isEmpty())
+                that.inst = lobounds.head.isPrimitive() ? syms.errType : lobounds.head;
             else {
-                that.inst = types.lub(that.lobounds);
+                that.inst = types.lub(lobounds);
             }
             if (that.inst == null || that.inst.tag == ERROR)
                     throw ambiguousNoInstanceException
                         .setMessage("no.unique.minimal.instance.exists",
-                                    that.qtype, that.lobounds);
+                                    that.qtype, lobounds);
             // VGJ: sort of inlined maximizeInst() below.  Adding
             // bounds can cause lobounds that are above hibounds.
-            if (that.hibounds.isEmpty())
+            List<Type> hibounds = Type.filter(that.hibounds, errorFilter);
+            if (hibounds.isEmpty())
                 return;
             Type hb = null;
-            if (that.hibounds.tail.isEmpty())
-                hb = that.hibounds.head;
-            else for (List<Type> bs = that.hibounds;
+            if (hibounds.tail.isEmpty())
+                hb = hibounds.head;
+            else for (List<Type> bs = hibounds;
                       bs.nonEmpty() && hb == null;
                       bs = bs.tail) {
-                if (isSubClass(bs.head, that.hibounds))
+                if (isSubClass(bs.head, hibounds))
                     hb = types.fromUnknownFun.apply(bs.head);
             }
             if (hb == null ||
-                !types.isSubtypeUnchecked(hb, that.hibounds, warn) ||
+                !types.isSubtypeUnchecked(hb, hibounds, warn) ||
                 !types.isSubtypeUnchecked(that.inst, hb, warn))
                 throw ambiguousNoInstanceException;
         }
@@ -396,7 +407,9 @@
 
         // for varargs arguments as well
         if (useVarargs) {
-            Type elemType = types.elemtype(varargsFormal);
+            //note: if applicability check is triggered by most specific test,
+            //the last argument of a varargs is _not_ an array type (see JLS 15.12.2.5)
+            Type elemType = types.elemtypeOrType(varargsFormal);
             Type elemUndet = types.subst(elemType, tvars, undetvars);
             while (actuals.nonEmpty()) {
                 Type actual = actuals.head.baseType();
@@ -527,7 +540,8 @@
         for (List<Type> tvs = tvars, args = arguments;
              tvs.nonEmpty();
              tvs = tvs.tail, args = args.tail) {
-            if (args.head instanceof UndetVar) continue;
+            if (args.head instanceof UndetVar ||
+                    tvars.head.getUpperBound().isErroneous()) continue;
             List<Type> bounds = types.subst(types.getBounds((TypeVar)tvs.head), tvars, arguments);
             if (!types.isSubtypeUnchecked(args.head, bounds, warn))
                 throw invalidInstanceException
@@ -538,43 +552,39 @@
 
     /**
      * Compute a synthetic method type corresponding to the requested polymorphic
-     * method signature. If no explicit return type is supplied, a provisional
-     * return type is computed (just Object in case of non-transitional 292)
+     * method signature. The target return type is computed from the immediately
+     * enclosing scope surrounding the polymorphic-signature call.
      */
     Type instantiatePolymorphicSignatureInstance(Env<AttrContext> env, Type site,
                                             Name name,
                                             MethodSymbol spMethod,  // sig. poly. method or null if none
-                                            List<Type> argtypes,
-                                            List<Type> typeargtypes) {
+                                            List<Type> argtypes) {
         final Type restype;
-        if (rs.allowTransitionalJSR292 && typeargtypes.nonEmpty()) {
-            restype = typeargtypes.head;
-        } else {
-            //The return type for a polymorphic signature call is computed from
-            //the enclosing tree E, as follows: if E is a cast, then use the
-            //target type of the cast expression as a return type; if E is an
-            //expression statement, the return type is 'void' - otherwise the
-            //return type is simply 'Object'. A correctness check ensures that
-            //env.next refers to the lexically enclosing environment in which
-            //the polymorphic signature call environment is nested.
+
+        //The return type for a polymorphic signature call is computed from
+        //the enclosing tree E, as follows: if E is a cast, then use the
+        //target type of the cast expression as a return type; if E is an
+        //expression statement, the return type is 'void' - otherwise the
+        //return type is simply 'Object'. A correctness check ensures that
+        //env.next refers to the lexically enclosing environment in which
+        //the polymorphic signature call environment is nested.
 
-            switch (env.next.tree.getTag()) {
-                case JCTree.TYPECAST:
-                    JCTypeCast castTree = (JCTypeCast)env.next.tree;
-                    restype = (castTree.expr == env.tree) ?
-                        castTree.clazz.type :
-                        syms.objectType;
-                    break;
-                case JCTree.EXEC:
-                    JCTree.JCExpressionStatement execTree =
-                            (JCTree.JCExpressionStatement)env.next.tree;
-                    restype = (execTree.expr == env.tree) ?
-                        syms.voidType :
-                        syms.objectType;
-                    break;
-                default:
-                    restype = syms.objectType;
-            }
+        switch (env.next.tree.getTag()) {
+            case JCTree.TYPECAST:
+                JCTypeCast castTree = (JCTypeCast)env.next.tree;
+                restype = (TreeInfo.skipParens(castTree.expr) == env.tree) ?
+                    castTree.clazz.type :
+                    syms.objectType;
+                break;
+            case JCTree.EXEC:
+                JCTree.JCExpressionStatement execTree =
+                        (JCTree.JCExpressionStatement)env.next.tree;
+                restype = (TreeInfo.skipParens(execTree.expr) == env.tree) ?
+                    syms.voidType :
+                    syms.objectType;
+                break;
+            default:
+                restype = syms.objectType;
         }
 
         List<Type> paramtypes = Type.map(argtypes, implicitArgType);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -1057,7 +1057,7 @@
             }
             // Otherwise replace the variable by its proxy.
             sym = proxies.lookup(proxyName(sym.name)).sym;
-            assert sym != null && (sym.flags_field & FINAL) != 0;
+            Assert.check(sym != null && (sym.flags_field & FINAL) != 0);
             tree = make.at(tree.pos).Ident(sym);
         }
         JCExpression base = (tree.getTag() == JCTree.SELECT) ? ((JCFieldAccess) tree).selected : null;
@@ -1208,7 +1208,7 @@
      */
     void makeAccessible(Symbol sym) {
         JCClassDecl cdef = classDef(sym.owner.enclClass());
-        assert cdef != null : "class def not found: " + sym + " in " + sym.owner;
+        if (cdef == null) Assert.error("class def not found: " + sym + " in " + sym.owner);
         if (sym.name == names.init) {
             cdef.defs = cdef.defs.prepend(
                 accessConstructorDef(cdef.pos, sym, accessConstrs.get(sym)));
@@ -1458,7 +1458,7 @@
             expr = make.Ident(var.sym).setType(resource.type);
             stats.add(var);
         } else {
-            assert resource instanceof JCExpression;
+            Assert.check(resource instanceof JCExpression);
             VarSymbol syntheticTwrVar =
             new VarSymbol(SYNTHETIC | FINAL,
                           makeSyntheticName(names.fromString("twrVar" +
@@ -1552,7 +1552,7 @@
         List<VarSymbol> ots = outerThisStack;
         if (ots.isEmpty()) {
             log.error(pos, "no.encl.instance.of.type.in.scope", c);
-            assert false;
+            Assert.error();
             return makeNull();
         }
         VarSymbol ot = ots.head;
@@ -1565,14 +1565,14 @@
                     log.error(pos,
                               "no.encl.instance.of.type.in.scope",
                               c);
-                    assert false; // should have been caught in Attr
+                    Assert.error(); // should have been caught in Attr
                     return tree;
                 }
                 ot = ots.head;
             } while (ot.owner != otc);
             if (otc.owner.kind != PCK && !otc.hasOuterInstance()) {
                 chk.earlyRefError(pos, c);
-                assert false; // should have been caught in Attr
+                Assert.error(); // should have been caught in Attr
                 return makeNull();
             }
             tree = access(make.at(pos).Select(tree, ot));
@@ -1610,7 +1610,7 @@
         List<VarSymbol> ots = outerThisStack;
         if (ots.isEmpty()) {
             log.error(pos, "no.encl.instance.of.type.in.scope", c);
-            assert false;
+            Assert.error();
             return makeNull();
         }
         VarSymbol ot = ots.head;
@@ -1623,7 +1623,7 @@
                     log.error(pos,
                         "no.encl.instance.of.type.in.scope",
                         c);
-                    assert false;
+                    Assert.error();
                     return tree;
                 }
                 ot = ots.head;
@@ -1640,9 +1640,9 @@
     JCStatement initField(int pos, Name name) {
         Scope.Entry e = proxies.lookup(name);
         Symbol rhs = e.sym;
-        assert rhs.owner.kind == MTH;
+        Assert.check(rhs.owner.kind == MTH);
         Symbol lhs = e.next().sym;
-        assert rhs.owner.owner == lhs.owner;
+        Assert.check(rhs.owner.owner == lhs.owner);
         make.at(pos);
         return
             make.Exec(
@@ -1655,9 +1655,9 @@
      */
     JCStatement initOuterThis(int pos) {
         VarSymbol rhs = outerThisStack.head;
-        assert rhs.owner.kind == MTH;
+        Assert.check(rhs.owner.kind == MTH);
         VarSymbol lhs = outerThisStack.tail.head;
-        assert rhs.owner.owner == lhs.owner;
+        Assert.check(rhs.owner.owner == lhs.owner);
         make.at(pos);
         return
             make.Exec(
@@ -1856,7 +1856,7 @@
     // where
         /** Create an attributed tree of the form left.name(). */
         private JCMethodInvocation makeCall(JCExpression left, Name name, List<JCExpression> args) {
-            assert left.type != null;
+            Assert.checkNonNull(left.type);
             Symbol funcsym = lookupMethod(make_pos, name, left.type,
                                           TreeInfo.types(args));
             return make.App(make.Select(left, funcsym), args);
@@ -2399,7 +2399,7 @@
                          names.valueOf,
                          tree.sym.type,
                          List.of(syms.stringType));
-        assert (valueOfSym.flags() & STATIC) != 0;
+        Assert.check((valueOfSym.flags() & STATIC) != 0);
         VarSymbol nameArgSym = valueOfSym.params.head;
         JCIdent nameVal = make.Ident(nameArgSym);
         JCStatement enum_ValueOf =
@@ -2585,11 +2585,6 @@
         result = tree;
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        tree.underlyingType = translate(tree.underlyingType);
-        result = tree.underlyingType;
-    }
-
     public void visitTypeCast(JCTypeCast tree) {
         tree.clazz = translate(tree.clazz);
         if (tree.type.isPrimitive() != tree.expr.type.isPrimitive())
@@ -3421,7 +3416,7 @@
                 if (expression != null) { // expression for a "default" case is null
                     String labelExpr = (String) expression.type.constValue();
                     Integer mapping = caseLabelToPosition.put(labelExpr, casePosition);
-                    assert mapping == null;
+                    Assert.checkNull(mapping);
                     int hashCode = labelExpr.hashCode();
 
                     Set<String> stringSet = hashToString.get(hashCode);
@@ -3431,7 +3426,7 @@
                         hashToString.put(hashCode, stringSet);
                     } else {
                         boolean added = stringSet.add(labelExpr);
-                        assert added;
+                        Assert.check(added);
                     }
                 }
                 casePosition++;
@@ -3483,7 +3478,7 @@
             for(Map.Entry<Integer, Set<String>> entry : hashToString.entrySet()) {
                 int hashCode = entry.getKey();
                 Set<String> stringsWithHashCode = entry.getValue();
-                assert stringsWithHashCode.size() >= 1;
+                Assert.check(stringsWithHashCode.size() >= 1);
 
                 JCStatement elsepart = null;
                 for(String caseLabel : stringsWithHashCode ) {
@@ -3697,8 +3692,7 @@
                                          cdef.type,
                                          List.<Type>nil());
 
-        assert(ordinalSym != null);
-        assert(ordinalSym instanceof MethodSymbol);
+        Assert.check(ordinalSym instanceof MethodSymbol);
 
         JCStatement ret = make.Return(make.Ident(ordinalSymbol));
         cdef.defs = cdef.defs.append(make.MethodDef((MethodSymbol)ordinalSym,
@@ -3714,8 +3708,7 @@
                                    cdef.type,
                                    List.<Type>nil());
 
-        assert(nameSym != null);
-        assert(nameSym instanceof MethodSymbol);
+        Assert.check(nameSym instanceof MethodSymbol);
 
         JCStatement ret = make.Return(make.Ident(nameSymbol));
 
@@ -3766,8 +3759,7 @@
                                    cdef.type,
                                    List.of(cdef.sym.type));
 
-        assert(compareToSym != null);
-        assert(compareToSym instanceof MethodSymbol);
+        Assert.check(compareToSym instanceof MethodSymbol);
 
         JCMethodDecl compareToDecl = (JCMethodDecl) TreeInfo.declarationFor(compareToSym, cdef);
 
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -581,8 +581,7 @@
         JCVariableDecl lastParam = null;
         for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
             JCVariableDecl param = lastParam = l.head;
-            assert param.sym != null;
-            params.append(param.sym);
+            params.append(Assert.checkNonNull(param.sym));
         }
         m.params = params.toList();
 
@@ -699,7 +698,7 @@
  *********************************************************************/
 
     Type attribImportType(JCTree tree, Env<AttrContext> env) {
-        assert completionEnabled;
+        Assert.check(completionEnabled);
         try {
             // To prevent deep recursion, suppress completion of some
             // types.
@@ -725,7 +724,7 @@
                     return "annotate " + annotations + " onto " + s + " in " + s.owner;
                 }
                 public void enterAnnotation() {
-                    assert s.kind == PCK || s.attributes_field == null;
+                    Assert.check(s.kind == PCK || s.attributes_field == null);
                     JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
                     try {
                         if (s.attributes_field != null &&
@@ -782,8 +781,8 @@
                     types.isSameType(c.type, syms.polymorphicSignatureType)) {
                 if (!target.hasMethodHandles()) {
                     // Somebody is compiling JDK7 source code to a JDK6 target.
-                    // Make it a strict warning, since it is unlikely but important.
-                    log.strictWarning(env.tree.pos(),
+                    // Make it an error, since it is unlikely but important.
+                    log.error(env.tree.pos(),
                             "wrong.target.for.polymorphic.signature.definition",
                             target.name);
                 }
@@ -836,7 +835,7 @@
         // Suppress some (recursive) MemberEnter invocations
         if (!completionEnabled) {
             // Re-install same completer for next time around and return.
-            assert (sym.flags() & Flags.COMPOUND) == 0;
+            Assert.check((sym.flags() & Flags.COMPOUND) == 0);
             sym.completer = this;
             return;
         }
@@ -928,10 +927,6 @@
             if (hasDeprecatedAnnotation(tree.mods.annotations))
                 c.flags_field |= DEPRECATED;
             annotateLater(tree.mods.annotations, baseEnv, c);
-            // class type parameters use baseEnv but everything uses env
-            for (JCTypeParameter tp : tree.typarams)
-                tp.accept(new TypeAnnotate(baseEnv));
-            tree.accept(new TypeAnnotate(env));
 
             chk.checkNonCyclicDecl(tree);
 
@@ -989,7 +984,7 @@
                 c.owner.kind == PCK && c.owner != syms.unnamedPackage &&
                 reader.packageExists(c.fullname))
                 {
-                    log.error(tree.pos, "clash.with.pkg.of.same.name", c);
+                    log.error(tree.pos, "clash.with.pkg.of.same.name", Kinds.kindName(sym), c);
                 }
 
         } catch (CompletionFailure ex) {
@@ -1014,86 +1009,6 @@
         }
     }
 
-    // A sub-phase that "compiles" annotations in annotated types.
-    private class TypeAnnotate extends TreeScanner {
-        private Env<AttrContext> env;
-        public TypeAnnotate(Env<AttrContext> env) { this.env = env; }
-
-        private void enterTypeAnnotations(List<JCTypeAnnotation> annotations) {
-            Set<TypeSymbol> annotated = new HashSet<TypeSymbol>();
-            if (!skipAnnotations)
-                for (List<JCTypeAnnotation> al = annotations; al.nonEmpty(); al = al.tail) {
-                    JCTypeAnnotation a = al.head;
-                    Attribute.Compound c = annotate.enterAnnotation(a,
-                            syms.annotationType,
-                            env);
-                    if (c == null) continue;
-                    Attribute.TypeCompound tc = new Attribute.TypeCompound(c.type, c.values, a.annotation_position);
-                    a.attribute_field = tc;
-                    // Note: @Deprecated has no effect on local variables and parameters
-                    if (!annotated.add(a.type.tsym))
-                        log.error(a.pos, "duplicate.annotation");
-                }
-        }
-
-        // each class (including enclosed inner classes) should be visited
-        // separately through MemberEnter.complete(Symbol)
-        // this flag is used to prevent from visiting inner classes.
-        private boolean isEnclosingClass = false;
-        @Override
-        public void visitClassDef(final JCClassDecl tree) {
-            if (isEnclosingClass)
-                return;
-            isEnclosingClass = true;
-            scan(tree.mods);
-            // type parameter need to be visited with a separate env
-            // scan(tree.typarams);
-            scan(tree.extending);
-            scan(tree.implementing);
-            scan(tree.defs);
-        }
-
-        private void annotate(final JCTree tree, final List<JCTypeAnnotation> annotations) {
-            annotate.later(new Annotate.Annotator() {
-                public String toString() {
-                    return "annotate " + annotations + " onto " + tree;
-                }
-                public void enterAnnotation() {
-                    JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
-                    try {
-                        enterTypeAnnotations(annotations);
-                    } finally {
-                        log.useSource(prev);
-                    }
-                }
-            });
-        }
-
-        @Override
-        public void visitAnnotatedType(final JCAnnotatedType tree) {
-            annotate(tree, tree.annotations);
-            super.visitAnnotatedType(tree);
-        }
-        @Override
-        public void visitTypeParameter(final JCTypeParameter tree) {
-            annotate(tree, tree.annotations);
-            super.visitTypeParameter(tree);
-        }
-        @Override
-        public void visitNewArray(final JCNewArray tree) {
-            annotate(tree, tree.annotations);
-            for (List<JCTypeAnnotation> dimAnnos : tree.dimAnnotations)
-                annotate(tree, dimAnnos);
-            super.visitNewArray(tree);
-        }
-        @Override
-        public void visitMethodDef(JCMethodDecl tree) {
-            annotate(tree, tree.receiverAnnotations);
-            super.visitMethodDef(tree);
-        }
-    }
-
-
     private Env<AttrContext> baseEnv(JCClassDecl tree, Env<AttrContext> env) {
         Scope baseScope = new Scope.ClassScope(tree.sym, scopeCounter);
         //import already entered local classes into base scope
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -70,8 +70,6 @@
     public final boolean boxingEnabled; // = source.allowBoxing();
     public final boolean varargsEnabled; // = source.allowVarargs();
     public final boolean allowMethodHandles;
-    public final boolean allowInvokeDynamic;
-    public final boolean allowTransitionalJSR292;
     private final boolean debugResolve;
 
     Scope polymorphicSignatureScope;
@@ -111,13 +109,8 @@
         varargsEnabled = source.allowVarargs();
         Options options = Options.instance(context);
         debugResolve = options.isSet("debugresolve");
-        allowTransitionalJSR292 = options.isSet("allowTransitionalJSR292");
         Target target = Target.instance(context);
-        allowMethodHandles = allowTransitionalJSR292 ||
-                target.hasMethodHandles();
-        allowInvokeDynamic = (allowTransitionalJSR292 ||
-                target.hasInvokedynamic()) &&
-                options.isSet("invokedynamic");
+        allowMethodHandles = target.hasMethodHandles();
         polymorphicSignatureScope = new Scope(syms.noSymbol);
 
         inapplicableMethodException = new InapplicableMethodException(diags);
@@ -336,8 +329,7 @@
                         boolean useVarargs,
                         Warner warn)
         throws Infer.InferenceException {
-        boolean polymorphicSignature = (m.isPolymorphicSignatureGeneric() && allowMethodHandles) ||
-                                        isTransitionalDynamicCallSite(site, m);
+        boolean polymorphicSignature = m.isPolymorphicSignatureGeneric() && allowMethodHandles;
         if (useVarargs && (m.flags() & VARARGS) == 0)
             throw inapplicableMethodException.setMessage(null);
         Type mt = types.memberType(site, m);
@@ -346,10 +338,7 @@
         // need to inferred.
         List<Type> tvars = env.info.tvars;
         if (typeargtypes == null) typeargtypes = List.nil();
-        if (allowTransitionalJSR292 && polymorphicSignature && typeargtypes.nonEmpty()) {
-            //transitional 292 call sites might have wrong number of targs
-        }
-        else if (mt.tag != FORALL && typeargtypes.nonEmpty()) {
+        if (mt.tag != FORALL && typeargtypes.nonEmpty()) {
             // This is not a polymorphic method, but typeargs are supplied
             // which is fine, see JLS3 15.12.2.1
         } else if (mt.tag == FORALL && typeargtypes.nonEmpty()) {
@@ -387,7 +376,7 @@
 
         if (instNeeded)
             return polymorphicSignature ?
-                infer.instantiatePolymorphicSignatureInstance(env, site, m.name, (MethodSymbol)m, argtypes, typeargtypes) :
+                infer.instantiatePolymorphicSignatureInstance(env, site, m.name, (MethodSymbol)m, argtypes) :
                 infer.instantiateMethod(env,
                                     tvars,
                                     (MethodType)mt,
@@ -402,14 +391,6 @@
         return mt;
     }
 
-    boolean isTransitionalDynamicCallSite(Type site, Symbol sym) {
-        return allowTransitionalJSR292 &&  // old logic that doesn't use annotations
-                !sym.isPolymorphicSignatureInstance() &&
-                ((allowMethodHandles && site == syms.methodHandleType && // invokeExact, invokeGeneric, invoke
-                    (sym.name == names.invoke && sym.isPolymorphicSignatureGeneric())) ||
-                (site == syms.invokeDynamicType && allowInvokeDynamic)); // InvokeDynamic.XYZ
-    }
-
     /** Same but returns null instead throwing a NoInstanceException
      */
     Type instantiate(Env<AttrContext> env,
@@ -679,7 +660,7 @@
                       boolean operator) {
         if (sym.kind == ERR) return bestSoFar;
         if (!sym.isInheritedIn(site.tsym, types)) return bestSoFar;
-        assert sym.kind < AMBIGUOUS;
+        Assert.check(sym.kind < AMBIGUOUS);
         try {
             rawInstantiate(env, site, sym, argtypes, typeargtypes,
                                allowBoxing, useVarargs, Warner.noWarnings);
@@ -1255,6 +1236,7 @@
      */
     Symbol access(Symbol sym,
                   DiagnosticPosition pos,
+                  Symbol location,
                   Type site,
                   Name name,
                   boolean qualified,
@@ -1265,23 +1247,46 @@
             if (!site.isErroneous() &&
                 !Type.isErroneous(argtypes) &&
                 (typeargtypes==null || !Type.isErroneous(typeargtypes)))
-                logResolveError(errSym, pos, site, name, argtypes, typeargtypes);
+                logResolveError(errSym, pos, location, site, name, argtypes, typeargtypes);
             sym = errSym.access(name, qualified ? site.tsym : syms.noSymbol);
         }
         return sym;
     }
 
-    /** Same as above, but without type arguments and arguments.
+    /** Same as original access(), but without location.
+     */
+    Symbol access(Symbol sym,
+                  DiagnosticPosition pos,
+                  Type site,
+                  Name name,
+                  boolean qualified,
+                  List<Type> argtypes,
+                  List<Type> typeargtypes) {
+        return access(sym, pos, site.tsym, site, name, qualified, argtypes, typeargtypes);
+    }
+
+    /** Same as original access(), but without type arguments and arguments.
+     */
+    Symbol access(Symbol sym,
+                  DiagnosticPosition pos,
+                  Symbol location,
+                  Type site,
+                  Name name,
+                  boolean qualified) {
+        if (sym.kind >= AMBIGUOUS)
+            return access(sym, pos, location, site, name, qualified, List.<Type>nil(), null);
+        else
+            return sym;
+    }
+
+    /** Same as original access(), but without location, type arguments and arguments.
      */
     Symbol access(Symbol sym,
                   DiagnosticPosition pos,
                   Type site,
                   Name name,
                   boolean qualified) {
-        if (sym.kind >= AMBIGUOUS)
-            return access(sym, pos, site, name, qualified, List.<Type>nil(), null);
-        else
-            return sym;
+        return access(sym, pos, site.tsym, site, name, qualified);
     }
 
     /** Check that sym is not an abstract method.
@@ -1399,6 +1404,11 @@
     Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env<AttrContext> env,
                                   Type site, Name name, List<Type> argtypes,
                                   List<Type> typeargtypes) {
+        return resolveQualifiedMethod(pos, env, site.tsym, site, name, argtypes, typeargtypes);
+    }
+    Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env<AttrContext> env,
+                                  Symbol location, Type site, Name name, List<Type> argtypes,
+                                  List<Type> typeargtypes) {
         Symbol sym = startResolution();
         List<MethodResolutionPhase> steps = methodResolutionSteps;
         while (steps.nonEmpty() &&
@@ -1412,26 +1422,25 @@
             steps = steps.tail;
         }
         if (sym.kind >= AMBIGUOUS) {
-            if (site.tsym.isPolymorphicSignatureGeneric() ||
-                    isTransitionalDynamicCallSite(site, sym)) {
+            if (site.tsym.isPolymorphicSignatureGeneric()) {
                 //polymorphic receiver - synthesize new method symbol
                 env.info.varArgs = false;
                 sym = findPolymorphicSignatureInstance(env,
-                        site, name, null, argtypes, typeargtypes);
+                        site, name, null, argtypes);
             }
             else {
                 //if nothing is found return the 'first' error
                 MethodResolutionPhase errPhase =
                         firstErroneousResolutionPhase();
                 sym = access(methodResolutionCache.get(errPhase),
-                        pos, site, name, true, argtypes, typeargtypes);
+                        pos, location, site, name, true, argtypes, typeargtypes);
                 env.info.varArgs = errPhase.isVarargsRequired;
             }
         } else if (allowMethodHandles && sym.isPolymorphicSignatureGeneric()) {
             //non-instantiated polymorphic signature - synthesize new method symbol
             env.info.varArgs = false;
             sym = findPolymorphicSignatureInstance(env,
-                    site, name, (MethodSymbol)sym, argtypes, typeargtypes);
+                    site, name, (MethodSymbol)sym, argtypes);
         }
         return sym;
     }
@@ -1449,15 +1458,9 @@
     Symbol findPolymorphicSignatureInstance(Env<AttrContext> env, Type site,
                                             Name name,
                                             MethodSymbol spMethod,  // sig. poly. method or null if none
-                                            List<Type> argtypes,
-                                            List<Type> typeargtypes) {
-        if (typeargtypes.nonEmpty() && (site.tsym.isPolymorphicSignatureGeneric() ||
-                (spMethod != null && spMethod.isPolymorphicSignatureGeneric()))) {
-            log.warning(env.tree.pos(), "type.parameter.on.polymorphic.signature");
-        }
-
+                                            List<Type> argtypes) {
         Type mtype = infer.instantiatePolymorphicSignatureInstance(env,
-                site, name, spMethod, argtypes, typeargtypes);
+                site, name, spMethod, argtypes);
         long flags = ABSTRACT | HYPOTHETICAL | POLYMORPHIC_SIGNATURE |
                     (spMethod != null ?
                         spMethod.flags() & Flags.AccessFlags :
@@ -1497,7 +1500,7 @@
                                         List<Type> argtypes,
                                         List<Type> typeargtypes) {
         Symbol sym = resolveQualifiedMethod(
-            pos, env, site, name, argtypes, typeargtypes);
+            pos, env, site.tsym, site, name, argtypes, typeargtypes);
         if (sym.kind == MTH) return (MethodSymbol)sym;
         else throw new FatalError(
                  diags.fragment("fatal.err.cant.locate.meth",
@@ -1572,11 +1575,13 @@
                 null;
             Symbol errSym = new ResolveError(WRONG_MTH, "diamond error") {
                 @Override
-                JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
+                JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos,
+                        Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
                     String key = details == null ?
                         "cant.apply.diamond" :
                         "cant.apply.diamond.1";
-                    return diags.create(dkind, log.currentSource(), pos, key, diags.fragment("diamond", site.tsym), details);
+                    return diags.create(dkind, log.currentSource(), pos, key,
+                            diags.fragment("diamond", site.tsym), details);
                 }
             };
             MethodResolutionPhase errPhase = firstErroneousResolutionPhase();
@@ -1755,17 +1760,18 @@
 
     public void logAccessError(Env<AttrContext> env, JCTree tree, Type type) {
         AccessError error = new AccessError(env, type.getEnclosingType(), type.tsym);
-        logResolveError(error, tree.pos(), type.getEnclosingType(), null, null, null);
+        logResolveError(error, tree.pos(), type.getEnclosingType().tsym, type.getEnclosingType(), null, null, null);
     }
     //where
     private void logResolveError(ResolveError error,
             DiagnosticPosition pos,
+            Symbol location,
             Type site,
             Name name,
             List<Type> argtypes,
             List<Type> typeargtypes) {
         JCDiagnostic d = error.getDiagnostic(JCDiagnostic.DiagnosticType.ERROR,
-                pos, site, name, argtypes, typeargtypes);
+                pos, location, site, name, argtypes, typeargtypes);
         if (d != null) {
             d.setFlag(DiagnosticFlag.RESOLVE_ERROR);
             log.report(d);
@@ -1835,6 +1841,7 @@
          */
         abstract JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
                 DiagnosticPosition pos,
+                Symbol location,
                 Type site,
                 Name name,
                 List<Type> argtypes,
@@ -1900,6 +1907,7 @@
         @Override
         JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
                 DiagnosticPosition pos,
+                Symbol location,
                 Type site,
                 Name name,
                 List<Type> argtypes,
@@ -1910,16 +1918,23 @@
                 return null;
 
             if (isOperator(name)) {
+                boolean isUnaryOp = argtypes.size() == 1;
+                String key = argtypes.size() == 1 ?
+                    "operator.cant.be.applied" :
+                    "operator.cant.be.applied.1";
+                Type first = argtypes.head;
+                Type second = !isUnaryOp ? argtypes.tail.head : null;
                 return diags.create(dkind, log.currentSource(), pos,
-                        "operator.cant.be.applied", name, argtypes);
+                        key, name, first, second);
             }
             boolean hasLocation = false;
-            if (!site.tsym.name.isEmpty()) {
-                if (site.tsym.kind == PCK && !site.tsym.exists()) {
+            if (!location.name.isEmpty()) {
+                if (location.kind == PCK && !site.tsym.exists()) {
                     return diags.create(dkind, log.currentSource(), pos,
-                        "doesnt.exist", site.tsym);
+                        "doesnt.exist", location);
                 }
-                hasLocation = true;
+                hasLocation = !location.name.equals(names._this) &&
+                        !location.name.equals(names._super);
             }
             boolean isConstructor = kind == ABSENT_MTH &&
                     name == names.table.names.init;
@@ -1930,7 +1945,7 @@
                 return diags.create(dkind, log.currentSource(), pos,
                         errKey, kindname, idname, //symbol kindname, name
                         typeargtypes, argtypes, //type parameters and arguments (if any)
-                        typeKindName(site), site); //location kindname, type
+                        getLocationDiag(location)); //location kindname, type
             }
             else {
                 return diags.create(dkind, log.currentSource(), pos,
@@ -1951,6 +1966,16 @@
             }
             return key + suffix;
         }
+        private JCDiagnostic getLocationDiag(Symbol location) {
+            boolean isVar = location.kind == VAR;
+            String key = isVar ?
+                "location.1" :
+                "location";
+            return diags.fragment(key,
+                    kindName(location),
+                    location,
+                    isVar ? location.type : null);
+        }
     }
 
     /**
@@ -1991,6 +2016,7 @@
         @Override
         JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
                 DiagnosticPosition pos,
+                Symbol location,
                 Type site,
                 Name name,
                 List<Type> argtypes,
@@ -2042,6 +2068,7 @@
         @Override
         JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
                 DiagnosticPosition pos,
+                Symbol location,
                 Type site,
                 Name name,
                 List<Type> argtypes,
@@ -2057,7 +2084,7 @@
                 return new JCDiagnostic.MultilineDiagnostic(err, candidateDetails(site));
             } else {
                 return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind, pos,
-                    site, name, argtypes, typeargtypes);
+                    location, site, name, argtypes, typeargtypes);
             }
         }
 
@@ -2157,6 +2184,7 @@
         @Override
         JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
                 DiagnosticPosition pos,
+                Symbol location,
                 Type site,
                 Name name,
                 List<Type> argtypes,
@@ -2166,7 +2194,7 @@
 
             if (sym.name == names.init && sym.owner != site.tsym) {
                 return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind,
-                        pos, site, name, argtypes, typeargtypes);
+                        pos, location, site, name, argtypes, typeargtypes);
             }
             else if ((sym.flags() & PUBLIC) != 0
                 || (env != null && this.site != null
@@ -2201,6 +2229,7 @@
         @Override
         JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
                 DiagnosticPosition pos,
+                Symbol location,
                 Type site,
                 Name name,
                 List<Type> argtypes,
@@ -2231,6 +2260,7 @@
         @Override
         JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
                 DiagnosticPosition pos,
+                Symbol location,
                 Type site,
                 Name name,
                 List<Type> argtypes,
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -69,7 +69,6 @@
     private boolean allowEnums;
     private Types types;
     private final Resolve resolve;
-    private final TypeAnnotations typeAnnotations;
 
     /**
      * Flag to indicate whether or not to generate bridge methods.
@@ -91,7 +90,6 @@
         types = Types.instance(context);
         make = TreeMaker.instance(context);
         resolve = Resolve.instance(context);
-        typeAnnotations = TypeAnnotations.instance(context);
     }
 
     /** A hashtable mapping bridge methods to the methods they override after
@@ -182,7 +180,7 @@
             parameters = parameters.tail;
         }
         Type parameter = parameters.head;
-        assert varargsElement != null || args.length() == 1;
+        Assert.check(varargsElement != null || args.length() == 1);
         if (varargsElement != null) {
             while (args.nonEmpty()) {
                 args.head = translate(args.head, varargsElement);
@@ -445,14 +443,12 @@
     }
 
     public void visitClassDef(JCClassDecl tree) {
-        typeAnnotations.taFillAndLift(tree, true);
         translateClass(tree.sym);
         result = tree;
     }
 
     JCMethodDecl currentMethod = null;
     public void visitMethodDef(JCMethodDecl tree) {
-        tree.sym.typeAnnotations = tree.sym.typeAnnotations;
         JCMethodDecl previousMethod = currentMethod;
         try {
             currentMethod = tree;
@@ -598,7 +594,7 @@
         if (tree.varargsElement != null)
             tree.varargsElement = types.erasure(tree.varargsElement);
         else
-            assert tree.args.length() == argtypes.length();
+            Assert.check(tree.args.length() == argtypes.length());
         tree.args = translateArgs(tree.args, argtypes, tree.varargsElement);
 
         // Insert casts of method invocation results as needed.
--- a/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -472,7 +472,7 @@
      */
     protected Archive openArchive(File zipFileName) throws IOException {
         File origZipFileName = zipFileName;
-        if (!ignoreSymbolFile && paths.isBootClassPathRtJar(zipFileName)) {
+        if (!ignoreSymbolFile && paths.isDefaultBootClassPathRtJar(zipFileName)) {
             File file = zipFileName.getParentFile().getParentFile(); // ${java.home}
             if (new File(file.getName()).equals(new File("jre")))
                 file = file.getParentFile();
--- a/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -112,7 +112,7 @@
      * rt.jar as found on the default bootclass path.  If the user specified a
      * bootclasspath, null is used.
      */
-    private File bootClassPathRtJar = null;
+    private File defaultBootClassPathRtJar = null;
 
     /**
      *  Is bootclasspath the default?
@@ -143,8 +143,10 @@
                 // no defaults for other paths
                 p = null;
         } else {
-            if (location == PLATFORM_CLASS_PATH)
+            if (location == PLATFORM_CLASS_PATH) {
+                defaultBootClassPathRtJar = null;
                 isDefaultBootClassPath = false;
+            }
             p = new Path();
             for (File f: path)
                 p.addFile(f, warn); // TODO: is use of warn appropriate?
@@ -185,8 +187,8 @@
             : Collections.unmodifiableCollection(p);
     }
 
-    boolean isBootClassPathRtJar(File file) {
-        return file.equals(bootClassPathRtJar);
+    boolean isDefaultBootClassPathRtJar(File file) {
+        return file.equals(defaultBootClassPathRtJar);
     }
 
     /**
@@ -355,7 +357,7 @@
     }
 
     private Path computeBootClassPath() {
-        bootClassPathRtJar = null;
+        defaultBootClassPathRtJar = null;
         Path path = new Path();
 
         String bootclasspathOpt = options.get(BOOTCLASSPATH);
@@ -380,7 +382,7 @@
             File rt_jar = new File("rt.jar");
             for (File file : getPathEntries(files)) {
                 if (new File(file.getName()).equals(rt_jar))
-                    bootClassPathRtJar = file;
+                    defaultBootClassPathRtJar = file;
             }
         }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -42,6 +42,7 @@
 import com.sun.tools.javac.file.JavacFileManager.Archive;
 import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
 import com.sun.tools.javac.file.RelativePath.RelativeFile;
+import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.List;
 
 /**
@@ -146,7 +147,7 @@
         @Override
         public InputStream openInputStream() throws IOException {
             if (inputStream == null) {
-                assert entry != null; // see constructor
+                Assert.checkNonNull(entry); // see constructor
                 inputStream = new ByteArrayInputStream(zfIndex.read(entry));
             }
             return inputStream;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/CRTable.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/CRTable.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -101,7 +101,7 @@
                 continue;
 
             SourceRange pos = positions.get(entry.tree);
-            assert pos != null : "CRT: tree source positions are undefined";
+            Assert.checkNonNull(pos, "CRT: tree source positions are undefined");
             if ((pos.startPos == Position.NOPOS) || (pos.endPos == Position.NOPOS))
                 continue;
 
@@ -517,7 +517,7 @@
         }
 
         public void visitTree(JCTree tree) {
-            assert false;
+            Assert.error();
         }
 
         /** The start position of given tree.
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -80,6 +80,9 @@
     public final static int CONSTANT_Methodref = 10;
     public final static int CONSTANT_InterfaceMethodref = 11;
     public final static int CONSTANT_NameandType = 12;
+    public final static int CONSTANT_MethodHandle = 15;
+    public final static int CONSTANT_MethodType = 16;
+    public final static int CONSTANT_InvokeDynamic = 18;
 
     public final static int MAX_PARAMETERS = 0xff;
     public final static int MAX_DIMENSIONS = 0xff;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -207,10 +207,6 @@
     /** The minor version number of the class file being read. */
     int minorVersion;
 
-    /** Switch: debug output for JSR 308-related operations.
-     */
-    boolean debugJSR308;
-
     /** A table to hold the constant pool indices for method parameter
      * names, as given in LocalVariableTable attributes.
      */
@@ -246,9 +242,9 @@
         if (classes != null) return;
 
         if (definitive) {
-            assert packages == null || packages == syms.packages;
+            Assert.check(packages == null || packages == syms.packages);
             packages = syms.packages;
-            assert classes == null || classes == syms.classes;
+            Assert.check(classes == null || classes == syms.classes);
             classes = syms.classes;
         } else {
             packages = new HashMap<Name, PackageSymbol>();
@@ -297,7 +293,6 @@
             : null;
 
         typevars = new Scope(syms.noSymbol);
-        debugJSR308 = options.isSet("TA:reader");
 
         lintClassfile = Lint.instance(context).isEnabled(LintCategory.CLASSFILE);
 
@@ -439,14 +434,19 @@
             }
             case CONSTANT_Class:
             case CONSTANT_String:
+            case CONSTANT_MethodType:
                 bp = bp + 2;
                 break;
+            case CONSTANT_MethodHandle:
+                bp = bp + 3;
+                break;
             case CONSTANT_Fieldref:
             case CONSTANT_Methodref:
             case CONSTANT_InterfaceMethodref:
             case CONSTANT_NameandType:
             case CONSTANT_Integer:
             case CONSTANT_Float:
+            case CONSTANT_InvokeDynamic:
                 bp = bp + 4;
                 break;
             case CONSTANT_Long:
@@ -515,6 +515,15 @@
         case CONSTANT_Double:
             poolObj[i] = new Double(getDouble(index + 1));
             break;
+        case CONSTANT_MethodHandle:
+            skipBytes(4);
+            break;
+        case CONSTANT_MethodType:
+            skipBytes(3);
+            break;
+        case CONSTANT_InvokeDynamic:
+            skipBytes(5);
+            break;
         default:
             throw badClassFile("bad.const.pool.tag", Byte.toString(tag));
         }
@@ -535,7 +544,7 @@
         int index =  poolIdx[i];
         int len = getChar(index + 1);
         int start = index + 3;
-        assert buf[start] == '[' || buf[start + len - 1] != ';';
+        Assert.check(buf[start] == '[' || buf[start + len - 1] != ';');
         // by the above assertion, the following test can be
         // simplified to (buf[start] == '[')
         return (buf[start] == '[' || buf[start + len - 1] == ';')
@@ -1046,7 +1055,7 @@
                         readingClassAttr = true;
                         try {
                             ClassType ct1 = (ClassType)c.type;
-                            assert c == currentOwner;
+                            Assert.check(c == currentOwner);
                             ct1.typarams_field = readTypeParams(nextChar());
                             ct1.supertype_field = sigToType();
                             ListBuffer<Type> is = new ListBuffer<Type>();
@@ -1128,20 +1137,6 @@
                 }
             },
 
-            // v51 attributes
-            new AttributeReader(names.RuntimeVisibleTypeAnnotations, V51, CLASS_OR_MEMBER_ATTRIBUTE) {
-                void read(Symbol sym, int attrLen) {
-                    attachTypeAnnotations(sym);
-                }
-            },
-
-            new AttributeReader(names.RuntimeInvisibleTypeAnnotations, V51, CLASS_OR_MEMBER_ATTRIBUTE) {
-                void read(Symbol sym, int attrLen) {
-                    attachTypeAnnotations(sym);
-                }
-            },
-
-
             // The following attributes for a Code attribute are not currently handled
             // StackMapTable
             // SourceDebugExtension
@@ -1351,17 +1346,6 @@
         }
     }
 
-    void attachTypeAnnotations(final Symbol sym) {
-        int numAttributes = nextChar();
-        if (numAttributes != 0) {
-            ListBuffer<TypeAnnotationProxy> proxies =
-                ListBuffer.lb();
-            for (int i = 0; i < numAttributes; i++)
-                proxies.append(readTypeAnnotation());
-            annotate.later(new TypeAnnotationCompleter(sym, proxies.toList()));
-        }
-    }
-
     /** Attach the default value for an annotation element.
      */
     void attachAnnotationDefault(final Symbol sym) {
@@ -1398,121 +1382,6 @@
         return new CompoundAnnotationProxy(t, pairs.toList());
     }
 
-    TypeAnnotationProxy readTypeAnnotation() {
-        CompoundAnnotationProxy proxy = readCompoundAnnotation();
-        TypeAnnotationPosition position = readPosition();
-
-        if (debugJSR308)
-            System.out.println("TA: reading: " + proxy + " @ " + position
-                    + " in " + log.currentSourceFile());
-
-        return new TypeAnnotationProxy(proxy, position);
-    }
-
-    TypeAnnotationPosition readPosition() {
-        byte tag = nextByte();
-
-        if (!TargetType.isValidTargetTypeValue(tag))
-            throw this.badClassFile("bad.type.annotation.value", tag);
-
-        TypeAnnotationPosition position = new TypeAnnotationPosition();
-        TargetType type = TargetType.fromTargetTypeValue(tag);
-
-        position.type = type;
-
-        switch (type) {
-        // type case
-        case TYPECAST:
-        case TYPECAST_GENERIC_OR_ARRAY:
-        // object creation
-        case INSTANCEOF:
-        case INSTANCEOF_GENERIC_OR_ARRAY:
-        // new expression
-        case NEW:
-        case NEW_GENERIC_OR_ARRAY:
-            position.offset = nextChar();
-            break;
-         // local variable
-        case LOCAL_VARIABLE:
-        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-            int table_length = nextChar();
-            position.lvarOffset = new int[table_length];
-            position.lvarLength = new int[table_length];
-            position.lvarIndex = new int[table_length];
-
-            for (int i = 0; i < table_length; ++i) {
-                position.lvarOffset[i] = nextChar();
-                position.lvarLength[i] = nextChar();
-                position.lvarIndex[i] = nextChar();
-            }
-            break;
-         // method receiver
-        case METHOD_RECEIVER:
-            // Do nothing
-            break;
-        // type parameters
-        case CLASS_TYPE_PARAMETER:
-        case METHOD_TYPE_PARAMETER:
-            position.parameter_index = nextByte();
-            break;
-        // type parameter bounds
-        case CLASS_TYPE_PARAMETER_BOUND:
-        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_PARAMETER_BOUND:
-        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            position.parameter_index = nextByte();
-            position.bound_index = nextByte();
-            break;
-         // wildcard
-        case WILDCARD_BOUND:
-        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-            position.wildcard_position = readPosition();
-            break;
-         // Class extends and implements clauses
-        case CLASS_EXTENDS:
-        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            position.type_index = nextChar();
-            break;
-        // throws
-        case THROWS:
-            position.type_index = nextChar();
-            break;
-        case CLASS_LITERAL:
-        case CLASS_LITERAL_GENERIC_OR_ARRAY:
-            position.offset = nextChar();
-            break;
-        // method parameter: not specified
-        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-            position.parameter_index = nextByte();
-            break;
-        // method type argument: wasn't specified
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_ARGUMENT:
-        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            position.offset = nextChar();
-            position.type_index = nextByte();
-            break;
-        // We don't need to worry abut these
-        case METHOD_RETURN_GENERIC_OR_ARRAY:
-        case FIELD_GENERIC_OR_ARRAY:
-            break;
-        case UNKNOWN:
-            break;
-        default:
-            throw new AssertionError("unknown type: " + position);
-        }
-
-        if (type.hasLocation()) {
-            int len = nextChar();
-            ListBuffer<Integer> loc = ListBuffer.lb();
-            for (int i = 0; i < len; i++)
-                loc = loc.append((int)nextByte());
-            position.location = loc.toList();
-        }
-
-        return position;
-    }
     Attribute readAttributeValue() {
         char c = (char) buf[bp++];
         switch (c) {
@@ -1825,45 +1694,6 @@
         }
     }
 
-    class TypeAnnotationCompleter extends AnnotationCompleter {
-
-        List<TypeAnnotationProxy> proxies;
-
-        TypeAnnotationCompleter(Symbol sym,
-                List<TypeAnnotationProxy> proxies) {
-            super(sym, List.<CompoundAnnotationProxy>nil());
-            this.proxies = proxies;
-        }
-
-        List<Attribute.TypeCompound> deproxyTypeCompoundList(List<TypeAnnotationProxy> proxies) {
-            ListBuffer<Attribute.TypeCompound> buf = ListBuffer.lb();
-            for (TypeAnnotationProxy proxy: proxies) {
-                Attribute.Compound compound = deproxyCompound(proxy.compound);
-                Attribute.TypeCompound typeCompound = new Attribute.TypeCompound(compound, proxy.position);
-                buf.add(typeCompound);
-            }
-            return buf.toList();
-        }
-
-        @Override
-        public void enterAnnotation() {
-            JavaFileObject previousClassFile = currentClassFile;
-            try {
-                currentClassFile = classFile;
-                List<Attribute.TypeCompound> newList = deproxyTypeCompoundList(proxies);
-              if (debugJSR308)
-              System.out.println("TA: reading: adding " + newList
-                      + " to symbol " + sym + " in " + log.currentSourceFile());
-                sym.typeAnnotations = ((sym.typeAnnotations == null)
-                                        ? newList
-                                        : newList.prependList(sym.typeAnnotations));
-
-            } finally {
-                currentClassFile = previousClassFile;
-            }
-        }
-    }
-
 
 /************************************************************************
  * Reading Symbols
@@ -2005,6 +1835,13 @@
         sym.savedParameterNames = paramNames.reverse();
     }
 
+    /**
+     * skip n bytes
+     */
+    void skipBytes(int n) {
+        bp = bp + n;
+    }
+
     /** Skip a field or method
      */
     void skipMember() {
@@ -2092,9 +1929,9 @@
         if (ct.interfaces_field == null)
             ct.interfaces_field = is.reverse();
 
-        if (fieldCount != nextChar()) assert false;
+        Assert.check(fieldCount == nextChar());
         for (int i = 0; i < fieldCount; i++) enterMember(c, readField());
-        if (methodCount != nextChar()) assert false;
+        Assert.check(methodCount == nextChar());
         for (int i = 0; i < methodCount; i++) enterMember(c, readMethod());
 
         typevars = typevars.leave();
@@ -2203,7 +2040,7 @@
     public ClassSymbol defineClass(Name name, Symbol owner) {
         ClassSymbol c = new ClassSymbol(0, name, owner);
         if (owner.kind == PCK)
-            assert classes.get(c.flatname) == null : c;
+            Assert.checkNull(classes.get(c.flatname), c);
         c.completer = this;
         return c;
     }
@@ -2343,9 +2180,9 @@
         if (classfile != null) {
             JavaFileObject previousClassFile = currentClassFile;
             try {
-                assert !filling :
-                    "Filling " + classfile.toUri() +
-                    " during " + previousClassFile;
+                if (filling) {
+                    Assert.error("Filling " + classfile.toUri() + " during " + previousClassFile);
+                }
                 currentClassFile = classfile;
                 if (verbose) {
                     printVerbose("loading", currentClassFile.toString());
@@ -2491,7 +2328,7 @@
     public PackageSymbol enterPackage(Name fullname) {
         PackageSymbol p = packages.get(fullname);
         if (p == null) {
-            assert !fullname.isEmpty() : "rootPackage missing!";
+            Assert.check(!fullname.isEmpty(), "rootPackage missing!");
             p = new PackageSymbol(
                 Convert.shortName(fullname),
                 enterPackage(Convert.packagePart(fullname)));
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -65,10 +65,6 @@
 
     private final Options options;
 
-    /** Switch: debugging output for JSR 308-related operations.
-     */
-    private boolean debugJSR308;
-
     /** Switch: verbose output.
      */
     private boolean verbose;
@@ -180,7 +176,6 @@
         types = Types.instance(context);
         fileManager = context.get(JavaFileManager.class);
 
-        debugJSR308    = options.isSet("TA:writer");
         verbose        = options.isSet(VERBOSE);
         scramble       = options.isSet("-scramble");
         scrambleAll    = options.isSet("-scrambleAll");
@@ -224,11 +219,14 @@
     /** Return flags as a string, separated by " ".
      */
     public static String flagNames(long flags) {
-        StringBuffer sbuf = new StringBuffer();
+        StringBuilder sbuf = new StringBuilder();
         int i = 0;
         long f = flags & StandardFlags;
         while (f != 0) {
-            if ((f & 1) != 0) sbuf.append(" " + flagName[i]);
+            if ((f & 1) != 0) {
+                sbuf.append(" ");
+                sbuf.append(flagName[i]);
+            }
             f = f >> 1;
             i++;
         }
@@ -381,7 +379,7 @@
                              ? types.erasure(outer)
                              : outer);
             sigbuf.appendByte('.');
-            assert c.flatname.startsWith(c.owner.enclClass().flatname);
+            Assert.check(c.flatname.startsWith(c.owner.enclClass().flatname));
             sigbuf.appendName(rawOuter
                               ? c.flatname.subName(c.owner.enclClass().flatname.getByteLength()+1,c.flatname.getByteLength())
                               : c.name);
@@ -421,7 +419,7 @@
     /** Return signature of given type
      */
     Name typeSig(Type type) {
-        assert sigbuf.length == 0;
+        Assert.check(sigbuf.length == 0);
         //- System.out.println(" ? " + type);
         assembleSig(type);
         Name n = sigbuf.toName(names);
@@ -471,7 +469,7 @@
         int i = 1;
         while (i < pool.pp) {
             Object value = pool.pool[i];
-            assert value != null;
+            Assert.checkNonNull(value);
             if (value instanceof Pool.Method)
                 value = ((Pool.Method)value).m;
             else if (value instanceof Pool.Variable)
@@ -534,7 +532,7 @@
                 poolbuf.appendByte(CONSTANT_Class);
                 poolbuf.appendChar(pool.put(xClassName(type)));
             } else {
-                assert false : "writePool " + value;
+                Assert.error("writePool " + value);
             }
             i++;
         }
@@ -677,7 +675,6 @@
             acount++;
         }
         acount += writeJavaAnnotations(sym.getAnnotationMirrors());
-        acount += writeTypeAnnotations(sym.typeAnnotations);
         return acount;
     }
 
@@ -772,46 +769,6 @@
         return attrCount;
     }
 
-    int writeTypeAnnotations(List<Attribute.TypeCompound> typeAnnos) {
-        if (typeAnnos.isEmpty()) return 0;
-
-        ListBuffer<Attribute.TypeCompound> visibles = ListBuffer.lb();
-        ListBuffer<Attribute.TypeCompound> invisibles = ListBuffer.lb();
-
-        for (Attribute.TypeCompound tc : typeAnnos) {
-            if (tc.position.type == TargetType.UNKNOWN
-                || !tc.position.emitToClassfile())
-                continue;
-            switch (types.getRetention(tc)) {
-            case SOURCE: break;
-            case CLASS: invisibles.append(tc); break;
-            case RUNTIME: visibles.append(tc); break;
-            default: ;// /* fail soft */ throw new AssertionError(vis);
-            }
-        }
-
-        int attrCount = 0;
-        if (visibles.length() != 0) {
-            int attrIndex = writeAttr(names.RuntimeVisibleTypeAnnotations);
-            databuf.appendChar(visibles.length());
-            for (Attribute.TypeCompound p : visibles)
-                writeTypeAnnotation(p);
-            endAttr(attrIndex);
-            attrCount++;
-        }
-
-        if (invisibles.length() != 0) {
-            int attrIndex = writeAttr(names.RuntimeInvisibleTypeAnnotations);
-            databuf.appendChar(invisibles.length());
-            for (Attribute.TypeCompound p : invisibles)
-                writeTypeAnnotation(p);
-            endAttr(attrIndex);
-            attrCount++;
-        }
-
-        return attrCount;
-    }
-
     /** A visitor to write an attribute including its leading
      *  single-character marker.
      */
@@ -844,7 +801,7 @@
                 databuf.appendByte('Z');
                 break;
             case CLASS:
-                assert value instanceof String;
+                Assert.check(value instanceof String);
                 databuf.appendByte('s');
                 value = names.fromString(value.toString()); // CONSTANT_Utf8
                 break;
@@ -888,104 +845,6 @@
             p.snd.accept(awriter);
         }
     }
-
-    void writeTypeAnnotation(Attribute.TypeCompound c) {
-        if (debugJSR308)
-            System.out.println("TA: writing " + c + " at " + c.position
-                    + " in " + log.currentSourceFile());
-        writeCompoundAttribute(c);
-        writePosition(c.position);
-    }
-
-    void writePosition(TypeAnnotationPosition p) {
-        databuf.appendByte(p.type.targetTypeValue());
-        switch (p.type) {
-        // type case
-        case TYPECAST:
-        case TYPECAST_GENERIC_OR_ARRAY:
-        // object creation
-        case INSTANCEOF:
-        case INSTANCEOF_GENERIC_OR_ARRAY:
-        // new expression
-        case NEW:
-        case NEW_GENERIC_OR_ARRAY:
-            databuf.appendChar(p.offset);
-            break;
-         // local variable
-        case LOCAL_VARIABLE:
-        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-            databuf.appendChar(p.lvarOffset.length);  // for table length
-            for (int i = 0; i < p.lvarOffset.length; ++i) {
-                databuf.appendChar(p.lvarOffset[i]);
-                databuf.appendChar(p.lvarLength[i]);
-                databuf.appendChar(p.lvarIndex[i]);
-            }
-            break;
-         // method receiver
-        case METHOD_RECEIVER:
-            // Do nothing
-            break;
-        // type parameters
-        case CLASS_TYPE_PARAMETER:
-        case METHOD_TYPE_PARAMETER:
-            databuf.appendByte(p.parameter_index);
-            break;
-        // type parameters bounds
-        case CLASS_TYPE_PARAMETER_BOUND:
-        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_PARAMETER_BOUND:
-        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            databuf.appendByte(p.parameter_index);
-            databuf.appendByte(p.bound_index);
-            break;
-         // wildcards
-        case WILDCARD_BOUND:
-        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-            writePosition(p.wildcard_position);
-            break;
-         // Class extends and implements clauses
-        case CLASS_EXTENDS:
-        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            databuf.appendChar(p.type_index);
-            break;
-        // throws
-        case THROWS:
-            databuf.appendChar(p.type_index);
-            break;
-        case CLASS_LITERAL:
-        case CLASS_LITERAL_GENERIC_OR_ARRAY:
-            databuf.appendChar(p.offset);
-            break;
-        // method parameter: not specified
-        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-            databuf.appendByte(p.parameter_index);
-            break;
-        // method type argument: wasn't specified
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_ARGUMENT:
-        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            databuf.appendChar(p.offset);
-            databuf.appendByte(p.type_index);
-            break;
-        // We don't need to worry abut these
-        case METHOD_RETURN_GENERIC_OR_ARRAY:
-        case FIELD_GENERIC_OR_ARRAY:
-            break;
-        case UNKNOWN:
-            break;
-        default:
-            throw new AssertionError("unknown position: " + p);
-        }
-
-        // Append location data for generics/arrays.
-        if (p.type.hasLocation()) {
-            databuf.appendChar(p.location.size());
-            for (int i : p.location)
-                databuf.appendByte((byte)i);
-        }
-    }
-
 /**********************************************************************
  * Writing Objects
  **********************************************************************/
@@ -1159,11 +1018,11 @@
                 Code.LocalVar var = code.varBuffer[i];
 
                 // write variable info
-                assert var.start_pc >= 0;
-                assert var.start_pc <= code.cp;
+                Assert.check(var.start_pc >= 0
+                        && var.start_pc <= code.cp);
                 databuf.appendChar(var.start_pc);
-                assert var.length >= 0;
-                assert (var.start_pc + var.length) <= code.cp;
+                Assert.check(var.length >= 0
+                        && (var.start_pc + var.length) <= code.cp);
                 databuf.appendChar(var.length);
                 VarSymbol sym = var.sym;
                 databuf.appendChar(pool.put(sym.name));
@@ -1195,7 +1054,7 @@
                 databuf.appendChar(pool.put(typeSig(sym.type)));
                 databuf.appendChar(var.reg);
             }
-            assert count == nGenericVars;
+            Assert.check(count == nGenericVars);
             endAttr(alenIdx);
             acount++;
         }
@@ -1266,7 +1125,7 @@
             }
             break;
         case JSR202: {
-            assert code.stackMapBuffer == null;
+            Assert.checkNull(code.stackMapBuffer);
             for (int i=0; i<nframes; i++) {
                 if (debugstackmap) System.out.print("  " + i + ":");
                 StackMapTableFrame frame = code.stackMapTableBuffer[i];
@@ -1606,7 +1465,7 @@
      */
     public void writeClassFile(OutputStream out, ClassSymbol c)
         throws IOException, PoolOverflow, StringOverflow {
-        assert (c.flags() & COMPOUND) == 0;
+        Assert.check((c.flags() & COMPOUND) == 0);
         databuf.reset();
         poolbuf.reset();
         sigbuf.reset();
@@ -1643,7 +1502,7 @@
             case MTH: if ((e.sym.flags() & HYPOTHETICAL) == 0) methodsCount++;
                       break;
             case TYP: enterInner((ClassSymbol)e.sym); break;
-            default : assert false;
+            default : Assert.error();
             }
         }
         databuf.appendChar(fieldsCount);
@@ -1659,7 +1518,7 @@
         for (List<Type> l = interfaces; !sigReq && l.nonEmpty(); l = l.tail)
             sigReq = l.head.allparams().length() != 0;
         if (sigReq) {
-            assert source.allowGenerics();
+            Assert.check(source.allowGenerics());
             int alenIdx = writeAttr(names.Signature);
             if (typarams.length() != 0) assembleParamsSig(typarams);
             assembleSig(supertype);
@@ -1698,7 +1557,6 @@
 
         acount += writeFlagAttrs(c.flags());
         acount += writeJavaAnnotations(c.getAnnotationMirrors());
-        acount += writeTypeAnnotations(c.typeAnnotations);
         acount += writeEnclosingMethodAttribute(c);
 
         poolbuf.appendInt(JAVA_MAGIC);
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -372,7 +372,7 @@
     }
 
     void postop() {
-        assert alive || state.stacksize == 0;
+        Assert.check(alive || state.stacksize == 0);
     }
 
     /** Emit a multinewarray instruction.
@@ -583,7 +583,7 @@
         case areturn:
         case ireturn:
         case freturn:
-            assert state.nlocks == 0;
+            Assert.check(state.nlocks == 0);
             state.pop(1);
             markDead();
             break;
@@ -604,7 +604,7 @@
             break;
         case lreturn:
         case dreturn:
-            assert state.nlocks == 0;
+            Assert.check(state.nlocks == 0);
             state.pop(2);
             markDead();
             break;
@@ -612,7 +612,7 @@
             state.push(state.stack[state.stacksize-1]);
             break;
         case return_:
-            assert state.nlocks == 0;
+            Assert.check(state.nlocks == 0);
             markDead();
             break;
         case arraylength:
@@ -1147,7 +1147,7 @@
         int pc = curPc();
         alive = true;
         this.state = state.dup();
-        assert state.stacksize <= max_stack;
+        Assert.check(state.stacksize <= max_stack);
         if (debugCode) System.err.println("entry point " + state);
         pendingStackMap = needStackMap;
         return pc;
@@ -1160,7 +1160,7 @@
         int pc = curPc();
         alive = true;
         this.state = state.dup();
-        assert state.stacksize <= max_stack;
+        Assert.check(state.stacksize <= max_stack);
         this.state.push(pushed);
         if (debugCode) System.err.println("entry point " + state);
         pendingStackMap = needStackMap;
@@ -1289,7 +1289,7 @@
         }
         frame.locals = new Type[localCount];
         for (int i=0, j=0; i<localsSize; i++, j++) {
-            assert(j < localCount);
+            Assert.check(j < localCount);
             frame.locals[j] = locals[i];
             if (width(locals[i]) > 1) i++;
         }
@@ -1435,8 +1435,8 @@
         boolean changed = false;
         State newState = state;
         for (; chain != null; chain = chain.next) {
-            assert state != chain.state;
-            assert target > chain.pc || state.stacksize == 0;
+            Assert.check(state != chain.state
+                    && (target > chain.pc || state.stacksize == 0));
             if (target >= cp) {
                 target = cp;
             } else if (get1(target) == goto_) {
@@ -1464,9 +1464,9 @@
                     fatcode = true;
                 else
                     put2(chain.pc + 1, target - chain.pc);
-                assert !alive ||
+                Assert.check(!alive ||
                     chain.state.stacksize == newState.stacksize &&
-                    chain.state.nlocks == newState.nlocks;
+                    chain.state.nlocks == newState.nlocks);
             }
             fixedPc = true;
             if (cp == target) {
@@ -1481,7 +1481,7 @@
                 }
             }
         }
-        assert !changed || state != newState;
+        Assert.check(!changed || state != newState);
         if (state != newState) {
             setDefined(newState.defined);
             state = newState;
@@ -1492,11 +1492,11 @@
     /** Resolve chain to point to current code pointer.
      */
     public void resolve(Chain chain) {
-        assert
+        Assert.check(
             !alive ||
             chain==null ||
             state.stacksize == chain.state.stacksize &&
-            state.nlocks == chain.state.nlocks;
+            state.nlocks == chain.state.nlocks);
         pendingJumps = mergeChains(chain, pendingJumps);
     }
 
@@ -1514,9 +1514,9 @@
         // recursive merge sort
         if (chain2 == null) return chain1;
         if (chain1 == null) return chain2;
-        assert
+        Assert.check(
             chain1.state.stacksize == chain2.state.stacksize &&
-            chain1.state.nlocks == chain2.state.nlocks;
+            chain1.state.nlocks == chain2.state.nlocks);
         if (chain1.pc < chain2.pc)
             return new Chain(
                 chain2.pc,
@@ -1631,7 +1631,7 @@
 
         void unlock(int register) {
             nlocks--;
-            assert locks[nlocks] == register;
+            Assert.check(locks[nlocks] == register);
             locks[nlocks] = -1;
         }
 
@@ -1673,7 +1673,7 @@
             stacksize--;
             Type result = stack[stacksize];
             stack[stacksize] = null;
-            assert result != null && width(result) == 1;
+            Assert.check(result != null && width(result) == 1);
             return result;
         }
 
@@ -1686,8 +1686,8 @@
             stacksize -= 2;
             Type result = stack[stacksize];
             stack[stacksize] = null;
-            assert stack[stacksize+1] == null;
-            assert result != null && width(result) == 2;
+            Assert.check(stack[stacksize+1] == null
+                    && result != null && width(result) == 2);
             return result;
         }
 
@@ -1712,8 +1712,8 @@
             case ARRAY:
                 int width = width(t);
                 Type old = stack[stacksize-width];
-                assert types.isSubtype(types.erasure(old),
-                                       types.erasure(t));
+                Assert.check(types.isSubtype(types.erasure(old),
+                                       types.erasure(t)));
                 stack[stacksize-width] = t;
                 break;
             default:
@@ -1739,8 +1739,8 @@
 
         State join(State other) {
             defined = defined.andSet(other.defined);
-            assert stacksize == other.stacksize;
-            assert nlocks == other.nlocks;
+            Assert.check(stacksize == other.stacksize
+                    && nlocks == other.nlocks);
             for (int i=0; i<stacksize; ) {
                 Type t = stack[i];
                 Type tother = other.stack[i];
@@ -1751,7 +1751,7 @@
                     error();
                 int w = width(result);
                 stack[i] = result;
-                if (w == 2) assert stack[i+1] == null;
+                if (w == 2) Assert.checkNull(stack[i+1]);
                 i += w;
             }
             return this;
@@ -1847,7 +1847,7 @@
             System.arraycopy(lvar, 0, new_lvar, 0, lvar.length);
             lvar = new_lvar;
         }
-        assert lvar[adr] == null;
+        Assert.checkNull(lvar[adr]);
         if (pendingJumps != null) resolvePending();
         lvar[adr] = new LocalVar(v);
         state.defined.excl(adr);
@@ -1912,29 +1912,12 @@
                 if (length < Character.MAX_VALUE) {
                     v.length = length;
                     putVar(v);
-                    fillLocalVarPosition(v);
                 }
             }
         }
         state.defined.excl(adr);
     }
 
-    private void fillLocalVarPosition(LocalVar lv) {
-        if (lv == null || lv.sym == null
-                || lv.sym.typeAnnotations == null)
-            return;
-        for (Attribute.TypeCompound ta : lv.sym.typeAnnotations) {
-            TypeAnnotationPosition p = ta.position;
-            while (p != null) {
-                p.lvarOffset = new int[] { (int)lv.start_pc };
-                p.lvarLength = new int[] { (int)lv.length };
-                p.lvarIndex = new int[] { (int)lv.reg };
-                p.isValidOffset = true;
-                p = p.wildcard_position;
-            }
-        }
-    }
-
     /** Put a live variable range into the buffer to be output to the
      *  class file.
      */
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -500,7 +500,7 @@
                 }
                 break;
             default:
-                assert false;
+                Assert.error();
             }
         }
         // Insert any instance initializers into all constructors.
@@ -857,7 +857,7 @@
             pts = pts.tail;
         }
         // require lists be of same length
-        assert pts.isEmpty();
+        Assert.check(pts.isEmpty());
     }
 
 /* ************************************************************************
@@ -1111,7 +1111,7 @@
 
     public void visitSwitch(JCSwitch tree) {
         int limit = code.nextreg;
-        assert tree.selector.type.tag != CLASS;
+        Assert.check(tree.selector.type.tag != CLASS);
         int startpcCrt = genCrt ? code.curPc() : 0;
         Item sel = genExpr(tree.selector, syms.intType);
         List<JCCase> cases = tree.cases;
@@ -1148,7 +1148,7 @@
                     if (hi < val) hi = val;
                     nlabels++;
                 } else {
-                    assert defaultIndex == -1;
+                    Assert.check(defaultIndex == -1);
                     defaultIndex = i;
                 }
                 l = l.tail;
@@ -1290,7 +1290,7 @@
         syncEnv.info.finalize = new GenFinalizer() {
             void gen() {
                 genLast();
-                assert syncEnv.info.gaps.length() % 2 == 0;
+                Assert.check(syncEnv.info.gaps.length() % 2 == 0);
                 syncEnv.info.gaps.append(code.curPc());
             }
             void genLast() {
@@ -1329,10 +1329,10 @@
                                       tryEnv.info.cont,
                                       jsrState);
                     }
-                    assert tryEnv.info.gaps.length() % 2 == 0;
+                    Assert.check(tryEnv.info.gaps.length() % 2 == 0);
                     tryEnv.info.gaps.append(code.curPc());
                 } else {
-                    assert tryEnv.info.gaps.length() % 2 == 0;
+                    Assert.check(tryEnv.info.gaps.length() % 2 == 0);
                     tryEnv.info.gaps.append(code.curPc());
                     genLast();
                 }
@@ -1640,14 +1640,14 @@
 
     public void visitBreak(JCBreak tree) {
         Env<GenContext> targetEnv = unwind(tree.target, env);
-        assert code.state.stacksize == 0;
+        Assert.check(code.state.stacksize == 0);
         targetEnv.info.addExit(code.branch(goto_));
         endFinalizerGaps(env, targetEnv);
     }
 
     public void visitContinue(JCContinue tree) {
         Env<GenContext> targetEnv = unwind(tree.target, env);
-        assert code.state.stacksize == 0;
+        Assert.check(code.state.stacksize == 0);
         targetEnv.info.addCont(code.branch(goto_));
         endFinalizerGaps(env, targetEnv);
     }
@@ -1682,7 +1682,6 @@
  *************************************************************************/
 
     public void visitApply(JCMethodInvocation tree) {
-        setTypeAnnotationPositions(tree.pos);
         // Generate code for method.
         Item m = genExpr(tree.meth, methodType);
         // Generate code for all arguments, where the expected types are
@@ -1718,48 +1717,10 @@
         result = items.makeStackItem(pt);
     }
 
-    private void setTypeAnnotationPositions(int treePos) {
-        MethodSymbol meth = code.meth;
-
-        for (Attribute.TypeCompound ta : meth.typeAnnotations) {
-            if (ta.position.pos == treePos) {
-                ta.position.offset = code.cp;
-                ta.position.lvarOffset = new int[] { code.cp };
-                ta.position.isValidOffset = true;
-            }
-        }
-
-        if (code.meth.getKind() != ElementKind.CONSTRUCTOR
-                && code.meth.getKind() != ElementKind.STATIC_INIT)
-            return;
-
-        for (Attribute.TypeCompound ta : meth.owner.typeAnnotations) {
-            if (ta.position.pos == treePos) {
-                ta.position.offset = code.cp;
-                ta.position.lvarOffset = new int[] { code.cp };
-                ta.position.isValidOffset = true;
-            }
-        }
-
-        ClassSymbol clazz = meth.enclClass();
-        for (Symbol s : new com.sun.tools.javac.model.FilteredMemberList(clazz.members())) {
-            if (!s.getKind().isField())
-                continue;
-            for (Attribute.TypeCompound ta : s.typeAnnotations) {
-                if (ta.position.pos == treePos) {
-                    ta.position.offset = code.cp;
-                    ta.position.lvarOffset = new int[] { code.cp };
-                    ta.position.isValidOffset = true;
-                }
-            }
-        }
-    }
-
     public void visitNewClass(JCNewClass tree) {
         // Enclosing instances or anonymous classes should have been eliminated
         // by now.
-        assert tree.encl == null && tree.def == null;
-        setTypeAnnotationPositions(tree.pos);
+        Assert.check(tree.encl == null && tree.def == null);
 
         code.emitop2(new_, makeRef(tree.pos(), tree.type));
         code.emitop0(dup);
@@ -1774,7 +1735,6 @@
     }
 
     public void visitNewArray(JCNewArray tree) {
-        setTypeAnnotationPositions(tree.pos);
 
         if (tree.elems != null) {
             Type elemtype = types.elemtype(tree.type);
@@ -1942,7 +1902,7 @@
                 genNullCheck(tree.pos());
                 break;
             default:
-                assert false;
+                Assert.error();
             }
         }
     }
@@ -2017,7 +1977,7 @@
             items.makeMemberItem(getStringBufferAppend(tree, t), false).invoke();
         }
         Symbol getStringBufferAppend(JCTree tree, Type t) {
-            assert t.constValue() == null;
+            Assert.checkNull(t.constValue());
             Symbol method = stringBufferAppend.get(t);
             if (method == null) {
                 method = rs.resolveInternalMethod(tree.pos(),
@@ -2104,7 +2064,6 @@
         }
 
     public void visitTypeCast(JCTypeCast tree) {
-        setTypeAnnotationPositions(tree.pos);
         result = genExpr(tree.expr, tree.clazz.type).load();
         // Additional code is only needed if we cast to a reference type
         // which is not statically a supertype of the expression's type.
@@ -2121,8 +2080,6 @@
     }
 
     public void visitTypeTest(JCInstanceOf tree) {
-        setTypeAnnotationPositions(tree.pos);
-
         genExpr(tree.expr, tree.expr.type).load();
         code.emitop2(instanceof_, makeRef(tree.pos(), tree.clazz.type));
         result = items.makeStackItem(syms.booleanType);
@@ -2163,16 +2120,10 @@
         Symbol sym = tree.sym;
 
         if (tree.name == names._class) {
-            assert target.hasClassLiterals();
-            setTypeAnnotationPositions(tree.pos);
+            Assert.check(target.hasClassLiterals());
             code.emitop2(ldc2, makeRef(tree.pos(), tree.selected.type));
             result = items.makeStackItem(pt);
             return;
-        } else if (tree.name == names.TYPE) {
-            // Set the annotation positions for primitive class literals
-            // (e.g. int.class) which have been converted to TYPE field
-            // access on the corresponding boxed type (e.g. Integer.TYPE).
-            setTypeAnnotationPositions(tree.pos);
         }
 
         Symbol ssym = TreeInfo.symbol(tree.selected);
@@ -2202,9 +2153,6 @@
             }
             result = items.
                 makeImmediateItem(sym.type, ((VarSymbol) sym).getConstValue());
-        } else if (allowInvokedynamic && sym.kind == MTH && ssym == syms.invokeDynamicType.tsym) {
-            base.drop();
-            result = items.makeDynamicItem(sym);
         } else {
             if (!accessSuper)
                 sym = binaryQualifier(sym, tree.selected.type);
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Items.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Items.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -26,11 +26,11 @@
 package com.sun.tools.javac.jvm;
 
 import com.sun.tools.javac.code.*;
-
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.jvm.Code.*;
 import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.util.Assert;
 
 import static com.sun.tools.javac.jvm.ByteCodes.*;
 
@@ -139,13 +139,6 @@
         return new StaticItem(member);
     }
 
-    /** Make an item representing a dynamically invoked method.
-     *  @param member   The represented symbol.
-     */
-    Item makeDynamicItem(Symbol member) {
-        return new DynamicItem(member);
-    }
-
     /** Make an item representing an instance variable or method.
      *  @param member       The represented symbol.
      *  @param nonvirtual   Is the reference not virtual? (true for constructors
@@ -387,7 +380,7 @@
 
         LocalItem(Type type, int reg) {
             super(Code.typecode(type));
-            assert reg >= 0;
+            Assert.check(reg >= 0);
             this.type = type;
             this.reg = reg;
         }
@@ -464,38 +457,6 @@
         }
     }
 
-    /** An item representing a dynamic call site.
-     */
-    class DynamicItem extends StaticItem {
-        DynamicItem(Symbol member) {
-            super(member);
-            assert member.owner == syms.invokeDynamicType.tsym;
-        }
-
-        Item load() {
-            assert false;
-            return null;
-        }
-
-        void store() {
-            assert false;
-        }
-
-        Item invoke() {
-            // assert target.hasNativeInvokeDynamic();
-            MethodType mtype = (MethodType)member.erasure(types);
-            int rescode = Code.typecode(mtype.restype);
-            ClassFile.NameAndType descr = new ClassFile.NameAndType(member.name, mtype);
-            code.emitInvokedynamic(pool.put(descr), mtype);
-            return stackItem[rescode];
-        }
-
-        public String toString() {
-            return "dynamic(" + member + ")";
-        }
-    }
-
-
     /** An item representing an instance variable or method.
      */
     class MemberItem extends Item {
@@ -620,7 +581,7 @@
                 ldc();
                 break;
             default:
-                assert false;
+                Assert.error();
             }
             return stackItem[typecode];
         }
@@ -716,7 +677,7 @@
         }
 
         void stash(int toscode) {
-            assert false;
+            Assert.error();
         }
 
         int width() {
@@ -784,7 +745,7 @@
         }
 
         void stash(int toscode) {
-            assert false;
+            Assert.error();
         }
 
         CondItem mkCond() {
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -848,7 +848,7 @@
                 break;
 
             default:
-                assert false: "unknown compile policy";
+                Assert.error("unknown compile policy");
             }
         } catch (Abort ex) {
             if (devVerbose)
@@ -1066,7 +1066,7 @@
                                     classSymbols = classSymbols.prepend((ClassSymbol)sym);
                                 continue;
                             }
-                            assert sym.kind == Kinds.PCK;
+                            Assert.check(sym.kind == Kinds.PCK);
                             log.warning("proc.package.does.not.exist", nameStr);
                             pckSymbols = pckSymbols.prepend((PackageSymbol)sym);
                         } catch (CompletionFailure e) {
@@ -1086,8 +1086,8 @@
                 if (c != this)
                     annotationProcessingOccurred = c.annotationProcessingOccurred = true;
                 // doProcessing will have handled deferred diagnostics
-                assert c.log.deferDiagnostics == false;
-                assert c.log.deferredDiagnostics.size() == 0;
+                Assert.check(c.log.deferDiagnostics == false
+                        && c.log.deferredDiagnostics.size() == 0);
                 return c;
             } finally {
                 procEnvImpl.close();
@@ -1324,7 +1324,7 @@
                         return;
                     List<JCTree> pdef = lower.translateTopLevelClass(env, env.tree, localMake);
                     if (pdef.head != null) {
-                        assert pdef.tail.isEmpty();
+                        Assert.check(pdef.tail.isEmpty());
                         results.add(new Pair<Env<AttrContext>, JCClassDecl>(env, (JCClassDecl)pdef.head));
                     }
                 }
--- a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java	Fri Jan 28 10:06:08 2011 -0800
@@ -284,13 +284,6 @@
             }
         }
 
-        // phase this out with JSR 292 PFD
-        if ("no".equals(options.get("allowTransitionalJSR292"))) {
-            options.put("allowTransitionalJSR292", null);
-        } else if (target.hasInvokedynamic() && options.isUnset("allowTransitionalJSR292")) {
-            options.put("allowTransitionalJSR292", "allowTransitionalJSR292");
-        }
-
         // handle this here so it works even if no other options given
         String showClass = options.get("showClass");
         if (showClass != null) {
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -547,7 +547,7 @@
                 null);
             break;
         default:
-            assert false;
+            Assert.error();
         }
         if (t == errorTree)
             t = F.at(pos).Erroneous();
@@ -724,7 +724,7 @@
                 topOpPos = posStack[top];
             }
         }
-        assert top == 0;
+        Assert.check(top == 0);
         t = odStack[0];
 
         if (t.getTag() == JCTree.PLUS) {
@@ -2168,8 +2168,11 @@
     JCVariableDecl variableDeclaratorId(JCModifiers mods, JCExpression type) {
         int pos = S.pos();
         Name name = ident();
-        if ((mods.flags & Flags.VARARGS) == 0)
-            type = bracketsOpt(type);
+        if ((mods.flags & Flags.VARARGS) != 0 &&
+                S.token() == LBRACKET) {
+            log.error(S.pos(), "varargs.and.old.array.syntax");
+        }
+        type = bracketsOpt(type);
         return toP(F.at(pos).VarDef(mods, name, type, null));
     }
 
@@ -2569,6 +2572,12 @@
             } else {
                 pos = S.pos();
                 List<JCTypeParameter> typarams = typeParametersOpt();
+                // if there are type parameters but no modifiers, save the start
+                // position of the method in the modifiers.
+                if (typarams.nonEmpty() && mods.pos == Position.NOPOS) {
+                    mods.pos = pos;
+                    storeEnd(mods, pos);
+                }
                 Name name = S.name();
                 pos = S.pos();
                 JCExpression type;
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -445,7 +445,7 @@
      */
     private void scanHexFractionAndSuffix(boolean seendigit) {
         this.radix = 16;
-        assert ch == '.';
+        Assert.check(ch == '.');
         putChar(ch);
         scanChar();
         skipIllegalUnderscores();
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -49,7 +49,6 @@
 import javax.tools.JavaFileObject;
 import javax.tools.DiagnosticListener;
 
-//308 import com.sun.source.util.AbstractTypeProcessor;
 import com.sun.source.util.TaskEvent;
 import com.sun.source.util.TaskListener;
 import com.sun.tools.javac.api.JavacTaskImpl;
@@ -66,6 +65,7 @@
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.Abort;
+import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.Convert;
 import com.sun.tools.javac.util.FatalError;
@@ -712,7 +712,6 @@
             }
 
             if (matchedNames.size() > 0 || ps.contributed) {
-//308                foundTypeProcessors = foundTypeProcessors || (ps.processor instanceof AbstractTypeProcessor);
                 boolean processingResult = callProcessor(ps.processor, typeElements, renv);
                 ps.contributed = true;
                 ps.removeSupportedOptions(unmatchedProcessorOptions);
@@ -1048,17 +1047,17 @@
             Context next = new Context();
 
             Options options = Options.instance(context);
-            assert options != null;
+            Assert.checkNonNull(options);
             next.put(Options.optionsKey, options);
 
             PrintWriter out = context.get(Log.outKey);
-            assert out != null;
+            Assert.checkNonNull(out);
             next.put(Log.outKey, out);
 
             final boolean shareNames = true;
             if (shareNames) {
                 Names names = Names.instance(context);
-                assert names != null;
+                Assert.checkNonNull(names);
                 next.put(Names.namesKey, names);
             }
 
@@ -1071,18 +1070,18 @@
                 next.put(TaskListener.class, tl);
 
             JavaFileManager jfm = context.get(JavaFileManager.class);
-            assert jfm != null;
+            Assert.checkNonNull(jfm);
             next.put(JavaFileManager.class, jfm);
             if (jfm instanceof JavacFileManager) {
                 ((JavacFileManager)jfm).setContext(next);
             }
 
             Names names = Names.instance(context);
-            assert names != null;
+            Assert.checkNonNull(names);
             next.put(Names.namesKey, names);
 
             Keywords keywords = Keywords.instance(context);
-            assert(keywords != null);
+            Assert.checkNonNull(keywords);
             next.put(Keywords.keywordsKey, keywords);
 
             JavaCompiler oldCompiler = JavaCompiler.instance(context);
@@ -1241,7 +1240,7 @@
             for (JCTree node : unit.defs) {
                 if (node.getTag() == JCTree.CLASSDEF) {
                     ClassSymbol sym = ((JCClassDecl) node).sym;
-                    assert sym != null;
+                    Assert.checkNonNull(sym);
                     classes = classes.prepend(sym);
                 }
             }
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
@@ -112,11 +112,9 @@
 compiler.err.catch.without.try=\
     ''catch'' without ''try''
 compiler.err.clash.with.pkg.of.same.name=\
-    {0} clashes with package of same name
+    {0} {1} clashes with package of same name
 compiler.err.const.expr.req=\
     constant expression required
-compiler.err.enum.const.req=\
-    unqualified enumeration constant name required
 compiler.err.cont.outside.loop=\
     continue outside of loop
 compiler.err.cyclic.inheritance=\
@@ -128,9 +126,7 @@
 compiler.err.no.superclass=\
     {0} has no superclass
 
-compiler.warn.type.parameter.on.polymorphic.signature=\
-    change obsolete notation for MethodHandle invocations from x.<T>invoke(y) to (T)x.invoke(y)
-compiler.warn.wrong.target.for.polymorphic.signature.definition=\
+compiler.err.wrong.target.for.polymorphic.signature.definition=\
     MethodHandle API building requires -target 7 runtimes or better; current is -target {0}
 
 compiler.err.concrete.inheritance.conflict=\
@@ -186,7 +182,9 @@
 compiler.err.finally.without.try=\
     ''finally'' without ''try''
 compiler.err.foreach.not.applicable.to.type=\
-    foreach not applicable to expression type
+    for-each not applicable to expression type\n\
+    required: {1}\n\
+    found:    {0}
 compiler.err.fp.number.too.large=\
     floating point number too large
 compiler.err.fp.number.too.small=\
@@ -198,7 +196,8 @@
     a generic class may not extend java.lang.Throwable
 
 compiler.err.icls.cant.have.static.decl=\
-    inner classes cannot have static declarations
+    Illegal static declaration in inner class {0}\n\
+    modifier \''static\'' is only allowed in constant variable declarations
 compiler.err.illegal.char=\
     illegal character: \\{0}
 compiler.err.illegal.char.for.encoding=\
@@ -240,7 +239,7 @@
 compiler.err.improperly.formed.type.param.missing=\
     improperly formed type, some parameters are missing
 compiler.err.improperly.formed.type.inner.raw.param=\
-    improperly formed type, type parameters given on a raw type
+    improperly formed type, type arguments given on a raw type
 compiler.err.incomparable.types=\
     incomparable types: {0} and {1}
 compiler.err.int.number.too.large=\
@@ -267,6 +266,8 @@
     hexadecimal numbers must contain at least one hexadecimal digit
 compiler.err.invalid.meth.decl.ret.type.req=\
     invalid method declaration; return type required
+compiler.err.varargs.and.old.array.syntax=\
+    legacy array notation not allowed on variable-arity parameter
 
 compiler.err.label.already.in.use=\
     label {0} already in use
@@ -356,7 +357,11 @@
     not an enclosing class: {0}
 
 compiler.err.operator.cant.be.applied=\
-    operator {0} cannot be applied to {1}
+    bad operand type {1} for unary operator ''{0}''
+compiler.err.operator.cant.be.applied.1=\
+    bad operand types for binary operator ''{0}''\n\
+    first type:  {1}\n\
+    second type: {2}
 
 compiler.err.pkg.annotations.sb.in.package-info.java=\
     package annotations should be in file package-info.java
@@ -483,9 +488,10 @@
 compiler.err.undef.label=\
     undefined label: {0}
 compiler.err.undetermined.type=\
-    type parameters of {0} cannot be determined
+    cannot infer type arguments for {0}
 compiler.err.undetermined.type.1=\
-    type parameters of {0} cannot be determined; {1}
+    cannot infer type arguments for {0};\n\
+    reason: {1}
 compiler.err.invalid.inferred.types=\
     invalid inferred types for {0}; {1}
 compiler.err.cant.apply.diamond=\
@@ -865,7 +871,7 @@
 
 compiler.warn.raw.class.use=\
     found raw type: {0}\n\
-    missing type parameters for generic class {1}
+    missing type arguments for generic class {1}
 
 compiler.warn.diamond.redundant.args=\
     redundant type arguments in new expression (use diamond operator instead).
@@ -971,8 +977,6 @@
     bad constant pool tag: {0} at {1}
 compiler.misc.bad.signature=\
     bad signature: {0}
-compiler.misc.bad.type.annotation.value=\
-    bad type annotation target type value: {0}
 compiler.misc.class.file.wrong.class=\
     class file contains wrong class: {0}
 compiler.misc.class.file.not.found=\
@@ -995,10 +999,7 @@
 #####
 
 compiler.err.not.within.bounds=\
-    type parameter {0} is not within its bound
-
-compiler.err.not.within.bounds.explain=\
-    type parameter {0} is not within its bound; {1}
+    type argument {0} is not within bounds of type-variable {1}
 
 ## The following are all possible strings for the second argument ({1}) of the
 ## above string.
@@ -1065,6 +1066,8 @@
     class
 compiler.misc.type.req.class.array=\
     class or array
+compiler.misc.type.req.array.or.iterable=\
+    array or java.lang.Iterable
 compiler.misc.type.req.ref=\
     reference
 compiler.misc.type.req.exact=\
@@ -1148,22 +1151,31 @@
     symbol: {0} <{2}>{1}({3})
 
 ## arguments from {0} to {3} have the same meaning as above
-## The fifth argument {4} is the location "kindname" (e.g. 'constructor', 'field', etc.)
-## The sixth argument {5} is the location type
+## The fifth argument {4} is a location subdiagnostic (see below)
 compiler.err.cant.resolve.location=\
     cannot find symbol\n\
     symbol:   {0} {1}\n\
-    location: {4} {5}
+    location: {4}
 
 compiler.err.cant.resolve.location.args=\
     cannot find symbol\n\
     symbol:   {0} {1}({3})\n\
-    location: {4} {5}
+    location: {4}
 
 compiler.err.cant.resolve.location.args.params=\
     cannot find symbol\n\
     symbol:   {0} <{2}>{1}({3})\n\
-    location: {4} {5}
+    location: {4}
+
+##a location subdiagnostic is composed as follows:
+## The first argument {0} is the location "kindname" (e.g. 'constructor', 'field', etc.)
+## The second argument {1} is the location name
+## The third argument {2} is the location type (only when {1} is a variable name)
+
+compiler.misc.location=\
+    {0} {1}
+compiler.misc.location.1=\
+    {0} {1} of type {2}
 
 ## The following are all possible string for "kindname".
 ## They should be called whatever the JLS calls them after it been translated
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -640,7 +640,6 @@
         public JCExpression restype;
         public List<JCTypeParameter> typarams;
         public List<JCVariableDecl> params;
-        public List<JCTypeAnnotation> receiverAnnotations;
         public List<JCExpression> thrown;
         public JCBlock body;
         public JCExpression defaultValue; // for annotation types
@@ -650,7 +649,6 @@
                             JCExpression restype,
                             List<JCTypeParameter> typarams,
                             List<JCVariableDecl> params,
-                            List<JCTypeAnnotation> receiver,
                             List<JCExpression> thrown,
                             JCBlock body,
                             JCExpression defaultValue,
@@ -661,7 +659,6 @@
             this.restype = restype;
             this.typarams = typarams;
             this.params = params;
-            this.receiverAnnotations = (receiver != null ? receiver : List.<JCTypeAnnotation>nil());
             this.thrown = thrown;
             this.body = body;
             this.defaultValue = defaultValue;
@@ -680,7 +677,6 @@
         public List<JCVariableDecl> getParameters() {
             return params;
         }
-        public List<JCTypeAnnotation> getReceiverAnnotations() { return receiverAnnotations; }
         public List<JCExpression> getThrows() {
             return thrown;
         }
@@ -1402,8 +1398,6 @@
     public static class JCNewArray extends JCExpression implements NewArrayTree {
         public JCExpression elemtype;
         public List<JCExpression> dims;
-        public List<JCTypeAnnotation> annotations;
-        public List<List<JCTypeAnnotation>> dimAnnotations;
         public List<JCExpression> elems;
         protected JCNewArray(JCExpression elemtype,
                            List<JCExpression> dims,
@@ -1411,8 +1405,6 @@
         {
             this.elemtype = elemtype;
             this.dims = dims;
-            this.annotations = List.nil();
-            this.dimAnnotations = List.nil();
             this.elems = elems;
         }
         @Override
@@ -1923,11 +1915,9 @@
     public static class JCTypeParameter extends JCTree implements TypeParameterTree {
         public Name name;
         public List<JCExpression> bounds;
-        public List<JCTypeAnnotation> annotations;
-        protected JCTypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annotations) {
+        protected JCTypeParameter(Name name, List<JCExpression> bounds) {
             this.name = name;
             this.bounds = bounds;
-            this.annotations = annotations;
         }
         @Override
         public void accept(Visitor v) { v.visitTypeParameter(this); }
@@ -1937,9 +1927,6 @@
         public List<JCExpression> getBounds() {
             return bounds;
         }
-        public List<JCTypeAnnotation> getAnnotations() {
-            return annotations;
-        }
         @Override
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitTypeParameter(this, d);
@@ -2030,16 +2017,6 @@
         }
     }
 
-    public static class JCTypeAnnotation extends JCAnnotation {
-        public TypeAnnotationPosition annotation_position;
-        public Attribute.TypeCompound attribute_field;
-
-        protected JCTypeAnnotation(JCTree annotationType, List<JCExpression> args) {
-            super(annotationType, args);
-            this.annotation_position = new TypeAnnotationPosition();
-        }
-    }
-
     public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
         public long flags;
         public List<JCAnnotation> annotations;
@@ -2067,40 +2044,6 @@
         }
     }
 
-    public static class JCAnnotatedType extends JCExpression
-//308            implements com.sun.source.tree.AnnotatedTypeTree
-    {
-        public List<JCTypeAnnotation> annotations;
-        public JCExpression underlyingType;
-        protected JCAnnotatedType(List<JCTypeAnnotation> annotations, JCExpression underlyingType) {
-            throw new UnsupportedOperationException();
-//308            this.annotations = annotations;
-//308            this.underlyingType = underlyingType;
-        }
-        @Override
-        public void accept(Visitor v) { v.visitAnnotatedType(this); }
-
-        public Kind getKind() {
-            throw new UnsupportedOperationException();
-//308            return Kind.ANNOTATED_TYPE;
-        }
-        public List<JCTypeAnnotation> getAnnotations() {
-            return annotations;
-        }
-        public JCExpression getUnderlyingType() {
-            return underlyingType;
-        }
-        @Override
-        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
-            throw new UnsupportedOperationException();
-//308            return v.visitAnnotatedType(this, d);
-        }
-        @Override
-        public int getTag() {
-            return ANNOTATED_TYPE;
-        }
-    }
-
     public static class JCErroneous extends JCExpression
             implements com.sun.source.tree.ErroneousTree {
         public List<? extends JCTree> errs;
@@ -2168,7 +2111,6 @@
                             JCExpression restype,
                             List<JCTypeParameter> typarams,
                             List<JCVariableDecl> params,
-                            List<JCTypeAnnotation> receiver,
                             List<JCExpression> thrown,
                             JCBlock body,
                             JCExpression defaultValue);
@@ -2290,11 +2232,10 @@
         public void visitTypeBoundKind(TypeBoundKind that)   { visitTree(that); }
         public void visitAnnotation(JCAnnotation that)       { visitTree(that); }
         public void visitModifiers(JCModifiers that)         { visitTree(that); }
-        public void visitAnnotatedType(JCAnnotatedType that) { visitTree(that); }
         public void visitErroneous(JCErroneous that)         { visitTree(that); }
         public void visitLetExpr(LetExpr that)               { visitTree(that); }
 
-        public void visitTree(JCTree that)                   { assert false; }
+        public void visitTree(JCTree that)                   { Assert.error(); }
     }
 
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -224,15 +224,6 @@
         }
     }
 
-    public void printTypeAnnotations(List<JCTypeAnnotation> trees) throws IOException {
-        if (trees.nonEmpty())
-            print(" ");
-        for (List<JCTypeAnnotation> l = trees; l.nonEmpty(); l = l.tail) {
-            printExpr(l.head);
-            print(" ");
-        }
-    }
-
     /** Print documentation comment, if it exists
      *  @param tree    The tree for which a documentation comment should be printed.
      */
@@ -890,33 +881,21 @@
         try {
             if (tree.elemtype != null) {
                 print("new ");
-                printTypeAnnotations(tree.annotations);
                 JCTree elem = tree.elemtype;
-                printBaseElementType(elem);
-                boolean isElemAnnoType = elem instanceof JCAnnotatedType;
-                int i = 0;
-                List<List<JCTypeAnnotation>> da = tree.dimAnnotations;
+                if (elem.getTag() == JCTree.TYPEARRAY)
+                    printBaseElementType((JCArrayTypeTree) elem);
+                else
+                    printExpr(elem);
                 for (List<JCExpression> l = tree.dims; l.nonEmpty(); l = l.tail) {
-                    if (da.size() > i) {
-                        printTypeAnnotations(da.get(i));
-                    }
                     print("[");
-                    i++;
                     printExpr(l.head);
                     print("]");
                 }
-                if (tree.elems != null) {
-                    if (isElemAnnoType) {
-                        printTypeAnnotations(((JCAnnotatedType)tree.elemtype).annotations);
-                    }
-                    print("[]");
-                }
-                if (isElemAnnoType)
-                    elem = ((JCAnnotatedType)elem).underlyingType;
                 if (elem instanceof JCArrayTypeTree)
                     printBrackets((JCArrayTypeTree) elem);
             }
             if (tree.elems != null) {
+                if (tree.elemtype != null) print("[]");
                 print("{");
                 printExprs(tree.elems);
                 print("}");
@@ -1173,11 +1152,6 @@
         JCTree elem;
         while (true) {
             elem = tree.elemtype;
-            if (elem.getTag() == JCTree.ANNOTATED_TYPE) {
-                JCAnnotatedType atype = (JCAnnotatedType) elem;
-                printTypeAnnotations(atype.annotations);
-                elem = atype.underlyingType;
-            }
             print("[]");
             if (elem.getTag() != JCTree.TYPEARRAY) break;
             tree = (JCArrayTypeTree) elem;
@@ -1272,15 +1246,6 @@
         }
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        try {
-            printTypeAnnotations(tree.annotations);
-            printExpr(tree.underlyingType);
-        } catch (IOException e) {
-            throw new UncheckedIOException(e);
-        }
-    }
-
     public void visitTree(JCTree tree) {
         try {
             print("(UNKNOWN: " + tree + ")");
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -71,13 +71,6 @@
         return lb.toList();
     }
 
-//308    public JCTree visitAnnotatedType(AnnotatedTypeTree node, P p) {
-//308        JCAnnotatedType t = (JCAnnotatedType) node;
-//308        List<JCTypeAnnotation> annotations = copy(t.annotations, p);
-//308        JCExpression underlyingType = copy(t.underlyingType, p);
-//308        return M.at(t.pos).AnnotatedType(annotations, underlyingType);
-//308    }
-
     public JCTree visitAnnotation(AnnotationTree node, P p) {
         JCAnnotation t = (JCAnnotation) node;
         JCTree annotationType = copy(t.annotationType, p);
@@ -240,11 +233,10 @@
         JCExpression restype = copy(t.restype, p);
         List<JCTypeParameter> typarams = copy(t.typarams, p);
         List<JCVariableDecl> params = copy(t.params, p);
-        List<JCTypeAnnotation> receiver = copy(t.receiverAnnotations, p);
         List<JCExpression> thrown = copy(t.thrown, p);
         JCBlock body = copy(t.body, p);
         JCExpression defaultValue = copy(t.defaultValue, p);
-        return M.at(t.pos).MethodDef(mods, t.name, restype, typarams, params, receiver, thrown, body, defaultValue);
+        return M.at(t.pos).MethodDef(mods, t.name, restype, typarams, params, thrown, body, defaultValue);
     }
 
     public JCTree visitMethodInvocation(MethodInvocationTree node, P p) {
@@ -372,9 +364,8 @@
 
     public JCTree visitTypeParameter(TypeParameterTree node, P p) {
         JCTypeParameter t = (JCTypeParameter) node;
-        List<JCTypeAnnotation> annos = copy(t.annotations, p);
         List<JCExpression> bounds = copy(t.bounds, p);
-        return M.at(t.pos).TypeParameter(t.name, bounds, annos);
+        return M.at(t.pos).TypeParameter(t.name, bounds);
     }
 
     public JCTree visitInstanceOf(InstanceOfTree node, P p) {
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -311,12 +311,6 @@
         case(JCTree.POSTINC):
         case(JCTree.POSTDEC):
             return getStartPos(((JCUnary) tree).arg);
-        case(JCTree.ANNOTATED_TYPE): {
-            JCAnnotatedType node = (JCAnnotatedType) tree;
-            if (node.annotations.nonEmpty())
-                return getStartPos(node.annotations.head);
-            return getStartPos(node.underlyingType);
-        }
         case(JCTree.NEWCLASS): {
             JCNewClass node = (JCNewClass)tree;
             if (node.encl != null)
@@ -420,8 +414,6 @@
             return getEndPos(((JCUnary) tree).arg, endPositions);
         case(JCTree.WHILELOOP):
             return getEndPos(((JCWhileLoop) tree).body, endPositions);
-        case(JCTree.ANNOTATED_TYPE):
-            return getEndPos(((JCAnnotatedType) tree).underlyingType, endPositions);
         case(JCTree.ERRONEOUS): {
             JCErroneous node = (JCErroneous)tree;
             if (node.errs != null && node.errs.nonEmpty())
@@ -453,7 +445,7 @@
     public static int finalizerPos(JCTree tree) {
         if (tree.getTag() == JCTree.TRY) {
             JCTry t = (JCTry) tree;
-            assert t.finalizer != null;
+            Assert.checkNonNull(t.finalizer);
             return firstStatPos(t.finalizer);
         } else if (tree.getTag() == JCTree.SYNCHRONIZED) {
             return endPos(((JCSynchronized) tree).body);
@@ -909,8 +901,6 @@
      */
     public static JCExpression typeIn(JCExpression tree) {
         switch (tree.getTag()) {
-        case JCTree.ANNOTATED_TYPE:
-            return ((JCAnnotatedType)tree).underlyingType;
         case JCTree.IDENT: /* simple names */
         case JCTree.TYPEIDENT: /* primitive name */
         case JCTree.SELECT: /* qualified name */
@@ -930,8 +920,6 @@
             return innermostType(((JCArrayTypeTree)type).elemtype);
         case JCTree.WILDCARD:
             return innermostType(((JCWildcard)type).inner);
-        case JCTree.ANNOTATED_TYPE:
-            return innermostType(((JCAnnotatedType)type).underlyingType);
         default:
             return type;
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -122,15 +122,15 @@
     public JCCompilationUnit TopLevel(List<JCAnnotation> packageAnnotations,
                                       JCExpression pid,
                                       List<JCTree> defs) {
-        assert packageAnnotations != null;
+        Assert.checkNonNull(packageAnnotations);
         for (JCTree node : defs)
-            assert node instanceof JCClassDecl
+            Assert.check(node instanceof JCClassDecl
                 || node instanceof JCImport
                 || node instanceof JCSkip
                 || node instanceof JCErroneous
                 || (node instanceof JCExpressionStatement
-                    && ((JCExpressionStatement)node).expr instanceof JCErroneous)
-                 : node.getClass().getSimpleName();
+                    && ((JCExpressionStatement)node).expr instanceof JCErroneous),
+                node.getClass().getSimpleName());
         JCCompilationUnit tree = new JCCompilationUnit(packageAnnotations, pid, defs,
                                      null, null, null, null);
         tree.pos = pos;
@@ -169,27 +169,11 @@
                                List<JCExpression> thrown,
                                JCBlock body,
                                JCExpression defaultValue) {
-        return MethodDef(
-                mods, name, restype, typarams, params,
-                null, thrown, body, defaultValue);
-    }
-
-    public JCMethodDecl MethodDef(JCModifiers mods,
-                               Name name,
-                               JCExpression restype,
-                               List<JCTypeParameter> typarams,
-                               List<JCVariableDecl> params,
-                               List<JCTypeAnnotation> receiver,
-                               List<JCExpression> thrown,
-                               JCBlock body,
-                               JCExpression defaultValue)
-    {
         JCMethodDecl tree = new JCMethodDecl(mods,
                                        name,
                                        restype,
                                        typarams,
                                        params,
-                                       receiver,
                                        thrown,
                                        body,
                                        defaultValue,
@@ -458,11 +442,7 @@
     }
 
     public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds) {
-        return TypeParameter(name, bounds, List.<JCTypeAnnotation>nil());
-    }
-
-    public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annos) {
-        JCTypeParameter tree = new JCTypeParameter(name, bounds, annos);
+        JCTypeParameter tree = new JCTypeParameter(name, bounds);
         tree.pos = pos;
         return tree;
     }
@@ -485,12 +465,6 @@
         return tree;
     }
 
-    public JCTypeAnnotation TypeAnnotation(JCTree annotationType, List<JCExpression> args) {
-        JCTypeAnnotation tree = new JCTypeAnnotation(annotationType, args);
-        tree.pos = pos;
-        return tree;
-    }
-
     public JCModifiers Modifiers(long flags, List<JCAnnotation> annotations) {
         JCModifiers tree = new JCModifiers(flags, annotations);
         boolean noFlags = (flags & (Flags.ModifierFlags | Flags.ANNOTATION)) == 0;
@@ -502,12 +476,6 @@
         return Modifiers(flags, List.<JCAnnotation>nil());
     }
 
-    public JCAnnotatedType AnnotatedType(List<JCTypeAnnotation> annotations, JCExpression underlyingType) {
-        JCAnnotatedType tree = new JCAnnotatedType(annotations, underlyingType);
-        tree.pos = pos;
-        return tree;
-    }
-
     public JCErroneous Erroneous() {
         return Erroneous(List.<JCTree>nil());
     }
@@ -679,19 +647,14 @@
         }
         return tp.setType(t);
     }
-//where
-        private JCExpression Selectors(JCExpression base, Symbol sym, Symbol limit) {
-            if (sym == limit) return base;
-            else return Select(Selectors(base, sym.owner, limit), sym);
-        }
 
     /** Create a list of trees representing given list of types.
      */
     public List<JCExpression> Types(List<Type> ts) {
-        ListBuffer<JCExpression> types = new ListBuffer<JCExpression>();
+        ListBuffer<JCExpression> lb = new ListBuffer<JCExpression>();
         for (List<Type> l = ts; l.nonEmpty(); l = l.tail)
-            types.append(Type(l.head));
-        return types.toList();
+            lb.append(Type(l.head));
+        return lb.toList();
     }
 
     /** Create a variable definition from a variable symbol and an initializer
@@ -821,7 +784,6 @@
                 Type(mtype.getReturnType()),
                 TypeParams(mtype.getTypeArguments()),
                 Params(mtype.getParameterTypes(), m),
-                null,
                 Types(mtype.getThrownTypes()),
                 body,
                 null,
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -85,7 +85,6 @@
         scan(tree.restype);
         scan(tree.typarams);
         scan(tree.params);
-        scan(tree.receiverAnnotations);
         scan(tree.thrown);
         scan(tree.defaultValue);
         scan(tree.body);
@@ -208,11 +207,8 @@
     }
 
     public void visitNewArray(JCNewArray tree) {
-        scan(tree.annotations);
         scan(tree.elemtype);
         scan(tree.dims);
-        for (List<JCTypeAnnotation> annos : tree.dimAnnotations)
-            scan(annos);
         scan(tree.elems);
     }
 
@@ -281,7 +277,6 @@
     }
 
     public void visitTypeParameter(JCTypeParameter tree) {
-        scan(tree.annotations);
         scan(tree.bounds);
     }
 
@@ -305,11 +300,6 @@
         scan(tree.args);
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        scan(tree.annotations);
-        scan(tree.underlyingType);
-    }
-
     public void visitErroneous(JCErroneous tree) {
     }
 
@@ -319,6 +309,6 @@
     }
 
     public void visitTree(JCTree tree) {
-        assert false;
+        Assert.error();
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -283,11 +283,6 @@
     }
 
     public void visitNewArray(JCNewArray tree) {
-        tree.annotations = translate(tree.annotations);
-        List<List<JCTypeAnnotation>> dimAnnos = List.nil();
-        for (List<JCTypeAnnotation> origDimAnnos : tree.dimAnnotations)
-            dimAnnos = dimAnnos.append(translate(origDimAnnos));
-        tree.dimAnnotations = dimAnnos;
         tree.elemtype = translate(tree.elemtype);
         tree.dims = translate(tree.dims);
         tree.elems = translate(tree.elems);
@@ -374,7 +369,6 @@
     }
 
     public void visitTypeParameter(JCTypeParameter tree) {
-        tree.annotations = translate(tree.annotations);
         tree.bounds = translate(tree.bounds);
         result = tree;
     }
@@ -412,12 +406,6 @@
         result = tree;
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        tree.annotations = translate(tree.annotations);
-        tree.underlyingType = translate(tree.underlyingType);
-        result = tree;
-    }
-
     public void visitTree(JCTree tree) {
         throw new AssertionError(tree);
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -117,7 +117,7 @@
     protected abstract String formatDiagnostic(JCDiagnostic d, Locale locale);
 
     public String formatPosition(JCDiagnostic d, PositionKind pk,Locale l) {
-        assert (d.getPosition() != Position.NOPOS);
+        Assert.check(d.getPosition() != Position.NOPOS);
         return String.valueOf(getPosition(d, pk));
     }
     //where
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Assert.java	Fri Jan 28 10:06:08 2011 -0800
@@ -0,0 +1,138 @@
+/*
+ * 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.  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 com.sun.tools.javac.util;
+
+
+/**
+ * Simple facility for unconditional assertions.
+ * The methods in this class are described in terms of equivalent assert
+ * statements, assuming that assertions have been enabled.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class Assert {
+    /** Equivalent to
+     *   assert cond;
+     */
+    public static void check(boolean cond) {
+        if (!cond)
+            error();
+    }
+
+    /** Equivalent to
+     *   assert (o == null);
+     */
+    public static void checkNull(Object o) {
+        if (o != null)
+            error();
+    }
+
+    /** Equivalent to
+     *   assert (t != null); return t;
+     */
+    public static <T> T checkNonNull(T t) {
+        if (t == null)
+            error();
+        return t;
+    }
+
+    /** Equivalent to
+     *   assert cond : value;
+     */
+    public static void check(boolean cond, int value) {
+        if (!cond)
+            error(String.valueOf(value));
+    }
+
+    /** Equivalent to
+     *   assert cond : value;
+     */
+    public static void check(boolean cond, long value) {
+        if (!cond)
+            error(String.valueOf(value));
+    }
+
+    /** Equivalent to
+     *   assert cond : value;
+     */
+    public static void check(boolean cond, Object value) {
+        if (!cond)
+            error(String.valueOf(value));
+    }
+
+    /** Equivalent to
+     *   assert cond : value;
+     */
+    public static void check(boolean cond, String msg) {
+        if (!cond)
+            error(msg);
+    }
+
+    /** Equivalent to
+     *   assert (o == null) : value;
+     */
+    public static void checkNull(Object o, Object value) {
+        if (o != null)
+            error(String.valueOf(value));
+    }
+
+    /** Equivalent to
+     *   assert (o == null) : value;
+     */
+    public static void checkNull(Object o, String msg) {
+        if (o != null)
+            error(msg);
+    }
+
+    /** Equivalent to
+     *   assert (o != null) : value;
+     */
+    public static <T> T checkNonNull(T t, String msg) {
+        if (t == null)
+            error(msg);
+        return t;
+    }
+
+    /** Equivalent to
+     *   assert false;
+     */
+    public static void error() {
+        throw new AssertionError();
+    }
+
+    /** Equivalent to
+     *   assert false : msg;
+     */
+    public static void error(String msg) {
+        throw new AssertionError(msg);
+    }
+
+    /** Prevent instantiation. */
+    private Assert() { }
+}
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Bits.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Bits.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -85,7 +85,7 @@
     /** Include x in this set.
      */
     public void incl(int x) {
-        assert x >= 0;
+        Assert.check(x >= 0);
         sizeTo((x >>> wordshift) + 1);
         bits[x >>> wordshift] = bits[x >>> wordshift] |
             (1 << (x & wordmask));
@@ -113,7 +113,7 @@
     /** Exclude x from this set.
      */
     public void excl(int x) {
-        assert x >= 0;
+        Assert.check(x >= 0);
         sizeTo((x >>> wordshift) + 1);
         bits[x >>> wordshift] = bits[x >>> wordshift] &
             ~(1 << (x & wordmask));
@@ -169,7 +169,7 @@
      *  Delight" by Henry S. Warren Jr. (figure 5-13)
      */
     private static int trailingZeroBits(int x) {
-        assert wordlen == 32;
+        Assert.check(wordlen == 32);
         if (x == 0) return 32;
         int n = 1;
         if ((x & 0xffff) == 0) { n += 16; x >>>= 16; }
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Context.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Context.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -145,7 +145,7 @@
             o = fac.make();
             if (o instanceof Factory<?>)
                 throw new AssertionError("T extends Context.Factory");
-            assert ht.get(key) == o;
+            Assert.check(ht.get(key) == o);
         }
 
         /* The following cast can't fail unless there was
--- a/langtools/src/share/classes/com/sun/tools/javac/util/List.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/List.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -184,7 +184,7 @@
         // return this.prependList(xs.tail).prepend(xs.head);
         List<A> result = this;
         List<A> rev = xs.reverse();
-        assert rev != xs;
+        Assert.check(rev != xs);
         // since xs.reverse() returned a new list, we can reuse the
         // individual List objects, instead of allocating new ones.
         while (rev.nonEmpty()) {
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Names.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Names.java	Fri Jan 28 10:06:08 2011 -0800
@@ -74,7 +74,6 @@
     public final Name serialVersionUID;
     public final Name java_lang_Enum;
     public final Name java_dyn_MethodHandle;
-    public final Name java_dyn_InvokeDynamic;
     public final Name package_info;
     public final Name ConstantValue;
     public final Name LineNumberTable;
@@ -115,7 +114,6 @@
     public final Name value;
     public final Name getMessage;
     public final Name getClass;
-    public final Name invoke;  //allowTransitionalJSR292 only
     public final Name TYPE;
     public final Name TYPE_USE;
     public final Name TYPE_PARAMETER;
@@ -186,7 +184,6 @@
         java_io_Serializable = fromString("java.io.Serializable");
         java_lang_Enum = fromString("java.lang.Enum");
         java_dyn_MethodHandle = fromString("java.dyn.MethodHandle");
-        java_dyn_InvokeDynamic = fromString("java.dyn.InvokeDynamic");
         package_info = fromString("package-info");
         serialVersionUID = fromString("serialVersionUID");
         ConstantValue = fromString("ConstantValue");
@@ -230,7 +227,6 @@
         value = fromString("value");
         getMessage = fromString("getMessage");
         getClass = fromString("getClass");
-        invoke = fromString("invoke");  //allowTransitionalJSR292 only
 
         TYPE = fromString("TYPE");
         TYPE_USE = fromString("TYPE_USE");
--- a/langtools/src/share/classes/com/sun/tools/javac/util/UnsharedNameTable.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/UnsharedNameTable.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -107,7 +107,7 @@
                     hashes[h] = firstTableEntry = element.next;
                 }
                 else {
-                    assert previousNonNullTableEntry != null : "previousNonNullTableEntry cannot be null here.";
+                    Assert.checkNonNull(previousNonNullTableEntry, "previousNonNullTableEntry cannot be null here.");
                     previousNonNullTableEntry.next = element.next;
                 }
             }
@@ -133,7 +133,7 @@
             hashes[h] = newEntry;
         }
         else {
-            assert previousNonNullTableEntry.next == null : "previousNonNullTableEntry.next must be null.";
+            Assert.checkNull(previousNonNullTableEntry.next, "previousNonNullTableEntry.next must be null.");
             previousNonNullTableEntry.next = newEntry;
         }
 
--- a/langtools/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -26,7 +26,6 @@
 package com.sun.tools.javap;
 
 import com.sun.tools.classfile.Annotation;
-import com.sun.tools.classfile.ExtendedAnnotation;
 import com.sun.tools.classfile.Annotation.Annotation_element_value;
 import com.sun.tools.classfile.Annotation.Array_element_value;
 import com.sun.tools.classfile.Annotation.Class_element_value;
@@ -77,129 +76,6 @@
             print(")");
     }
 
-    public void write(ExtendedAnnotation annot) {
-        write(annot, true, false);
-    }
-
-    public void write(ExtendedAnnotation annot, boolean showOffsets, boolean resolveIndices) {
-        write(annot.annotation, resolveIndices);
-        print(": ");
-        write(annot.position, showOffsets);
-    }
-
-    public void write(ExtendedAnnotation.Position pos, boolean showOffsets) {
-        print(pos.type);
-
-        switch (pos.type) {
-        // type case
-        case TYPECAST:
-        case TYPECAST_GENERIC_OR_ARRAY:
-        // object creation
-        case INSTANCEOF:
-        case INSTANCEOF_GENERIC_OR_ARRAY:
-        // new expression
-        case NEW:
-        case NEW_GENERIC_OR_ARRAY:
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            if (showOffsets) {
-                print(", offset=");
-                print(pos.offset);
-            }
-            break;
-         // local variable
-        case LOCAL_VARIABLE:
-        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-            print(", {");
-            for (int i = 0; i < pos.lvarOffset.length; ++i) {
-                if (i != 0) print("; ");
-                if (showOffsets) {
-                    print(", start_pc=");
-                    print(pos.lvarOffset[i]);
-                }
-                print(", length=");
-                print(pos.lvarLength[i]);
-                print(", index=");
-                print(pos.lvarIndex[i]);
-            }
-            print("}");
-            break;
-         // method receiver
-        case METHOD_RECEIVER:
-            // Do nothing
-            break;
-        // type parameters
-        case CLASS_TYPE_PARAMETER:
-        case METHOD_TYPE_PARAMETER:
-            print(", param_index=");
-            print(pos.parameter_index);
-            break;
-        // type parameters bound
-        case CLASS_TYPE_PARAMETER_BOUND:
-        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_PARAMETER_BOUND:
-        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            print(", param_index=");
-            print(pos.parameter_index);
-            print(", bound_index=");
-            print(pos.bound_index);
-            break;
-         // wildcard
-        case WILDCARD_BOUND:
-        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-            print(", wild_card=");
-            print(pos.wildcard_position);
-            break;
-         // Class extends and implements clauses
-        case CLASS_EXTENDS:
-        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            print(", type_index=");
-            print(pos.type_index);
-            break;
-        // throws
-        case THROWS:
-            print(", type_index=");
-            print(pos.type_index);
-            break;
-        case CLASS_LITERAL:
-        case CLASS_LITERAL_GENERIC_OR_ARRAY:
-            if (showOffsets) {
-                print(", offset=");
-                print(pos.offset);
-            }
-            break;
-        // method parameter: not specified
-        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-            print(", param_index=");
-            print(pos.parameter_index);
-            break;
-        // method type argument: wasn't specified
-        case METHOD_TYPE_ARGUMENT:
-        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            if (showOffsets) {
-                print(", offset=");
-                print(pos.offset);
-            }
-            print(", type_index=");
-            print(pos.type_index);
-            break;
-        // We don't need to worry abut these
-        case METHOD_RETURN_GENERIC_OR_ARRAY:
-        case FIELD_GENERIC_OR_ARRAY:
-            break;
-        case UNKNOWN:
-            break;
-        default:
-            throw new AssertionError("unknown type: " + pos.type);
-        }
-
-        // Append location data for generics/arrays.
-        if (pos.type.hasLocation()) {
-            print(", location=");
-            print(pos.location);
-        }
-    }
-
     public void write(Annotation.element_value_pair pair) {
         write(pair, false);
     }
--- a/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -31,6 +31,7 @@
 import com.sun.tools.classfile.AnnotationDefault_attribute;
 import com.sun.tools.classfile.Attribute;
 import com.sun.tools.classfile.Attributes;
+import com.sun.tools.classfile.BootstrapMethods_attribute;
 import com.sun.tools.classfile.CharacterRangeTable_attribute;
 import com.sun.tools.classfile.Code_attribute;
 import com.sun.tools.classfile.CompilationID_attribute;
@@ -47,10 +48,8 @@
 import com.sun.tools.classfile.LocalVariableTypeTable_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeVisibleAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeVisibleParameterAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;
 import com.sun.tools.classfile.Signature_attribute;
 import com.sun.tools.classfile.SourceDebugExtension_attribute;
 import com.sun.tools.classfile.SourceFile_attribute;
@@ -153,6 +152,25 @@
         return null;
     }
 
+    public Void visitBootstrapMethods(BootstrapMethods_attribute attr, Void p) {
+        println(Attribute.BootstrapMethods + ":");
+        for (int i = 0; i < attr.bootstrap_method_specifiers.length ; i++) {
+            BootstrapMethods_attribute.BootstrapMethodSpecifier bsm = attr.bootstrap_method_specifiers[i];
+            indent(+1);
+            print(i + ": #" + bsm.bootstrap_method_ref + " ");
+            println(constantWriter.stringValue(bsm.bootstrap_method_ref));
+            indent(+1);
+            println("Method arguments:");
+            indent(+1);
+            for (int j = 0; j < bsm.bootstrap_arguments.length; j++) {
+                print("#" + bsm.bootstrap_arguments[j] + " ");
+                println(constantWriter.stringValue(bsm.bootstrap_arguments[j]));
+            }
+            indent(-3);
+        }
+        return null;
+    }
+
     public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr, Void ignore) {
         println("CharacterRangeTable:");
         indent(+1);
@@ -392,30 +410,6 @@
         return null;
     }
 
-    public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, Void ignore) {
-        println("RuntimeVisibleTypeAnnotations:");
-        indent(+1);
-        for (int i = 0; i < attr.annotations.length; i++) {
-            print(i + ": ");
-            annotationWriter.write(attr.annotations[i]);
-            println();
-        }
-        indent(-1);
-        return null;
-    }
-
-    public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, Void ignore) {
-        println("RuntimeInvisibleTypeAnnotations:");
-        indent(+1);
-        for (int i = 0; i < attr.annotations.length; i++) {
-            print(i + ": ");
-            annotationWriter.write(attr.annotations[i]);
-            println();
-        }
-        indent(-1);
-        return null;
-    }
-
     public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, Void ignore) {
         println("RuntimeVisibleParameterAnnotations:");
         indent(+1);
--- a/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -64,7 +64,6 @@
         stackMapWriter = StackMapWriter.instance(context);
         localVariableTableWriter = LocalVariableTableWriter.instance(context);
         localVariableTypeTableWriter = LocalVariableTypeTableWriter.instance(context);
-        typeAnnotationWriter = TypeAnnotationWriter.instance(context);
         options = Options.instance(context);
     }
 
@@ -266,11 +265,6 @@
             detailWriters.add(tryBlockWriter);
         }
 
-        if (options.details.contains(InstructionDetailWriter.Kind.TYPE_ANNOS)) {
-            typeAnnotationWriter.reset(attr);
-            detailWriters.add(typeAnnotationWriter);
-        }
-
         return detailWriters;
     }
 
@@ -279,7 +273,6 @@
     private ConstantWriter constantWriter;
     private LocalVariableTableWriter localVariableTableWriter;
     private LocalVariableTypeTableWriter localVariableTypeTableWriter;
-    private TypeAnnotationWriter typeAnnotationWriter;
     private SourceWriter sourceWriter;
     private StackMapWriter stackMapWriter;
     private TryBlockWriter tryBlockWriter;
--- a/langtools/src/share/classes/com/sun/tools/javap/ConstantWriter.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javap/ConstantWriter.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -97,6 +97,13 @@
                 return 1;
             }
 
+            public Integer visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
+                print("#" + info.bootstrap_method_attr_index + ":#" + info.name_and_type_index);
+                tab();
+                println("//  " + stringValue(info));
+                return 1;
+            }
+
             public Integer visitLong(CONSTANT_Long_info info, Void p) {
                 println(stringValue(info));
                 return 2;
@@ -116,6 +123,20 @@
                 return 1;
             }
 
+            public Integer visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
+                print("#" + info.reference_kind.tag + ":#" + info.reference_index);
+                tab();
+                println("//  " + stringValue(info));
+                return 1;
+            }
+
+            public Integer visitMethodType(CONSTANT_MethodType_info info, Void p) {
+                print("#" + info.descriptor_index);
+                tab();
+                println("//  " + stringValue(info));
+                return 1;
+            }
+
             public Integer visitString(CONSTANT_String_info info, Void p) {
                 print("#" + info.string_index);
                 tab();
@@ -201,14 +222,20 @@
                 return "String";
             case CONSTANT_Fieldref:
                 return "Field";
+            case CONSTANT_MethodHandle:
+                return "MethodHandle";
+            case CONSTANT_MethodType:
+                return "MethodType";
             case CONSTANT_Methodref:
                 return "Method";
             case CONSTANT_InterfaceMethodref:
                 return "InterfaceMethod";
+            case CONSTANT_InvokeDynamic:
+                return "InvokeDynamic";
             case CONSTANT_NameAndType:
                 return "NameAndType";
             default:
-                return "(unknown tag)";
+                return "(unknown tag " + tag + ")";
         }
     }
 
@@ -264,6 +291,15 @@
             return visitRef(info, p);
         }
 
+        public String visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
+            try {
+                String callee = stringValue(info.getNameAndTypeInfo());
+                return "#" + info.bootstrap_method_attr_index + ":" + callee;
+            } catch (ConstantPoolException e) {
+                return report(e);
+            }
+        }
+
         public String visitLong(CONSTANT_Long_info info, Void p) {
             return info.value + "l";
         }
@@ -288,6 +324,22 @@
             }
         }
 
+        public String visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
+            try {
+                return info.reference_kind.name + " " + stringValue(info.getCPRefInfo());
+            } catch (ConstantPoolException e) {
+                return report(e);
+            }
+        }
+
+        public String visitMethodType(CONSTANT_MethodType_info info, Void p) {
+            try {
+                return info.getType();
+            } catch (ConstantPoolException e) {
+                return report(e);
+            }
+        }
+
         public String visitMethodref(CONSTANT_Methodref_info info, Void p) {
             return visitRef(info, p);
         }
@@ -347,7 +399,6 @@
         }
     }
 
-
     /* If name is a valid binary name, return it; otherwise quote it. */
     private static String checkName(String name) {
         if (name == null)
--- a/langtools/src/share/classes/com/sun/tools/javap/InstructionDetailWriter.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javap/InstructionDetailWriter.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -42,13 +42,13 @@
         LOCAL_VAR_TYPES("localVariableTypes"),
         SOURCE("source"),
         STACKMAPS("stackMaps"),
-        TRY_BLOCKS("tryBlocks"),
-        TYPE_ANNOS("typeAnnotations");
+        TRY_BLOCKS("tryBlocks");
         Kind(String option) {
             this.option = option;
         }
         final String option;
     }
+
     InstructionDetailWriter(Context context) {
         super(context);
     }
--- a/langtools/src/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java	Thu Jan 27 17:28:57 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2009, 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 com.sun.tools.javap;
-
-import com.sun.tools.classfile.Attribute;
-import com.sun.tools.classfile.Code_attribute;
-import com.sun.tools.classfile.ExtendedAnnotation;
-import com.sun.tools.classfile.ExtendedAnnotation.Position;
-import com.sun.tools.classfile.Instruction;
-import com.sun.tools.classfile.Method;
-import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeTypeAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Annotate instructions with details about type annotations.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class TypeAnnotationWriter extends InstructionDetailWriter {
-    public enum NoteKind { VISIBLE, INVISIBLE };
-    public static class Note {
-        Note(NoteKind kind, ExtendedAnnotation anno) {
-            this.kind = kind;
-            this.anno = anno;
-        }
-        public final NoteKind kind;
-        public final ExtendedAnnotation anno;
-    }
-
-    static TypeAnnotationWriter instance(Context context) {
-        TypeAnnotationWriter instance = context.get(TypeAnnotationWriter.class);
-        if (instance == null)
-            instance = new TypeAnnotationWriter(context);
-        return instance;
-    }
-
-    protected TypeAnnotationWriter(Context context) {
-        super(context);
-        context.put(TypeAnnotationWriter.class, this);
-        annotationWriter = AnnotationWriter.instance(context);
-        classWriter = ClassWriter.instance(context);
-    }
-
-    public void reset(Code_attribute attr) {
-        Method m = classWriter.getMethod();
-        pcMap = new HashMap<Integer, List<Note>>();
-        check(NoteKind.VISIBLE, (RuntimeVisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeVisibleTypeAnnotations));
-        check(NoteKind.INVISIBLE, (RuntimeInvisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeInvisibleTypeAnnotations));
-    }
-
-    private void check(NoteKind kind, RuntimeTypeAnnotations_attribute attr) {
-        if (attr == null)
-            return;
-
-        for (ExtendedAnnotation anno: attr.annotations) {
-            Position p = anno.position;
-            Note note = null;
-            if (p.offset != -1)
-                addNote(p.offset, note = new Note(kind, anno));
-            if (p.lvarOffset != null) {
-                for (int i = 0; i < p.lvarOffset.length; i++) {
-                    if (note == null)
-                        note = new Note(kind, anno);
-                    addNote(p.lvarOffset[i], note);
-                }
-            }
-        }
-    }
-
-    private void addNote(int pc, Note note) {
-        List<Note> list = pcMap.get(pc);
-        if (list == null)
-            pcMap.put(pc, list = new ArrayList<Note>());
-        list.add(note);
-    }
-
-    @Override
-    void writeDetails(Instruction instr) {
-        String indent = space(2); // get from Options?
-        int pc = instr.getPC();
-        List<Note> notes = pcMap.get(pc);
-        if (notes != null) {
-            for (Note n: notes) {
-                print(indent);
-                print("@");
-                annotationWriter.write(n.anno, false, true);
-                print(", ");
-                println(n.kind.toString().toLowerCase());
-            }
-        }
-    }
-
-    private AnnotationWriter annotationWriter;
-    private ClassWriter classWriter;
-    private Map<Integer, List<Note>> pcMap;
-}
--- a/langtools/src/share/classes/javax/tools/JavaCompiler.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/javax/tools/JavaCompiler.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -137,9 +137,9 @@
  *       StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null);
  *       compiler.getTask(null, fileManager, diagnostics, null, null, compilationUnits).call();
  *
- *       for (Diagnostic diagnostic : diagnostics.getDiagnostics())
- *           System.out.format("Error on line %d in %d%n",
- *                             diagnostic.getLineNumber()
+ *       for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics.getDiagnostics())
+ *           System.out.format("Error on line %d in %s%n",
+ *                             diagnostic.getLineNumber(),
  *                             diagnostic.getSource().toUri());
  *
  *       fileManager.close();</pre>
--- a/langtools/src/share/classes/javax/tools/ToolProvider.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/src/share/classes/javax/tools/ToolProvider.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -172,7 +172,7 @@
     {
         // try loading class directly, in case tool is on the bootclasspath
         try {
-            return enableAsserts(Class.forName(toolClassName, false, null));
+            return Class.forName(toolClassName, false, null);
         } catch (ClassNotFoundException e) {
             trace(FINE, e);
 
@@ -194,27 +194,10 @@
                 trace(FINE, urls[0].toString());
 
                 cl = URLClassLoader.newInstance(urls);
-                cl.setPackageAssertionStatus("com.sun.tools.javac", true);
                 refToolClassLoader = new WeakReference<ClassLoader>(cl);
             }
 
             return Class.forName(toolClassName, false, cl);
         }
-
     }
-
-    private static Class<?> enableAsserts(Class<?> cls) {
-        try {
-            ClassLoader loader = cls.getClassLoader();
-            if (loader != null)
-                loader.setPackageAssertionStatus("com.sun.tools.javac", true);
-            else
-                trace(FINE, "loader == null");
-        } catch (SecurityException ex) {
-            trace(FINE, ex);
-        }
-        return cls;
-    }
-
-
 }
--- a/langtools/test/tools/javac/6304921/T6304921.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/6304921/T6304921.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,7 +1,7 @@
 T6304921.java:29:34: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
 T6304921.java:29:30: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.ArrayList, java.util.List<java.lang.Integer>
 - compiler.err.warnings.and.werror
-T6304921.java:35:15: compiler.err.cant.resolve.location: kindname.variable, orr, , , kindname.class, java.lang.System
-T6304921.java:38:20: compiler.err.operator.cant.be.applied: +, int,boolean
+T6304921.java:35:15: compiler.err.cant.resolve.location: kindname.variable, orr, , , (compiler.misc.location: kindname.class, java.lang.System, null)
+T6304921.java:38:20: compiler.err.operator.cant.be.applied.1: +, int, boolean
 3 errors
 2 warnings
--- a/langtools/test/tools/javac/6330920/T6330920.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/6330920/T6330920.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,2 +1,2 @@
-T6330920.java:11:22: compiler.err.cant.resolve.location: kindname.class, T6330920Missing, , , kindname.class, T6330920
+T6330920.java:11:22: compiler.err.cant.resolve.location: kindname.class, T6330920Missing, , , (compiler.misc.location: kindname.class, T6330920, null)
 1 error
--- a/langtools/test/tools/javac/6717241/T6717241a.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/6717241/T6717241a.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,4 +1,4 @@
-T6717241a.java:13:21: compiler.err.cant.resolve: kindname.variable, v, , 
-T6717241a.java:15:10: compiler.err.cant.resolve.args: kindname.method, m1, , int,java.lang.String
-T6717241a.java:17:10: compiler.err.cant.resolve.args.params: kindname.method, m2, java.lang.Integer,java.lang.Double, int,java.lang.String
+T6717241a.java:13:21: compiler.err.cant.resolve.location: kindname.variable, v, , , (compiler.misc.location.1: kindname.variable, x, X)
+T6717241a.java:15:10: compiler.err.cant.resolve.location.args: kindname.method, m1, , int,java.lang.String, (compiler.misc.location.1: kindname.variable, x, X)
+T6717241a.java:17:10: compiler.err.cant.resolve.location.args.params: kindname.method, m2, java.lang.Integer,java.lang.Double, int,java.lang.String, (compiler.misc.location.1: kindname.variable, x, X)
 3 errors
--- a/langtools/test/tools/javac/6717241/T6717241b.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/6717241/T6717241b.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,4 +1,4 @@
-T6717241b.java:12:20: compiler.err.cant.resolve.location: kindname.variable, v, , , kindname.class, T6717241b
-T6717241b.java:14:9: compiler.err.cant.resolve.location.args: kindname.method, m1, , int,java.lang.String, kindname.class, T6717241b
-T6717241b.java:16:18: compiler.err.cant.resolve.location.args.params: kindname.method, m2, java.lang.Integer,java.lang.Double, int,java.lang.String, kindname.class, T6717241b
+T6717241b.java:12:20: compiler.err.cant.resolve.location: kindname.variable, v, , , (compiler.misc.location: kindname.class, T6717241b, null)
+T6717241b.java:14:9: compiler.err.cant.resolve.location.args: kindname.method, m1, , int,java.lang.String, (compiler.misc.location: kindname.class, T6717241b, null)
+T6717241b.java:16:18: compiler.err.cant.resolve.location.args.params: kindname.method, m2, java.lang.Integer,java.lang.Double, int,java.lang.String, (compiler.misc.location: kindname.class, T6717241b, null)
 3 errors
--- a/langtools/test/tools/javac/6857948/T6857948.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/6857948/T6857948.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,3 +1,3 @@
-T6857948.java:16:32: compiler.err.cant.resolve.location.args: kindname.method, nosuchfunction, , , kindname.class, Test
+T6857948.java:16:32: compiler.err.cant.resolve.location.args: kindname.method, nosuchfunction, , , (compiler.misc.location: kindname.class, Test, null)
 T6857948.java:16:50: compiler.err.cant.apply.symbol.1: kindname.constructor, Foo, java.lang.String, compiler.misc.no.args, kindname.class, Foo, (compiler.misc.arg.length.mismatch)
 2 errors
--- a/langtools/test/tools/javac/6863465/T6863465c.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/6863465/T6863465c.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,3 +1,3 @@
-T6863465c.java:13:47: compiler.err.cant.resolve.location: kindname.class, d, , , kindname.class, T6863465c.z
+T6863465c.java:13:47: compiler.err.cant.resolve.location: kindname.class, d, , , (compiler.misc.location: kindname.class, T6863465c.z, null)
 T6863465c.java:11:12: compiler.err.cyclic.inheritance: T6863465c.z
 2 errors
--- a/langtools/test/tools/javac/6863465/T6863465d.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/6863465/T6863465d.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,3 +1,3 @@
-T6863465d.java:13:47: compiler.err.cant.resolve.location: kindname.class, w, , , kindname.class, T6863465d.c
+T6863465d.java:13:47: compiler.err.cant.resolve.location: kindname.class, w, , , (compiler.misc.location: kindname.class, T6863465d.c, null)
 T6863465d.java:11:12: compiler.err.cyclic.inheritance: T6863465d.c
 2 errors
--- a/langtools/test/tools/javac/InnerNamedConstant_2.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/InnerNamedConstant_2.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
-InnerNamedConstant_2.java:22:20: compiler.err.icls.cant.have.static.decl
-InnerNamedConstant_2.java:23:29: compiler.err.icls.cant.have.static.decl
+InnerNamedConstant_2.java:22:20: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner2
+InnerNamedConstant_2.java:23:29: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner2
 InnerNamedConstant_2.java:25:13: compiler.err.cant.assign.val.to.final.var: z
-InnerNamedConstant_2.java:34:26: compiler.err.icls.cant.have.static.decl
+InnerNamedConstant_2.java:34:26: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner3
 4 errors
--- a/langtools/test/tools/javac/T6247324.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/T6247324.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,2 +1,2 @@
-T6247324.java:18:6: compiler.err.cant.resolve.location: kindname.class, Seetharam, , , kindname.class, Pair<X,Y>
+T6247324.java:18:6: compiler.err.cant.resolve.location: kindname.class, Seetharam, , , (compiler.misc.location: kindname.class, Pair, null)
 1 error
--- a/langtools/test/tools/javac/TryWithResources/ResourceOutsideTry.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/TryWithResources/ResourceOutsideTry.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,3 +1,3 @@
-ResourceOutsideTry.java:14:13: compiler.err.cant.resolve.location: kindname.variable, c, , , kindname.class, ResourceOutsideTry
-ResourceOutsideTry.java:16:13: compiler.err.cant.resolve.location: kindname.variable, c, , , kindname.class, ResourceOutsideTry
+ResourceOutsideTry.java:14:13: compiler.err.cant.resolve.location: kindname.variable, c, , , (compiler.misc.location: kindname.class, ResourceOutsideTry, null)
+ResourceOutsideTry.java:16:13: compiler.err.cant.resolve.location: kindname.variable, c, , , (compiler.misc.location: kindname.class, ResourceOutsideTry, null)
 2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/api/T6419926.java	Fri Jan 28 10:06:08 2011 -0800
@@ -0,0 +1,51 @@
+/*
+ * 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     6419926
+ * @summary JSR 199: FileObject.toUri() generates URI without schema (Solaris)
+ */
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import javax.tools.*;
+
+public class T6419926 {
+    public static void main(String[] argv) throws Exception {
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager mgr = compiler.getStandardFileManager( new DiagnosticCollector<JavaFileObject>(), null, null);
+        System.out.println( new File( new File(".").toURI() ).getAbsolutePath() );
+        mgr.setLocation(StandardLocation.CLASS_OUTPUT,
+                            Collections.singleton(new File(".")));
+
+        FileObject fo = mgr.getFileForOutput(StandardLocation.CLASS_OUTPUT,
+                                "", "file.to.delete", null);
+        URI uri = fo.toUri();
+        System.out.println( uri );
+
+        if (!"file".equals(uri.getScheme()))
+            throw new Exception("unexpected scheme for uri: " + uri.getScheme());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/api/T6430241.java	Fri Jan 28 10:06:08 2011 -0800
@@ -0,0 +1,237 @@
+    /*
+     * 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 6430241
+     * @summary Hard to disable symbol file feature through API
+     */
+
+    import java.io.*;
+    import java.util.*;
+    import javax.tools.*;
+
+    import com.sun.source.util.JavacTask;
+    import com.sun.tools.javac.api.JavacTool;
+
+    public class T6430241 {
+        public static void main(String... args) throws Exception {
+            new T6430241().run();
+        }
+
+        void run() throws Exception {
+            setup();
+            testCommandLine();
+            testSimpleAPI();
+            testTaskAPI();
+
+            if (errors > 0)
+                throw new Exception(errors + " errors found");
+        }
+
+        void setup() throws Exception {
+            classesDir = new File("classes");
+            classesDir.mkdirs();
+
+            emptyDir = new File("empty");
+            emptyDir.mkdirs();
+
+            bootClassPath = System.getProperty("sun.boot.class.path");
+
+            File srcDir = new File("src");
+            String test = "import sun.misc.Unsafe; class Test { }";
+            testFile = writeFile(srcDir, "Test.java", test);
+        }
+
+        //----- tests for command line invocation
+
+        void testCommandLine() throws Exception {
+            testCommandLine(true);
+            testCommandLine(true,  "-Xbootclasspath/p:" + emptyDir);
+            testCommandLine(false, "-Xbootclasspath:" + bootClassPath);
+            testCommandLine(true,  "-Xbootclasspath/a:" + emptyDir);
+            testCommandLine(false, "-XDignore.symbol.file");
+            System.err.println();
+        }
+
+        void testCommandLine(boolean expectWarnings, String... opts) throws Exception {
+            System.err.println("test command line: " + Arrays.asList(opts));
+
+            String[] args = initArgs(opts);
+
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw);
+            int rc = com.sun.tools.javac.Main.compile(args, pw);
+            String out = showOutput(sw.toString());
+
+            checkCompilationOK(rc);
+            checkOutput(out, expectWarnings);
+        }
+
+        //----- tests for simple API invocation
+
+        void testSimpleAPI() {
+            testSimpleAPI(true);
+            testSimpleAPI(true,  "-Xbootclasspath/p:" + emptyDir);
+            testSimpleAPI(false, "-Xbootclasspath:" + bootClassPath);
+            testSimpleAPI(true,  "-Xbootclasspath/a:" + emptyDir);
+            testSimpleAPI(false, "-XDignore.symbol.file");
+            System.err.println();
+        }
+
+        void testSimpleAPI(boolean expectWarnings, String... opts) {
+            System.err.println("test simple API: " + Arrays.asList(opts));
+
+            String[] args = initArgs(opts);
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            PrintStream ps = new PrintStream(baos);
+
+            JavacTool tool = JavacTool.create();
+            int rc = tool.run(null, null, ps, args);
+
+            String out = showOutput(baos.toString());
+
+            checkCompilationOK(rc);
+            checkOutput(out, expectWarnings);
+        }
+
+        //----- tests for CompilationTask API invocation
+
+        void testTaskAPI() throws Exception {
+            List<File> bcp = new ArrayList<File>();
+            for (String f: bootClassPath.split(File.pathSeparator)) {
+                if (!f.isEmpty())
+                    bcp.add(new File(f));
+            }
+
+            testTaskAPI(true, null);
+            testTaskAPI(false, bcp);
+            System.err.println();
+        }
+
+        void testTaskAPI(boolean expectWarnings, Iterable<? extends File> pcp) throws Exception {
+            System.err.println("test task API: " + pcp);
+
+            JavacTool tool = JavacTool.create();
+            StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
+
+            if (pcp != null)
+                fm.setLocation(StandardLocation.PLATFORM_CLASS_PATH, pcp);
+
+            Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(testFile);
+
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw);
+            JavacTask task = tool.getTask(pw, fm, null, null, null, files);
+            boolean ok = task.call();
+            String out = showOutput(sw.toString());
+
+            checkCompilationOK(ok);
+            checkOutput(out, expectWarnings);
+        }
+
+        //----- utility methods
+
+        /**
+         * Create a file with given content.
+         */
+        File writeFile(File dir, String path, String content) throws IOException {
+            File f = new File(dir, path);
+            f.getParentFile().mkdirs();
+            FileWriter out = new FileWriter(f);
+            try {
+                out.write(content);
+            } finally {
+                out.close();
+            }
+            return f;
+        }
+
+        /**
+         * Initialize args for compilation with given opts.
+         * @return opts -d classesDir testFile
+         */
+        String[] initArgs(String[] opts) {
+            List<String> args = new ArrayList<String>();
+            args.addAll(Arrays.asList(opts));
+            args.add("-d");
+            args.add(classesDir.getPath());
+            args.add(testFile.getPath());
+            return args.toArray(new String[args.size()]);
+        }
+
+        /**
+         * Show output from compilation if non empty.
+         */
+        String showOutput(String out) {
+            if (!out.isEmpty())
+                System.err.println(out);
+            return out;
+        }
+
+        /**
+         * Verify compilation succeeeded.
+         */
+        void checkCompilationOK(boolean ok) {
+            if (!ok)
+                error("compilation failed");
+        }
+
+        /**
+         * Verify compilation succeeeded.
+         */
+        void checkCompilationOK(int rc) {
+            if (rc != 0)
+                error("compilation failed, rc: " + rc);
+        }
+
+        /**
+         * Check whether output contains warnings if and only if warnings
+         * are expected.
+         */
+        void checkOutput(String out, boolean expectWarnings) {
+            boolean foundWarnings = out.contains("warning");
+            if (foundWarnings) {
+                if (!expectWarnings)
+                    error("unexpected warnings found");
+            } else {
+                if (expectWarnings)
+                    error("expected warnings not found");
+            }
+        }
+
+        /**
+         * Report an error.
+         */
+        void error(String msg) {
+            System.err.println("error: " + msg);
+            errors++;
+        }
+
+        String bootClassPath;
+        File classesDir;
+        File emptyDir;
+        File testFile;
+        int errors;
+    }
--- a/langtools/test/tools/javac/diags/examples.not-yet.txt	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/diags/examples.not-yet.txt	Fri Jan 28 10:06:08 2011 -0800
@@ -24,7 +24,6 @@
 compiler.err.no.encl.instance.of.type.in.scope          # cannot occur; always followed by assert false;
 compiler.err.no.match.entry                             # UNUSED?
 compiler.err.not.annotation.type                        # cannot occur given preceding checkType
-compiler.err.not.within.bounds.explain                  # UNUSED?
 compiler.err.prob.found.req.1                           # Check: DEAD, in unused method
 compiler.err.proc.bad.config.file                       # JavacProcessingEnvironment
 compiler.err.proc.cant.access                           # completion failure
@@ -43,6 +42,7 @@
 compiler.err.unexpected.type
 compiler.err.unknown.enum.constant                      # in bad class file
 compiler.err.unsupported.cross.fp.lit                   # Scanner: host system dependent
+compiler.err.wrong.target.for.polymorphic.signature.definition     # Transitional 292
 compiler.misc.assignment.from.super-bound
 compiler.misc.assignment.to.extends-bound
 compiler.misc.bad.class.file.header                     # bad class file
@@ -52,7 +52,6 @@
 compiler.misc.bad.enclosing.method                      # bad class file
 compiler.misc.bad.runtime.invisible.param.annotations   # bad class file
 compiler.misc.bad.signature                             # bad class file
-compiler.misc.bad.type.annotation.value
 compiler.misc.base.membership                           # UNUSED
 compiler.misc.ccf.found.later.version
 compiler.misc.ccf.unrecognized.attribute
@@ -113,4 +112,3 @@
 compiler.warn.unchecked.assign                          # DEAD, replaced by compiler.misc.unchecked.assign
 compiler.warn.unchecked.cast.to.type                    # DEAD, replaced by compiler.misc.unchecked.cast.to.type
 compiler.warn.unexpected.archive.file                   # Paths: zip file with unknown extn
-compiler.warn.wrong.target.for.polymorphic.signature.definition     # Transitional 292
--- a/langtools/test/tools/javac/diags/examples/CantResolve.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/diags/examples/CantResolve.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -23,9 +23,8 @@
 
 // key: compiler.err.cant.resolve
 
-class CantResolve<T extends Object & java.io.Serializable> {
-    T t;
-    void m() {
-        Object o = t.v;
-    }
+class CantResolve {
+    Object o = new Object() {
+        int i = f;
+    };
 }
--- a/langtools/test/tools/javac/diags/examples/CantResolveArgsParams.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/diags/examples/CantResolveArgsParams.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -23,9 +23,8 @@
 
 // key: compiler.err.cant.resolve.args.params
 
-class CantResolveArgsParams<T extends Object & java.io.Serializable> {
-    T t;
-    void m() {
-        t.<Integer,Double>m2(1, "");
-    }
+class CantResolveArgsParams {
+    Object o = new Object() {
+        { this.<Integer,Double>m2(1, ""); }
+    };
 }
--- a/langtools/test/tools/javac/diags/examples/CantResolveLocation.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/diags/examples/CantResolveLocation.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -22,6 +22,7 @@
  */
 
 // key: compiler.err.cant.resolve.location
+// key: compiler.misc.location
 
 class CantResolveLocation {
     Unknown y;
--- a/langtools/test/tools/javac/diags/examples/CantResolveLocationArgs.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/diags/examples/CantResolveLocationArgs.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -22,6 +22,7 @@
  */
 
 // key: compiler.err.cant.resolve.location.args
+// key: compiler.misc.location
 
 class X {
     void m() {
--- a/langtools/test/tools/javac/diags/examples/CantResolveLocationArgsParams.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/diags/examples/CantResolveLocationArgsParams.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -22,6 +22,7 @@
  */
 
 // key: compiler.err.cant.resolve.location.args.params
+// key: compiler.misc.location
 
 import java.util.*;
 
--- a/langtools/test/tools/javac/diags/examples/EnumConstRequired.java	Thu Jan 27 17:28:57 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2010, 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.enum.const.req
-
-class EnumConstRequired {
-    enum E { A, B, C };
-
-    void m(E e) {
-        switch (e) {
-            case e:
-                System.err.println("It's me!");
-        }
-    }
-}
--- a/langtools/test/tools/javac/diags/examples/ForeachNotApplicable.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/diags/examples/ForeachNotApplicable.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -22,6 +22,7 @@
  */
 
 // key: compiler.err.foreach.not.applicable.to.type
+// key: compiler.misc.type.req.array.or.iterable
 
 class ForeachNotApplicable {
     void m(String arg) {
--- a/langtools/test/tools/javac/diags/examples/KindnameClass.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/diags/examples/KindnameClass.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -23,6 +23,7 @@
 
 // key: compiler.misc.kindname.class
 // key: compiler.err.cant.resolve.location
+// key: compiler.misc.location
 // key: compiler.misc.count.error
 // run: backdoor
 
--- a/langtools/test/tools/javac/diags/examples/KindnameMethod.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/diags/examples/KindnameMethod.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -24,6 +24,7 @@
 // key: compiler.misc.kindname.method
 // key: compiler.misc.kindname.class
 // key: compiler.err.cant.resolve.location.args
+// key: compiler.misc.location
 // key: compiler.misc.count.error
 // run: backdoor
 
--- a/langtools/test/tools/javac/diags/examples/KindnameVariable.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/diags/examples/KindnameVariable.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -24,6 +24,7 @@
 // key: compiler.misc.kindname.variable
 // key: compiler.misc.kindname.class
 // key: compiler.err.cant.resolve.location
+// key: compiler.misc.location
 // key: compiler.misc.count.error
 // run: backdoor
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/Location.java	Fri Jan 28 10:06:08 2011 -0800
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+// key: compiler.err.cant.resolve.location
+// key: compiler.misc.location
+
+class Location {
+    { Object o = v; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/Location1.java	Fri Jan 28 10:06:08 2011 -0800
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+// key: compiler.err.cant.resolve.location
+// key: compiler.misc.location.1
+
+class Location1 {
+    Object o = null;
+    { Object o2 = o.v; }
+}
--- a/langtools/test/tools/javac/diags/examples/OperatorCantBeApplied.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/diags/examples/OperatorCantBeApplied.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -24,5 +24,6 @@
 // key: compiler.err.operator.cant.be.applied
 
 class OperatorCantBeApplied {
-    String s = ("a" - "b");
+    String s = null;
+    { s++; }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/OperatorCantBeApplied1.java	Fri Jan 28 10:06:08 2011 -0800
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+// key: compiler.err.operator.cant.be.applied.1
+
+class OperatorCantBeApplied1 {
+    String s = ("a" - "b");
+}
--- a/langtools/test/tools/javac/diags/examples/StaticImportOnlyClassesAndInterfaces/StaticImportOnlyClassesAndInterfaces.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/diags/examples/StaticImportOnlyClassesAndInterfaces/StaticImportOnlyClassesAndInterfaces.java	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -23,6 +23,7 @@
 
 // key: compiler.err.static.imp.only.classes.and.interfaces
 // key: compiler.err.cant.resolve.location
+// key: compiler.misc.location
 
 import static p.Other.array.length;
 
--- a/langtools/test/tools/javac/diags/examples/TypeParameterOnPolymorphicSignature.java	Thu Jan 27 17:28:57 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2010, 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.warn.type.parameter.on.polymorphic.signature
-// key: compiler.err.unreported.exception.need.to.catch.or.throw
-
-import java.dyn.MethodHandle;
-
-class TypeParameterOnPolymorphicSignature {
-    void test(MethodHandle mh) {
-        mh.<void>invokeExact("",123);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VarargsAndOldArraySyntax.java	Fri Jan 28 10:06:08 2011 -0800
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+// key: compiler.err.varargs.and.old.array.syntax
+
+class VarargsAndOldArraySyntax {
+    void  m1 (Integer... i[]) { }
+}
--- a/langtools/test/tools/javac/failover/FailOver01.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/failover/FailOver01.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,3 +1,3 @@
 FailOver01.java:10:22: compiler.err.expected: ';'
-FailOver01.java:10:16: compiler.err.cant.resolve.location: kindname.variable, x, , , kindname.class, Test
+FailOver01.java:10:16: compiler.err.cant.resolve.location: kindname.variable, x, , , (compiler.misc.location: kindname.class, Test, null)
 2 errors
--- a/langtools/test/tools/javac/failover/FailOver02.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/failover/FailOver02.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,3 +1,3 @@
 FailOver02.java:10:1: compiler.err.does.not.override.abstract: Test, close(), java.lang.AutoCloseable
-FailOver02.java:12:9: compiler.err.cant.resolve.location.args: kindname.method, close, , , kindname.class, Test
+FailOver02.java:12:9: compiler.err.cant.resolve.location.args: kindname.method, close, , , (compiler.misc.location: kindname.class, Test, null)
 2 errors
--- a/langtools/test/tools/javac/failover/FailOver04.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/failover/FailOver04.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,2 +1,2 @@
-FailOver04.java:11:10: compiler.err.cant.resolve.location: kindname.class, Unknown, , , kindname.class, Test
+FailOver04.java:11:10: compiler.err.cant.resolve.location: kindname.class, Unknown, , , (compiler.misc.location: kindname.class, Test, null)
 1 error
--- a/langtools/test/tools/javac/generics/6711619/T6711619a.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/generics/6711619/T6711619a.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,5 +1,5 @@
-T6711619a.java:40:14: compiler.err.cant.resolve.args: kindname.method, a, , 
-T6711619a.java:41:14: compiler.err.cant.resolve.args: kindname.method, b, , 
+T6711619a.java:40:14: compiler.err.cant.resolve.location.args: kindname.method, a, , , (compiler.misc.location.1: kindname.variable, t, T)
+T6711619a.java:41:14: compiler.err.cant.resolve.location.args: kindname.method, b, , , (compiler.misc.location.1: kindname.variable, t, T)
 T6711619a.java:46:19: compiler.err.report.access: a, private, T6711619a.A
 T6711619a.java:47:19: compiler.err.report.access: b, private, T6711619a.B
 T6711619a.java:48:19: compiler.err.report.access: a, private, T6711619a.A
--- a/langtools/test/tools/javac/generics/diamond/neg/Neg01.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/generics/diamond/neg/Neg01.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,29 +1,29 @@
-Neg01.java:18:15: compiler.err.not.within.bounds: java.lang.String
+Neg01.java:18:15: compiler.err.not.within.bounds: java.lang.String, X
 Neg01.java:18:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:19:15: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg01.java:19:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg01.java:19:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:20:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:21:15: compiler.err.not.within.bounds: ? super java.lang.String
+Neg01.java:21:15: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg01.java:21:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:23:15: compiler.err.not.within.bounds: java.lang.String
+Neg01.java:23:15: compiler.err.not.within.bounds: java.lang.String, X
 Neg01.java:23:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:24:15: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg01.java:24:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg01.java:24:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:25:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:26:15: compiler.err.not.within.bounds: ? super java.lang.String
+Neg01.java:26:15: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg01.java:26:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:28:15: compiler.err.not.within.bounds: java.lang.String
+Neg01.java:28:15: compiler.err.not.within.bounds: java.lang.String, X
 Neg01.java:28:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:29:15: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg01.java:29:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg01.java:29:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:30:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:31:9: compiler.err.cant.resolve.location: kindname.class, Foo, , , kindname.class, Neg01<X>
+Neg01.java:31:9: compiler.err.cant.resolve.location: kindname.class, Foo, , , (compiler.misc.location: kindname.class, Neg01, null)
 Neg01.java:31:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:33:15: compiler.err.not.within.bounds: java.lang.String
+Neg01.java:33:15: compiler.err.not.within.bounds: java.lang.String, X
 Neg01.java:33:29: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:34:15: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg01.java:34:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg01.java:34:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:35:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:36:15: compiler.err.not.within.bounds: ? super java.lang.String
+Neg01.java:36:15: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg01.java:36:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 28 errors
--- a/langtools/test/tools/javac/generics/diamond/neg/Neg02.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/generics/diamond/neg/Neg02.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,57 +1,57 @@
-Neg02.java:19:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:19:13: compiler.err.not.within.bounds: java.lang.String, X
 Neg02.java:19:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg02.java:20:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:21:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg02.java:22:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:24:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:24:13: compiler.err.not.within.bounds: java.lang.String, X
 Neg02.java:24:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg02.java:25:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:26:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg02.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:29:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:29:13: compiler.err.not.within.bounds: java.lang.String, X
 Neg02.java:29:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg02.java:30:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:31:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg02.java:32:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:34:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:34:13: compiler.err.not.within.bounds: java.lang.String, X
 Neg02.java:34:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg02.java:35:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:36:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg02.java:37:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:41:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:41:13: compiler.err.not.within.bounds: java.lang.String, X
 Neg02.java:41:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg02.java:42:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:43:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg02.java:44:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:46:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:46:13: compiler.err.not.within.bounds: java.lang.String, X
 Neg02.java:46:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg02.java:47:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:48:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg02.java:49:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:51:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:51:13: compiler.err.not.within.bounds: java.lang.String, X
 Neg02.java:51:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg02.java:52:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:53:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg02.java:54:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:56:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:56:13: compiler.err.not.within.bounds: java.lang.String, X
 Neg02.java:56:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
 Neg02.java:57:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:58:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String, X
 Neg02.java:59:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 56 errors
--- a/langtools/test/tools/javac/generics/diamond/neg/Neg03.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/generics/diamond/neg/Neg03.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,85 +1,85 @@
-Neg03.java:19:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:19:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:19:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:20:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:21:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:22:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:24:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:24:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:24:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:25:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:26:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:29:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:29:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:29:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:30:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:31:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:32:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:34:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:34:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:34:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:35:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:36:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:37:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:41:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:41:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:41:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:42:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:43:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:44:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:46:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:46:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:46:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:47:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:48:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:49:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:51:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:51:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:51:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:52:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:53:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:54:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:56:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:56:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:56:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:57:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:58:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:59:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:63:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:63:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:63:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:64:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:64:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:64:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:65:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:66:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:66:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:66:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:68:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:68:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:68:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:69:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:69:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:69:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:70:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:71:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:71:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:71:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:73:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:73:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:73:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:74:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:74:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:74:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:75:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:76:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:76:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:76:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:78:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:78:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg03.java:78:29: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:79:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:79:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg03.java:79:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:80:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:81:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:81:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg03.java:81:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 84 errors
--- a/langtools/test/tools/javac/generics/diamond/neg/Neg04.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/generics/diamond/neg/Neg04.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,29 +1,29 @@
-Neg04.java:18:13: compiler.err.not.within.bounds: java.lang.String
+Neg04.java:18:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg04.java:18:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:19:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg04.java:19:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg04.java:19:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:20:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:21:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg04.java:21:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg04.java:21:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:23:13: compiler.err.not.within.bounds: java.lang.String
+Neg04.java:23:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg04.java:23:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:24:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg04.java:24:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg04.java:24:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:25:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:26:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg04.java:26:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg04.java:26:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:28:13: compiler.err.not.within.bounds: java.lang.String
+Neg04.java:28:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg04.java:28:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:29:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg04.java:29:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg04.java:29:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:30:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:31:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg04.java:31:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg04.java:31:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:33:13: compiler.err.not.within.bounds: java.lang.String
+Neg04.java:33:13: compiler.err.not.within.bounds: java.lang.String, V
 Neg04.java:33:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:34:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg04.java:34:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 Neg04.java:34:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:35:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:36:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg04.java:36:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 Neg04.java:36:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 28 errors
--- a/langtools/test/tools/javac/generics/diamond/neg/Neg11.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/generics/diamond/neg/Neg11.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,3 +1,3 @@
-Neg11.java:15:25: compiler.err.cant.resolve.location: kindname.class, UndeclaredName, , , kindname.class, Neg11
-Neg11.java:16:25: compiler.err.cant.resolve.location: kindname.class, UndeclaredName, , , kindname.class, Neg11
+Neg11.java:15:25: compiler.err.cant.resolve.location: kindname.class, UndeclaredName, , , (compiler.misc.location: kindname.class, Neg11, null)
+Neg11.java:16:25: compiler.err.cant.resolve.location: kindname.class, UndeclaredName, , , (compiler.misc.location: kindname.class, Neg11, null)
 2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/6943278/T6943278.java	Fri Jan 28 10:06:08 2011 -0800
@@ -0,0 +1,12 @@
+/**
+ * @test /nodynamiccopyright/
+ * @bug 6943278
+ * @summary spurious error message for inference and type-variable with erroneous bound
+ * @compile/fail/ref=T6943278.out -XDrawDiagnostics -Xlint:unchecked T6943278.java
+ */
+class T6943278<X extends Number & NonExistentInterface> {
+    <X> T6943278<X> m() { return null;}
+    <X extends Number & NonExistentInterface> T6943278<X> m(X x) { return null;}
+    T6943278<?> f1 = m();
+    T6943278<?> f2 = m("");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/6943278/T6943278.out	Fri Jan 28 10:06:08 2011 -0800
@@ -0,0 +1,3 @@
+T6943278.java:7:35: compiler.err.cant.resolve: kindname.class, NonExistentInterface, , 
+T6943278.java:9:25: compiler.err.cant.resolve.location: kindname.class, NonExistentInterface, , , (compiler.misc.location: kindname.class, T6943278, null)
+2 errors
--- a/langtools/test/tools/javac/generics/typevars/5060485/Compatibility.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/generics/typevars/5060485/Compatibility.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,2 +1,2 @@
-Compatibility.java:36:35: compiler.err.not.within.bounds: Test.Y
+Compatibility.java:36:35: compiler.err.not.within.bounds: Test.Y, T
 1 error
--- a/langtools/test/tools/javac/generics/typevars/5060485/Compatibility02.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/generics/typevars/5060485/Compatibility02.out	Fri Jan 28 10:06:08 2011 -0800
@@ -1,2 +1,2 @@
-Compatibility.java:36:35: compiler.err.not.within.bounds: Test.Y
+Compatibility.java:36:35: compiler.err.not.within.bounds: Test.Y, T
 1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typevars/6968793/T6968793.java	Fri Jan 28 10:06:08 2011 -0800
@@ -0,0 +1,11 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     6968793
+ * @summary javac generates spourious diagnostics for ill-formed type-variable bounds
+ * @author  mcimadamore
+ * @compile/fail/ref=T6968793.out -XDrawDiagnostics T6968793.java
+ */
+
+class T6968793<X extends Number, Y extends X, Z extends Object & Comparable<Y>> {
+    T6968793<Object, Object, Object> o;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typevars/6968793/T6968793.out	Fri Jan 28 10:06:08 2011 -0800
@@ -0,0 +1,4 @@
+T6968793.java:10:14: compiler.err.not.within.bounds: java.lang.Object, X
+T6968793.java:10:22: compiler.err.not.within.bounds: java.lang.Object, Y
+T6968793.java:10:30: compiler.err.not.within.bounds: java.lang.Object, Z
+3 errors
--- a/langtools/test/tools/javac/meth/InvokeDynTrans.out	Thu Jan 27 17:28:57 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-InvokeDynTrans.java:55:39: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeDynTrans.java:57:34: compiler.warn.type.parameter.on.polymorphic.signature
-- compiler.err.warnings.and.werror
-1 error
-2 warnings
--- a/langtools/test/tools/javac/meth/InvokeMHTrans.java	Thu Jan 27 17:28:57 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/* Copyright (c) 2008, 2010, 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 6754038 6979327
- * @summary Generate call sites for method handle
- * @author jrose
- *
- * @compile/fail/ref=InvokeMHTrans.out -Werror -XDrawDiagnostics -source 7 -target 7 InvokeMHTrans.java
- */
-
-/*
- * Standalone testing:
- * <code>
- * $ cd $MY_REPO_DIR/langtools
- * $ (cd make; make)
- * $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/meth/InvokeMH.java
- * $ javap -c -classpath dist meth.InvokeMH
- * </code>
- */
-
-package meth;
-
-import java.dyn.MethodHandle;
-
-public class InvokeMHTrans {
-    void test(MethodHandle mh_SiO,
-              MethodHandle mh_vS,
-              MethodHandle mh_vi,
-              MethodHandle mh_vv) throws Throwable {
-        Object o; String s; int i;  // for return type testing
-
-        // next five must have sig = (String,int)Object
-        mh_SiO.invokeExact("world", 123);
-        mh_SiO.invokeExact("mundus", 456);
-        Object k = "kosmos";
-        mh_SiO.invokeExact((String)k, 789);
-        o = mh_SiO.invokeExact((String)null, 000);
-        o = mh_SiO.<Object>invokeExact("arda", -123);
-
-        // sig = ()String
-        s = mh_vS.<String>invokeExact();
-
-        // sig = ()int
-        i = mh_vi.<int>invokeExact();
-        o = mh_vi.<int>invokeExact();
-        //s = mh_vi.<int>invokeExact(); //BAD
-        mh_vi.<int>invokeExact();
-
-        // sig = ()void
-        //o = mh_vv.<void>invokeExact(); //BAD
-        mh_vv.<void>invokeExact();
-    }
-
-    void testGen(MethodHandle mh_SiO,
-                 MethodHandle mh_vS,
-                 MethodHandle mh_vi,
-                 MethodHandle mh_vv) throws Throwable {
-        Object o; String s; int i;  // for return type testing
-
-        // next five must have sig = (*,*)*
-        mh_SiO.invokeGeneric((Object)"world", (Object)123);
-        mh_SiO.<void>invokeGeneric((Object)"mundus", (Object)456);
-        Object k = "kosmos";
-        mh_SiO.invokeGeneric(k, 789);
-        o = mh_SiO.invokeGeneric(null, 000);
-        o = mh_SiO.<Object>invokeGeneric("arda", -123);
-
-        // sig = ()String
-        o = mh_vS.invokeGeneric();
-
-        // sig = ()int
-        i = mh_vi.<int>invokeGeneric();
-        o = mh_vi.invokeGeneric();
-        //s = mh_vi.<int>invokeGeneric(); //BAD
-        mh_vi.<void>invokeGeneric();
-
-        // sig = ()void
-        //o = mh_vv.<void>invokeGeneric(); //BAD
-        o = mh_vv.invokeGeneric();
-    }
-}
--- a/langtools/test/tools/javac/meth/InvokeMHTrans.out	Thu Jan 27 17:28:57 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-InvokeMHTrans.java:59:39: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:62:38: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:65:35: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:66:35: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:68:31: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:72:32: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:83:35: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:87:41: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:93:37: compiler.warn.type.parameter.on.polymorphic.signature
-InvokeMHTrans.java:96:34: compiler.warn.type.parameter.on.polymorphic.signature
-- compiler.err.warnings.and.werror
-1 error
-10 warnings
--- a/langtools/test/tools/javac/meth/TestCP.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/meth/TestCP.java	Fri Jan 28 10:06:08 2011 -0800
@@ -42,13 +42,15 @@
 
     static class TestClass {
         void test(MethodHandle mh) throws Throwable {
-            Number n = mh.<Number>invokeExact("daddy",1,'n');
+            Number n = (Number)mh.invokeExact("daddy",1,'n');
             n = (Number)mh.invokeExact("bunny",1,'d');
+            n = (Number)(mh.invokeExact("foo",1,'d'));
+            n = (Number)((mh.invokeExact("bar",1,'d')));
         }
     }
 
     static final String PS_TYPE = "(Ljava/lang/String;IC)Ljava/lang/Number;";
-    static final int PS_CALLS_COUNT = 2;
+    static final int PS_CALLS_COUNT = 4;
     static final String SUBTEST_NAME = TestClass.class.getName() + ".class";
     static final String TEST_METHOD_NAME = "test";
 
--- a/langtools/test/tools/javac/meth/XlintWarn.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/meth/XlintWarn.java	Fri Jan 28 10:06:08 2011 -0800
@@ -35,6 +35,19 @@
 class XlintWarn {
     void test(MethodHandle mh) throws Throwable {
         int i1 = (int)mh.invokeExact();
-        int i2 = (int)mh.invokeVarargs();
+        int i2 = (int)mh.invokeGeneric();
+        int i3 = (int)mh.invokeWithArguments();
+    }
+
+    void test2(MethodHandle mh) throws Throwable {
+        int i1 = (int)(mh.invokeExact());
+        int i2 = (int)(mh.invokeGeneric());
+        int i3 = (int)(mh.invokeWithArguments());
+    }
+
+    void test3(MethodHandle mh) throws Throwable {
+        int i1 = (int)((mh.invokeExact()));
+        int i2 = (int)((mh.invokeGeneric()));
+        int i3 = (int)((mh.invokeWithArguments()));
     }
 }
--- a/langtools/test/tools/javac/policy/test1/byfile.ABD.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/policy/test1/byfile.ABD.out	Fri Jan 28 10:06:08 2011 -0800
@@ -12,6 +12,6 @@
 [generate code A2]
 [attribute B]
 [attribute B1]
-B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , kindname.class, B1
+B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , (compiler.misc.location: kindname.class, B1, null)
 [attribute B2]
 1 error
--- a/langtools/test/tools/javac/policy/test1/bytodo.ABD.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/policy/test1/bytodo.ABD.out	Fri Jan 28 10:06:08 2011 -0800
@@ -15,7 +15,7 @@
 [desugar B]
 [generate code B]
 [attribute B1]
-B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , kindname.class, B1
+B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , (compiler.misc.location: kindname.class, B1, null)
 [attribute B2]
 [attribute D]
 [attribute D1]
--- a/langtools/test/tools/javac/policy/test1/simple.ABD.out	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/policy/test1/simple.ABD.out	Fri Jan 28 10:06:08 2011 -0800
@@ -3,7 +3,7 @@
 [attribute A2]
 [attribute B]
 [attribute B1]
-B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , kindname.class, B1
+B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , (compiler.misc.location: kindname.class, B1, null)
 [attribute B2]
 [attribute D]
 [attribute D1]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/tree/T6993305.java	Fri Jan 28 10:06:08 2011 -0800
@@ -0,0 +1,124 @@
+/*
+ * 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 6993305
+ * @summary starting position of a method without modifiers and with type parameters is incorrect
+ */
+
+import java.io.File;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.MethodTree;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.SourcePositions;
+import com.sun.source.util.TreeScanner;
+import com.sun.source.util.Trees;
+import com.sun.tools.javac.api.JavacTool;
+import java.io.IOException;
+
+/*
+ * Test verifies the starting position of all methods by computing the start position
+ * of each method as the first non-white character on the first line containing
+ * (" " + methodName + "("), and then comparing this value against the reported
+ * value in the SourcePositions table.
+ */
+public class T6993305 {
+    <T> void test1(T t) { }  // this is the primary case to be tested
+    public <T> void test2(T t) { }
+    @Deprecated <T> void test3(T t) { }
+
+    public static void main(String... args) throws Exception {
+        new T6993305().run();
+    }
+
+    void run() throws Exception {
+        File testSrc = new File(System.getProperty("test.src"));
+
+        JavacTool tool = JavacTool.create();
+        StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
+
+        File f = new File(testSrc, T6993305.class.getSimpleName() + ".java");
+        Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjects(f);
+        JavacTask task = tool.getTask(null, fm, null, null, null, fos);
+        Iterable<? extends CompilationUnitTree> cus = task.parse();
+
+        TestScanner s = new TestScanner();
+        s.scan(cus, task);
+
+        if (errors > 0)
+            throw new Exception(errors + " errors occurred");
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+
+    class TestScanner extends TreeScanner<Void, JavacTask> {
+        CompilationUnitTree cu;
+        SourcePositions sourcePositions;
+        String source;
+
+        void show(String label, int pos) {
+            System.err.println(label + ": " +
+                    source.substring(pos, Math.min(source.length(), pos + 10)));
+        }
+
+        @Override public Void visitCompilationUnit(CompilationUnitTree tree, JavacTask task) {
+            cu = tree;
+            Trees trees = Trees.instance(task);
+            sourcePositions = trees.getSourcePositions();
+            try {
+                source = String.valueOf(tree.getSourceFile().getCharContent(true));
+            } catch (IOException e) {
+                throw new Error(e);
+            }
+            return super.visitCompilationUnit(tree, task);
+        }
+
+        // this is the core of the test
+        @Override public Void visitMethod(MethodTree tree, JavacTask task) {
+            String name = String.valueOf(tree.getName());
+            int pos = source.indexOf(" " + name + "(");
+            while (source.charAt(pos - 1) != '\n') pos--;
+            while (source.charAt(pos) == ' ') pos++;
+            int expectedStart = pos;
+            int reportedStart = (int) sourcePositions.getStartPosition(cu, tree);
+            System.err.println("Method " + name
+                    + " expectedStart:" + expectedStart
+                    + " reportedStart:" + reportedStart);
+            if (expectedStart != reportedStart) {
+                error("Unexpected value for " + name);
+                show("expected", expectedStart);
+                show("reported", reportedStart);
+            }
+            return super.visitMethod(tree, task);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/types/GenericTypeWellFormednessTest.java	Fri Jan 28 10:06:08 2011 -0800
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 2010, 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 7007432 7006109
+ * @summary Test generic types well-formedness
+ * @author mcimadamore
+ * @library .
+ * @run main GenericTypeWellFormednessTest
+ */
+
+import com.sun.tools.javac.code.BoundKind;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Type.*;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symbol.*;
+import java.lang.reflect.Array;
+
+/**
+ * Check parameterized type well-formedness. This test executes a number of checks
+ * in order to establish as to whether an instantiation of a generic type conforms
+ * to the generic class' declared bounds.
+ */
+public class GenericTypeWellFormednessTest extends TypeHarness {
+
+    static int executedCount = 0;
+    static int ignoredCount = 0;
+
+    InstantiableType[] rows;
+    Type[] columns;
+
+    static class InstantiableType {
+        protected Type type;
+
+        public InstantiableType(Type type) {
+            this.type = type;
+        }
+
+        Type inst(Type clazz) {
+            return type;
+        }
+    }
+
+    enum Result {
+        /* generic type is well-formed w.r.t. declared bounds */
+        OK(true),
+        /* generic type is not well-formed w.r.t. declared bounds */
+        FAIL(false),
+        /* generic type is not well-formed w.r.t. declared bounds according to the JLS 3rd,
+         * but javac allows it (spec for generic type well-formedness is overly restrictive)
+         * See regression test test/tools/generics/wildcards/T5097548.java
+         */
+        IGNORE(false);
+
+        boolean value;
+
+        Result(boolean value) {
+            this.value = value;
+        }
+    }
+
+    static final Result T = Result.OK;
+    static final Result F = Result.FAIL;
+    static final Result I = Result.IGNORE;
+
+    /*is a type in 'rows' a valid instantiation for the generic class in 'col' ? */
+    Result[][] isValidInstantiation = {
+                     //Foo<X>, Foo<X ext Object>, Foo<X ext Number>, Foo<X ext Foo<X>>, Foo<X ext Foo<+X>>, Foo<X ext Foo<-X>>, Foo<X ext Foo<?>>
+    /*Foo<Object>*/  { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<Number>*/  { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<Integer>*/ { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<Double>*/  { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<String>*/  { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<X1>*/      { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<X2>*/      { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<X3>*/      { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<X4>*/      { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<X5>*/      { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<X6>*/      { T     , T                , F                , T                , T                 , T                 , T },
+    /*Foo<+Object>*/ { T     , T                , I                , I                , I                 , I                 , I },
+    /*Foo<+Number>*/ { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<+Integer>*/{ T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<+Double>*/ { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<+String>*/ { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<+X1>*/     { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<+X2>*/     { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<+X3>*/     { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<+X4>*/     { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<+X5>*/     { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<+X6>*/     { T     , T                , F                , T                , T                 , I                 , T },
+    /*Foo<-Object>*/ { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<-Number>*/ { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<-Integer>*/{ T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<-Double>*/ { T     , T                , T                , F                , F                 , F                 , F },
+    /*Foo<-String>*/ { T     , T                , F                , F                , F                 , F                 , F },
+    /*Foo<-X1>*/     { T     , T                , I                , I                , I                 , I                 , I },
+    /*Foo<-X2>*/     { T     , T                , I                , F                , F                 , F                 , F },
+    /*Foo<-X3>*/     { T     , T                , I                , F                , F                 , F                 , F },
+    /*Foo<-X4>*/     { T     , T                , I                , F                , F                 , F                 , F },
+    /*Foo<-X5>*/     { T     , T                , I                , F                , F                 , F                 , F },
+    /*Foo<-X6>*/     { T     , T                , F                , T                , I                 , I                 , T },
+    /*Foo<?>*/       { T     , T                , T                , T                , T                 , T                 , T }};
+
+    GenericTypeWellFormednessTest() {
+        InstantiableType[] basicTypes = {
+            new InstantiableType(predef.objectType),
+            new InstantiableType(NumberType()),
+            new InstantiableType(box(predef.intType)),
+            new InstantiableType(box(predef.doubleType)),
+            new InstantiableType(predef.stringType) };
+
+        InstantiableType[] typeVars = new InstantiableType[basicTypes.length + 1];
+        for (int i = 0 ; i < basicTypes.length ; i++) {
+           typeVars[i] = new InstantiableType(fac.TypeVariable(basicTypes[i].type));
+        }
+        typeVars[typeVars.length - 1] = new InstantiableType(null) {
+            Type inst(Type clazz) {
+                TypeVar tvar = fac.TypeVariable();
+                tvar.bound = subst(clazz, Mapping(clazz.getTypeArguments().head, tvar));
+                return tvar;
+            }
+        };
+
+        InstantiableType[] typeArgs = join(InstantiableType.class, basicTypes, typeVars);
+
+        InstantiableType[] invariantTypes = new InstantiableType[typeArgs.length];
+        for (int i = 0 ; i < typeArgs.length ; i++) {
+           final InstantiableType type1 = typeArgs[i];
+           invariantTypes[i] = new InstantiableType(typeArgs[i].type) {
+               Type inst(Type clazz) {
+                   return subst(clazz, Mapping(clazz.getTypeArguments().head, type1.inst(clazz)));
+               }
+            };
+        }
+
+        InstantiableType[] covariantTypes = new InstantiableType[typeArgs.length];
+        for (int i = 0 ; i < typeArgs.length ; i++) {
+           final InstantiableType type1 = typeArgs[i];
+           covariantTypes[i] = new InstantiableType(null) {
+               Type inst(Type clazz) {
+                   Type t = fac.Wildcard(BoundKind.EXTENDS, type1.inst(clazz));
+                   return subst(clazz, Mapping(clazz.getTypeArguments().head, t));
+               }
+            };
+        }
+
+        InstantiableType[] contravariantTypes = new InstantiableType[typeArgs.length];
+        for (int i = 0 ; i < typeArgs.length ; i++) {
+           final InstantiableType type1 = typeArgs[i];
+           contravariantTypes[i] = new InstantiableType(null) {
+               Type inst(Type clazz) {
+                   Type t = fac.Wildcard(BoundKind.SUPER, type1.inst(clazz));
+                   return subst(clazz, Mapping(clazz.getTypeArguments().head, t));
+               }
+            };
+        }
+
+        InstantiableType[] bivariantTypes = {
+            new InstantiableType(fac.Wildcard(BoundKind.UNBOUND, predef.objectType)) {
+               Type inst(Type clazz) {
+                   return subst(clazz, Mapping(clazz.getTypeArguments().head, type));
+               }
+            }
+        };
+
+        rows = join(InstantiableType.class, invariantTypes, covariantTypes, contravariantTypes, bivariantTypes);
+
+        Type tv1 = fac.TypeVariable();
+        Type decl1 = fac.Class(tv1);
+
+        Type tv2 = fac.TypeVariable(predef.objectType);
+        Type decl2 = fac.Class(tv2);
+
+        Type tv3 = fac.TypeVariable(NumberType());
+        Type decl3 = fac.Class(tv3);
+
+        TypeVar tv4 = fac.TypeVariable();
+        Type decl4 = fac.Class(tv4);
+        tv4.bound = decl4;
+        tv4.tsym.name = predef.exceptionType.tsym.name;
+
+        TypeVar tv5 = fac.TypeVariable();
+        Type decl5 = fac.Class(tv5);
+        tv5.bound = subst(decl5, Mapping(tv5, fac.Wildcard(BoundKind.EXTENDS, tv5)));
+
+        TypeVar tv6 = fac.TypeVariable();
+        Type decl6 = fac.Class(tv6);
+        tv6.bound = subst(decl6, Mapping(tv6, fac.Wildcard(BoundKind.SUPER, tv6)));
+
+        TypeVar tv7 = fac.TypeVariable();
+        Type decl7 = fac.Class(tv7);
+        tv7.bound = subst(decl7, Mapping(tv7, fac.Wildcard(BoundKind.UNBOUND, predef.objectType)));
+
+        columns = new Type[] {
+            decl1, decl2, decl3, decl4, decl5, decl6, decl7
+        };
+    }
+
+    void test() {
+        for (int i = 0; i < rows.length ; i++) {
+            for (int j = 0; j < columns.length ; j++) {
+                Type decl = columns[j];
+                Type inst = rows[i].inst(decl);
+                if (isValidInstantiation[i][j] != Result.IGNORE) {
+                    executedCount++;
+                    assertValidGenericType(inst, isValidInstantiation[i][j].value);
+                } else {
+                    ignoredCount++;
+                }
+            }
+        }
+    }
+
+    Type NumberType() {
+        Symbol s = box(predef.intType).tsym;
+        s.complete();
+        return ((ClassType)s.type).supertype_field;
+    }
+
+    @SuppressWarnings("unchecked")
+    <T> T[] join(Class<T> type, T[]... args) {
+        int totalLength = 0;
+        for (T[] arr : args) {
+            totalLength += arr.length;
+        }
+        T[] new_arr = (T[])Array.newInstance(type, totalLength);
+        int idx = 0;
+        for (T[] arr : args) {
+            System.arraycopy(arr, 0, new_arr, idx, arr.length);
+            idx += arr.length;
+        }
+        return new_arr;
+    }
+
+    public static void main(String[] args) {
+        new GenericTypeWellFormednessTest().test();
+        System.out.println("Executed checks : " + executedCount);
+        System.out.println("Ignored checks : " + ignoredCount);
+    }
+}
--- a/langtools/test/tools/javac/types/TypeHarness.java	Thu Jan 27 17:28:57 2011 -0800
+++ b/langtools/test/tools/javac/types/TypeHarness.java	Fri Jan 28 10:06:08 2011 -0800
@@ -29,6 +29,7 @@
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.comp.Check;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Name;
@@ -68,6 +69,7 @@
 public class TypeHarness {
 
     protected Types types;
+    protected Check chk;
     protected Symtab predef;
     protected Names names;
     protected Factory fac;
@@ -76,6 +78,7 @@
         Context ctx = new Context();
         JavacFileManager.preRegister(ctx);
         types = Types.instance(ctx);
+        chk = Check.instance(ctx);
         predef = Symtab.instance(ctx);
         names = Names.instance(ctx);
         fac = new Factory();
@@ -157,6 +160,21 @@
             error(s + msg + t);
         }
     }
+
+    /** assert that generic type 't' is well-formed */
+    public void assertValidGenericType(Type t) {
+        assertValidGenericType(t, true);
+    }
+
+    /** assert that 's' is/is not assignable to 't' */
+    public void assertValidGenericType(Type t, boolean expected) {
+        if (chk.checkValidGenericType(t) != expected) {
+            String msg = expected ?
+                " is not a valid generic type" :
+                " is a valid generic type";
+            error(t + msg + "   " + t.tsym.type);
+        }
+    }
     // </editor-fold>
 
     private void error(String msg) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/varargs/6569633/T6569633.java	Fri Jan 28 10:06:08 2011 -0800
@@ -0,0 +1,13 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     6569633
+ * @author mcimadamore
+ * @summary  Varargs: parser error when varargs element type is an array
+ * @compile/fail/ref=T6569633.out -XDrawDiagnostics T6569633.java
+ */
+
+class T6569633 {
+    void  m1 (Integer... i[]) { }
+    void  m2 (Integer[]... i) { }
+    void  m3 (Integer[]... i[]) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/varargs/6569633/T6569633.out	Fri Jan 28 10:06:08 2011 -0800
@@ -0,0 +1,3 @@
+T6569633.java:10:27: compiler.err.varargs.and.old.array.syntax
+T6569633.java:12:29: compiler.err.varargs.and.old.array.syntax
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/varargs/T7013865.java	Fri Jan 28 10:06:08 2011 -0800
@@ -0,0 +1,36 @@
+/*
+ * 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     7013865
+ * @summary varargs: javac crashes during overload resolution with generic varargs
+ * @compile T7013865.java
+ */
+
+class T7013865 {
+    public <X extends Number> void m(X... args) { }
+    public void m(Object... args) { }
+
+    { m(null, null); }
+}