Merge jdk7-b128

Fri, 28 Jan 2011 10:06:08 -0800

author
lana
date
Fri, 28 Jan 2011 10:06:08 -0800
changeset 834
d7225b476a5d
parent 814
d79e283c7d9b
parent 833
2314f2b07ae7
child 835
1383d1ee8b5d

Merge

src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/classfile/RuntimeInvisibleTypeAnnotations_attribute.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/classfile/RuntimeTypeAnnotations_attribute.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/classfile/RuntimeVisibleTypeAnnotations_attribute.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/EnumConstRequired.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/TypeParameterOnPolymorphicSignature.java file | annotate | diff | comparison | revisions
test/tools/javac/meth/InvokeDynTrans.out file | annotate | diff | comparison | revisions
test/tools/javac/meth/InvokeMHTrans.java file | annotate | diff | comparison | revisions
test/tools/javac/meth/InvokeMHTrans.out file | annotate | diff | comparison | revisions
     1.1 --- a/make/build.xml	Thu Jan 27 17:28:57 2011 -0800
     1.2 +++ b/make/build.xml	Fri Jan 28 10:06:08 2011 -0800
     1.3 @@ -352,6 +352,45 @@
     1.4          </java>
     1.5      </target>
     1.6  
     1.7 +    <!-- a patching facility to speed up incorporating the langtools' classfiles
     1.8 +         into a jdk of your choice. Either target.java.home or patch.jdk can be
     1.9 +         set on the command line; setting target.java.home has the advantage of
    1.10 +         patching the jdk used for jtreg and other tests.
    1.11 +    -->
    1.12 +    <target name="patch" depends="build-all-classes">
    1.13 +        <condition property="patch.jdk" value="${target.java.home}">
    1.14 +            <available file="${target.java.home}" type="dir"/>
    1.15 +        </condition>
    1.16 +        <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">
    1.17 +            <condition>
    1.18 +                <not>
    1.19 +                    <isset property="patch.jdk"/>
    1.20 +                </not>
    1.21 +            </condition>
    1.22 +        </fail>
    1.23 +        <property name="patch.tools.jar" location="${patch.jdk}/lib/tools.jar"/>
    1.24 +        <property name="patch.rt.jar" location="${patch.jdk}/jre/lib/rt.jar"/>
    1.25 +        <fail message="patch.jdk or target.java.home must point to a valid jdk image: missing tools.jar">
    1.26 +            <condition>
    1.27 +                <not>
    1.28 +                    <available file="${patch.tools.jar}" type="file"/>
    1.29 +                </not>
    1.30 +            </condition>
    1.31 +        </fail>
    1.32 +        <fail message="patch.jdk or target.java.home must point to a valid jdk image: missing rt.jar">
    1.33 +            <condition>
    1.34 +                <not>
    1.35 +                    <available file="${patch.rt.jar}" type="file"/>
    1.36 +                </not>
    1.37 +            </condition>
    1.38 +        </fail>
    1.39 +        <zip zipfile="${patch.tools.jar}" update="true">
    1.40 +            <zipfileset dir="${build.classes.dir}" includes="com/**"/>
    1.41 +        </zip>
    1.42 +        <zip zipfile="${patch.rt.jar}" update="true">
    1.43 +            <zipfileset dir="${build.classes.dir}" includes="javax/**"/>
    1.44 +        </zip>
    1.45 +    </target>
    1.46  
    1.47      <!--
    1.48      **** Debugging/diagnostic targets.
     2.1 --- a/src/share/classes/com/sun/source/tree/MethodTree.java	Thu Jan 27 17:28:57 2011 -0800
     2.2 +++ b/src/share/classes/com/sun/source/tree/MethodTree.java	Fri Jan 28 10:06:08 2011 -0800
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -53,7 +53,6 @@
    2.11      Tree getReturnType();
    2.12      List<? extends TypeParameterTree> getTypeParameters();
    2.13      List<? extends VariableTree> getParameters();
    2.14 -//308    List<? extends AnnotationTree> getReceiverAnnotations();
    2.15      List<? extends ExpressionTree> getThrows();
    2.16      BlockTree getBody();
    2.17      Tree getDefaultValue(); // for annotation types
     3.1 --- a/src/share/classes/com/sun/source/tree/Tree.java	Thu Jan 27 17:28:57 2011 -0800
     3.2 +++ b/src/share/classes/com/sun/source/tree/Tree.java	Fri Jan 28 10:06:08 2011 -0800
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
     3.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8   *
     3.9   * This code is free software; you can redistribute it and/or modify it
    3.10 @@ -46,8 +46,6 @@
    3.11       */
    3.12      public enum Kind {
    3.13  
    3.14 -//308        ANNOTATED_TYPE(AnnotatedTypeTree.class),
    3.15 -
    3.16          /**
    3.17           * Used for instances of {@link AnnotationTree}.
    3.18           */
     4.1 --- a/src/share/classes/com/sun/source/tree/TreeVisitor.java	Thu Jan 27 17:28:57 2011 -0800
     4.2 +++ b/src/share/classes/com/sun/source/tree/TreeVisitor.java	Fri Jan 28 10:06:08 2011 -0800
     4.3 @@ -1,5 +1,5 @@
     4.4  /*
     4.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
     4.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
     4.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8   *
     4.9   * This code is free software; you can redistribute it and/or modify it
    4.10 @@ -57,7 +57,6 @@
    4.11   * @since 1.6
    4.12   */
    4.13  public interface TreeVisitor<R,P> {
    4.14 -//308    R visitAnnotatedType(AnnotatedTypeTree node, P p);
    4.15      R visitAnnotation(AnnotationTree node, P p);
    4.16      R visitMethodInvocation(MethodInvocationTree node, P p);
    4.17      R visitAssert(AssertTree node, P p);
     5.1 --- a/src/share/classes/com/sun/source/tree/TypeParameterTree.java	Thu Jan 27 17:28:57 2011 -0800
     5.2 +++ b/src/share/classes/com/sun/source/tree/TypeParameterTree.java	Fri Jan 28 10:06:08 2011 -0800
     5.3 @@ -1,5 +1,5 @@
     5.4  /*
     5.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
     5.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
     5.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.8   *
     5.9   * This code is free software; you can redistribute it and/or modify it
    5.10 @@ -47,5 +47,4 @@
    5.11  public interface TypeParameterTree extends Tree {
    5.12      Name getName();
    5.13      List<? extends Tree> getBounds();
    5.14 -//308    List<? extends AnnotationTree> getAnnotations();
    5.15  }
     6.1 --- a/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java	Thu Jan 27 17:28:57 2011 -0800
     6.2 +++ b/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java	Fri Jan 28 10:06:08 2011 -0800
     6.3 @@ -1,5 +1,5 @@
     6.4  /*
     6.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
     6.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
     6.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.8   *
     6.9   * This code is free software; you can redistribute it and/or modify it
    6.10 @@ -248,10 +248,6 @@
    6.11          return defaultAction(node, p);
    6.12      }
    6.13  
    6.14 -//308    public R visitAnnotatedType(AnnotatedTypeTree node, P p) {
    6.15 -//308        return defaultAction(node, p);
    6.16 -//308    }
    6.17 -
    6.18      public R visitErroneous(ErroneousTree node, P p) {
    6.19          return defaultAction(node, p);
    6.20      }
     7.1 --- a/src/share/classes/com/sun/source/util/TreeScanner.java	Thu Jan 27 17:28:57 2011 -0800
     7.2 +++ b/src/share/classes/com/sun/source/util/TreeScanner.java	Fri Jan 28 10:06:08 2011 -0800
     7.3 @@ -1,5 +1,5 @@
     7.4  /*
     7.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
     7.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
     7.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8   *
     7.9   * This code is free software; you can redistribute it and/or modify it
    7.10 @@ -138,7 +138,6 @@
    7.11          r = scanAndReduce(node.getReturnType(), p, r);
    7.12          r = scanAndReduce(node.getTypeParameters(), p, r);
    7.13          r = scanAndReduce(node.getParameters(), p, r);
    7.14 -//308        r = scanAndReduce(node.getReceiverAnnotations(), p, r);
    7.15          r = scanAndReduce(node.getThrows(), p, r);
    7.16          r = scanAndReduce(node.getBody(), p, r);
    7.17          r = scanAndReduce(node.getDefaultValue(), p, r);
    7.18 @@ -362,7 +361,6 @@
    7.19  
    7.20      public R visitTypeParameter(TypeParameterTree node, P p) {
    7.21          R r = scan(node.getBounds(), p);
    7.22 -//308        R r = scanAndReduce(node.getAnnotations(), p, r);
    7.23          return r;
    7.24      }
    7.25  
    7.26 @@ -380,12 +378,6 @@
    7.27          return r;
    7.28      }
    7.29  
    7.30 -//308   public R visitAnnotatedType(AnnotatedTypeTree node, P p) {
    7.31 -//308       R r = scan(node.getAnnotations(), p);
    7.32 -//308       r = scanAndReduce(node.getUnderlyingType(), p, r);
    7.33 -//308       return r;
    7.34 -//308   }
    7.35 -
    7.36      public R visitOther(Tree node, P p) {
    7.37          return null;
    7.38      }
     8.1 --- a/src/share/classes/com/sun/tools/classfile/Attribute.java	Thu Jan 27 17:28:57 2011 -0800
     8.2 +++ b/src/share/classes/com/sun/tools/classfile/Attribute.java	Fri Jan 28 10:06:08 2011 -0800
     8.3 @@ -1,5 +1,5 @@
     8.4  /*
     8.5 - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
     8.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
     8.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.8   *
     8.9   * This code is free software; you can redistribute it and/or modify it
    8.10 @@ -39,6 +39,7 @@
    8.11  
    8.12  public abstract class Attribute {
    8.13      public static final String AnnotationDefault        = "AnnotationDefault";
    8.14 +    public static final String BootstrapMethods         = "BootstrapMethods";
    8.15      public static final String CharacterRangeTable      = "CharacterRangeTable";
    8.16      public static final String Code                     = "Code";
    8.17      public static final String ConstantValue            = "ConstantValue";
    8.18 @@ -54,8 +55,6 @@
    8.19      public static final String RuntimeInvisibleAnnotations = "RuntimeInvisibleAnnotations";
    8.20      public static final String RuntimeVisibleParameterAnnotations = "RuntimeVisibleParameterAnnotations";
    8.21      public static final String RuntimeInvisibleParameterAnnotations = "RuntimeInvisibleParameterAnnotations";
    8.22 -    public static final String RuntimeVisibleTypeAnnotations = "RuntimeVisibleTypeAnnotations";
    8.23 -    public static final String RuntimeInvisibleTypeAnnotations = "RuntimeInvisibleTypeAnnotations";
    8.24      public static final String Signature                = "Signature";
    8.25      public static final String SourceDebugExtension     = "SourceDebugExtension";
    8.26      public static final String SourceFile               = "SourceFile";
    8.27 @@ -101,6 +100,7 @@
    8.28          protected void init() {
    8.29              standardAttributes = new HashMap<String,Class<? extends Attribute>>();
    8.30              standardAttributes.put(AnnotationDefault, AnnotationDefault_attribute.class);
    8.31 +            standardAttributes.put(BootstrapMethods, BootstrapMethods_attribute.class);
    8.32              standardAttributes.put(CharacterRangeTable, CharacterRangeTable_attribute.class);
    8.33              standardAttributes.put(Code,              Code_attribute.class);
    8.34              standardAttributes.put(ConstantValue,     ConstantValue_attribute.class);
    8.35 @@ -118,8 +118,6 @@
    8.36                  standardAttributes.put(RuntimeInvisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations_attribute.class);
    8.37                  standardAttributes.put(RuntimeVisibleAnnotations, RuntimeVisibleAnnotations_attribute.class);
    8.38                  standardAttributes.put(RuntimeVisibleParameterAnnotations, RuntimeVisibleParameterAnnotations_attribute.class);
    8.39 -                standardAttributes.put(RuntimeVisibleTypeAnnotations, RuntimeVisibleTypeAnnotations_attribute.class);
    8.40 -                standardAttributes.put(RuntimeInvisibleTypeAnnotations, RuntimeInvisibleTypeAnnotations_attribute.class);
    8.41                  standardAttributes.put(Signature,     Signature_attribute.class);
    8.42                  standardAttributes.put(SourceID, SourceID_attribute.class);
    8.43              }
    8.44 @@ -159,6 +157,7 @@
    8.45  
    8.46  
    8.47      public interface Visitor<R,P> {
    8.48 +        R visitBootstrapMethods(BootstrapMethods_attribute attr, P p);
    8.49          R visitDefault(DefaultAttribute attr, P p);
    8.50          R visitAnnotationDefault(AnnotationDefault_attribute attr, P p);
    8.51          R visitCharacterRangeTable(CharacterRangeTable_attribute attr, P p);
    8.52 @@ -176,8 +175,6 @@
    8.53          R visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, P p);
    8.54          R visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, P p);
    8.55          R visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, P p);
    8.56 -        R visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, P p);
    8.57 -        R visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, P p);
    8.58          R visitSignature(Signature_attribute attr, P p);
    8.59          R visitSourceDebugExtension(SourceDebugExtension_attribute attr, P p);
    8.60          R visitSourceFile(SourceFile_attribute attr, P p);
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/src/share/classes/com/sun/tools/classfile/BootstrapMethods_attribute.java	Fri Jan 28 10:06:08 2011 -0800
     9.3 @@ -0,0 +1,90 @@
     9.4 +/*
     9.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
     9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.7 + *
     9.8 + * This code is free software; you can redistribute it and/or modify it
     9.9 + * under the terms of the GNU General Public License version 2 only, as
    9.10 + * published by the Free Software Foundation.  Oracle designates this
    9.11 + * particular file as subject to the "Classpath" exception as provided
    9.12 + * by Oracle in the LICENSE file that accompanied this code.
    9.13 + *
    9.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    9.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    9.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    9.17 + * version 2 for more details (a copy is included in the LICENSE file that
    9.18 + * accompanied this code).
    9.19 + *
    9.20 + * You should have received a copy of the GNU General Public License version
    9.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    9.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    9.23 + *
    9.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    9.25 + * or visit www.oracle.com if you need additional information or have any
    9.26 + * questions.
    9.27 + */
    9.28 +
    9.29 +package com.sun.tools.classfile;
    9.30 +
    9.31 +import java.io.IOException;
    9.32 +
    9.33 +/**
    9.34 + * See JVMS3 <TBD>
    9.35 + * http://cr.openjdk.java.net/~jrose/pres/indy-javadoc-mlvm/
    9.36 + *
    9.37 + *  <p><b>This is NOT part of any supported API.
    9.38 + *  If you write code that depends on this, you do so at your own risk.
    9.39 + *  This code and its internal interfaces are subject to change or
    9.40 + *  deletion without notice.</b>
    9.41 + */
    9.42 +public class BootstrapMethods_attribute extends Attribute {
    9.43 +    public final BootstrapMethodSpecifier[] bootstrap_method_specifiers;
    9.44 +
    9.45 +    BootstrapMethods_attribute(ClassReader cr, int name_index, int length)
    9.46 +            throws IOException, AttributeException {
    9.47 +        super(name_index, length);
    9.48 +        int bootstrap_method_count = cr.readUnsignedShort();
    9.49 +        bootstrap_method_specifiers = new BootstrapMethodSpecifier[bootstrap_method_count];
    9.50 +        for (int i = 0; i < bootstrap_method_specifiers.length; i++)
    9.51 +            bootstrap_method_specifiers[i] = new BootstrapMethodSpecifier(cr);
    9.52 +    }
    9.53 +
    9.54 +    public  BootstrapMethods_attribute(int name_index, BootstrapMethodSpecifier[] bootstrap_method_specifiers) {
    9.55 +        super(name_index, length(bootstrap_method_specifiers));
    9.56 +        this.bootstrap_method_specifiers = bootstrap_method_specifiers;
    9.57 +    }
    9.58 +
    9.59 +    public static int length(BootstrapMethodSpecifier[] bootstrap_method_specifiers) {
    9.60 +        int n = 2;
    9.61 +        for (BootstrapMethodSpecifier b : bootstrap_method_specifiers)
    9.62 +            n += b.length();
    9.63 +        return n;
    9.64 +    }
    9.65 +
    9.66 +    @Override
    9.67 +    public <R, P> R accept(Visitor<R, P> visitor, P p) {
    9.68 +        return visitor.visitBootstrapMethods(this, p);
    9.69 +    }
    9.70 +
    9.71 +    public static class BootstrapMethodSpecifier {
    9.72 +        public int bootstrap_method_ref;
    9.73 +        public int[] bootstrap_arguments;
    9.74 +
    9.75 +        public BootstrapMethodSpecifier(int bootstrap_method_ref, int[] bootstrap_arguments) {
    9.76 +            this.bootstrap_method_ref = bootstrap_method_ref;
    9.77 +            this.bootstrap_arguments = bootstrap_arguments;
    9.78 +        }
    9.79 +        BootstrapMethodSpecifier(ClassReader cr) throws IOException {
    9.80 +            bootstrap_method_ref = cr.readUnsignedShort();
    9.81 +            int method_count = cr.readUnsignedShort();
    9.82 +            bootstrap_arguments = new int[method_count];
    9.83 +            for (int i = 0; i < bootstrap_arguments.length; i++) {
    9.84 +                bootstrap_arguments[i] = cr.readUnsignedShort();
    9.85 +            }
    9.86 +        }
    9.87 +
    9.88 +        int length() {
    9.89 +            // u2 (method_ref) + u2 (argc) + u2 * argc
    9.90 +            return 2 + 2 + (bootstrap_arguments.length * 2);
    9.91 +        }
    9.92 +    }
    9.93 +}
    10.1 --- a/src/share/classes/com/sun/tools/classfile/ClassTranslator.java	Thu Jan 27 17:28:57 2011 -0800
    10.2 +++ b/src/share/classes/com/sun/tools/classfile/ClassTranslator.java	Fri Jan 28 10:06:08 2011 -0800
    10.3 @@ -1,5 +1,5 @@
    10.4  /*
    10.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
    10.6 + * Copyright (c) 2008, 2011 Oracle and/or its affiliates. All rights reserved.
    10.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.8   *
    10.9   * This code is free software; you can redistribute it and/or modify it
   10.10 @@ -31,7 +31,10 @@
   10.11  import com.sun.tools.classfile.ConstantPool.CONSTANT_Float_info;
   10.12  import com.sun.tools.classfile.ConstantPool.CONSTANT_Integer_info;
   10.13  import com.sun.tools.classfile.ConstantPool.CONSTANT_InterfaceMethodref_info;
   10.14 +import com.sun.tools.classfile.ConstantPool.CONSTANT_InvokeDynamic_info;
   10.15  import com.sun.tools.classfile.ConstantPool.CONSTANT_Long_info;
   10.16 +import com.sun.tools.classfile.ConstantPool.CONSTANT_MethodHandle_info;
   10.17 +import com.sun.tools.classfile.ConstantPool.CONSTANT_MethodType_info;
   10.18  import com.sun.tools.classfile.ConstantPool.CONSTANT_Methodref_info;
   10.19  import com.sun.tools.classfile.ConstantPool.CONSTANT_NameAndType_info;
   10.20  import com.sun.tools.classfile.ConstantPool.CONSTANT_String_info;
   10.21 @@ -304,6 +307,20 @@
   10.22          return info;
   10.23      }
   10.24  
   10.25 +    public CPInfo visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Map<Object, Object> translations) {
   10.26 +        CONSTANT_InvokeDynamic_info info2 = (CONSTANT_InvokeDynamic_info) translations.get(info);
   10.27 +        if (info2 == null) {
   10.28 +            ConstantPool cp2 = translate(info.cp, translations);
   10.29 +            if (cp2 == info.cp) {
   10.30 +                info2 = info;
   10.31 +            } else {
   10.32 +                info2 = new CONSTANT_InvokeDynamic_info(cp2, info.bootstrap_method_attr_index, info.name_and_type_index);
   10.33 +            }
   10.34 +            translations.put(info, info2);
   10.35 +        }
   10.36 +        return info;
   10.37 +    }
   10.38 +
   10.39      public CPInfo visitLong(CONSTANT_Long_info info, Map<Object, Object> translations) {
   10.40          CONSTANT_Long_info info2 = (CONSTANT_Long_info) translations.get(info);
   10.41          if (info2 == null) {
   10.42 @@ -339,6 +356,34 @@
   10.43          return info;
   10.44      }
   10.45  
   10.46 +    public CPInfo visitMethodHandle(CONSTANT_MethodHandle_info info, Map<Object, Object> translations) {
   10.47 +        CONSTANT_MethodHandle_info info2 = (CONSTANT_MethodHandle_info) translations.get(info);
   10.48 +        if (info2 == null) {
   10.49 +            ConstantPool cp2 = translate(info.cp, translations);
   10.50 +            if (cp2 == info.cp) {
   10.51 +                info2 = info;
   10.52 +            } else {
   10.53 +                info2 = new CONSTANT_MethodHandle_info(cp2, info.reference_kind, info.reference_index);
   10.54 +            }
   10.55 +            translations.put(info, info2);
   10.56 +        }
   10.57 +        return info;
   10.58 +    }
   10.59 +
   10.60 +    public CPInfo visitMethodType(CONSTANT_MethodType_info info, Map<Object, Object> translations) {
   10.61 +        CONSTANT_MethodType_info info2 = (CONSTANT_MethodType_info) translations.get(info);
   10.62 +        if (info2 == null) {
   10.63 +            ConstantPool cp2 = translate(info.cp, translations);
   10.64 +            if (cp2 == info.cp) {
   10.65 +                info2 = info;
   10.66 +            } else {
   10.67 +                info2 = new CONSTANT_MethodType_info(cp2, info.descriptor_index);
   10.68 +            }
   10.69 +            translations.put(info, info2);
   10.70 +        }
   10.71 +        return info;
   10.72 +    }
   10.73 +
   10.74      public CPInfo visitString(CONSTANT_String_info info, Map<Object, Object> translations) {
   10.75          CONSTANT_String_info info2 = (CONSTANT_String_info) translations.get(info);
   10.76          if (info2 == null) {
    11.1 --- a/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Thu Jan 27 17:28:57 2011 -0800
    11.2 +++ b/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Fri Jan 28 10:06:08 2011 -0800
    11.3 @@ -1,6 +1,6 @@
    11.4  
    11.5  /*
    11.6 - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
    11.7 + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
    11.8   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.9   *
   11.10   * This code is free software; you can redistribute it and/or modify it
   11.11 @@ -267,6 +267,12 @@
   11.12              return 1;
   11.13          }
   11.14  
   11.15 +        public Integer visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, ClassOutputStream out) {
   11.16 +            out.writeShort(info.bootstrap_method_attr_index);
   11.17 +            out.writeShort(info.name_and_type_index);
   11.18 +            return 1;
   11.19 +        }
   11.20 +
   11.21          public Integer visitLong(CONSTANT_Long_info info, ClassOutputStream out) {
   11.22              out.writeLong(info.value);
   11.23              return 2;
   11.24 @@ -278,6 +284,17 @@
   11.25              return 1;
   11.26          }
   11.27  
   11.28 +        public Integer visitMethodHandle(CONSTANT_MethodHandle_info info, ClassOutputStream out) {
   11.29 +            out.writeByte(info.reference_kind.tag);
   11.30 +            out.writeShort(info.reference_index);
   11.31 +            return 1;
   11.32 +        }
   11.33 +
   11.34 +        public Integer visitMethodType(CONSTANT_MethodType_info info, ClassOutputStream out) {
   11.35 +            out.writeShort(info.descriptor_index);
   11.36 +            return 1;
   11.37 +        }
   11.38 +
   11.39          public Integer visitMethodref(CONSTANT_Methodref_info info, ClassOutputStream out) {
   11.40              return writeRef(info, out);
   11.41          }
   11.42 @@ -332,6 +349,19 @@
   11.43              return null;
   11.44          }
   11.45  
   11.46 +        public Void visitBootstrapMethods(BootstrapMethods_attribute attr, ClassOutputStream out) {
   11.47 +            out.writeShort(attr.bootstrap_method_specifiers.length);
   11.48 +            for (BootstrapMethods_attribute.BootstrapMethodSpecifier bsm : attr.bootstrap_method_specifiers) {
   11.49 +                out.writeShort(bsm.bootstrap_method_ref);
   11.50 +                int bsm_args_count = bsm.bootstrap_arguments.length;
   11.51 +                out.writeShort(bsm_args_count);
   11.52 +                for (int i : bsm.bootstrap_arguments) {
   11.53 +                    out.writeShort(i);
   11.54 +                }
   11.55 +            }
   11.56 +            return null;
   11.57 +        }
   11.58 +
   11.59          public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr, ClassOutputStream out) {
   11.60              out.writeShort(attr.character_range_table.length);
   11.61              for (CharacterRangeTable_attribute.Entry e: attr.character_range_table)
   11.62 @@ -459,16 +489,6 @@
   11.63              return null;
   11.64          }
   11.65  
   11.66 -        public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
   11.67 -            annotationWriter.write(attr.annotations, out);
   11.68 -            return null;
   11.69 -        }
   11.70 -
   11.71 -        public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
   11.72 -            annotationWriter.write(attr.annotations, out);
   11.73 -            return null;
   11.74 -        }
   11.75 -
   11.76          public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, ClassOutputStream out) {
   11.77              out.writeByte(attr.parameter_annotations.length);
   11.78              for (Annotation[] annos: attr.parameter_annotations)
   11.79 @@ -628,12 +648,6 @@
   11.80                  write(anno, out);
   11.81          }
   11.82  
   11.83 -        public void write(ExtendedAnnotation[] annos, ClassOutputStream out) {
   11.84 -            out.writeShort(annos.length);
   11.85 -            for (ExtendedAnnotation anno: annos)
   11.86 -                write(anno, out);
   11.87 -        }
   11.88 -
   11.89          public void write(Annotation anno, ClassOutputStream out) {
   11.90              out.writeShort(anno.type_index);
   11.91              out.writeShort(anno.element_value_pairs.length);
   11.92 @@ -641,11 +655,6 @@
   11.93                  write(p, out);
   11.94          }
   11.95  
   11.96 -        public void write(ExtendedAnnotation anno, ClassOutputStream out) {
   11.97 -            write(anno.annotation, out);
   11.98 -            write(anno.position, out);
   11.99 -        }
  11.100 -
  11.101          public void write(element_value_pair pair, ClassOutputStream out) {
  11.102              out.writeShort(pair.element_name_index);
  11.103              write(pair.value, out);
  11.104 @@ -684,95 +693,5 @@
  11.105              return null;
  11.106          }
  11.107  
  11.108 -        private void write(ExtendedAnnotation.Position p, ClassOutputStream out) {
  11.109 -            out.writeByte(p.type.targetTypeValue());
  11.110 -            switch (p.type) {
  11.111 -            // type case
  11.112 -            case TYPECAST:
  11.113 -            case TYPECAST_GENERIC_OR_ARRAY:
  11.114 -            // object creation
  11.115 -            case INSTANCEOF:
  11.116 -            case INSTANCEOF_GENERIC_OR_ARRAY:
  11.117 -            // new expression
  11.118 -            case NEW:
  11.119 -            case NEW_GENERIC_OR_ARRAY:
  11.120 -            case NEW_TYPE_ARGUMENT:
  11.121 -            case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
  11.122 -                out.writeShort(p.offset);
  11.123 -                break;
  11.124 -             // local variable
  11.125 -            case LOCAL_VARIABLE:
  11.126 -            case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
  11.127 -                int table_length = p.lvarOffset.length;
  11.128 -                out.writeShort(table_length);
  11.129 -                for (int i = 0; i < table_length; ++i) {
  11.130 -                    out.writeShort(1);  // for table length
  11.131 -                    out.writeShort(p.lvarOffset[i]);
  11.132 -                    out.writeShort(p.lvarLength[i]);
  11.133 -                    out.writeShort(p.lvarIndex[i]);
  11.134 -                }
  11.135 -                break;
  11.136 -             // method receiver
  11.137 -            case METHOD_RECEIVER:
  11.138 -                // Do nothing
  11.139 -                break;
  11.140 -            // type parameters
  11.141 -            case CLASS_TYPE_PARAMETER:
  11.142 -            case METHOD_TYPE_PARAMETER:
  11.143 -                out.writeByte(p.parameter_index);
  11.144 -                break;
  11.145 -            // type parameters bounds
  11.146 -            case CLASS_TYPE_PARAMETER_BOUND:
  11.147 -            case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
  11.148 -            case METHOD_TYPE_PARAMETER_BOUND:
  11.149 -            case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
  11.150 -                out.writeByte(p.parameter_index);
  11.151 -                out.writeByte(p.bound_index);
  11.152 -                break;
  11.153 -             // wildcards
  11.154 -            case WILDCARD_BOUND:
  11.155 -            case WILDCARD_BOUND_GENERIC_OR_ARRAY:
  11.156 -                write(p.wildcard_position, out);
  11.157 -                break;
  11.158 -            // Class extends and implements clauses
  11.159 -            case CLASS_EXTENDS:
  11.160 -            case CLASS_EXTENDS_GENERIC_OR_ARRAY:
  11.161 -                out.writeByte(p.type_index);
  11.162 -                break;
  11.163 -            // throws
  11.164 -            case THROWS:
  11.165 -                out.writeByte(p.type_index);
  11.166 -                break;
  11.167 -            case CLASS_LITERAL:
  11.168 -            case CLASS_LITERAL_GENERIC_OR_ARRAY:
  11.169 -                out.writeShort(p.offset);
  11.170 -                break;
  11.171 -            // method parameter: not specified
  11.172 -            case METHOD_PARAMETER_GENERIC_OR_ARRAY:
  11.173 -                out.writeByte(p.parameter_index);
  11.174 -                break;
  11.175 -            // method type argument: wasn't specified
  11.176 -            case METHOD_TYPE_ARGUMENT:
  11.177 -            case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
  11.178 -                out.writeShort(p.offset);
  11.179 -                out.writeByte(p.type_index);
  11.180 -                break;
  11.181 -            // We don't need to worry abut these
  11.182 -            case METHOD_RETURN_GENERIC_OR_ARRAY:
  11.183 -            case FIELD_GENERIC_OR_ARRAY:
  11.184 -                break;
  11.185 -            case UNKNOWN:
  11.186 -                break;
  11.187 -            default:
  11.188 -                throw new AssertionError("unknown type: " + p);
  11.189 -            }
  11.190 -
  11.191 -            // Append location data for generics/arrays.
  11.192 -            if (p.type.hasLocation()) {
  11.193 -                out.writeShort(p.location.size());
  11.194 -                for (int i : p.location)
  11.195 -                    out.writeByte((byte)i);
  11.196 -            }
  11.197 -        }
  11.198      }
  11.199  }
    12.1 --- a/src/share/classes/com/sun/tools/classfile/ConstantPool.java	Thu Jan 27 17:28:57 2011 -0800
    12.2 +++ b/src/share/classes/com/sun/tools/classfile/ConstantPool.java	Fri Jan 28 10:06:08 2011 -0800
    12.3 @@ -1,5 +1,5 @@
    12.4  /*
    12.5 - * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
    12.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
    12.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.8   *
    12.9   * This code is free software; you can redistribute it and/or modify it
   12.10 @@ -114,6 +114,54 @@
   12.11      public static final int CONSTANT_Methodref = 10;
   12.12      public static final int CONSTANT_InterfaceMethodref = 11;
   12.13      public static final int CONSTANT_NameAndType = 12;
   12.14 +    public static final int CONSTANT_MethodHandle = 15;
   12.15 +    public static final int CONSTANT_MethodType = 16;
   12.16 +    public static final int CONSTANT_InvokeDynamic = 18;
   12.17 +
   12.18 +    public static enum RefKind {
   12.19 +        REF_getField(1, "getfield"),
   12.20 +        REF_getStatic(2, "getstatic"),
   12.21 +        REF_putField(3, "putfield"),
   12.22 +        REF_putStatic(4, "putstatic"),
   12.23 +        REF_invokeVirtual(5, "invokevirtual"),
   12.24 +        REF_invokeStatic(6, "invokestatic"),
   12.25 +        REF_invokeSpecial(7, "invokespecial"),
   12.26 +        REF_newInvokeSpecial(8, "newinvokespecial"),
   12.27 +        REF_invokeInterface(9, "invokeinterface");
   12.28 +
   12.29 +        public final int tag;
   12.30 +        public final String name;
   12.31 +
   12.32 +        RefKind(int tag, String name) {
   12.33 +            this.tag = tag;
   12.34 +            this.name = name;
   12.35 +        }
   12.36 +
   12.37 +        static RefKind getRefkind(int tag) {
   12.38 +            switch(tag) {
   12.39 +                case 1:
   12.40 +                    return REF_getField;
   12.41 +                case 2:
   12.42 +                    return REF_getStatic;
   12.43 +                case 3:
   12.44 +                    return REF_putField;
   12.45 +                case 4:
   12.46 +                    return REF_putStatic;
   12.47 +                case 5:
   12.48 +                    return REF_invokeVirtual;
   12.49 +                case 6:
   12.50 +                    return REF_invokeStatic;
   12.51 +                case 7:
   12.52 +                    return REF_invokeSpecial;
   12.53 +                case 8:
   12.54 +                    return REF_newInvokeSpecial;
   12.55 +                case 9:
   12.56 +                    return REF_invokeInterface;
   12.57 +                default:
   12.58 +                    return null;
   12.59 +            }
   12.60 +        }
   12.61 +    }
   12.62  
   12.63      ConstantPool(ClassReader cr) throws IOException, InvalidEntry {
   12.64          int count = cr.readUnsignedShort();
   12.65 @@ -146,11 +194,23 @@
   12.66                  pool[i] = new CONSTANT_InterfaceMethodref_info(this, cr);
   12.67                  break;
   12.68  
   12.69 +            case CONSTANT_InvokeDynamic:
   12.70 +                pool[i] = new CONSTANT_InvokeDynamic_info(this, cr);
   12.71 +                break;
   12.72 +
   12.73              case CONSTANT_Long:
   12.74                  pool[i] = new CONSTANT_Long_info(cr);
   12.75                  i++;
   12.76                  break;
   12.77  
   12.78 +            case CONSTANT_MethodHandle:
   12.79 +                pool[i] = new CONSTANT_MethodHandle_info(this, cr);
   12.80 +                break;
   12.81 +
   12.82 +            case CONSTANT_MethodType:
   12.83 +                pool[i] = new CONSTANT_MethodType_info(this, cr);
   12.84 +                break;
   12.85 +
   12.86              case CONSTANT_Methodref:
   12.87                  pool[i] = new CONSTANT_Methodref_info(this, cr);
   12.88                  break;
   12.89 @@ -279,9 +339,12 @@
   12.90          R visitFloat(CONSTANT_Float_info info, P p);
   12.91          R visitInteger(CONSTANT_Integer_info info, P p);
   12.92          R visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, P p);
   12.93 +        R visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, P p);
   12.94          R visitLong(CONSTANT_Long_info info, P p);
   12.95          R visitNameAndType(CONSTANT_NameAndType_info info, P p);
   12.96          R visitMethodref(CONSTANT_Methodref_info info, P p);
   12.97 +        R visitMethodHandle(CONSTANT_MethodHandle_info info, P p);
   12.98 +        R visitMethodType(CONSTANT_MethodType_info info, P p);
   12.99          R visitString(CONSTANT_String_info info, P p);
  12.100          R visitUtf8(CONSTANT_Utf8_info info, P p);
  12.101      }
  12.102 @@ -548,6 +611,44 @@
  12.103          }
  12.104      }
  12.105  
  12.106 +    public static class CONSTANT_InvokeDynamic_info extends CPInfo {
  12.107 +        CONSTANT_InvokeDynamic_info(ConstantPool cp, ClassReader cr) throws IOException {
  12.108 +            super(cp);
  12.109 +            bootstrap_method_attr_index = cr.readUnsignedShort();
  12.110 +            name_and_type_index = cr.readUnsignedShort();
  12.111 +        }
  12.112 +
  12.113 +        public CONSTANT_InvokeDynamic_info(ConstantPool cp, int bootstrap_method_index, int name_and_type_index) {
  12.114 +            super(cp);
  12.115 +            this.bootstrap_method_attr_index = bootstrap_method_index;
  12.116 +            this.name_and_type_index = name_and_type_index;
  12.117 +        }
  12.118 +
  12.119 +        public int getTag() {
  12.120 +            return CONSTANT_InvokeDynamic;
  12.121 +        }
  12.122 +
  12.123 +        public int byteLength() {
  12.124 +            return 5;
  12.125 +        }
  12.126 +
  12.127 +        @Override
  12.128 +        public String toString() {
  12.129 +            return "CONSTANT_InvokeDynamic_info[bootstrap_method_index: " + bootstrap_method_attr_index + ", name_and_type_index: " + name_and_type_index + "]";
  12.130 +        }
  12.131 +
  12.132 +        public <R, D> R accept(Visitor<R, D> visitor, D data) {
  12.133 +            return visitor.visitInvokeDynamic(this, data);
  12.134 +        }
  12.135 +
  12.136 +        public CONSTANT_NameAndType_info getNameAndTypeInfo() throws ConstantPoolException {
  12.137 +            return cp.getNameAndTypeInfo(name_and_type_index);
  12.138 +        }
  12.139 +
  12.140 +        public final int bootstrap_method_attr_index;
  12.141 +        public final int name_and_type_index;
  12.142 +    }
  12.143 +
  12.144      public static class CONSTANT_Long_info extends CPInfo {
  12.145          CONSTANT_Long_info(ClassReader cr) throws IOException {
  12.146              value = cr.readLong();
  12.147 @@ -582,6 +683,87 @@
  12.148          public final long value;
  12.149      }
  12.150  
  12.151 +    public static class CONSTANT_MethodHandle_info extends CPInfo {
  12.152 +        CONSTANT_MethodHandle_info(ConstantPool cp, ClassReader cr) throws IOException {
  12.153 +            super(cp);
  12.154 +            reference_kind =  RefKind.getRefkind(cr.readUnsignedByte());
  12.155 +            reference_index = cr.readUnsignedShort();
  12.156 +        }
  12.157 +
  12.158 +        public CONSTANT_MethodHandle_info(ConstantPool cp, RefKind ref_kind, int member_index) {
  12.159 +            super(cp);
  12.160 +            this.reference_kind = ref_kind;
  12.161 +            this.reference_index = member_index;
  12.162 +        }
  12.163 +
  12.164 +        public int getTag() {
  12.165 +            return CONSTANT_MethodHandle;
  12.166 +        }
  12.167 +
  12.168 +        public int byteLength() {
  12.169 +            return 4;
  12.170 +        }
  12.171 +
  12.172 +        @Override
  12.173 +        public String toString() {
  12.174 +            return "CONSTANT_MethodHandle_info[ref_kind: " + reference_kind + ", member_index: " + reference_index + "]";
  12.175 +        }
  12.176 +
  12.177 +        public <R, D> R accept(Visitor<R, D> visitor, D data) {
  12.178 +            return visitor.visitMethodHandle(this, data);
  12.179 +        }
  12.180 +
  12.181 +        public CPRefInfo getCPRefInfo() throws ConstantPoolException {
  12.182 +            int expected = CONSTANT_Methodref;
  12.183 +            int actual = cp.get(reference_index).getTag();
  12.184 +            // allow these tag types also:
  12.185 +            switch (actual) {
  12.186 +                case CONSTANT_Fieldref:
  12.187 +                case CONSTANT_InterfaceMethodref:
  12.188 +                    expected = actual;
  12.189 +            }
  12.190 +            return (CPRefInfo) cp.get(reference_index, expected);
  12.191 +        }
  12.192 +
  12.193 +        public final RefKind reference_kind;
  12.194 +        public final int reference_index;
  12.195 +    }
  12.196 +
  12.197 +    public static class CONSTANT_MethodType_info extends CPInfo {
  12.198 +        CONSTANT_MethodType_info(ConstantPool cp, ClassReader cr) throws IOException {
  12.199 +            super(cp);
  12.200 +            descriptor_index = cr.readUnsignedShort();
  12.201 +        }
  12.202 +
  12.203 +        public CONSTANT_MethodType_info(ConstantPool cp, int signature_index) {
  12.204 +            super(cp);
  12.205 +            this.descriptor_index = signature_index;
  12.206 +        }
  12.207 +
  12.208 +        public int getTag() {
  12.209 +            return CONSTANT_MethodType;
  12.210 +        }
  12.211 +
  12.212 +        public int byteLength() {
  12.213 +            return 3;
  12.214 +        }
  12.215 +
  12.216 +        @Override
  12.217 +        public String toString() {
  12.218 +            return "CONSTANT_MethodType_info[signature_index: " + descriptor_index + "]";
  12.219 +        }
  12.220 +
  12.221 +        public <R, D> R accept(Visitor<R, D> visitor, D data) {
  12.222 +            return visitor.visitMethodType(this, data);
  12.223 +        }
  12.224 +
  12.225 +        public String getType() throws ConstantPoolException {
  12.226 +            return cp.getUTF8Value(descriptor_index);
  12.227 +        }
  12.228 +
  12.229 +        public final int descriptor_index;
  12.230 +    }
  12.231 +
  12.232      public static class CONSTANT_Methodref_info extends CPRefInfo {
  12.233          CONSTANT_Methodref_info(ConstantPool cp, ClassReader cr) throws IOException {
  12.234              super(cp, cr, CONSTANT_Methodref);
  12.235 @@ -729,5 +911,4 @@
  12.236          public final String value;
  12.237      }
  12.238  
  12.239 -
  12.240  }
    13.1 --- a/src/share/classes/com/sun/tools/classfile/Dependencies.java	Thu Jan 27 17:28:57 2011 -0800
    13.2 +++ b/src/share/classes/com/sun/tools/classfile/Dependencies.java	Fri Jan 28 10:06:08 2011 -0800
    13.3 @@ -1,5 +1,5 @@
    13.4  /*
    13.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    13.6 + * Copyright (c) 2009, 2011 Oracle and/or its affiliates. All rights reserved.
    13.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.8   *
    13.9   * This code is free software; you can redistribute it and/or modify it
   13.10 @@ -626,10 +626,26 @@
   13.11                  return visitRef(info, p);
   13.12              }
   13.13  
   13.14 +            public Void visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
   13.15 +                return null;
   13.16 +            }
   13.17 +
   13.18              public Void visitLong(CONSTANT_Long_info info, Void p) {
   13.19                  return null;
   13.20              }
   13.21  
   13.22 +            public Void visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
   13.23 +                return null;
   13.24 +            }
   13.25 +
   13.26 +            public Void visitMethodType(CONSTANT_MethodType_info info, Void p) {
   13.27 +                return null;
   13.28 +            }
   13.29 +
   13.30 +            public Void visitMethodref(CONSTANT_Methodref_info info, Void p) {
   13.31 +                return visitRef(info, p);
   13.32 +            }
   13.33 +
   13.34              public Void visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
   13.35                  try {
   13.36                      new Signature(info.type_index).getType(constant_pool).accept(this, null);
   13.37 @@ -639,10 +655,6 @@
   13.38                  }
   13.39              }
   13.40  
   13.41 -            public Void visitMethodref(CONSTANT_Methodref_info info, Void p) {
   13.42 -                return visitRef(info, p);
   13.43 -            }
   13.44 -
   13.45              public Void visitString(CONSTANT_String_info info, Void p) {
   13.46                  return null;
   13.47              }
    14.1 --- a/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java	Thu Jan 27 17:28:57 2011 -0800
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,612 +0,0 @@
    14.4 -/*
    14.5 - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
    14.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    14.7 - *
    14.8 - * This code is free software; you can redistribute it and/or modify it
    14.9 - * under the terms of the GNU General Public License version 2 only, as
   14.10 - * published by the Free Software Foundation.  Oracle designates this
   14.11 - * particular file as subject to the "Classpath" exception as provided
   14.12 - * by Oracle in the LICENSE file that accompanied this code.
   14.13 - *
   14.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   14.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   14.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   14.17 - * version 2 for more details (a copy is included in the LICENSE file that
   14.18 - * accompanied this code).
   14.19 - *
   14.20 - * You should have received a copy of the GNU General Public License version
   14.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   14.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   14.23 - *
   14.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   14.25 - * or visit www.oracle.com if you need additional information or have any
   14.26 - * questions.
   14.27 - */
   14.28 -
   14.29 -package com.sun.tools.classfile;
   14.30 -
   14.31 -import java.io.IOException;
   14.32 -import java.util.ArrayList;
   14.33 -import java.util.EnumSet;
   14.34 -import java.util.List;
   14.35 -import java.util.Set;
   14.36 -
   14.37 -import static com.sun.tools.classfile.ExtendedAnnotation.TargetAttribute.*;
   14.38 -
   14.39 -/**
   14.40 - * See JSR 308 specification, section 4.1
   14.41 - *
   14.42 - *  <p><b>This is NOT part of any supported API.
   14.43 - *  If you write code that depends on this, you do so at your own risk.
   14.44 - *  This code and its internal interfaces are subject to change or
   14.45 - *  deletion without notice.</b>
   14.46 - */
   14.47 -public class ExtendedAnnotation {
   14.48 -    ExtendedAnnotation(ClassReader cr) throws IOException, Annotation.InvalidAnnotation {
   14.49 -        annotation = new Annotation(cr);
   14.50 -        position = read_position(cr);
   14.51 -    }
   14.52 -
   14.53 -    public ExtendedAnnotation(ConstantPool constant_pool,
   14.54 -            Annotation annotation, Position position) {
   14.55 -        this.annotation = annotation;
   14.56 -        this.position = position;
   14.57 -    }
   14.58 -
   14.59 -    public int length() {
   14.60 -        int n = annotation.length();
   14.61 -        n += position_length(position);
   14.62 -        return n;
   14.63 -    }
   14.64 -
   14.65 -    public final Annotation annotation;
   14.66 -    public final Position position;
   14.67 -
   14.68 -    private static Position read_position(ClassReader cr) throws IOException, Annotation.InvalidAnnotation {
   14.69 -        // Copied from ClassReader
   14.70 -        int tag = (byte)cr.readUnsignedByte();  // cast to introduce signedness
   14.71 -        if (!TargetType.isValidTargetTypeValue(tag))
   14.72 -            throw new Annotation.InvalidAnnotation("invalid type annotation target type value: " + tag);
   14.73 -
   14.74 -        TargetType type = TargetType.fromTargetTypeValue(tag);
   14.75 -
   14.76 -        Position position = new Position();
   14.77 -        position.type = type;
   14.78 -
   14.79 -        switch (type) {
   14.80 -        // type case
   14.81 -        case TYPECAST:
   14.82 -        case TYPECAST_GENERIC_OR_ARRAY:
   14.83 -        // object creation
   14.84 -        case INSTANCEOF:
   14.85 -        case INSTANCEOF_GENERIC_OR_ARRAY:
   14.86 -        // new expression
   14.87 -        case NEW:
   14.88 -        case NEW_GENERIC_OR_ARRAY:
   14.89 -            position.offset = cr.readUnsignedShort();
   14.90 -            break;
   14.91 -         // local variable
   14.92 -        case LOCAL_VARIABLE:
   14.93 -        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
   14.94 -            int table_length = cr.readUnsignedShort();
   14.95 -            position.lvarOffset = new int[table_length];
   14.96 -            position.lvarLength = new int[table_length];
   14.97 -            position.lvarIndex = new int[table_length];
   14.98 -            for (int i = 0; i < table_length; ++i) {
   14.99 -                position.lvarOffset[i] = cr.readUnsignedShort();
  14.100 -                position.lvarLength[i] = cr.readUnsignedShort();
  14.101 -                position.lvarIndex[i] = cr.readUnsignedShort();
  14.102 -            }
  14.103 -            break;
  14.104 -         // method receiver
  14.105 -        case METHOD_RECEIVER:
  14.106 -            // Do nothing
  14.107 -            break;
  14.108 -        // type parameters
  14.109 -        case CLASS_TYPE_PARAMETER:
  14.110 -        case METHOD_TYPE_PARAMETER:
  14.111 -            position.parameter_index = cr.readUnsignedByte();
  14.112 -            break;
  14.113 -        // type parameter bounds
  14.114 -        case CLASS_TYPE_PARAMETER_BOUND:
  14.115 -        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
  14.116 -        case METHOD_TYPE_PARAMETER_BOUND:
  14.117 -        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
  14.118 -            position.parameter_index = cr.readUnsignedByte();
  14.119 -            position.bound_index = cr.readUnsignedByte();
  14.120 -            break;
  14.121 -         // wildcards
  14.122 -        case WILDCARD_BOUND:
  14.123 -        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
  14.124 -            position.wildcard_position = read_position(cr);
  14.125 -            break;
  14.126 -         // Class extends and implements clauses
  14.127 -        case CLASS_EXTENDS:
  14.128 -        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
  14.129 -            int in = cr.readUnsignedShort();
  14.130 -            if (in == 0xFFFF)
  14.131 -                in = -1;
  14.132 -            position.type_index = in;
  14.133 -            break;
  14.134 -        // throws
  14.135 -        case THROWS:
  14.136 -            position.type_index = cr.readUnsignedShort();
  14.137 -            break;
  14.138 -        case CLASS_LITERAL:
  14.139 -        case CLASS_LITERAL_GENERIC_OR_ARRAY:
  14.140 -            position.offset = cr.readUnsignedShort();
  14.141 -            break;
  14.142 -        // method parameter: not specified
  14.143 -        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
  14.144 -            position.parameter_index = cr.readUnsignedByte();
  14.145 -            break;
  14.146 -        // method type argument: wasn't specified
  14.147 -        case NEW_TYPE_ARGUMENT:
  14.148 -        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
  14.149 -        case METHOD_TYPE_ARGUMENT:
  14.150 -        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
  14.151 -            position.offset = cr.readUnsignedShort();
  14.152 -            position.type_index = cr.readUnsignedByte();
  14.153 -            break;
  14.154 -        // We don't need to worry abut these
  14.155 -        case METHOD_RETURN_GENERIC_OR_ARRAY:
  14.156 -        case FIELD_GENERIC_OR_ARRAY:
  14.157 -            break;
  14.158 -        case UNKNOWN:
  14.159 -            break;
  14.160 -        default:
  14.161 -            throw new AssertionError("Cannot be here");
  14.162 -        }
  14.163 -
  14.164 -        if (type.hasLocation()) {
  14.165 -            int len = cr.readUnsignedShort();
  14.166 -            List<Integer> loc = new ArrayList<Integer>(len);
  14.167 -            for (int i = 0; i < len; i++)
  14.168 -                loc.add(cr.readUnsignedByte());
  14.169 -            position.location = loc;
  14.170 -        }
  14.171 -        return position;
  14.172 -    }
  14.173 -
  14.174 -    private static int position_length(Position pos) {
  14.175 -        int n = 0;
  14.176 -        n += 1; // target_type
  14.177 -        switch (pos.type) {
  14.178 -        // type case
  14.179 -        case TYPECAST:
  14.180 -        case TYPECAST_GENERIC_OR_ARRAY:
  14.181 -        // object creation
  14.182 -        case INSTANCEOF:
  14.183 -        case INSTANCEOF_GENERIC_OR_ARRAY:
  14.184 -        // new expression
  14.185 -        case NEW:
  14.186 -        case NEW_GENERIC_OR_ARRAY:
  14.187 -            n += 2;
  14.188 -            break;
  14.189 -         // local variable
  14.190 -        case LOCAL_VARIABLE:
  14.191 -        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
  14.192 -            n += 2; // table_length;
  14.193 -            int table_length = pos.lvarOffset.length;
  14.194 -            n += 2 * table_length; // offset
  14.195 -            n += 2 * table_length; // length;
  14.196 -            n += 2 * table_length; // index
  14.197 -            break;
  14.198 -         // method receiver
  14.199 -        case METHOD_RECEIVER:
  14.200 -            // Do nothing
  14.201 -            break;
  14.202 -        // type parameters
  14.203 -        case CLASS_TYPE_PARAMETER:
  14.204 -        case METHOD_TYPE_PARAMETER:
  14.205 -            n += 1; // parameter_index;
  14.206 -            break;
  14.207 -        // type parameter bounds
  14.208 -        case CLASS_TYPE_PARAMETER_BOUND:
  14.209 -        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
  14.210 -        case METHOD_TYPE_PARAMETER_BOUND:
  14.211 -        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
  14.212 -            n += 1; // parameter_index
  14.213 -            n += 1; // bound_index
  14.214 -            break;
  14.215 -        case WILDCARD_BOUND:
  14.216 -        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
  14.217 -            n += position_length(pos.wildcard_position);
  14.218 -            break;
  14.219 -         // Class extends and implements clauses
  14.220 -        case CLASS_EXTENDS:
  14.221 -        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
  14.222 -            n += 2; // type_index
  14.223 -            break;
  14.224 -        // throws
  14.225 -        case THROWS:
  14.226 -            n += 2; // type_index
  14.227 -            break;
  14.228 -        case CLASS_LITERAL:
  14.229 -        case CLASS_LITERAL_GENERIC_OR_ARRAY:
  14.230 -            n += 1; // offset
  14.231 -            break;
  14.232 -        // method parameter: not specified
  14.233 -        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
  14.234 -            n += 1; // parameter_index
  14.235 -            break;
  14.236 -        // method type argument: wasn't specified
  14.237 -        case NEW_TYPE_ARGUMENT:
  14.238 -        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
  14.239 -        case METHOD_TYPE_ARGUMENT:
  14.240 -        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
  14.241 -            n += 2; // offset
  14.242 -            n += 1; // type index
  14.243 -            break;
  14.244 -        // We don't need to worry abut these
  14.245 -        case METHOD_RETURN_GENERIC_OR_ARRAY:
  14.246 -        case FIELD_GENERIC_OR_ARRAY:
  14.247 -            break;
  14.248 -        case UNKNOWN:
  14.249 -            break;
  14.250 -        default:
  14.251 -        }
  14.252 -
  14.253 -        if (pos.type.hasLocation()) {
  14.254 -            n += 2; // length
  14.255 -            n += 1 * pos.location.size(); // actual array size
  14.256 -        }
  14.257 -
  14.258 -        return n;
  14.259 -    }
  14.260 -
  14.261 -    // Code duplicated from com.sun.tools.javac.code.TypeAnnotations.Position
  14.262 -    public static class Position {
  14.263 -
  14.264 -        public TargetType type = TargetType.UNKNOWN;
  14.265 -
  14.266 -        // For generic/array types.
  14.267 -        public List<Integer> location = new ArrayList<Integer>();
  14.268 -
  14.269 -        // For typecasts, type tests, new (and locals, as start_pc).
  14.270 -        public int offset = -1;
  14.271 -
  14.272 -        // For locals.
  14.273 -        public int[] lvarOffset = null;
  14.274 -        public int[] lvarLength = null;
  14.275 -        public int[] lvarIndex = null;
  14.276 -
  14.277 -        // For type parameter bound
  14.278 -        public int bound_index = Integer.MIN_VALUE;
  14.279 -
  14.280 -        // For type parameter and method parameter
  14.281 -        public int parameter_index = Integer.MIN_VALUE;
  14.282 -
  14.283 -        // For class extends, implements, and throws classes
  14.284 -        public int type_index = Integer.MIN_VALUE;
  14.285 -
  14.286 -        // For wildcards
  14.287 -        public Position wildcard_position = null;
  14.288 -
  14.289 -        @Override
  14.290 -        public String toString() {
  14.291 -            StringBuilder sb = new StringBuilder();
  14.292 -            sb.append('[');
  14.293 -            sb.append(type);
  14.294 -
  14.295 -            switch (type) {
  14.296 -            // type case
  14.297 -            case TYPECAST:
  14.298 -            case TYPECAST_GENERIC_OR_ARRAY:
  14.299 -            // object creation
  14.300 -            case INSTANCEOF:
  14.301 -            case INSTANCEOF_GENERIC_OR_ARRAY:
  14.302 -            // new expression
  14.303 -            case NEW:
  14.304 -            case NEW_GENERIC_OR_ARRAY:
  14.305 -            case NEW_TYPE_ARGUMENT:
  14.306 -            case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
  14.307 -                sb.append(", offset = ");
  14.308 -                sb.append(offset);
  14.309 -                break;
  14.310 -             // local variable
  14.311 -            case LOCAL_VARIABLE:
  14.312 -            case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
  14.313 -                sb.append(", {");
  14.314 -                for (int i = 0; i < lvarOffset.length; ++i) {
  14.315 -                    if (i != 0) sb.append("; ");
  14.316 -                    sb.append(", start_pc = ");
  14.317 -                    sb.append(lvarOffset[i]);
  14.318 -                    sb.append(", length = ");
  14.319 -                    sb.append(lvarLength[i]);
  14.320 -                    sb.append(", index = ");
  14.321 -                    sb.append(lvarIndex[i]);
  14.322 -                }
  14.323 -                sb.append("}");
  14.324 -                break;
  14.325 -             // method receiver
  14.326 -            case METHOD_RECEIVER:
  14.327 -                // Do nothing
  14.328 -                break;
  14.329 -            // type parameters
  14.330 -            case CLASS_TYPE_PARAMETER:
  14.331 -            case METHOD_TYPE_PARAMETER:
  14.332 -                sb.append(", param_index = ");
  14.333 -                sb.append(parameter_index);
  14.334 -                break;
  14.335 -            // type parameters bound
  14.336 -            case CLASS_TYPE_PARAMETER_BOUND:
  14.337 -            case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
  14.338 -            case METHOD_TYPE_PARAMETER_BOUND:
  14.339 -            case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
  14.340 -                sb.append(", param_index = ");
  14.341 -                sb.append(parameter_index);
  14.342 -                sb.append(", bound_index = ");
  14.343 -                sb.append(bound_index);
  14.344 -                break;
  14.345 -             // wildcard
  14.346 -            case WILDCARD_BOUND:
  14.347 -            case WILDCARD_BOUND_GENERIC_OR_ARRAY:
  14.348 -                sb.append(", wild_card = ");
  14.349 -                sb.append(wildcard_position);
  14.350 -                break;
  14.351 -             // Class extends and implements clauses
  14.352 -            case CLASS_EXTENDS:
  14.353 -            case CLASS_EXTENDS_GENERIC_OR_ARRAY:
  14.354 -                sb.append(", type_index = ");
  14.355 -                sb.append(type_index);
  14.356 -                break;
  14.357 -            // throws
  14.358 -            case THROWS:
  14.359 -                sb.append(", type_index = ");
  14.360 -                sb.append(type_index);
  14.361 -                break;
  14.362 -            case CLASS_LITERAL:
  14.363 -            case CLASS_LITERAL_GENERIC_OR_ARRAY:
  14.364 -                sb.append(", offset = ");
  14.365 -                sb.append(offset);
  14.366 -                break;
  14.367 -            // method parameter: not specified
  14.368 -            case METHOD_PARAMETER_GENERIC_OR_ARRAY:
  14.369 -                sb.append(", param_index = ");
  14.370 -                sb.append(parameter_index);
  14.371 -                break;
  14.372 -            // method type argument: wasn't specified
  14.373 -            case METHOD_TYPE_ARGUMENT:
  14.374 -            case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
  14.375 -                sb.append(", offset = ");
  14.376 -                sb.append(offset);
  14.377 -                sb.append(", type_index = ");
  14.378 -                sb.append(type_index);
  14.379 -                break;
  14.380 -            // We don't need to worry abut these
  14.381 -            case METHOD_RETURN_GENERIC_OR_ARRAY:
  14.382 -            case FIELD_GENERIC_OR_ARRAY:
  14.383 -                break;
  14.384 -            case UNKNOWN:
  14.385 -                break;
  14.386 -            default:
  14.387 -                throw new AssertionError("unknown type: " + type);
  14.388 -            }
  14.389 -
  14.390 -            // Append location data for generics/arrays.
  14.391 -            if (type.hasLocation()) {
  14.392 -                sb.append(", location = (");
  14.393 -                sb.append(location);
  14.394 -                sb.append(")");
  14.395 -            }
  14.396 -
  14.397 -            sb.append(']');
  14.398 -            return sb.toString();
  14.399 -        }
  14.400 -    }
  14.401 -
  14.402 -    // Code duplicated from com.sun.tools.javac.comp.TargetType
  14.403 -    public enum TargetType {
  14.404 -
  14.405 -        /** For annotations on typecasts. */
  14.406 -        TYPECAST(0x00),
  14.407 -
  14.408 -        /** For annotations on a type argument or nested array of a typecast. */
  14.409 -        TYPECAST_GENERIC_OR_ARRAY(0x01, HasLocation),
  14.410 -
  14.411 -        /** For annotations on type tests. */
  14.412 -        INSTANCEOF(0x02),
  14.413 -
  14.414 -        /** For annotations on a type argument or nested array of a type test. */
  14.415 -        INSTANCEOF_GENERIC_OR_ARRAY(0x03, HasLocation),
  14.416 -
  14.417 -        /** For annotations on object creation expressions. */
  14.418 -        NEW(0x04),
  14.419 -
  14.420 -        /**
  14.421 -         * For annotations on a type argument or nested array of an object creation
  14.422 -         * expression.
  14.423 -         */
  14.424 -        NEW_GENERIC_OR_ARRAY(0x05, HasLocation),
  14.425 -
  14.426 -
  14.427 -        /** For annotations on the method receiver. */
  14.428 -        METHOD_RECEIVER(0x06),
  14.429 -
  14.430 -        // invalid location
  14.431 -        // METHOD_RECEIVER_GENERIC_OR_ARRAY(0x07, HasLocation),
  14.432 -
  14.433 -        /** For annotations on local variables. */
  14.434 -        LOCAL_VARIABLE(0x08),
  14.435 -
  14.436 -        /** For annotations on a type argument or nested array of a local. */
  14.437 -        LOCAL_VARIABLE_GENERIC_OR_ARRAY(0x09, HasLocation),
  14.438 -
  14.439 -        // already handled by regular annotations
  14.440 -        // METHOD_RETURN(0x0A),
  14.441 -
  14.442 -        /**
  14.443 -         * For annotations on a type argument or nested array of a method return
  14.444 -         * type.
  14.445 -         */
  14.446 -        METHOD_RETURN_GENERIC_OR_ARRAY(0x0B, HasLocation),
  14.447 -
  14.448 -        // already handled by regular annotations
  14.449 -        // METHOD_PARAMETER(0x0C),
  14.450 -
  14.451 -        /** For annotations on a type argument or nested array of a method parameter. */
  14.452 -        METHOD_PARAMETER_GENERIC_OR_ARRAY(0x0D, HasLocation),
  14.453 -
  14.454 -        // already handled by regular annotations
  14.455 -        // FIELD(0x0E),
  14.456 -
  14.457 -        /** For annotations on a type argument or nested array of a field. */
  14.458 -        FIELD_GENERIC_OR_ARRAY(0x0F, HasLocation),
  14.459 -
  14.460 -        /** For annotations on a bound of a type parameter of a class. */
  14.461 -        CLASS_TYPE_PARAMETER_BOUND(0x10, HasBound, HasParameter),
  14.462 -
  14.463 -        /**
  14.464 -         * For annotations on a type argument or nested array of a bound of a type
  14.465 -         * parameter of a class.
  14.466 -         */
  14.467 -        CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY(0x11, HasBound, HasLocation, HasParameter),
  14.468 -
  14.469 -        /** For annotations on a bound of a type parameter of a method. */
  14.470 -        METHOD_TYPE_PARAMETER_BOUND(0x12, HasBound, HasParameter),
  14.471 -
  14.472 -        /**
  14.473 -         * For annotations on a type argument or nested array of a bound of a type
  14.474 -         * parameter of a method.
  14.475 -         */
  14.476 -        METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY(0x13, HasBound, HasLocation, HasParameter),
  14.477 -
  14.478 -        /** For annotations on the type of an "extends" or "implements" clause. */
  14.479 -        CLASS_EXTENDS(0x14),
  14.480 -
  14.481 -        /** For annotations on the inner type of an "extends" or "implements" clause. */
  14.482 -        CLASS_EXTENDS_GENERIC_OR_ARRAY(0x15, HasLocation),
  14.483 -
  14.484 -        /** For annotations on a throws clause in a method declaration. */
  14.485 -        THROWS(0x16),
  14.486 -
  14.487 -        // invalid location
  14.488 -        // THROWS_GENERIC_OR_ARRAY(0x17, HasLocation),
  14.489 -
  14.490 -        /** For annotations in type arguments of object creation expressions. */
  14.491 -        NEW_TYPE_ARGUMENT(0x18),
  14.492 -        NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY(0x19, HasLocation),
  14.493 -
  14.494 -        METHOD_TYPE_ARGUMENT(0x1A),
  14.495 -        METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY(0x1B, HasLocation),
  14.496 -
  14.497 -        WILDCARD_BOUND(0x1C, HasBound),
  14.498 -        WILDCARD_BOUND_GENERIC_OR_ARRAY(0x1D, HasBound, HasLocation),
  14.499 -
  14.500 -        CLASS_LITERAL(0x1E),
  14.501 -        CLASS_LITERAL_GENERIC_OR_ARRAY(0x1F, HasLocation),
  14.502 -
  14.503 -        METHOD_TYPE_PARAMETER(0x20, HasParameter),
  14.504 -
  14.505 -        // invalid location
  14.506 -        // METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY(0x21, HasLocation, HasParameter),
  14.507 -
  14.508 -        CLASS_TYPE_PARAMETER(0x22, HasParameter),
  14.509 -
  14.510 -        // invalid location
  14.511 -        // CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY(0x23, HasLocation, HasParameter),
  14.512 -
  14.513 -        /** For annotations with an unknown target. */
  14.514 -        UNKNOWN(-1);
  14.515 -
  14.516 -        static final int MAXIMUM_TARGET_TYPE_VALUE = 0x22;
  14.517 -
  14.518 -        private final int targetTypeValue;
  14.519 -        private Set<TargetAttribute> flags;
  14.520 -
  14.521 -        TargetType(int targetTypeValue, TargetAttribute... attrs) {
  14.522 -            if (targetTypeValue < Byte.MIN_VALUE
  14.523 -                || targetTypeValue > Byte.MAX_VALUE)
  14.524 -                throw new AssertionError("attribute type value needs to be a byte: " + targetTypeValue);
  14.525 -            this.targetTypeValue = (byte)targetTypeValue;
  14.526 -            this.flags = EnumSet.noneOf(TargetAttribute.class);
  14.527 -            for (TargetAttribute attr : attrs)
  14.528 -                this.flags.add(attr);
  14.529 -        }
  14.530 -
  14.531 -        /**
  14.532 -         * Returns whether or not this TargetType represents an annotation whose
  14.533 -         * target is an inner type of a generic or array type.
  14.534 -         *
  14.535 -         * @return true if this TargetType represents an annotation on an inner
  14.536 -         *         type, false otherwise
  14.537 -         */
  14.538 -        public boolean hasLocation() {
  14.539 -            return flags.contains(HasLocation);
  14.540 -        }
  14.541 -
  14.542 -        public TargetType getGenericComplement() {
  14.543 -            if (hasLocation())
  14.544 -                return this;
  14.545 -            else
  14.546 -                return fromTargetTypeValue(targetTypeValue() + 1);
  14.547 -        }
  14.548 -
  14.549 -        /**
  14.550 -         * Returns whether or not this TargetType represents an annotation whose
  14.551 -         * target has a parameter index.
  14.552 -         *
  14.553 -         * @return true if this TargetType has a parameter index,
  14.554 -         *         false otherwise
  14.555 -         */
  14.556 -        public boolean hasParameter() {
  14.557 -            return flags.contains(HasParameter);
  14.558 -        }
  14.559 -
  14.560 -        /**
  14.561 -         * Returns whether or not this TargetType represents an annotation whose
  14.562 -         * target is a type parameter bound.
  14.563 -         *
  14.564 -         * @return true if this TargetType represents an type parameter bound
  14.565 -         *         annotation, false otherwise
  14.566 -         */
  14.567 -        public boolean hasBound() {
  14.568 -            return flags.contains(HasBound);
  14.569 -        }
  14.570 -
  14.571 -        public int targetTypeValue() {
  14.572 -            return this.targetTypeValue;
  14.573 -        }
  14.574 -
  14.575 -        private static TargetType[] targets = null;
  14.576 -
  14.577 -        private static TargetType[] buildTargets() {
  14.578 -            TargetType[] targets = new TargetType[MAXIMUM_TARGET_TYPE_VALUE + 1];
  14.579 -            TargetType[] alltargets = values();
  14.580 -            for (TargetType target : alltargets)
  14.581 -                if (target.targetTypeValue >= 0)
  14.582 -                    targets[target.targetTypeValue] = target;
  14.583 -            for (int i = 0; i <= MAXIMUM_TARGET_TYPE_VALUE; ++i)
  14.584 -                if (targets[i] == null)
  14.585 -                    targets[i] = UNKNOWN;
  14.586 -            return targets;
  14.587 -        }
  14.588 -
  14.589 -        public static boolean isValidTargetTypeValue(int tag) {
  14.590 -            if (targets == null)
  14.591 -                targets = buildTargets();
  14.592 -
  14.593 -            if (((byte)tag) == ((byte)UNKNOWN.targetTypeValue))
  14.594 -                return true;
  14.595 -
  14.596 -            return (tag >= 0 && tag < targets.length);
  14.597 -        }
  14.598 -
  14.599 -        public static TargetType fromTargetTypeValue(int tag) {
  14.600 -            if (targets == null)
  14.601 -                targets = buildTargets();
  14.602 -
  14.603 -            if (((byte)tag) == ((byte)UNKNOWN.targetTypeValue))
  14.604 -                return UNKNOWN;
  14.605 -
  14.606 -            if (tag < 0 || tag >= targets.length)
  14.607 -                throw new IllegalArgumentException("Unknown TargetType: " + tag);
  14.608 -            return targets[tag];
  14.609 -        }
  14.610 -    }
  14.611 -
  14.612 -    static enum TargetAttribute {
  14.613 -        HasLocation, HasParameter, HasBound;
  14.614 -    }
  14.615 -}
    15.1 --- a/src/share/classes/com/sun/tools/classfile/RuntimeInvisibleTypeAnnotations_attribute.java	Thu Jan 27 17:28:57 2011 -0800
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,56 +0,0 @@
    15.4 -/*
    15.5 - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
    15.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    15.7 - *
    15.8 - * This code is free software; you can redistribute it and/or modify it
    15.9 - * under the terms of the GNU General Public License version 2 only, as
   15.10 - * published by the Free Software Foundation.  Oracle designates this
   15.11 - * particular file as subject to the "Classpath" exception as provided
   15.12 - * by Oracle in the LICENSE file that accompanied this code.
   15.13 - *
   15.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   15.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   15.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   15.17 - * version 2 for more details (a copy is included in the LICENSE file that
   15.18 - * accompanied this code).
   15.19 - *
   15.20 - * You should have received a copy of the GNU General Public License version
   15.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   15.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   15.23 - *
   15.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   15.25 - * or visit www.oracle.com if you need additional information or have any
   15.26 - * questions.
   15.27 - */
   15.28 -
   15.29 -package com.sun.tools.classfile;
   15.30 -
   15.31 -import java.io.IOException;
   15.32 -
   15.33 -/**
   15.34 - * See JSR 308 specification, section 4.1
   15.35 - *
   15.36 - *  <p><b>This is NOT part of any supported API.
   15.37 - *  If you write code that depends on this, you do so at your own risk.
   15.38 - *  This code and its internal interfaces are subject to change or
   15.39 - *  deletion without notice.</b>
   15.40 - */
   15.41 -public class RuntimeInvisibleTypeAnnotations_attribute extends RuntimeTypeAnnotations_attribute {
   15.42 -    RuntimeInvisibleTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
   15.43 -            throws IOException, Annotation.InvalidAnnotation {
   15.44 -        super(cr, name_index, length);
   15.45 -    }
   15.46 -
   15.47 -    public RuntimeInvisibleTypeAnnotations_attribute(ConstantPool cp, ExtendedAnnotation[] annotations)
   15.48 -            throws ConstantPoolException {
   15.49 -        this(cp.getUTF8Index(Attribute.RuntimeInvisibleTypeAnnotations), annotations);
   15.50 -    }
   15.51 -
   15.52 -    public RuntimeInvisibleTypeAnnotations_attribute(int name_index, ExtendedAnnotation[] annotations) {
   15.53 -        super(name_index, annotations);
   15.54 -    }
   15.55 -
   15.56 -    public <R, P> R accept(Visitor<R, P> visitor, P p) {
   15.57 -        return visitor.visitRuntimeInvisibleTypeAnnotations(this, p);
   15.58 -    }
   15.59 -}
    16.1 --- a/src/share/classes/com/sun/tools/classfile/RuntimeTypeAnnotations_attribute.java	Thu Jan 27 17:28:57 2011 -0800
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,61 +0,0 @@
    16.4 -/*
    16.5 - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
    16.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.7 - *
    16.8 - * This code is free software; you can redistribute it and/or modify it
    16.9 - * under the terms of the GNU General Public License version 2 only, as
   16.10 - * published by the Free Software Foundation.  Oracle designates this
   16.11 - * particular file as subject to the "Classpath" exception as provided
   16.12 - * by Oracle in the LICENSE file that accompanied this code.
   16.13 - *
   16.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   16.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   16.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   16.17 - * version 2 for more details (a copy is included in the LICENSE file that
   16.18 - * accompanied this code).
   16.19 - *
   16.20 - * You should have received a copy of the GNU General Public License version
   16.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   16.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   16.23 - *
   16.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   16.25 - * or visit www.oracle.com if you need additional information or have any
   16.26 - * questions.
   16.27 - */
   16.28 -
   16.29 -package com.sun.tools.classfile;
   16.30 -
   16.31 -import java.io.IOException;
   16.32 -
   16.33 -/**
   16.34 - * See JSR 308 specification, section 4
   16.35 - *
   16.36 - *  <p><b>This is NOT part of any supported API.
   16.37 - *  If you write code that depends on this, you do so at your own risk.
   16.38 - *  This code and its internal interfaces are subject to change or
   16.39 - *  deletion without notice.</b>
   16.40 - */
   16.41 -public abstract class RuntimeTypeAnnotations_attribute extends Attribute {
   16.42 -    protected RuntimeTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
   16.43 -            throws IOException, Annotation.InvalidAnnotation {
   16.44 -        super(name_index, length);
   16.45 -        int num_annotations = cr.readUnsignedShort();
   16.46 -        annotations = new ExtendedAnnotation[num_annotations];
   16.47 -        for (int i = 0; i < annotations.length; i++)
   16.48 -            annotations[i] = new ExtendedAnnotation(cr);
   16.49 -    }
   16.50 -
   16.51 -    protected RuntimeTypeAnnotations_attribute(int name_index, ExtendedAnnotation[] annotations) {
   16.52 -        super(name_index, length(annotations));
   16.53 -        this.annotations = annotations;
   16.54 -    }
   16.55 -
   16.56 -    private static int length(ExtendedAnnotation[] annos) {
   16.57 -        int n = 2;
   16.58 -        for (ExtendedAnnotation anno: annos)
   16.59 -            n += anno.length();
   16.60 -        return n;
   16.61 -    }
   16.62 -
   16.63 -    public final ExtendedAnnotation[] annotations;
   16.64 -}
    17.1 --- a/src/share/classes/com/sun/tools/classfile/RuntimeVisibleTypeAnnotations_attribute.java	Thu Jan 27 17:28:57 2011 -0800
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,56 +0,0 @@
    17.4 -/*
    17.5 - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
    17.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    17.7 - *
    17.8 - * This code is free software; you can redistribute it and/or modify it
    17.9 - * under the terms of the GNU General Public License version 2 only, as
   17.10 - * published by the Free Software Foundation.  Oracle designates this
   17.11 - * particular file as subject to the "Classpath" exception as provided
   17.12 - * by Oracle in the LICENSE file that accompanied this code.
   17.13 - *
   17.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   17.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   17.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   17.17 - * version 2 for more details (a copy is included in the LICENSE file that
   17.18 - * accompanied this code).
   17.19 - *
   17.20 - * You should have received a copy of the GNU General Public License version
   17.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   17.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   17.23 - *
   17.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   17.25 - * or visit www.oracle.com if you need additional information or have any
   17.26 - * questions.
   17.27 - */
   17.28 -
   17.29 -package com.sun.tools.classfile;
   17.30 -
   17.31 -import java.io.IOException;
   17.32 -
   17.33 -/**
   17.34 - * See JSR 308 specification, section 4.1
   17.35 - *
   17.36 - *  <p><b>This is NOT part of any supported API.
   17.37 - *  If you write code that depends on this, you do so at your own risk.
   17.38 - *  This code and its internal interfaces are subject to change or
   17.39 - *  deletion without notice.</b>
   17.40 - */
   17.41 -public class RuntimeVisibleTypeAnnotations_attribute extends RuntimeTypeAnnotations_attribute {
   17.42 -    RuntimeVisibleTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
   17.43 -            throws IOException, Annotation.InvalidAnnotation {
   17.44 -        super(cr, name_index, length);
   17.45 -    }
   17.46 -
   17.47 -    public RuntimeVisibleTypeAnnotations_attribute(ConstantPool cp, ExtendedAnnotation[] annotations)
   17.48 -            throws ConstantPoolException {
   17.49 -        this(cp.getUTF8Index(Attribute.RuntimeVisibleTypeAnnotations), annotations);
   17.50 -    }
   17.51 -
   17.52 -    public RuntimeVisibleTypeAnnotations_attribute(int name_index, ExtendedAnnotation[] annotations) {
   17.53 -        super(name_index, annotations);
   17.54 -    }
   17.55 -
   17.56 -    public <R, P> R accept(Visitor<R, P> visitor, P p) {
   17.57 -        return visitor.visitRuntimeVisibleTypeAnnotations(this, p);
   17.58 -    }
   17.59 -}
    18.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Thu Jan 27 17:28:57 2011 -0800
    18.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Fri Jan 28 10:06:08 2011 -0800
    18.3 @@ -755,22 +755,30 @@
    18.4          if (!isInline() && !endsWithNewLine(contentBuilder))
    18.5              contentBuilder.append(DocletConstants.NL);
    18.6          String tagString = htmlTag.toString();
    18.7 -        contentBuilder.append("<" + tagString);
    18.8 +        contentBuilder.append("<");
    18.9 +        contentBuilder.append(tagString);
   18.10          Iterator<HtmlAttr> iterator = attrs.keySet().iterator();
   18.11          HtmlAttr key;
   18.12          String value = "";
   18.13          while (iterator.hasNext()) {
   18.14              key = iterator.next();
   18.15              value = attrs.get(key);
   18.16 -            contentBuilder.append(" " + key.toString());
   18.17 -            if (!value.isEmpty())
   18.18 -                contentBuilder.append("=\"" + value + "\"");
   18.19 +            contentBuilder.append(" ");
   18.20 +            contentBuilder.append(key.toString());
   18.21 +            if (!value.isEmpty()) {
   18.22 +                contentBuilder.append("=\"");
   18.23 +                contentBuilder.append(value);
   18.24 +                contentBuilder.append("\"");
   18.25 +            }
   18.26          }
   18.27          contentBuilder.append(">");
   18.28          for (Content c : content)
   18.29              c.write(contentBuilder);
   18.30 -        if (htmlTag.endTagRequired())
   18.31 -            contentBuilder.append("</" + tagString + ">");
   18.32 +        if (htmlTag.endTagRequired()) {
   18.33 +            contentBuilder.append("</");
   18.34 +            contentBuilder.append(tagString);
   18.35 +            contentBuilder.append(">");
   18.36 +        }
   18.37          if (!isInline())
   18.38              contentBuilder.append(DocletConstants.NL);
   18.39      }
    19.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java	Thu Jan 27 17:28:57 2011 -0800
    19.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java	Fri Jan 28 10:06:08 2011 -0800
    19.3 @@ -99,8 +99,24 @@
    19.4       * @param contentBuilder content to test for newline character at the end
    19.5       * @return true if the content ends with newline.
    19.6       */
    19.7 -    public boolean endsWithNewLine(StringBuilder contentBuilder) {
    19.8 -        return ((contentBuilder.length() == 0) ||
    19.9 -                (contentBuilder.toString().endsWith(DocletConstants.NL)));
   19.10 +    protected boolean endsWithNewLine(StringBuilder contentBuilder) {
   19.11 +        int contentLength = contentBuilder.length();
   19.12 +        if (contentLength == 0) {
   19.13 +            return true;
   19.14 +        }
   19.15 +        int nlLength = DocletConstants.NL.length();
   19.16 +        if (contentLength < nlLength) {
   19.17 +            return false;
   19.18 +        }
   19.19 +        int contentIndex = contentLength - 1;
   19.20 +        int nlIndex = nlLength - 1;
   19.21 +        while (nlIndex >= 0) {
   19.22 +            if (contentBuilder.charAt(contentIndex) != DocletConstants.NL.charAt(nlIndex)) {
   19.23 +                return false;
   19.24 +            }
   19.25 +            contentIndex--;
   19.26 +            nlIndex--;
   19.27 +        }
   19.28 +        return true;
   19.29      }
   19.30  }
    20.1 --- a/src/share/classes/com/sun/tools/javac/Main.java	Thu Jan 27 17:28:57 2011 -0800
    20.2 +++ b/src/share/classes/com/sun/tools/javac/Main.java	Fri Jan 28 10:06:08 2011 -0800
    20.3 @@ -1,5 +1,5 @@
    20.4  /*
    20.5 - * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
    20.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    20.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.8   *
    20.9   * This code is free software; you can redistribute it and/or modify it
   20.10 @@ -43,12 +43,6 @@
   20.11   */
   20.12  public class Main {
   20.13  
   20.14 -    static {
   20.15 -        ClassLoader loader = Main.class.getClassLoader();
   20.16 -        if (loader != null)
   20.17 -            loader.setPackageAssertionStatus("com.sun.tools.javac", true);
   20.18 -    }
   20.19 -
   20.20      /** Unsupported command line interface.
   20.21       * @param args   The command line parameters.
   20.22       */
    21.1 --- a/src/share/classes/com/sun/tools/javac/code/Attribute.java	Thu Jan 27 17:28:57 2011 -0800
    21.2 +++ b/src/share/classes/com/sun/tools/javac/code/Attribute.java	Fri Jan 28 10:06:08 2011 -0800
    21.3 @@ -1,5 +1,5 @@
    21.4  /*
    21.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    21.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    21.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    21.8   *
    21.9   * This code is free software; you can redistribute it and/or modify it
   21.10 @@ -204,21 +204,6 @@
   21.11          }
   21.12      }
   21.13  
   21.14 -    public static class TypeCompound extends Compound {
   21.15 -        public TypeAnnotationPosition position;
   21.16 -        public TypeCompound(Compound compound,
   21.17 -                TypeAnnotationPosition position) {
   21.18 -            this(compound.type, compound.values, position);
   21.19 -        }
   21.20 -        public TypeCompound(Type type,
   21.21 -                List<Pair<MethodSymbol, Attribute>> values,
   21.22 -                TypeAnnotationPosition position) {
   21.23 -            super(type, values);
   21.24 -            this.position = position;
   21.25 -        }
   21.26 -
   21.27 -    }
   21.28 -
   21.29      /** The value for an annotation element of an array type.
   21.30       */
   21.31      public static class Array extends Attribute {
   21.32 @@ -255,8 +240,7 @@
   21.33          public VarSymbol value;
   21.34          public Enum(Type type, VarSymbol value) {
   21.35              super(type);
   21.36 -            assert value != null;
   21.37 -            this.value = value;
   21.38 +            this.value = Assert.checkNonNull(value);
   21.39          }
   21.40          public void accept(Visitor v) { v.visitEnum(this); }
   21.41          public String toString() {
    22.1 --- a/src/share/classes/com/sun/tools/javac/code/Scope.java	Thu Jan 27 17:28:57 2011 -0800
    22.2 +++ b/src/share/classes/com/sun/tools/javac/code/Scope.java	Fri Jan 28 10:06:08 2011 -0800
    22.3 @@ -1,5 +1,5 @@
    22.4  /*
    22.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    22.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    22.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    22.8   *
    22.9   * This code is free software; you can redistribute it and/or modify it
   22.10 @@ -133,7 +133,7 @@
   22.11       */
   22.12      private Scope(Scope next, Symbol owner, Entry[] table, ScopeCounter scopeCounter) {
   22.13          this.next = next;
   22.14 -        assert emptyScope == null || owner != null;
   22.15 +        Assert.check(emptyScope == null || owner != null);
   22.16          this.owner = owner;
   22.17          this.table = table;
   22.18          this.hashMask = table.length - 1;
   22.19 @@ -191,16 +191,16 @@
   22.20       *  with next.
   22.21       */
   22.22      public Scope leave() {
   22.23 -        assert shared == 0;
   22.24 +        Assert.check(shared == 0);
   22.25          if (table != next.table) return next;
   22.26          while (elems != null) {
   22.27              int hash = getIndex(elems.sym.name);
   22.28              Entry e = table[hash];
   22.29 -            assert e == elems : elems.sym;
   22.30 +            Assert.check(e == elems, elems.sym);
   22.31              table[hash] = elems.shadowed;
   22.32              elems = elems.sibling;
   22.33          }
   22.34 -        assert next.shared > 0;
   22.35 +        Assert.check(next.shared > 0);
   22.36          next.shared--;
   22.37          next.nelems = nelems;
   22.38          // System.out.println("====> leaving scope " + this.hashCode() + " owned by " + this.owner + " to " + next.hashCode());
   22.39 @@ -211,12 +211,12 @@
   22.40      /** Double size of hash table.
   22.41       */
   22.42      private void dble() {
   22.43 -        assert shared == 0;
   22.44 +        Assert.check(shared == 0);
   22.45          Entry[] oldtable = table;
   22.46          Entry[] newtable = new Entry[oldtable.length * 2];
   22.47          for (Scope s = this; s != null; s = s.next) {
   22.48              if (s.table == oldtable) {
   22.49 -                assert s == this || s.shared != 0;
   22.50 +                Assert.check(s == this || s.shared != 0);
   22.51                  s.table = newtable;
   22.52                  s.hashMask = newtable.length - 1;
   22.53              }
   22.54 @@ -237,7 +237,7 @@
   22.55      /** Enter symbol sym in this scope.
   22.56       */
   22.57      public void enter(Symbol sym) {
   22.58 -        assert shared == 0;
   22.59 +        Assert.check(shared == 0);
   22.60          enter(sym, this);
   22.61      }
   22.62  
   22.63 @@ -251,7 +251,7 @@
   22.64       * arguments are only used in import scopes.
   22.65       */
   22.66      public void enter(Symbol sym, Scope s, Scope origin) {
   22.67 -        assert shared == 0;
   22.68 +        Assert.check(shared == 0);
   22.69          if (nelems * 3 >= hashMask * 2)
   22.70              dble();
   22.71          int hash = getIndex(sym.name);
   22.72 @@ -274,7 +274,7 @@
   22.73       *  attribute tells us that the class isn't a package member.
   22.74       */
   22.75      public void remove(Symbol sym) {
   22.76 -        assert shared == 0;
   22.77 +        Assert.check(shared == 0);
   22.78          Entry e = lookup(sym.name);
   22.79          if (e.scope == null) return;
   22.80  
   22.81 @@ -314,7 +314,7 @@
   22.82      /** Enter symbol sym in this scope if not already there.
   22.83       */
   22.84      public void enterIfAbsent(Symbol sym) {
   22.85 -        assert shared == 0;
   22.86 +        Assert.check(shared == 0);
   22.87          Entry e = lookup(sym.name);
   22.88          while (e.scope == this && e.sym.kind != sym.kind) e = e.next();
   22.89          if (e.scope != this) enter(sym);
    23.1 --- a/src/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Jan 27 17:28:57 2011 -0800
    23.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java	Fri Jan 28 10:06:08 2011 -0800
    23.3 @@ -1,5 +1,5 @@
    23.4  /*
    23.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    23.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    23.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    23.8   *
    23.9   * This code is free software; you can redistribute it and/or modify it
   23.10 @@ -81,8 +81,7 @@
   23.11       *  method to make sure that the class symbol is loaded.
   23.12       */
   23.13      public List<Attribute.Compound> getAnnotationMirrors() {
   23.14 -        assert attributes_field != null;
   23.15 -        return attributes_field;
   23.16 +        return Assert.checkNonNull(attributes_field);
   23.17      }
   23.18  
   23.19      /** Fetch a particular annotation from a symbol. */
   23.20 @@ -100,17 +99,6 @@
   23.21       */
   23.22      public Type type;
   23.23  
   23.24 -    /** The type annotations targeted to a tree directly owned by this symbol
   23.25 -     */
   23.26 -    // type annotations are stored here for two purposes:
   23.27 -    //  - convenient location to store annotations for generation after erasure
   23.28 -    //  - a private interface for accessing type annotations parsed from
   23.29 -    //    classfiles
   23.30 -    //  the field is populated for the following declaration only
   23.31 -    //  class, field, variable and type parameters
   23.32 -    //
   23.33 -    public List<Attribute.TypeCompound> typeAnnotations;
   23.34 -
   23.35      /** The owner of this symbol.
   23.36       */
   23.37      public Symbol owner;
   23.38 @@ -133,7 +121,6 @@
   23.39          this.completer = null;
   23.40          this.erasure_field = null;
   23.41          this.attributes_field = List.nil();
   23.42 -        this.typeAnnotations = List.nil();
   23.43          this.name = name;
   23.44      }
   23.45  
   23.46 @@ -608,7 +595,7 @@
   23.47          }
   23.48  
   23.49          public <R, P> R accept(ElementVisitor<R, P> v, P p) {
   23.50 -            assert type.tag == TYPEVAR; // else override will be invoked
   23.51 +            Assert.check(type.tag == TYPEVAR); // else override will be invoked
   23.52              return v.visitTypeParameter(this, p);
   23.53          }
   23.54  
   23.55 @@ -682,8 +669,7 @@
   23.56                  if (attributes_field.isEmpty())
   23.57                      attributes_field = package_info.attributes_field;
   23.58              }
   23.59 -            assert attributes_field != null;
   23.60 -            return attributes_field;
   23.61 +            return Assert.checkNonNull(attributes_field);
   23.62          }
   23.63  
   23.64          /** A package "exists" if a type or package that exists has
   23.65 @@ -780,8 +766,7 @@
   23.66  
   23.67          public List<Attribute.Compound> getAnnotationMirrors() {
   23.68              if (completer != null) complete();
   23.69 -            assert attributes_field != null;
   23.70 -            return attributes_field;
   23.71 +            return Assert.checkNonNull(attributes_field);
   23.72          }
   23.73  
   23.74          public Type erasure(Types types) {
   23.75 @@ -1032,7 +1017,7 @@
   23.76          }
   23.77  
   23.78          public void setData(Object data) {
   23.79 -            assert !(data instanceof Env<?>) : this;
   23.80 +            Assert.check(!(data instanceof Env<?>), this);
   23.81              this.data = data;
   23.82          }
   23.83  
   23.84 @@ -1064,7 +1049,7 @@
   23.85           */
   23.86          public MethodSymbol(long flags, Name name, Type type, Symbol owner) {
   23.87              super(MTH, flags, name, type, owner);
   23.88 -            assert owner.type.tag != TYPEVAR : owner + "." + name;
   23.89 +            if (owner.type.tag == TYPEVAR) Assert.error(owner + "." + name);
   23.90          }
   23.91  
   23.92          /** Clone this symbol with new owner.
    24.1 --- a/src/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Jan 27 17:28:57 2011 -0800
    24.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symtab.java	Fri Jan 28 10:06:08 2011 -0800
    24.3 @@ -126,7 +126,6 @@
    24.4      public final Type serializableType;
    24.5      public final Type methodHandleType;
    24.6      public final Type polymorphicSignatureType;
    24.7 -    public final Type invokeDynamicType;
    24.8      public final Type throwableType;
    24.9      public final Type errorType;
   24.10      public final Type illegalArgumentExceptionType;
   24.11 @@ -422,7 +421,6 @@
   24.12          serializableType = enterClass("java.io.Serializable");
   24.13          methodHandleType = enterClass("java.dyn.MethodHandle");
   24.14          polymorphicSignatureType = enterClass("java.dyn.MethodHandle$PolymorphicSignature");
   24.15 -        invokeDynamicType = enterClass("java.dyn.InvokeDynamic");
   24.16          errorType = enterClass("java.lang.Error");
   24.17          illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
   24.18          exceptionType = enterClass("java.lang.Exception");
    25.1 --- a/src/share/classes/com/sun/tools/javac/code/Type.java	Thu Jan 27 17:28:57 2011 -0800
    25.2 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java	Fri Jan 28 10:06:08 2011 -0800
    25.3 @@ -1,5 +1,5 @@
    25.4  /*
    25.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    25.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    25.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    25.8   *
    25.9   * This code is free software; you can redistribute it and/or modify it
   25.10 @@ -138,7 +138,7 @@
   25.11       */
   25.12      public Type constType(Object constValue) {
   25.13          final Object value = constValue;
   25.14 -        assert tag <= BOOLEAN;
   25.15 +        Assert.check(tag <= BOOLEAN);
   25.16          return new Type(tag, tsym) {
   25.17                  @Override
   25.18                  public Object constValue() {
   25.19 @@ -202,13 +202,13 @@
   25.20       * The constant value of this type, converted to String
   25.21       */
   25.22      public String stringValue() {
   25.23 -        assert constValue() != null;
   25.24 +        Object cv = Assert.checkNonNull(constValue());
   25.25          if (tag == BOOLEAN)
   25.26 -            return ((Integer) constValue()).intValue() == 0 ? "false" : "true";
   25.27 +            return ((Integer) cv).intValue() == 0 ? "false" : "true";
   25.28          else if (tag == CHAR)
   25.29 -            return String.valueOf((char) ((Integer) constValue()).intValue());
   25.30 +            return String.valueOf((char) ((Integer) cv).intValue());
   25.31          else
   25.32 -            return constValue().toString();
   25.33 +            return cv.toString();
   25.34      }
   25.35  
   25.36      /**
   25.37 @@ -365,6 +365,16 @@
   25.38          return false;
   25.39      }
   25.40  
   25.41 +    public static List<Type> filter(List<Type> ts, Filter<Type> tf) {
   25.42 +        ListBuffer<Type> buf = ListBuffer.lb();
   25.43 +        for (Type t : ts) {
   25.44 +            if (tf.accepts(t)) {
   25.45 +                buf.append(t);
   25.46 +            }
   25.47 +        }
   25.48 +        return buf.toList();
   25.49 +    }
   25.50 +
   25.51      public boolean isSuperBound() { return false; }
   25.52      public boolean isExtendsBound() { return false; }
   25.53      public boolean isUnbound() { return false; }
   25.54 @@ -428,9 +438,8 @@
   25.55  
   25.56          public WildcardType(Type type, BoundKind kind, TypeSymbol tsym) {
   25.57              super(WILDCARD, tsym);
   25.58 -            assert(type != null);
   25.59 +            this.type = Assert.checkNonNull(type);
   25.60              this.kind = kind;
   25.61 -            this.type = type;
   25.62          }
   25.63          public WildcardType(WildcardType t, TypeVar bound) {
   25.64              this(t.type, t.kind, t.tsym, bound);
   25.65 @@ -1021,9 +1030,8 @@
   25.66                              Type lower,
   25.67                              WildcardType wildcard) {
   25.68              super(name, owner, lower);
   25.69 -            assert lower != null;
   25.70 +            this.lower = Assert.checkNonNull(lower);
   25.71              this.bound = upper;
   25.72 -            this.lower = lower;
   25.73              this.wildcard = wildcard;
   25.74          }
   25.75  
    26.1 --- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Thu Jan 27 17:28:57 2011 -0800
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,403 +0,0 @@
    26.4 -/*
    26.5 - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
    26.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    26.7 - *
    26.8 - * This code is free software; you can redistribute it and/or modify it
    26.9 - * under the terms of the GNU General Public License version 2 only, as
   26.10 - * published by the Free Software Foundation.  Oracle designates this
   26.11 - * particular file as subject to the "Classpath" exception as provided
   26.12 - * by Oracle in the LICENSE file that accompanied this code.
   26.13 - *
   26.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   26.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   26.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   26.17 - * version 2 for more details (a copy is included in the LICENSE file that
   26.18 - * accompanied this code).
   26.19 - *
   26.20 - * You should have received a copy of the GNU General Public License version
   26.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   26.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   26.23 - *
   26.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   26.25 - * or visit www.oracle.com if you need additional information or have any
   26.26 - * questions.
   26.27 - */
   26.28 -
   26.29 -package com.sun.tools.javac.code;
   26.30 -
   26.31 -import javax.lang.model.element.ElementKind;
   26.32 -
   26.33 -import com.sun.tools.javac.code.Symbol.VarSymbol;
   26.34 -import com.sun.tools.javac.tree.JCTree;
   26.35 -import com.sun.tools.javac.tree.TreeInfo;
   26.36 -import com.sun.tools.javac.tree.TreeScanner;
   26.37 -import com.sun.tools.javac.tree.JCTree.*;
   26.38 -import com.sun.tools.javac.util.Context;
   26.39 -import com.sun.tools.javac.util.List;
   26.40 -import com.sun.tools.javac.util.ListBuffer;
   26.41 -
   26.42 -/**
   26.43 - * Contains operations specific to processing type annotations
   26.44 - */
   26.45 -public class TypeAnnotations {
   26.46 -    private static final Context.Key<TypeAnnotations> key
   26.47 -        = new Context.Key<TypeAnnotations>();
   26.48 -
   26.49 -    public static TypeAnnotations instance(Context context) {
   26.50 -        TypeAnnotations instance = context.get(key);
   26.51 -        if (instance == null)
   26.52 -            instance = new TypeAnnotations(context);
   26.53 -        return instance;
   26.54 -    }
   26.55 -
   26.56 -    protected TypeAnnotations(Context context) {
   26.57 -        context.put(key, this);
   26.58 -    }
   26.59 -
   26.60 -    public void taFillAndLift(JCClassDecl tree, boolean visitBodies) {
   26.61 -//308        new TypeAnnotationPositions().scan(tree);
   26.62 -//308        new TypeAnnotationLift().scan(tree);
   26.63 -    }
   26.64 -
   26.65 -    private static class TypeAnnotationPositions extends TreeScanner {
   26.66 -
   26.67 -        private ListBuffer<JCTree> frames = ListBuffer.lb();
   26.68 -        private void push(JCTree t) { frames = frames.prepend(t); }
   26.69 -        private JCTree pop() { return frames.next(); }
   26.70 -        private JCTree peek2() { return frames.toList().tail.head; }
   26.71 -
   26.72 -        @Override
   26.73 -        public void scan(JCTree tree) {
   26.74 -            push(tree);
   26.75 -            super.scan(tree);
   26.76 -            pop();
   26.77 -        }
   26.78 -
   26.79 -        private boolean inClass = false;
   26.80 -
   26.81 -        @Override
   26.82 -        public void visitClassDef(JCClassDecl tree) {
   26.83 -           if (!inClass) {
   26.84 -               // Do not recurse into nested and inner classes since
   26.85 -               // TransTypes.visitClassDef makes an invocation for each class
   26.86 -               // separately.
   26.87 -               inClass = true;
   26.88 -               try {
   26.89 -                   super.visitClassDef(tree);
   26.90 -               } finally {
   26.91 -                   inClass = false;
   26.92 -               }
   26.93 -           }
   26.94 -        }
   26.95 -
   26.96 -        private TypeAnnotationPosition resolveFrame(JCTree tree, JCTree frame,
   26.97 -                List<JCTree> path, TypeAnnotationPosition p) {
   26.98 -            switch (frame.getKind()) {
   26.99 -                case TYPE_CAST:
  26.100 -                    p.type = TargetType.TYPECAST;
  26.101 -                    p.pos = frame.pos;
  26.102 -                    return p;
  26.103 -
  26.104 -                case INSTANCE_OF:
  26.105 -                    p.type = TargetType.INSTANCEOF;
  26.106 -                    p.pos = frame.pos;
  26.107 -                    return p;
  26.108 -
  26.109 -                case NEW_CLASS:
  26.110 -                    p.type = TargetType.NEW;
  26.111 -                    p.pos = frame.pos;
  26.112 -                    return p;
  26.113 -
  26.114 -                case NEW_ARRAY:
  26.115 -                    p.type = TargetType.NEW;
  26.116 -                    p.pos = frame.pos;
  26.117 -                    return p;
  26.118 -
  26.119 -                case ANNOTATION_TYPE:
  26.120 -                case CLASS:
  26.121 -                case ENUM:
  26.122 -                case INTERFACE:
  26.123 -                    p.pos = frame.pos;
  26.124 -                    if (((JCClassDecl)frame).extending == tree) {
  26.125 -                        p.type = TargetType.CLASS_EXTENDS;
  26.126 -                        p.type_index = -1;
  26.127 -                    } else if (((JCClassDecl)frame).implementing.contains(tree)) {
  26.128 -                        p.type = TargetType.CLASS_EXTENDS;
  26.129 -                        p.type_index = ((JCClassDecl)frame).implementing.indexOf(tree);
  26.130 -                    } else if (((JCClassDecl)frame).typarams.contains(tree)) {
  26.131 -                        p.type = TargetType.CLASS_TYPE_PARAMETER;
  26.132 -                        p.parameter_index = ((JCClassDecl)frame).typarams.indexOf(tree);
  26.133 -                    } else
  26.134 -                        throw new AssertionError();
  26.135 -                    return p;
  26.136 -
  26.137 -                case METHOD: {
  26.138 -                    JCMethodDecl frameMethod = (JCMethodDecl)frame;
  26.139 -                    p.pos = frame.pos;
  26.140 -                    if (frameMethod.receiverAnnotations.contains(tree))
  26.141 -                        p.type = TargetType.METHOD_RECEIVER;
  26.142 -                    else if (frameMethod.thrown.contains(tree)) {
  26.143 -                        p.type = TargetType.THROWS;
  26.144 -                        p.type_index = frameMethod.thrown.indexOf(tree);
  26.145 -                    } else if (((JCMethodDecl)frame).restype == tree) {
  26.146 -                        p.type = TargetType.METHOD_RETURN_GENERIC_OR_ARRAY;
  26.147 -                    } else if (frameMethod.typarams.contains(tree)) {
  26.148 -                        p.type = TargetType.METHOD_TYPE_PARAMETER;
  26.149 -                        p.parameter_index = frameMethod.typarams.indexOf(tree);
  26.150 -                    } else
  26.151 -                        throw new AssertionError();
  26.152 -                    return p;
  26.153 -                }
  26.154 -                case MEMBER_SELECT: {
  26.155 -                    JCFieldAccess fieldFrame = (JCFieldAccess)frame;
  26.156 -                    if ("class".contentEquals(fieldFrame.name)) {
  26.157 -                        p.type = TargetType.CLASS_LITERAL;
  26.158 -                        p.pos = TreeInfo.innermostType(fieldFrame.selected).pos;
  26.159 -                    } else
  26.160 -                        throw new AssertionError();
  26.161 -                    return p;
  26.162 -                }
  26.163 -                case PARAMETERIZED_TYPE: {
  26.164 -                    TypeAnnotationPosition nextP;
  26.165 -                    if (((JCTypeApply)frame).clazz == tree)
  26.166 -                        nextP = p; // generic: RAW; noop
  26.167 -                    else if (((JCTypeApply)frame).arguments.contains(tree))
  26.168 -                        p.location = p.location.prepend(
  26.169 -                                ((JCTypeApply)frame).arguments.indexOf(tree));
  26.170 -                    else
  26.171 -                        throw new AssertionError();
  26.172 -
  26.173 -                    List<JCTree> newPath = path.tail;
  26.174 -                    return resolveFrame(newPath.head, newPath.tail.head, newPath, p);
  26.175 -                }
  26.176 -
  26.177 -                case ARRAY_TYPE: {
  26.178 -                    p.location = p.location.prepend(0);
  26.179 -                    List<JCTree> newPath = path.tail;
  26.180 -                    return resolveFrame(newPath.head, newPath.tail.head, newPath, p);
  26.181 -                }
  26.182 -
  26.183 -                case TYPE_PARAMETER:
  26.184 -                    if (path.tail.tail.head.getTag() == JCTree.CLASSDEF) {
  26.185 -                        JCClassDecl clazz = (JCClassDecl)path.tail.tail.head;
  26.186 -                        p.type = TargetType.CLASS_TYPE_PARAMETER_BOUND;
  26.187 -                        p.parameter_index = clazz.typarams.indexOf(path.tail.head);
  26.188 -                        p.bound_index = ((JCTypeParameter)frame).bounds.indexOf(tree);
  26.189 -                    } else if (path.tail.tail.head.getTag() == JCTree.METHODDEF) {
  26.190 -                        JCMethodDecl method = (JCMethodDecl)path.tail.tail.head;
  26.191 -                        p.type = TargetType.METHOD_TYPE_PARAMETER_BOUND;
  26.192 -                        p.parameter_index = method.typarams.indexOf(path.tail.head);
  26.193 -                        p.bound_index = ((JCTypeParameter)frame).bounds.indexOf(tree);
  26.194 -                    } else
  26.195 -                        throw new AssertionError();
  26.196 -                    p.pos = frame.pos;
  26.197 -                    return p;
  26.198 -
  26.199 -                case VARIABLE:
  26.200 -                    VarSymbol v = ((JCVariableDecl)frame).sym;
  26.201 -                    p.pos = frame.pos;
  26.202 -                    switch (v.getKind()) {
  26.203 -                        case LOCAL_VARIABLE:
  26.204 -                            p.type = TargetType.LOCAL_VARIABLE; break;
  26.205 -                        case FIELD:
  26.206 -                            p.type = TargetType.FIELD_GENERIC_OR_ARRAY; break;
  26.207 -                        case PARAMETER:
  26.208 -                            p.type = TargetType.METHOD_PARAMETER_GENERIC_OR_ARRAY;
  26.209 -                            p.parameter_index = methodParamIndex(path, frame);
  26.210 -                            break;
  26.211 -                        default: throw new AssertionError();
  26.212 -                    }
  26.213 -                    return p;
  26.214 -
  26.215 -//308                case ANNOTATED_TYPE: {
  26.216 -//308                    List<JCTree> newPath = path.tail;
  26.217 -//308                    return resolveFrame(newPath.head, newPath.tail.head,
  26.218 -//308                            newPath, p);
  26.219 -//308                }
  26.220 -
  26.221 -                case METHOD_INVOCATION: {
  26.222 -                    JCMethodInvocation invocation = (JCMethodInvocation)frame;
  26.223 -                    if (!invocation.typeargs.contains(tree))
  26.224 -                        throw new AssertionError("{" + tree + "} is not an argument in the invocation: " + invocation);
  26.225 -                    p.type = TargetType.METHOD_TYPE_ARGUMENT;
  26.226 -                    p.pos = invocation.pos;
  26.227 -                    p.type_index = invocation.typeargs.indexOf(tree);
  26.228 -                    return p;
  26.229 -                }
  26.230 -
  26.231 -                case EXTENDS_WILDCARD:
  26.232 -                case SUPER_WILDCARD: {
  26.233 -                    p.type = TargetType.WILDCARD_BOUND;
  26.234 -                    List<JCTree> newPath = path.tail;
  26.235 -
  26.236 -                    TypeAnnotationPosition wildcard =
  26.237 -                        resolveFrame(newPath.head, newPath.tail.head, newPath,
  26.238 -                                new TypeAnnotationPosition());
  26.239 -                    if (!wildcard.location.isEmpty())
  26.240 -                        wildcard.type = wildcard.type.getGenericComplement();
  26.241 -                    p.wildcard_position = wildcard;
  26.242 -                    p.pos = frame.pos;
  26.243 -                    return p;
  26.244 -                }
  26.245 -            }
  26.246 -            return p;
  26.247 -        }
  26.248 -
  26.249 -        private void setTypeAnnotationPos(List<JCTypeAnnotation> annotations, TypeAnnotationPosition position) {
  26.250 -            for (JCTypeAnnotation anno : annotations) {
  26.251 -                anno.annotation_position = position;
  26.252 -                anno.attribute_field.position = position;
  26.253 -            }
  26.254 -        }
  26.255 -
  26.256 -        @Override
  26.257 -        public void visitNewArray(JCNewArray tree) {
  26.258 -            findPosition(tree, tree, tree.annotations);
  26.259 -            int dimAnnosCount = tree.dimAnnotations.size();
  26.260 -
  26.261 -            // handle annotations associated with dimentions
  26.262 -            for (int i = 0; i < dimAnnosCount; ++i) {
  26.263 -                TypeAnnotationPosition p = new TypeAnnotationPosition();
  26.264 -                p.type = TargetType.NEW_GENERIC_OR_ARRAY;
  26.265 -                p.pos = tree.pos;
  26.266 -                p.location = p.location.append(i);
  26.267 -                setTypeAnnotationPos(tree.dimAnnotations.get(i), p);
  26.268 -            }
  26.269 -
  26.270 -            // handle "free" annotations
  26.271 -            int i = dimAnnosCount == 0 ? 0 : dimAnnosCount - 1;
  26.272 -            JCExpression elemType = tree.elemtype;
  26.273 -            while (elemType != null) {
  26.274 -                if (elemType.getTag() == JCTree.ANNOTATED_TYPE) {
  26.275 -                    JCAnnotatedType at = (JCAnnotatedType)elemType;
  26.276 -                    TypeAnnotationPosition p = new TypeAnnotationPosition();
  26.277 -                    p.type = TargetType.NEW_GENERIC_OR_ARRAY;
  26.278 -                    p.pos = tree.pos;
  26.279 -                    p.location = p.location.append(i);
  26.280 -                    setTypeAnnotationPos(at.annotations, p);
  26.281 -                    elemType = at.underlyingType;
  26.282 -                } else if (elemType.getTag() == JCTree.TYPEARRAY) {
  26.283 -                    ++i;
  26.284 -                    elemType = ((JCArrayTypeTree)elemType).elemtype;
  26.285 -                } else
  26.286 -                    break;
  26.287 -            }
  26.288 -
  26.289 -            // find annotations locations of initializer elements
  26.290 -            scan(tree.elems);
  26.291 -        }
  26.292 -
  26.293 -        @Override
  26.294 -        public void visitAnnotatedType(JCAnnotatedType tree) {
  26.295 -            findPosition(tree, peek2(), tree.annotations);
  26.296 -            super.visitAnnotatedType(tree);
  26.297 -        }
  26.298 -
  26.299 -        @Override
  26.300 -        public void visitMethodDef(JCMethodDecl tree) {
  26.301 -            TypeAnnotationPosition p = new TypeAnnotationPosition();
  26.302 -            p.type = TargetType.METHOD_RECEIVER;
  26.303 -            setTypeAnnotationPos(tree.receiverAnnotations, p);
  26.304 -            super.visitMethodDef(tree);
  26.305 -        }
  26.306 -        @Override
  26.307 -        public void visitTypeParameter(JCTypeParameter tree) {
  26.308 -            findPosition(tree, peek2(), tree.annotations);
  26.309 -            super.visitTypeParameter(tree);
  26.310 -        }
  26.311 -
  26.312 -        void findPosition(JCTree tree, JCTree frame, List<JCTypeAnnotation> annotations) {
  26.313 -            if (!annotations.isEmpty()) {
  26.314 -                TypeAnnotationPosition p =
  26.315 -                        resolveFrame(tree, frame, frames.toList(),
  26.316 -                                new TypeAnnotationPosition());
  26.317 -                if (!p.location.isEmpty())
  26.318 -                    p.type = p.type.getGenericComplement();
  26.319 -                setTypeAnnotationPos(annotations, p);
  26.320 -            }
  26.321 -        }
  26.322 -
  26.323 -        private int methodParamIndex(List<JCTree> path, JCTree param) {
  26.324 -            List<JCTree> curr = path;
  26.325 -            if (curr.head != param)
  26.326 -                curr = path.tail;
  26.327 -            JCMethodDecl method = (JCMethodDecl)curr.tail.head;
  26.328 -            return method.params.indexOf(param);
  26.329 -        }
  26.330 -    }
  26.331 -
  26.332 -    private static class TypeAnnotationLift extends TreeScanner {
  26.333 -        List<Attribute.TypeCompound> recordedTypeAnnotations = List.nil();
  26.334 -
  26.335 -        boolean isInner = false;
  26.336 -        @Override
  26.337 -        public void visitClassDef(JCClassDecl tree) {
  26.338 -            if (isInner) {
  26.339 -                // tree is an inner class tree.  stop now.
  26.340 -                // TransTypes.visitClassDef makes an invocation for each class
  26.341 -                // separately.
  26.342 -                return;
  26.343 -            }
  26.344 -            isInner = true;
  26.345 -            List<Attribute.TypeCompound> prevTAs = recordedTypeAnnotations;
  26.346 -            recordedTypeAnnotations = List.nil();
  26.347 -            try {
  26.348 -                super.visitClassDef(tree);
  26.349 -            } finally {
  26.350 -                tree.sym.typeAnnotations = tree.sym.typeAnnotations.appendList(recordedTypeAnnotations);
  26.351 -                recordedTypeAnnotations = prevTAs;
  26.352 -            }
  26.353 -        }
  26.354 -
  26.355 -        @Override
  26.356 -        public void visitMethodDef(JCMethodDecl tree) {
  26.357 -            List<Attribute.TypeCompound> prevTAs = recordedTypeAnnotations;
  26.358 -            recordedTypeAnnotations = List.nil();
  26.359 -            try {
  26.360 -                super.visitMethodDef(tree);
  26.361 -            } finally {
  26.362 -                tree.sym.typeAnnotations = tree.sym.typeAnnotations.appendList(recordedTypeAnnotations);
  26.363 -                recordedTypeAnnotations = prevTAs;
  26.364 -            }
  26.365 -        }
  26.366 -
  26.367 -        @Override
  26.368 -        public void visitVarDef(JCVariableDecl tree) {
  26.369 -            List<Attribute.TypeCompound> prevTAs = recordedTypeAnnotations;
  26.370 -            recordedTypeAnnotations = List.nil();
  26.371 -            ElementKind kind = tree.sym.getKind();
  26.372 -            if (kind == ElementKind.LOCAL_VARIABLE && tree.mods.annotations.nonEmpty()) {
  26.373 -                // need to lift the annotations
  26.374 -                TypeAnnotationPosition position = new TypeAnnotationPosition();
  26.375 -                position.pos = tree.pos;
  26.376 -                position.type = TargetType.LOCAL_VARIABLE;
  26.377 -                for (Attribute.Compound attribute : tree.sym.attributes_field) {
  26.378 -                    Attribute.TypeCompound tc =
  26.379 -                        new Attribute.TypeCompound(attribute.type, attribute.values, position);
  26.380 -                    recordedTypeAnnotations = recordedTypeAnnotations.append(tc);
  26.381 -                }
  26.382 -            }
  26.383 -            try {
  26.384 -                super.visitVarDef(tree);
  26.385 -            } finally {
  26.386 -                if (kind.isField() || kind == ElementKind.LOCAL_VARIABLE)
  26.387 -                    tree.sym.typeAnnotations = tree.sym.typeAnnotations.appendList(recordedTypeAnnotations);
  26.388 -                recordedTypeAnnotations = kind.isField() ? prevTAs : prevTAs.appendList(recordedTypeAnnotations);
  26.389 -            }
  26.390 -        }
  26.391 -
  26.392 -        @Override
  26.393 -        public void visitApply(JCMethodInvocation tree) {
  26.394 -            scan(tree.meth);
  26.395 -            scan(tree.typeargs);
  26.396 -            scan(tree.args);
  26.397 -        }
  26.398 -
  26.399 -        public void visitAnnotation(JCAnnotation tree) {
  26.400 -            if (tree instanceof JCTypeAnnotation)
  26.401 -                recordedTypeAnnotations = recordedTypeAnnotations.append(((JCTypeAnnotation)tree).attribute_field);
  26.402 -            super.visitAnnotation(tree);
  26.403 -        }
  26.404 -    }
  26.405 -
  26.406 -}
    27.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Jan 27 17:28:57 2011 -0800
    27.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Fri Jan 28 10:06:08 2011 -0800
    27.3 @@ -1,5 +1,5 @@
    27.4  /*
    27.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    27.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    27.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    27.8   *
    27.9   * This code is free software; you can redistribute it and/or modify it
   27.10 @@ -1061,8 +1061,9 @@
   27.11                              highSub = (lowSub == null) ? null : asSub(bHigh, aHigh.tsym);
   27.12                          }
   27.13                          if (highSub != null) {
   27.14 -                            assert a.tsym == highSub.tsym && a.tsym == lowSub.tsym
   27.15 -                                : a.tsym + " != " + highSub.tsym + " != " + lowSub.tsym;
   27.16 +                            if (!(a.tsym == highSub.tsym && a.tsym == lowSub.tsym)) {
   27.17 +                                Assert.error(a.tsym + " != " + highSub.tsym + " != " + lowSub.tsym);
   27.18 +                            }
   27.19                              if (!disjointTypes(aHigh.allparams(), highSub.allparams())
   27.20                                  && !disjointTypes(aHigh.allparams(), lowSub.allparams())
   27.21                                  && !disjointTypes(aLow.allparams(), highSub.allparams())
   27.22 @@ -1703,9 +1704,9 @@
   27.23              bt.supertype_field = bounds.head;
   27.24              bt.interfaces_field = bounds.tail;
   27.25          }
   27.26 -        assert bt.supertype_field.tsym.completer != null
   27.27 -            || !bt.supertype_field.isInterface()
   27.28 -            : bt.supertype_field;
   27.29 +        Assert.check(bt.supertype_field.tsym.completer != null
   27.30 +                || !bt.supertype_field.isInterface(),
   27.31 +            bt.supertype_field);
   27.32          return bt;
   27.33      }
   27.34  
   27.35 @@ -1834,7 +1835,7 @@
   27.36                          // t.interfaces_field is null after
   27.37                          // completion, we can assume that t is not the
   27.38                          // type of a class/interface declaration.
   27.39 -                        assert t != t.tsym.type : t.toString();
   27.40 +                        Assert.check(t != t.tsym.type, t);
   27.41                          List<Type> actuals = t.allparams();
   27.42                          List<Type> formals = t.tsym.type.allparams();
   27.43                          if (t.hasErasedSupertypes()) {
   27.44 @@ -2646,7 +2647,7 @@
   27.45                  act2 = act2.tail;
   27.46                  typarams = typarams.tail;
   27.47              }
   27.48 -            assert(act1.isEmpty() && act2.isEmpty() && typarams.isEmpty());
   27.49 +            Assert.check(act1.isEmpty() && act2.isEmpty() && typarams.isEmpty());
   27.50              return new ClassType(class1.getEnclosingType(), merged.toList(), class1.tsym);
   27.51          }
   27.52  
   27.53 @@ -2758,7 +2759,7 @@
   27.54              // calculate lub(A, B)
   27.55              while (ts.head.tag != CLASS && ts.head.tag != TYPEVAR)
   27.56                  ts = ts.tail;
   27.57 -            assert !ts.isEmpty();
   27.58 +            Assert.check(!ts.isEmpty());
   27.59              List<Type> cl = closure(ts.head);
   27.60              for (Type t : ts.tail) {
   27.61                  if (t.tag == CLASS || t.tag == TYPEVAR)
   27.62 @@ -3138,7 +3139,7 @@
   27.63          boolean reverse = false;
   27.64          Type target = to;
   27.65          if ((to.tsym.flags() & INTERFACE) == 0) {
   27.66 -            assert (from.tsym.flags() & INTERFACE) != 0;
   27.67 +            Assert.check((from.tsym.flags() & INTERFACE) != 0);
   27.68              reverse = true;
   27.69              to = from;
   27.70              from = target;
   27.71 @@ -3173,12 +3174,12 @@
   27.72          boolean reverse = false;
   27.73          Type target = to;
   27.74          if ((to.tsym.flags() & INTERFACE) == 0) {
   27.75 -            assert (from.tsym.flags() & INTERFACE) != 0;
   27.76 +            Assert.check((from.tsym.flags() & INTERFACE) != 0);
   27.77              reverse = true;
   27.78              to = from;
   27.79              from = target;
   27.80          }
   27.81 -        assert (from.tsym.flags() & FINAL) != 0;
   27.82 +        Assert.check((from.tsym.flags() & FINAL) != 0);
   27.83          Type t1 = asSuper(from, to.tsym);
   27.84          if (t1 == null) return false;
   27.85          Type t2 = to;
    28.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Jan 27 17:28:57 2011 -0800
    28.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Jan 28 10:06:08 2011 -0800
    28.3 @@ -1,5 +1,5 @@
    28.4  /*
    28.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    28.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    28.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    28.8   *
    28.9   * This code is free software; you can redistribute it and/or modify it
   28.10 @@ -563,7 +563,7 @@
   28.11              if (bound != null && bound.tsym instanceof ClassSymbol) {
   28.12                  ClassSymbol c = (ClassSymbol)bound.tsym;
   28.13                  if ((c.flags_field & COMPOUND) != 0) {
   28.14 -                    assert (c.flags_field & UNATTRIBUTED) != 0 : c;
   28.15 +                    Assert.check((c.flags_field & UNATTRIBUTED) != 0, c);
   28.16                      attribClass(typaram.pos(), c);
   28.17                  }
   28.18              }
   28.19 @@ -905,7 +905,10 @@
   28.20              // or perhaps expr implements Iterable<T>?
   28.21              Type base = types.asSuper(exprType, syms.iterableType.tsym);
   28.22              if (base == null) {
   28.23 -                log.error(tree.expr.pos(), "foreach.not.applicable.to.type");
   28.24 +                log.error(tree.expr.pos(),
   28.25 +                        "foreach.not.applicable.to.type",
   28.26 +                        exprType,
   28.27 +                        diags.fragment("type.req.array.or.iterable"));
   28.28                  elemtype = types.createErrorType(exprType);
   28.29              } else {
   28.30                  List<Type> iterableParams = base.allparams();
   28.31 @@ -970,7 +973,7 @@
   28.32                  if (enumSwitch) {
   28.33                      Symbol sym = enumConstant(c.pat, seltype);
   28.34                      if (sym == null) {
   28.35 -                        log.error(c.pat.pos(), "enum.const.req");
   28.36 +                        log.error(c.pat.pos(), "enum.label.must.be.unqualified.enum");
   28.37                      } else if (!labels.add(sym)) {
   28.38                          log.error(c.pos(), "duplicate.case.label");
   28.39                      }
   28.40 @@ -1334,7 +1337,6 @@
   28.41  
   28.42          // The types of the actual method type arguments.
   28.43          List<Type> typeargtypes = null;
   28.44 -        boolean typeargtypesNonRefOK = false;
   28.45  
   28.46          Name methName = TreeInfo.name(tree.meth);
   28.47  
   28.48 @@ -1434,7 +1436,7 @@
   28.49              localEnv.info.varArgs = false;
   28.50              Type mtype = attribExpr(tree.meth, localEnv, mpt);
   28.51              if (localEnv.info.varArgs)
   28.52 -                assert mtype.isErroneous() || tree.varargsElement != null;
   28.53 +                Assert.check(mtype.isErroneous() || tree.varargsElement != null);
   28.54  
   28.55              // Compute the result type.
   28.56              Type restype = mtype.getReturnType();
   28.57 @@ -1463,21 +1465,7 @@
   28.58                                restype.tsym);
   28.59              }
   28.60  
   28.61 -            // Special case logic for JSR 292 types.
   28.62 -            if (rs.allowTransitionalJSR292 &&
   28.63 -                    tree.meth.getTag() == JCTree.SELECT &&
   28.64 -                    !typeargtypes.isEmpty()) {
   28.65 -                JCFieldAccess mfield = (JCFieldAccess) tree.meth;
   28.66 -                // MethodHandle.<T>invoke(abc) and InvokeDynamic.<T>foo(abc)
   28.67 -                // has type <T>, and T can be a primitive type.
   28.68 -                if (mfield.sym != null &&
   28.69 -                        mfield.sym.isPolymorphicSignatureInstance())
   28.70 -                    typeargtypesNonRefOK = true;
   28.71 -            }
   28.72 -
   28.73 -            if (!(rs.allowTransitionalJSR292 && typeargtypesNonRefOK)) {
   28.74 -                chk.checkRefTypes(tree.typeargs, typeargtypes);
   28.75 -            }
   28.76 +            chk.checkRefTypes(tree.typeargs, typeargtypes);
   28.77  
   28.78              // Check that value of resulting type is admissible in the
   28.79              // current context.  Also, capture the return type
   28.80 @@ -1667,7 +1655,7 @@
   28.81                          typeargtypes,
   28.82                          localEnv.info.varArgs);
   28.83                  if (localEnv.info.varArgs)
   28.84 -                    assert tree.constructorType.isErroneous() || tree.varargsElement != null;
   28.85 +                    Assert.check(tree.constructorType.isErroneous() || tree.varargsElement != null);
   28.86              }
   28.87  
   28.88              if (cdef != null) {
   28.89 @@ -1727,7 +1715,7 @@
   28.90                  Symbol sym = rs.resolveConstructor(
   28.91                      tree.pos(), localEnv, clazztype, argtypes,
   28.92                      typeargtypes, true, tree.varargsElement != null);
   28.93 -                assert sym.kind < AMBIGUOUS || tree.constructor.type.isErroneous();
   28.94 +                Assert.check(sym.kind < AMBIGUOUS || tree.constructor.type.isErroneous());
   28.95                  tree.constructor = sym;
   28.96                  if (tree.constructor.kind > ERRONEOUS) {
   28.97                      tree.constructorType =  syms.errType;
   28.98 @@ -2243,10 +2231,10 @@
   28.99  
  28.100          // Determine the symbol represented by the selection.
  28.101          env.info.varArgs = false;
  28.102 -        Symbol sym = selectSym(tree, site, env, pt, pkind);
  28.103 +        Symbol sym = selectSym(tree, sitesym, site, env, pt, pkind);
  28.104          if (sym.exists() && !isType(sym) && (pkind & (PCK | TYP)) != 0) {
  28.105              site = capture(site);
  28.106 -            sym = selectSym(tree, site, env, pt, pkind);
  28.107 +            sym = selectSym(tree, sitesym, site, env, pt, pkind);
  28.108          }
  28.109          boolean varArgs = env.info.varArgs;
  28.110          tree.sym = sym;
  28.111 @@ -2335,6 +2323,14 @@
  28.112           *  @param pkind  The expected kind(s) of the Select expression.
  28.113           */
  28.114          private Symbol selectSym(JCFieldAccess tree,
  28.115 +                                     Type site,
  28.116 +                                     Env<AttrContext> env,
  28.117 +                                     Type pt,
  28.118 +                                     int pkind) {
  28.119 +            return selectSym(tree, site.tsym, site, env, pt, pkind);
  28.120 +        }
  28.121 +        private Symbol selectSym(JCFieldAccess tree,
  28.122 +                                 Symbol location,
  28.123                                   Type site,
  28.124                                   Env<AttrContext> env,
  28.125                                   Type pt,
  28.126 @@ -2346,12 +2342,12 @@
  28.127              case PACKAGE:
  28.128                  return rs.access(
  28.129                      rs.findIdentInPackage(env, site.tsym, name, pkind),
  28.130 -                    pos, site, name, true);
  28.131 +                    pos, location, site, name, true);
  28.132              case ARRAY:
  28.133              case CLASS:
  28.134                  if (pt.tag == METHOD || pt.tag == FORALL) {
  28.135                      return rs.resolveQualifiedMethod(
  28.136 -                        pos, env, site, name, pt.getParameterTypes(), pt.getTypeArguments());
  28.137 +                        pos, env, location, site, name, pt.getParameterTypes(), pt.getTypeArguments());
  28.138                  } else if (name == names._this || name == names._super) {
  28.139                      return rs.resolveSelf(pos, env, site.tsym, name);
  28.140                  } else if (name == names._class) {
  28.141 @@ -2368,7 +2364,7 @@
  28.142                      // We are seeing a plain identifier as selector.
  28.143                      Symbol sym = rs.findIdentInType(env, site, name, pkind);
  28.144                      if ((pkind & ERRONEOUS) == 0)
  28.145 -                        sym = rs.access(sym, pos, site, name, true);
  28.146 +                        sym = rs.access(sym, pos, location, site, name, true);
  28.147                      return sym;
  28.148                  }
  28.149              case WILDCARD:
  28.150 @@ -2376,12 +2372,12 @@
  28.151              case TYPEVAR:
  28.152                  // Normally, site.getUpperBound() shouldn't be null.
  28.153                  // It should only happen during memberEnter/attribBase
  28.154 -                // when determining the super type which *must* be
  28.155 +                // when determining the super type which *must* beac
  28.156                  // done before attributing the type variables.  In
  28.157                  // other words, we are seeing this illegal program:
  28.158                  // class B<T> extends A<T.foo> {}
  28.159                  Symbol sym = (site.getUpperBound() != null)
  28.160 -                    ? selectSym(tree, capture(site.getUpperBound()), env, pt, pkind)
  28.161 +                    ? selectSym(tree, location, capture(site.getUpperBound()), env, pt, pkind)
  28.162                      : null;
  28.163                  if (sym == null) {
  28.164                      log.error(pos, "type.var.cant.be.deref");
  28.165 @@ -2390,7 +2386,7 @@
  28.166                      Symbol sym2 = (sym.flags() & Flags.PRIVATE) != 0 ?
  28.167                          rs.new AccessError(env, site, sym) :
  28.168                                  sym;
  28.169 -                    rs.access(sym2, pos, site, name, true);
  28.170 +                    rs.access(sym2, pos, location, site, name, true);
  28.171                      return sym;
  28.172                  }
  28.173              case ERROR:
  28.174 @@ -2961,7 +2957,7 @@
  28.175                  extending, implementing, List.<JCTree>nil());
  28.176  
  28.177              ClassSymbol c = (ClassSymbol)a.getUpperBound().tsym;
  28.178 -            assert (c.flags() & COMPOUND) != 0;
  28.179 +            Assert.check((c.flags() & COMPOUND) != 0);
  28.180              cd.sym = c;
  28.181              c.sourcefile = env.toplevel.sourcefile;
  28.182  
  28.183 @@ -2989,10 +2985,6 @@
  28.184          result = tree.type = syms.errType;
  28.185      }
  28.186  
  28.187 -    public void visitAnnotatedType(JCAnnotatedType tree) {
  28.188 -        result = tree.type = attribType(tree.getUnderlyingType(), env);
  28.189 -    }
  28.190 -
  28.191      public void visitErroneous(JCErroneous tree) {
  28.192          if (tree.errs != null)
  28.193              for (JCTree err : tree.errs)
  28.194 @@ -3097,7 +3089,7 @@
  28.195      /** Finish the attribution of a class. */
  28.196      private void attribClassBody(Env<AttrContext> env, ClassSymbol c) {
  28.197          JCClassDecl tree = (JCClassDecl)env.tree;
  28.198 -        assert c == tree.sym;
  28.199 +        Assert.check(c == tree.sym);
  28.200  
  28.201          // Validate annotations
  28.202          chk.validateAnnotations(tree.mods.annotations, c);
  28.203 @@ -3138,12 +3130,9 @@
  28.204  
  28.205          tree.type = c.type;
  28.206  
  28.207 -        boolean assertsEnabled = false;
  28.208 -        assert assertsEnabled = true;
  28.209 -        if (assertsEnabled) {
  28.210 -            for (List<JCTypeParameter> l = tree.typarams;
  28.211 -                 l.nonEmpty(); l = l.tail)
  28.212 -                assert env.info.scope.lookup(l.head.name).scope != null;
  28.213 +        for (List<JCTypeParameter> l = tree.typarams;
  28.214 +             l.nonEmpty(); l = l.tail) {
  28.215 +             Assert.checkNonNull(env.info.scope.lookup(l.head.name).scope);
  28.216          }
  28.217  
  28.218          // Check that a generic class doesn't extend Throwable
  28.219 @@ -3167,7 +3156,7 @@
  28.220                  if (sym == null ||
  28.221                      sym.kind != VAR ||
  28.222                      ((VarSymbol) sym).getConstValue() == null)
  28.223 -                    log.error(l.head.pos(), "icls.cant.have.static.decl");
  28.224 +                    log.error(l.head.pos(), "icls.cant.have.static.decl", sym.location());
  28.225              }
  28.226          }
  28.227  
  28.228 @@ -3184,9 +3173,6 @@
  28.229              (c.flags() & ABSTRACT) == 0) {
  28.230              checkSerialVersionUID(tree, c);
  28.231          }
  28.232 -
  28.233 -        // Check type annotations applicability rules
  28.234 -        validateTypeAnnotations(tree);
  28.235      }
  28.236          // where
  28.237          /** check if a class is a subtype of Serializable, if that is available. */
  28.238 @@ -3234,35 +3220,6 @@
  28.239          return types.capture(type);
  28.240      }
  28.241  
  28.242 -    private void validateTypeAnnotations(JCTree tree) {
  28.243 -        tree.accept(typeAnnotationsValidator);
  28.244 -    }
  28.245 -    //where
  28.246 -    private final JCTree.Visitor typeAnnotationsValidator =
  28.247 -        new TreeScanner() {
  28.248 -        public void visitAnnotation(JCAnnotation tree) {
  28.249 -            if (tree instanceof JCTypeAnnotation) {
  28.250 -                chk.validateTypeAnnotation((JCTypeAnnotation)tree, false);
  28.251 -            }
  28.252 -            super.visitAnnotation(tree);
  28.253 -        }
  28.254 -        public void visitTypeParameter(JCTypeParameter tree) {
  28.255 -            chk.validateTypeAnnotations(tree.annotations, true);
  28.256 -            // don't call super. skip type annotations
  28.257 -            scan(tree.bounds);
  28.258 -        }
  28.259 -        public void visitMethodDef(JCMethodDecl tree) {
  28.260 -            // need to check static methods
  28.261 -            if ((tree.sym.flags() & Flags.STATIC) != 0) {
  28.262 -                for (JCTypeAnnotation a : tree.receiverAnnotations) {
  28.263 -                    if (chk.isTypeAnnotation(a, false))
  28.264 -                        log.error(a.pos(), "annotation.type.not.applicable");
  28.265 -                }
  28.266 -            }
  28.267 -            super.visitMethodDef(tree);
  28.268 -        }
  28.269 -    };
  28.270 -
  28.271      // <editor-fold desc="post-attribution visitor">
  28.272  
  28.273      /**
    29.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Jan 27 17:28:57 2011 -0800
    29.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Fri Jan 28 10:06:08 2011 -0800
    29.3 @@ -1,5 +1,5 @@
    29.4  /*
    29.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    29.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    29.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    29.8   *
    29.9   * This code is free software; you can redistribute it and/or modify it
   29.10 @@ -506,43 +506,18 @@
   29.11       *  @param a             The type that should be bounded by bs.
   29.12       *  @param bs            The bound.
   29.13       */
   29.14 -    private void checkExtends(DiagnosticPosition pos, Type a, TypeVar bs) {
   29.15 +    private boolean checkExtends(Type a, TypeVar bs) {
   29.16           if (a.isUnbound()) {
   29.17 -             return;
   29.18 +             return true;
   29.19           } else if (a.tag != WILDCARD) {
   29.20               a = types.upperBound(a);
   29.21 -             for (List<Type> l = types.getBounds(bs); l.nonEmpty(); l = l.tail) {
   29.22 -                 if (!types.isSubtype(a, l.head)) {
   29.23 -                     log.error(pos, "not.within.bounds", a);
   29.24 -                     return;
   29.25 -                 }
   29.26 -             }
   29.27 +             return types.isSubtype(a, bs.bound);
   29.28           } else if (a.isExtendsBound()) {
   29.29 -             if (!types.isCastable(bs.getUpperBound(), types.upperBound(a), Warner.noWarnings))
   29.30 -                 log.error(pos, "not.within.bounds", a);
   29.31 +             return types.isCastable(bs.getUpperBound(), types.upperBound(a), Warner.noWarnings);
   29.32           } else if (a.isSuperBound()) {
   29.33 -             if (types.notSoftSubtype(types.lowerBound(a), bs.getUpperBound()))
   29.34 -                 log.error(pos, "not.within.bounds", a);
   29.35 +             return !types.notSoftSubtype(types.lowerBound(a), bs.getUpperBound());
   29.36           }
   29.37 -     }
   29.38 -
   29.39 -    /** Check that a type is within some bounds.
   29.40 -     *
   29.41 -     *  Used in TypeApply to verify that, e.g., X in V<X> is a valid
   29.42 -     *  type argument.
   29.43 -     *  @param pos           Position to be used for error reporting.
   29.44 -     *  @param a             The type that should be bounded by bs.
   29.45 -     *  @param bs            The bound.
   29.46 -     */
   29.47 -    private void checkCapture(JCTypeApply tree) {
   29.48 -        List<JCExpression> args = tree.getTypeArguments();
   29.49 -        for (Type arg : types.capture(tree.type).getTypeArguments()) {
   29.50 -            if (arg.tag == TYPEVAR && arg.getUpperBound().isErroneous()) {
   29.51 -                log.error(args.head.pos, "not.within.bounds", args.head.type);
   29.52 -                break;
   29.53 -            }
   29.54 -            args = args.tail;
   29.55 -        }
   29.56 +         return true;
   29.57       }
   29.58  
   29.59      /** Check that type is different from 'void'.
   29.60 @@ -775,6 +750,79 @@
   29.61          }
   29.62      }
   29.63  
   29.64 +    /**
   29.65 +     * Check that type 't' is a valid instantiation of a generic class
   29.66 +     * (see JLS 4.5)
   29.67 +     *
   29.68 +     * @param t class type to be checked
   29.69 +     * @return true if 't' is well-formed
   29.70 +     */
   29.71 +    public boolean checkValidGenericType(Type t) {
   29.72 +        return firstIncompatibleTypeArg(t) == null;
   29.73 +    }
   29.74 +    //WHERE
   29.75 +        private Type firstIncompatibleTypeArg(Type type) {
   29.76 +            List<Type> formals = type.tsym.type.allparams();
   29.77 +            List<Type> actuals = type.allparams();
   29.78 +            List<Type> args = type.getTypeArguments();
   29.79 +            List<Type> forms = type.tsym.type.getTypeArguments();
   29.80 +            ListBuffer<Type> tvars_buf = new ListBuffer<Type>();
   29.81 +
   29.82 +            // For matching pairs of actual argument types `a' and
   29.83 +            // formal type parameters with declared bound `b' ...
   29.84 +            while (args.nonEmpty() && forms.nonEmpty()) {
   29.85 +                // exact type arguments needs to know their
   29.86 +                // bounds (for upper and lower bound
   29.87 +                // calculations).  So we create new TypeVars with
   29.88 +                // bounds substed with actuals.
   29.89 +                tvars_buf.append(types.substBound(((TypeVar)forms.head),
   29.90 +                                                  formals,
   29.91 +                                                  actuals));
   29.92 +                args = args.tail;
   29.93 +                forms = forms.tail;
   29.94 +            }
   29.95 +
   29.96 +            args = type.getTypeArguments();
   29.97 +            List<Type> tvars_cap = types.substBounds(formals,
   29.98 +                                      formals,
   29.99 +                                      types.capture(type).allparams());
  29.100 +            while (args.nonEmpty() && tvars_cap.nonEmpty()) {
  29.101 +                // Let the actual arguments know their bound
  29.102 +                args.head.withTypeVar((TypeVar)tvars_cap.head);
  29.103 +                args = args.tail;
  29.104 +                tvars_cap = tvars_cap.tail;
  29.105 +            }
  29.106 +
  29.107 +            args = type.getTypeArguments();
  29.108 +            List<Type> tvars = tvars_buf.toList();
  29.109 +
  29.110 +            while (args.nonEmpty() && tvars.nonEmpty()) {
  29.111 +                Type actual = types.subst(args.head,
  29.112 +                    type.tsym.type.getTypeArguments(),
  29.113 +                    tvars_buf.toList());
  29.114 +                if (!checkExtends(actual, (TypeVar)tvars.head) &&
  29.115 +                        !tvars.head.getUpperBound().isErroneous()) {
  29.116 +                    return args.head;
  29.117 +                }
  29.118 +                args = args.tail;
  29.119 +                tvars = tvars.tail;
  29.120 +            }
  29.121 +
  29.122 +            args = type.getTypeArguments();
  29.123 +            tvars = tvars_buf.toList();
  29.124 +
  29.125 +            for (Type arg : types.capture(type).getTypeArguments()) {
  29.126 +                if (arg.tag == TYPEVAR &&
  29.127 +                        arg.getUpperBound().isErroneous() &&
  29.128 +                        !tvars.head.getUpperBound().isErroneous()) {
  29.129 +                    return args.head;
  29.130 +                }
  29.131 +                tvars = tvars.tail;
  29.132 +            }
  29.133 +
  29.134 +            return null;
  29.135 +        }
  29.136 +
  29.137      /** Check that given modifiers are legal for given symbol and
  29.138       *  return modifiers together with any implicit modififiers for that symbol.
  29.139       *  Warning: we can't use flags() here since this method
  29.140 @@ -987,11 +1035,20 @@
  29.141          @Override
  29.142          public void visitTypeApply(JCTypeApply tree) {
  29.143              if (tree.type.tag == CLASS) {
  29.144 -                List<Type> formals = tree.type.tsym.type.allparams();
  29.145 -                List<Type> actuals = tree.type.allparams();
  29.146                  List<JCExpression> args = tree.arguments;
  29.147                  List<Type> forms = tree.type.tsym.type.getTypeArguments();
  29.148 -                ListBuffer<Type> tvars_buf = new ListBuffer<Type>();
  29.149 +
  29.150 +                Type incompatibleArg = firstIncompatibleTypeArg(tree.type);
  29.151 +                if (incompatibleArg != null) {
  29.152 +                    for (JCTree arg : tree.arguments) {
  29.153 +                        if (arg.type == incompatibleArg) {
  29.154 +                            log.error(arg, "not.within.bounds", incompatibleArg, forms.head);
  29.155 +                        }
  29.156 +                        forms = forms.tail;
  29.157 +                     }
  29.158 +                 }
  29.159 +
  29.160 +                forms = tree.type.tsym.type.getTypeArguments();
  29.161  
  29.162                  boolean is_java_lang_Class = tree.type.tsym.flatName() == names.java_lang_Class;
  29.163  
  29.164 @@ -1001,46 +1058,10 @@
  29.165                      validateTree(args.head,
  29.166                              !(isOuter && is_java_lang_Class),
  29.167                              false);
  29.168 -
  29.169 -                    // exact type arguments needs to know their
  29.170 -                    // bounds (for upper and lower bound
  29.171 -                    // calculations).  So we create new TypeVars with
  29.172 -                    // bounds substed with actuals.
  29.173 -                    tvars_buf.append(types.substBound(((TypeVar)forms.head),
  29.174 -                                                      formals,
  29.175 -                                                      actuals));
  29.176 -
  29.177                      args = args.tail;
  29.178                      forms = forms.tail;
  29.179                  }
  29.180  
  29.181 -                args = tree.arguments;
  29.182 -                List<Type> tvars_cap = types.substBounds(formals,
  29.183 -                                          formals,
  29.184 -                                          types.capture(tree.type).allparams());
  29.185 -                while (args.nonEmpty() && tvars_cap.nonEmpty()) {
  29.186 -                    // Let the actual arguments know their bound
  29.187 -                    args.head.type.withTypeVar((TypeVar)tvars_cap.head);
  29.188 -                    args = args.tail;
  29.189 -                    tvars_cap = tvars_cap.tail;
  29.190 -                }
  29.191 -
  29.192 -                args = tree.arguments;
  29.193 -                List<Type> tvars = tvars_buf.toList();
  29.194 -
  29.195 -                while (args.nonEmpty() && tvars.nonEmpty()) {
  29.196 -                    Type actual = types.subst(args.head.type,
  29.197 -                        tree.type.tsym.type.getTypeArguments(),
  29.198 -                        tvars_buf.toList());
  29.199 -                    checkExtends(args.head.pos(),
  29.200 -                                 actual,
  29.201 -                                 (TypeVar)tvars.head);
  29.202 -                    args = args.tail;
  29.203 -                    tvars = tvars.tail;
  29.204 -                }
  29.205 -
  29.206 -                checkCapture(tree);
  29.207 -
  29.208                  // Check that this type is either fully parameterized, or
  29.209                  // not parameterized at all.
  29.210                  if (tree.type.getEnclosingType().isRaw())
  29.211 @@ -1086,11 +1107,6 @@
  29.212              }
  29.213          }
  29.214  
  29.215 -        @Override
  29.216 -        public void visitAnnotatedType(JCAnnotatedType tree) {
  29.217 -            tree.underlyingType.accept(this);
  29.218 -        }
  29.219 -
  29.220          /** Default visitor method: do nothing.
  29.221           */
  29.222          @Override
  29.223 @@ -2239,14 +2255,6 @@
  29.224              validateAnnotation(a, s);
  29.225      }
  29.226  
  29.227 -    /** Check the type annotations
  29.228 -     */
  29.229 -    public void validateTypeAnnotations(List<JCTypeAnnotation> annotations, boolean isTypeParameter) {
  29.230 -        if (skipAnnotations) return;
  29.231 -        for (JCTypeAnnotation a : annotations)
  29.232 -            validateTypeAnnotation(a, isTypeParameter);
  29.233 -    }
  29.234 -
  29.235      /** Check an annotation of a symbol.
  29.236       */
  29.237      public void validateAnnotation(JCAnnotation a, Symbol s) {
  29.238 @@ -2261,15 +2269,6 @@
  29.239          }
  29.240      }
  29.241  
  29.242 -    public void validateTypeAnnotation(JCTypeAnnotation a, boolean isTypeParameter) {
  29.243 -        if (a.type == null)
  29.244 -            throw new AssertionError("annotation tree hasn't been attributed yet: " + a);
  29.245 -        validateAnnotationTree(a);
  29.246 -
  29.247 -        if (!isTypeAnnotation(a, isTypeParameter))
  29.248 -            log.error(a.pos(), "annotation.type.not.applicable");
  29.249 -    }
  29.250 -
  29.251      /** Is s a method symbol that overrides a method in a superclass? */
  29.252      boolean isOverrider(Symbol s) {
  29.253          if (s.kind != MTH || s.isStatic())
  29.254 @@ -2288,25 +2287,6 @@
  29.255          return false;
  29.256      }
  29.257  
  29.258 -    /** Is the annotation applicable to type annotations */
  29.259 -    boolean isTypeAnnotation(JCTypeAnnotation a, boolean isTypeParameter) {
  29.260 -        Attribute.Compound atTarget =
  29.261 -            a.annotationType.type.tsym.attribute(syms.annotationTargetType.tsym);
  29.262 -        if (atTarget == null) return true;
  29.263 -        Attribute atValue = atTarget.member(names.value);
  29.264 -        if (!(atValue instanceof Attribute.Array)) return true; // error recovery
  29.265 -        Attribute.Array arr = (Attribute.Array) atValue;
  29.266 -        for (Attribute app : arr.values) {
  29.267 -            if (!(app instanceof Attribute.Enum)) return true; // recovery
  29.268 -            Attribute.Enum e = (Attribute.Enum) app;
  29.269 -            if (!isTypeParameter && e.value.name == names.TYPE_USE)
  29.270 -                return true;
  29.271 -            else if (isTypeParameter && e.value.name == names.TYPE_PARAMETER)
  29.272 -                return true;
  29.273 -        }
  29.274 -        return false;
  29.275 -    }
  29.276 -
  29.277      /** Is the annotation applicable to the symbol? */
  29.278      boolean annotationApplicable(JCAnnotation a, Symbol s) {
  29.279          Attribute.Compound atTarget =
  29.280 @@ -2438,7 +2418,7 @@
  29.281       */
  29.282      void checkNonCyclicElements(JCClassDecl tree) {
  29.283          if ((tree.sym.flags_field & ANNOTATION) == 0) return;
  29.284 -        assert (tree.sym.flags_field & LOCKED) == 0;
  29.285 +        Assert.check((tree.sym.flags_field & LOCKED) == 0);
  29.286          try {
  29.287              tree.sym.flags_field |= LOCKED;
  29.288              for (JCTree def : tree.defs) {
    30.1 --- a/src/share/classes/com/sun/tools/javac/comp/Flow.java	Thu Jan 27 17:28:57 2011 -0800
    30.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java	Fri Jan 28 10:06:08 2011 -0800
    30.3 @@ -1,5 +1,5 @@
    30.4  /*
    30.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    30.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    30.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    30.8   *
    30.9   * This code is free software; you can redistribute it and/or modify it
   30.10 @@ -37,7 +37,6 @@
   30.11  import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
   30.12  
   30.13  import com.sun.tools.javac.code.Symbol.*;
   30.14 -import com.sun.tools.javac.comp.Resolve;
   30.15  import com.sun.tools.javac.tree.JCTree.*;
   30.16  
   30.17  import static com.sun.tools.javac.code.Flags.*;
   30.18 @@ -709,7 +708,7 @@
   30.19  
   30.20          lint = lint.augment(tree.sym.attributes_field);
   30.21  
   30.22 -        assert pendingExits.isEmpty();
   30.23 +        Assert.check(pendingExits.isEmpty());
   30.24  
   30.25          try {
   30.26              boolean isInitialConstructor =
   30.27 @@ -747,7 +746,7 @@
   30.28                  PendingExit exit = exits.head;
   30.29                  exits = exits.tail;
   30.30                  if (exit.thrown == null) {
   30.31 -                    assert exit.tree.getTag() == JCTree.RETURN;
   30.32 +                    Assert.check(exit.tree.getTag() == JCTree.RETURN);
   30.33                      if (isInitialConstructor) {
   30.34                          inits = exit.inits;
   30.35                          for (int i = firstadr; i < nextadr; i++)
   30.36 @@ -1350,11 +1349,6 @@
   30.37          }
   30.38      }
   30.39  
   30.40 -    public void visitAnnotatedType(JCAnnotatedType tree) {
   30.41 -        // annotations don't get scanned
   30.42 -        tree.underlyingType.accept(this);
   30.43 -    }
   30.44 -
   30.45      public void visitIdent(JCIdent tree) {
   30.46          if (tree.sym.kind == VAR) {
   30.47              checkInit(tree.pos(), (VarSymbol)tree.sym);
   30.48 @@ -1373,7 +1367,6 @@
   30.49          if (!tree.type.isErroneous()
   30.50              && lint.isEnabled(Lint.LintCategory.CAST)
   30.51              && types.isSameType(tree.expr.type, tree.clazz.type)
   30.52 -            && !(ignoreAnnotatedCasts && containsTypeAnnotation(tree.clazz))
   30.53              && !is292targetTypeCast(tree)) {
   30.54              log.warning(Lint.LintCategory.CAST,
   30.55                      tree.pos(), "redundant.cast", tree.expr.type);
   30.56 @@ -1382,8 +1375,9 @@
   30.57      //where
   30.58          private boolean is292targetTypeCast(JCTypeCast tree) {
   30.59              boolean is292targetTypeCast = false;
   30.60 -            if (tree.expr.getTag() == JCTree.APPLY) {
   30.61 -                JCMethodInvocation apply = (JCMethodInvocation)tree.expr;
   30.62 +            JCExpression expr = TreeInfo.skipParens(tree.expr);
   30.63 +            if (expr.getTag() == JCTree.APPLY) {
   30.64 +                JCMethodInvocation apply = (JCMethodInvocation)expr;
   30.65                  Symbol sym = TreeInfo.symbol(apply.meth);
   30.66                  is292targetTypeCast = sym != null &&
   30.67                      sym.kind == MTH &&
   30.68 @@ -1397,23 +1391,6 @@
   30.69      }
   30.70  
   30.71  /**************************************************************************
   30.72 - * utility methods for ignoring type-annotated casts lint checking
   30.73 - *************************************************************************/
   30.74 -    private static final boolean ignoreAnnotatedCasts = true;
   30.75 -    private static class AnnotationFinder extends TreeScanner {
   30.76 -        public boolean foundTypeAnno = false;
   30.77 -        public void visitAnnotation(JCAnnotation tree) {
   30.78 -            foundTypeAnno = foundTypeAnno || (tree instanceof JCTypeAnnotation);
   30.79 -        }
   30.80 -    }
   30.81 -
   30.82 -    private boolean containsTypeAnnotation(JCTree e) {
   30.83 -        AnnotationFinder finder = new AnnotationFinder();
   30.84 -        finder.scan(e);
   30.85 -        return finder.foundTypeAnno;
   30.86 -    }
   30.87 -
   30.88 -/**************************************************************************
   30.89   * main method
   30.90   *************************************************************************/
   30.91  
    31.1 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Jan 27 17:28:57 2011 -0800
    31.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Fri Jan 28 10:06:08 2011 -0800
    31.3 @@ -27,6 +27,7 @@
    31.4  
    31.5  import com.sun.tools.javac.tree.JCTree;
    31.6  import com.sun.tools.javac.tree.JCTree.JCTypeCast;
    31.7 +import com.sun.tools.javac.tree.TreeInfo;
    31.8  import com.sun.tools.javac.util.*;
    31.9  import com.sun.tools.javac.util.List;
   31.10  import com.sun.tools.javac.code.*;
   31.11 @@ -204,19 +205,20 @@
   31.12       *  Throw a NoInstanceException if this not possible.
   31.13       */
   31.14      void maximizeInst(UndetVar that, Warner warn) throws NoInstanceException {
   31.15 +        List<Type> hibounds = Type.filter(that.hibounds, errorFilter);
   31.16          if (that.inst == null) {
   31.17 -            if (that.hibounds.isEmpty())
   31.18 +            if (hibounds.isEmpty())
   31.19                  that.inst = syms.objectType;
   31.20 -            else if (that.hibounds.tail.isEmpty())
   31.21 -                that.inst = that.hibounds.head;
   31.22 +            else if (hibounds.tail.isEmpty())
   31.23 +                that.inst = hibounds.head;
   31.24              else
   31.25 -                that.inst = types.glb(that.hibounds);
   31.26 +                that.inst = types.glb(hibounds);
   31.27          }
   31.28          if (that.inst == null ||
   31.29              that.inst.isErroneous())
   31.30              throw ambiguousNoInstanceException
   31.31                  .setMessage("no.unique.maximal.instance.exists",
   31.32 -                            that.qtype, that.hibounds);
   31.33 +                            that.qtype, hibounds);
   31.34      }
   31.35      //where
   31.36          private boolean isSubClass(Type t, final List<Type> ts) {
   31.37 @@ -240,37 +242,46 @@
   31.38              return true;
   31.39          }
   31.40  
   31.41 +    private Filter<Type> errorFilter = new Filter<Type>() {
   31.42 +        @Override
   31.43 +        public boolean accepts(Type t) {
   31.44 +            return !t.isErroneous();
   31.45 +        }
   31.46 +    };
   31.47 +
   31.48      /** Instantiate undetermined type variable to the lub of all its lower bounds.
   31.49       *  Throw a NoInstanceException if this not possible.
   31.50       */
   31.51      void minimizeInst(UndetVar that, Warner warn) throws NoInstanceException {
   31.52 +        List<Type> lobounds = Type.filter(that.lobounds, errorFilter);
   31.53          if (that.inst == null) {
   31.54 -            if (that.lobounds.isEmpty())
   31.55 +            if (lobounds.isEmpty())
   31.56                  that.inst = syms.botType;
   31.57 -            else if (that.lobounds.tail.isEmpty())
   31.58 -                that.inst = that.lobounds.head.isPrimitive() ? syms.errType : that.lobounds.head;
   31.59 +            else if (lobounds.tail.isEmpty())
   31.60 +                that.inst = lobounds.head.isPrimitive() ? syms.errType : lobounds.head;
   31.61              else {
   31.62 -                that.inst = types.lub(that.lobounds);
   31.63 +                that.inst = types.lub(lobounds);
   31.64              }
   31.65              if (that.inst == null || that.inst.tag == ERROR)
   31.66                      throw ambiguousNoInstanceException
   31.67                          .setMessage("no.unique.minimal.instance.exists",
   31.68 -                                    that.qtype, that.lobounds);
   31.69 +                                    that.qtype, lobounds);
   31.70              // VGJ: sort of inlined maximizeInst() below.  Adding
   31.71              // bounds can cause lobounds that are above hibounds.
   31.72 -            if (that.hibounds.isEmpty())
   31.73 +            List<Type> hibounds = Type.filter(that.hibounds, errorFilter);
   31.74 +            if (hibounds.isEmpty())
   31.75                  return;
   31.76              Type hb = null;
   31.77 -            if (that.hibounds.tail.isEmpty())
   31.78 -                hb = that.hibounds.head;
   31.79 -            else for (List<Type> bs = that.hibounds;
   31.80 +            if (hibounds.tail.isEmpty())
   31.81 +                hb = hibounds.head;
   31.82 +            else for (List<Type> bs = hibounds;
   31.83                        bs.nonEmpty() && hb == null;
   31.84                        bs = bs.tail) {
   31.85 -                if (isSubClass(bs.head, that.hibounds))
   31.86 +                if (isSubClass(bs.head, hibounds))
   31.87                      hb = types.fromUnknownFun.apply(bs.head);
   31.88              }
   31.89              if (hb == null ||
   31.90 -                !types.isSubtypeUnchecked(hb, that.hibounds, warn) ||
   31.91 +                !types.isSubtypeUnchecked(hb, hibounds, warn) ||
   31.92                  !types.isSubtypeUnchecked(that.inst, hb, warn))
   31.93                  throw ambiguousNoInstanceException;
   31.94          }
   31.95 @@ -396,7 +407,9 @@
   31.96  
   31.97          // for varargs arguments as well
   31.98          if (useVarargs) {
   31.99 -            Type elemType = types.elemtype(varargsFormal);
  31.100 +            //note: if applicability check is triggered by most specific test,
  31.101 +            //the last argument of a varargs is _not_ an array type (see JLS 15.12.2.5)
  31.102 +            Type elemType = types.elemtypeOrType(varargsFormal);
  31.103              Type elemUndet = types.subst(elemType, tvars, undetvars);
  31.104              while (actuals.nonEmpty()) {
  31.105                  Type actual = actuals.head.baseType();
  31.106 @@ -527,7 +540,8 @@
  31.107          for (List<Type> tvs = tvars, args = arguments;
  31.108               tvs.nonEmpty();
  31.109               tvs = tvs.tail, args = args.tail) {
  31.110 -            if (args.head instanceof UndetVar) continue;
  31.111 +            if (args.head instanceof UndetVar ||
  31.112 +                    tvars.head.getUpperBound().isErroneous()) continue;
  31.113              List<Type> bounds = types.subst(types.getBounds((TypeVar)tvs.head), tvars, arguments);
  31.114              if (!types.isSubtypeUnchecked(args.head, bounds, warn))
  31.115                  throw invalidInstanceException
  31.116 @@ -538,43 +552,39 @@
  31.117  
  31.118      /**
  31.119       * Compute a synthetic method type corresponding to the requested polymorphic
  31.120 -     * method signature. If no explicit return type is supplied, a provisional
  31.121 -     * return type is computed (just Object in case of non-transitional 292)
  31.122 +     * method signature. The target return type is computed from the immediately
  31.123 +     * enclosing scope surrounding the polymorphic-signature call.
  31.124       */
  31.125      Type instantiatePolymorphicSignatureInstance(Env<AttrContext> env, Type site,
  31.126                                              Name name,
  31.127                                              MethodSymbol spMethod,  // sig. poly. method or null if none
  31.128 -                                            List<Type> argtypes,
  31.129 -                                            List<Type> typeargtypes) {
  31.130 +                                            List<Type> argtypes) {
  31.131          final Type restype;
  31.132 -        if (rs.allowTransitionalJSR292 && typeargtypes.nonEmpty()) {
  31.133 -            restype = typeargtypes.head;
  31.134 -        } else {
  31.135 -            //The return type for a polymorphic signature call is computed from
  31.136 -            //the enclosing tree E, as follows: if E is a cast, then use the
  31.137 -            //target type of the cast expression as a return type; if E is an
  31.138 -            //expression statement, the return type is 'void' - otherwise the
  31.139 -            //return type is simply 'Object'. A correctness check ensures that
  31.140 -            //env.next refers to the lexically enclosing environment in which
  31.141 -            //the polymorphic signature call environment is nested.
  31.142  
  31.143 -            switch (env.next.tree.getTag()) {
  31.144 -                case JCTree.TYPECAST:
  31.145 -                    JCTypeCast castTree = (JCTypeCast)env.next.tree;
  31.146 -                    restype = (castTree.expr == env.tree) ?
  31.147 -                        castTree.clazz.type :
  31.148 -                        syms.objectType;
  31.149 -                    break;
  31.150 -                case JCTree.EXEC:
  31.151 -                    JCTree.JCExpressionStatement execTree =
  31.152 -                            (JCTree.JCExpressionStatement)env.next.tree;
  31.153 -                    restype = (execTree.expr == env.tree) ?
  31.154 -                        syms.voidType :
  31.155 -                        syms.objectType;
  31.156 -                    break;
  31.157 -                default:
  31.158 -                    restype = syms.objectType;
  31.159 -            }
  31.160 +        //The return type for a polymorphic signature call is computed from
  31.161 +        //the enclosing tree E, as follows: if E is a cast, then use the
  31.162 +        //target type of the cast expression as a return type; if E is an
  31.163 +        //expression statement, the return type is 'void' - otherwise the
  31.164 +        //return type is simply 'Object'. A correctness check ensures that
  31.165 +        //env.next refers to the lexically enclosing environment in which
  31.166 +        //the polymorphic signature call environment is nested.
  31.167 +
  31.168 +        switch (env.next.tree.getTag()) {
  31.169 +            case JCTree.TYPECAST:
  31.170 +                JCTypeCast castTree = (JCTypeCast)env.next.tree;
  31.171 +                restype = (TreeInfo.skipParens(castTree.expr) == env.tree) ?
  31.172 +                    castTree.clazz.type :
  31.173 +                    syms.objectType;
  31.174 +                break;
  31.175 +            case JCTree.EXEC:
  31.176 +                JCTree.JCExpressionStatement execTree =
  31.177 +                        (JCTree.JCExpressionStatement)env.next.tree;
  31.178 +                restype = (TreeInfo.skipParens(execTree.expr) == env.tree) ?
  31.179 +                    syms.voidType :
  31.180 +                    syms.objectType;
  31.181 +                break;
  31.182 +            default:
  31.183 +                restype = syms.objectType;
  31.184          }
  31.185  
  31.186          List<Type> paramtypes = Type.map(argtypes, implicitArgType);
    32.1 --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java	Thu Jan 27 17:28:57 2011 -0800
    32.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java	Fri Jan 28 10:06:08 2011 -0800
    32.3 @@ -1,5 +1,5 @@
    32.4  /*
    32.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    32.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    32.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    32.8   *
    32.9   * This code is free software; you can redistribute it and/or modify it
   32.10 @@ -1057,7 +1057,7 @@
   32.11              }
   32.12              // Otherwise replace the variable by its proxy.
   32.13              sym = proxies.lookup(proxyName(sym.name)).sym;
   32.14 -            assert sym != null && (sym.flags_field & FINAL) != 0;
   32.15 +            Assert.check(sym != null && (sym.flags_field & FINAL) != 0);
   32.16              tree = make.at(tree.pos).Ident(sym);
   32.17          }
   32.18          JCExpression base = (tree.getTag() == JCTree.SELECT) ? ((JCFieldAccess) tree).selected : null;
   32.19 @@ -1208,7 +1208,7 @@
   32.20       */
   32.21      void makeAccessible(Symbol sym) {
   32.22          JCClassDecl cdef = classDef(sym.owner.enclClass());
   32.23 -        assert cdef != null : "class def not found: " + sym + " in " + sym.owner;
   32.24 +        if (cdef == null) Assert.error("class def not found: " + sym + " in " + sym.owner);
   32.25          if (sym.name == names.init) {
   32.26              cdef.defs = cdef.defs.prepend(
   32.27                  accessConstructorDef(cdef.pos, sym, accessConstrs.get(sym)));
   32.28 @@ -1458,7 +1458,7 @@
   32.29              expr = make.Ident(var.sym).setType(resource.type);
   32.30              stats.add(var);
   32.31          } else {
   32.32 -            assert resource instanceof JCExpression;
   32.33 +            Assert.check(resource instanceof JCExpression);
   32.34              VarSymbol syntheticTwrVar =
   32.35              new VarSymbol(SYNTHETIC | FINAL,
   32.36                            makeSyntheticName(names.fromString("twrVar" +
   32.37 @@ -1552,7 +1552,7 @@
   32.38          List<VarSymbol> ots = outerThisStack;
   32.39          if (ots.isEmpty()) {
   32.40              log.error(pos, "no.encl.instance.of.type.in.scope", c);
   32.41 -            assert false;
   32.42 +            Assert.error();
   32.43              return makeNull();
   32.44          }
   32.45          VarSymbol ot = ots.head;
   32.46 @@ -1565,14 +1565,14 @@
   32.47                      log.error(pos,
   32.48                                "no.encl.instance.of.type.in.scope",
   32.49                                c);
   32.50 -                    assert false; // should have been caught in Attr
   32.51 +                    Assert.error(); // should have been caught in Attr
   32.52                      return tree;
   32.53                  }
   32.54                  ot = ots.head;
   32.55              } while (ot.owner != otc);
   32.56              if (otc.owner.kind != PCK && !otc.hasOuterInstance()) {
   32.57                  chk.earlyRefError(pos, c);
   32.58 -                assert false; // should have been caught in Attr
   32.59 +                Assert.error(); // should have been caught in Attr
   32.60                  return makeNull();
   32.61              }
   32.62              tree = access(make.at(pos).Select(tree, ot));
   32.63 @@ -1610,7 +1610,7 @@
   32.64          List<VarSymbol> ots = outerThisStack;
   32.65          if (ots.isEmpty()) {
   32.66              log.error(pos, "no.encl.instance.of.type.in.scope", c);
   32.67 -            assert false;
   32.68 +            Assert.error();
   32.69              return makeNull();
   32.70          }
   32.71          VarSymbol ot = ots.head;
   32.72 @@ -1623,7 +1623,7 @@
   32.73                      log.error(pos,
   32.74                          "no.encl.instance.of.type.in.scope",
   32.75                          c);
   32.76 -                    assert false;
   32.77 +                    Assert.error();
   32.78                      return tree;
   32.79                  }
   32.80                  ot = ots.head;
   32.81 @@ -1640,9 +1640,9 @@
   32.82      JCStatement initField(int pos, Name name) {
   32.83          Scope.Entry e = proxies.lookup(name);
   32.84          Symbol rhs = e.sym;
   32.85 -        assert rhs.owner.kind == MTH;
   32.86 +        Assert.check(rhs.owner.kind == MTH);
   32.87          Symbol lhs = e.next().sym;
   32.88 -        assert rhs.owner.owner == lhs.owner;
   32.89 +        Assert.check(rhs.owner.owner == lhs.owner);
   32.90          make.at(pos);
   32.91          return
   32.92              make.Exec(
   32.93 @@ -1655,9 +1655,9 @@
   32.94       */
   32.95      JCStatement initOuterThis(int pos) {
   32.96          VarSymbol rhs = outerThisStack.head;
   32.97 -        assert rhs.owner.kind == MTH;
   32.98 +        Assert.check(rhs.owner.kind == MTH);
   32.99          VarSymbol lhs = outerThisStack.tail.head;
  32.100 -        assert rhs.owner.owner == lhs.owner;
  32.101 +        Assert.check(rhs.owner.owner == lhs.owner);
  32.102          make.at(pos);
  32.103          return
  32.104              make.Exec(
  32.105 @@ -1856,7 +1856,7 @@
  32.106      // where
  32.107          /** Create an attributed tree of the form left.name(). */
  32.108          private JCMethodInvocation makeCall(JCExpression left, Name name, List<JCExpression> args) {
  32.109 -            assert left.type != null;
  32.110 +            Assert.checkNonNull(left.type);
  32.111              Symbol funcsym = lookupMethod(make_pos, name, left.type,
  32.112                                            TreeInfo.types(args));
  32.113              return make.App(make.Select(left, funcsym), args);
  32.114 @@ -2399,7 +2399,7 @@
  32.115                           names.valueOf,
  32.116                           tree.sym.type,
  32.117                           List.of(syms.stringType));
  32.118 -        assert (valueOfSym.flags() & STATIC) != 0;
  32.119 +        Assert.check((valueOfSym.flags() & STATIC) != 0);
  32.120          VarSymbol nameArgSym = valueOfSym.params.head;
  32.121          JCIdent nameVal = make.Ident(nameArgSym);
  32.122          JCStatement enum_ValueOf =
  32.123 @@ -2585,11 +2585,6 @@
  32.124          result = tree;
  32.125      }
  32.126  
  32.127 -    public void visitAnnotatedType(JCAnnotatedType tree) {
  32.128 -        tree.underlyingType = translate(tree.underlyingType);
  32.129 -        result = tree.underlyingType;
  32.130 -    }
  32.131 -
  32.132      public void visitTypeCast(JCTypeCast tree) {
  32.133          tree.clazz = translate(tree.clazz);
  32.134          if (tree.type.isPrimitive() != tree.expr.type.isPrimitive())
  32.135 @@ -3421,7 +3416,7 @@
  32.136                  if (expression != null) { // expression for a "default" case is null
  32.137                      String labelExpr = (String) expression.type.constValue();
  32.138                      Integer mapping = caseLabelToPosition.put(labelExpr, casePosition);
  32.139 -                    assert mapping == null;
  32.140 +                    Assert.checkNull(mapping);
  32.141                      int hashCode = labelExpr.hashCode();
  32.142  
  32.143                      Set<String> stringSet = hashToString.get(hashCode);
  32.144 @@ -3431,7 +3426,7 @@
  32.145                          hashToString.put(hashCode, stringSet);
  32.146                      } else {
  32.147                          boolean added = stringSet.add(labelExpr);
  32.148 -                        assert added;
  32.149 +                        Assert.check(added);
  32.150                      }
  32.151                  }
  32.152                  casePosition++;
  32.153 @@ -3483,7 +3478,7 @@
  32.154              for(Map.Entry<Integer, Set<String>> entry : hashToString.entrySet()) {
  32.155                  int hashCode = entry.getKey();
  32.156                  Set<String> stringsWithHashCode = entry.getValue();
  32.157 -                assert stringsWithHashCode.size() >= 1;
  32.158 +                Assert.check(stringsWithHashCode.size() >= 1);
  32.159  
  32.160                  JCStatement elsepart = null;
  32.161                  for(String caseLabel : stringsWithHashCode ) {
  32.162 @@ -3697,8 +3692,7 @@
  32.163                                           cdef.type,
  32.164                                           List.<Type>nil());
  32.165  
  32.166 -        assert(ordinalSym != null);
  32.167 -        assert(ordinalSym instanceof MethodSymbol);
  32.168 +        Assert.check(ordinalSym instanceof MethodSymbol);
  32.169  
  32.170          JCStatement ret = make.Return(make.Ident(ordinalSymbol));
  32.171          cdef.defs = cdef.defs.append(make.MethodDef((MethodSymbol)ordinalSym,
  32.172 @@ -3714,8 +3708,7 @@
  32.173                                     cdef.type,
  32.174                                     List.<Type>nil());
  32.175  
  32.176 -        assert(nameSym != null);
  32.177 -        assert(nameSym instanceof MethodSymbol);
  32.178 +        Assert.check(nameSym instanceof MethodSymbol);
  32.179  
  32.180          JCStatement ret = make.Return(make.Ident(nameSymbol));
  32.181  
  32.182 @@ -3766,8 +3759,7 @@
  32.183                                     cdef.type,
  32.184                                     List.of(cdef.sym.type));
  32.185  
  32.186 -        assert(compareToSym != null);
  32.187 -        assert(compareToSym instanceof MethodSymbol);
  32.188 +        Assert.check(compareToSym instanceof MethodSymbol);
  32.189  
  32.190          JCMethodDecl compareToDecl = (JCMethodDecl) TreeInfo.declarationFor(compareToSym, cdef);
  32.191  
    33.1 --- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Thu Jan 27 17:28:57 2011 -0800
    33.2 +++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Fri Jan 28 10:06:08 2011 -0800
    33.3 @@ -1,5 +1,5 @@
    33.4  /*
    33.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    33.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    33.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    33.8   *
    33.9   * This code is free software; you can redistribute it and/or modify it
   33.10 @@ -581,8 +581,7 @@
   33.11          JCVariableDecl lastParam = null;
   33.12          for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
   33.13              JCVariableDecl param = lastParam = l.head;
   33.14 -            assert param.sym != null;
   33.15 -            params.append(param.sym);
   33.16 +            params.append(Assert.checkNonNull(param.sym));
   33.17          }
   33.18          m.params = params.toList();
   33.19  
   33.20 @@ -699,7 +698,7 @@
   33.21   *********************************************************************/
   33.22  
   33.23      Type attribImportType(JCTree tree, Env<AttrContext> env) {
   33.24 -        assert completionEnabled;
   33.25 +        Assert.check(completionEnabled);
   33.26          try {
   33.27              // To prevent deep recursion, suppress completion of some
   33.28              // types.
   33.29 @@ -725,7 +724,7 @@
   33.30                      return "annotate " + annotations + " onto " + s + " in " + s.owner;
   33.31                  }
   33.32                  public void enterAnnotation() {
   33.33 -                    assert s.kind == PCK || s.attributes_field == null;
   33.34 +                    Assert.check(s.kind == PCK || s.attributes_field == null);
   33.35                      JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
   33.36                      try {
   33.37                          if (s.attributes_field != null &&
   33.38 @@ -782,8 +781,8 @@
   33.39                      types.isSameType(c.type, syms.polymorphicSignatureType)) {
   33.40                  if (!target.hasMethodHandles()) {
   33.41                      // Somebody is compiling JDK7 source code to a JDK6 target.
   33.42 -                    // Make it a strict warning, since it is unlikely but important.
   33.43 -                    log.strictWarning(env.tree.pos(),
   33.44 +                    // Make it an error, since it is unlikely but important.
   33.45 +                    log.error(env.tree.pos(),
   33.46                              "wrong.target.for.polymorphic.signature.definition",
   33.47                              target.name);
   33.48                  }
   33.49 @@ -836,7 +835,7 @@
   33.50          // Suppress some (recursive) MemberEnter invocations
   33.51          if (!completionEnabled) {
   33.52              // Re-install same completer for next time around and return.
   33.53 -            assert (sym.flags() & Flags.COMPOUND) == 0;
   33.54 +            Assert.check((sym.flags() & Flags.COMPOUND) == 0);
   33.55              sym.completer = this;
   33.56              return;
   33.57          }
   33.58 @@ -928,10 +927,6 @@
   33.59              if (hasDeprecatedAnnotation(tree.mods.annotations))
   33.60                  c.flags_field |= DEPRECATED;
   33.61              annotateLater(tree.mods.annotations, baseEnv, c);
   33.62 -            // class type parameters use baseEnv but everything uses env
   33.63 -            for (JCTypeParameter tp : tree.typarams)
   33.64 -                tp.accept(new TypeAnnotate(baseEnv));
   33.65 -            tree.accept(new TypeAnnotate(env));
   33.66  
   33.67              chk.checkNonCyclicDecl(tree);
   33.68  
   33.69 @@ -989,7 +984,7 @@
   33.70                  c.owner.kind == PCK && c.owner != syms.unnamedPackage &&
   33.71                  reader.packageExists(c.fullname))
   33.72                  {
   33.73 -                    log.error(tree.pos, "clash.with.pkg.of.same.name", c);
   33.74 +                    log.error(tree.pos, "clash.with.pkg.of.same.name", Kinds.kindName(sym), c);
   33.75                  }
   33.76  
   33.77          } catch (CompletionFailure ex) {
   33.78 @@ -1014,86 +1009,6 @@
   33.79          }
   33.80      }
   33.81  
   33.82 -    // A sub-phase that "compiles" annotations in annotated types.
   33.83 -    private class TypeAnnotate extends TreeScanner {
   33.84 -        private Env<AttrContext> env;
   33.85 -        public TypeAnnotate(Env<AttrContext> env) { this.env = env; }
   33.86 -
   33.87 -        private void enterTypeAnnotations(List<JCTypeAnnotation> annotations) {
   33.88 -            Set<TypeSymbol> annotated = new HashSet<TypeSymbol>();
   33.89 -            if (!skipAnnotations)
   33.90 -                for (List<JCTypeAnnotation> al = annotations; al.nonEmpty(); al = al.tail) {
   33.91 -                    JCTypeAnnotation a = al.head;
   33.92 -                    Attribute.Compound c = annotate.enterAnnotation(a,
   33.93 -                            syms.annotationType,
   33.94 -                            env);
   33.95 -                    if (c == null) continue;
   33.96 -                    Attribute.TypeCompound tc = new Attribute.TypeCompound(c.type, c.values, a.annotation_position);
   33.97 -                    a.attribute_field = tc;
   33.98 -                    // Note: @Deprecated has no effect on local variables and parameters
   33.99 -                    if (!annotated.add(a.type.tsym))
  33.100 -                        log.error(a.pos, "duplicate.annotation");
  33.101 -                }
  33.102 -        }
  33.103 -
  33.104 -        // each class (including enclosed inner classes) should be visited
  33.105 -        // separately through MemberEnter.complete(Symbol)
  33.106 -        // this flag is used to prevent from visiting inner classes.
  33.107 -        private boolean isEnclosingClass = false;
  33.108 -        @Override
  33.109 -        public void visitClassDef(final JCClassDecl tree) {
  33.110 -            if (isEnclosingClass)
  33.111 -                return;
  33.112 -            isEnclosingClass = true;
  33.113 -            scan(tree.mods);
  33.114 -            // type parameter need to be visited with a separate env
  33.115 -            // scan(tree.typarams);
  33.116 -            scan(tree.extending);
  33.117 -            scan(tree.implementing);
  33.118 -            scan(tree.defs);
  33.119 -        }
  33.120 -
  33.121 -        private void annotate(final JCTree tree, final List<JCTypeAnnotation> annotations) {
  33.122 -            annotate.later(new Annotate.Annotator() {
  33.123 -                public String toString() {
  33.124 -                    return "annotate " + annotations + " onto " + tree;
  33.125 -                }
  33.126 -                public void enterAnnotation() {
  33.127 -                    JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
  33.128 -                    try {
  33.129 -                        enterTypeAnnotations(annotations);
  33.130 -                    } finally {
  33.131 -                        log.useSource(prev);
  33.132 -                    }
  33.133 -                }
  33.134 -            });
  33.135 -        }
  33.136 -
  33.137 -        @Override
  33.138 -        public void visitAnnotatedType(final JCAnnotatedType tree) {
  33.139 -            annotate(tree, tree.annotations);
  33.140 -            super.visitAnnotatedType(tree);
  33.141 -        }
  33.142 -        @Override
  33.143 -        public void visitTypeParameter(final JCTypeParameter tree) {
  33.144 -            annotate(tree, tree.annotations);
  33.145 -            super.visitTypeParameter(tree);
  33.146 -        }
  33.147 -        @Override
  33.148 -        public void visitNewArray(final JCNewArray tree) {
  33.149 -            annotate(tree, tree.annotations);
  33.150 -            for (List<JCTypeAnnotation> dimAnnos : tree.dimAnnotations)
  33.151 -                annotate(tree, dimAnnos);
  33.152 -            super.visitNewArray(tree);
  33.153 -        }
  33.154 -        @Override
  33.155 -        public void visitMethodDef(JCMethodDecl tree) {
  33.156 -            annotate(tree, tree.receiverAnnotations);
  33.157 -            super.visitMethodDef(tree);
  33.158 -        }
  33.159 -    }
  33.160 -
  33.161 -
  33.162      private Env<AttrContext> baseEnv(JCClassDecl tree, Env<AttrContext> env) {
  33.163          Scope baseScope = new Scope.ClassScope(tree.sym, scopeCounter);
  33.164          //import already entered local classes into base scope
    34.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Jan 27 17:28:57 2011 -0800
    34.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Jan 28 10:06:08 2011 -0800
    34.3 @@ -1,5 +1,5 @@
    34.4  /*
    34.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    34.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    34.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    34.8   *
    34.9   * This code is free software; you can redistribute it and/or modify it
   34.10 @@ -70,8 +70,6 @@
   34.11      public final boolean boxingEnabled; // = source.allowBoxing();
   34.12      public final boolean varargsEnabled; // = source.allowVarargs();
   34.13      public final boolean allowMethodHandles;
   34.14 -    public final boolean allowInvokeDynamic;
   34.15 -    public final boolean allowTransitionalJSR292;
   34.16      private final boolean debugResolve;
   34.17  
   34.18      Scope polymorphicSignatureScope;
   34.19 @@ -111,13 +109,8 @@
   34.20          varargsEnabled = source.allowVarargs();
   34.21          Options options = Options.instance(context);
   34.22          debugResolve = options.isSet("debugresolve");
   34.23 -        allowTransitionalJSR292 = options.isSet("allowTransitionalJSR292");
   34.24          Target target = Target.instance(context);
   34.25 -        allowMethodHandles = allowTransitionalJSR292 ||
   34.26 -                target.hasMethodHandles();
   34.27 -        allowInvokeDynamic = (allowTransitionalJSR292 ||
   34.28 -                target.hasInvokedynamic()) &&
   34.29 -                options.isSet("invokedynamic");
   34.30 +        allowMethodHandles = target.hasMethodHandles();
   34.31          polymorphicSignatureScope = new Scope(syms.noSymbol);
   34.32  
   34.33          inapplicableMethodException = new InapplicableMethodException(diags);
   34.34 @@ -336,8 +329,7 @@
   34.35                          boolean useVarargs,
   34.36                          Warner warn)
   34.37          throws Infer.InferenceException {
   34.38 -        boolean polymorphicSignature = (m.isPolymorphicSignatureGeneric() && allowMethodHandles) ||
   34.39 -                                        isTransitionalDynamicCallSite(site, m);
   34.40 +        boolean polymorphicSignature = m.isPolymorphicSignatureGeneric() && allowMethodHandles;
   34.41          if (useVarargs && (m.flags() & VARARGS) == 0)
   34.42              throw inapplicableMethodException.setMessage(null);
   34.43          Type mt = types.memberType(site, m);
   34.44 @@ -346,10 +338,7 @@
   34.45          // need to inferred.
   34.46          List<Type> tvars = env.info.tvars;
   34.47          if (typeargtypes == null) typeargtypes = List.nil();
   34.48 -        if (allowTransitionalJSR292 && polymorphicSignature && typeargtypes.nonEmpty()) {
   34.49 -            //transitional 292 call sites might have wrong number of targs
   34.50 -        }
   34.51 -        else if (mt.tag != FORALL && typeargtypes.nonEmpty()) {
   34.52 +        if (mt.tag != FORALL && typeargtypes.nonEmpty()) {
   34.53              // This is not a polymorphic method, but typeargs are supplied
   34.54              // which is fine, see JLS3 15.12.2.1
   34.55          } else if (mt.tag == FORALL && typeargtypes.nonEmpty()) {
   34.56 @@ -387,7 +376,7 @@
   34.57  
   34.58          if (instNeeded)
   34.59              return polymorphicSignature ?
   34.60 -                infer.instantiatePolymorphicSignatureInstance(env, site, m.name, (MethodSymbol)m, argtypes, typeargtypes) :
   34.61 +                infer.instantiatePolymorphicSignatureInstance(env, site, m.name, (MethodSymbol)m, argtypes) :
   34.62                  infer.instantiateMethod(env,
   34.63                                      tvars,
   34.64                                      (MethodType)mt,
   34.65 @@ -402,14 +391,6 @@
   34.66          return mt;
   34.67      }
   34.68  
   34.69 -    boolean isTransitionalDynamicCallSite(Type site, Symbol sym) {
   34.70 -        return allowTransitionalJSR292 &&  // old logic that doesn't use annotations
   34.71 -                !sym.isPolymorphicSignatureInstance() &&
   34.72 -                ((allowMethodHandles && site == syms.methodHandleType && // invokeExact, invokeGeneric, invoke
   34.73 -                    (sym.name == names.invoke && sym.isPolymorphicSignatureGeneric())) ||
   34.74 -                (site == syms.invokeDynamicType && allowInvokeDynamic)); // InvokeDynamic.XYZ
   34.75 -    }
   34.76 -
   34.77      /** Same but returns null instead throwing a NoInstanceException
   34.78       */
   34.79      Type instantiate(Env<AttrContext> env,
   34.80 @@ -679,7 +660,7 @@
   34.81                        boolean operator) {
   34.82          if (sym.kind == ERR) return bestSoFar;
   34.83          if (!sym.isInheritedIn(site.tsym, types)) return bestSoFar;
   34.84 -        assert sym.kind < AMBIGUOUS;
   34.85 +        Assert.check(sym.kind < AMBIGUOUS);
   34.86          try {
   34.87              rawInstantiate(env, site, sym, argtypes, typeargtypes,
   34.88                                 allowBoxing, useVarargs, Warner.noWarnings);
   34.89 @@ -1255,6 +1236,7 @@
   34.90       */
   34.91      Symbol access(Symbol sym,
   34.92                    DiagnosticPosition pos,
   34.93 +                  Symbol location,
   34.94                    Type site,
   34.95                    Name name,
   34.96                    boolean qualified,
   34.97 @@ -1265,23 +1247,46 @@
   34.98              if (!site.isErroneous() &&
   34.99                  !Type.isErroneous(argtypes) &&
  34.100                  (typeargtypes==null || !Type.isErroneous(typeargtypes)))
  34.101 -                logResolveError(errSym, pos, site, name, argtypes, typeargtypes);
  34.102 +                logResolveError(errSym, pos, location, site, name, argtypes, typeargtypes);
  34.103              sym = errSym.access(name, qualified ? site.tsym : syms.noSymbol);
  34.104          }
  34.105          return sym;
  34.106      }
  34.107  
  34.108 -    /** Same as above, but without type arguments and arguments.
  34.109 +    /** Same as original access(), but without location.
  34.110 +     */
  34.111 +    Symbol access(Symbol sym,
  34.112 +                  DiagnosticPosition pos,
  34.113 +                  Type site,
  34.114 +                  Name name,
  34.115 +                  boolean qualified,
  34.116 +                  List<Type> argtypes,
  34.117 +                  List<Type> typeargtypes) {
  34.118 +        return access(sym, pos, site.tsym, site, name, qualified, argtypes, typeargtypes);
  34.119 +    }
  34.120 +
  34.121 +    /** Same as original access(), but without type arguments and arguments.
  34.122 +     */
  34.123 +    Symbol access(Symbol sym,
  34.124 +                  DiagnosticPosition pos,
  34.125 +                  Symbol location,
  34.126 +                  Type site,
  34.127 +                  Name name,
  34.128 +                  boolean qualified) {
  34.129 +        if (sym.kind >= AMBIGUOUS)
  34.130 +            return access(sym, pos, location, site, name, qualified, List.<Type>nil(), null);
  34.131 +        else
  34.132 +            return sym;
  34.133 +    }
  34.134 +
  34.135 +    /** Same as original access(), but without location, type arguments and arguments.
  34.136       */
  34.137      Symbol access(Symbol sym,
  34.138                    DiagnosticPosition pos,
  34.139                    Type site,
  34.140                    Name name,
  34.141                    boolean qualified) {
  34.142 -        if (sym.kind >= AMBIGUOUS)
  34.143 -            return access(sym, pos, site, name, qualified, List.<Type>nil(), null);
  34.144 -        else
  34.145 -            return sym;
  34.146 +        return access(sym, pos, site.tsym, site, name, qualified);
  34.147      }
  34.148  
  34.149      /** Check that sym is not an abstract method.
  34.150 @@ -1399,6 +1404,11 @@
  34.151      Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env<AttrContext> env,
  34.152                                    Type site, Name name, List<Type> argtypes,
  34.153                                    List<Type> typeargtypes) {
  34.154 +        return resolveQualifiedMethod(pos, env, site.tsym, site, name, argtypes, typeargtypes);
  34.155 +    }
  34.156 +    Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env<AttrContext> env,
  34.157 +                                  Symbol location, Type site, Name name, List<Type> argtypes,
  34.158 +                                  List<Type> typeargtypes) {
  34.159          Symbol sym = startResolution();
  34.160          List<MethodResolutionPhase> steps = methodResolutionSteps;
  34.161          while (steps.nonEmpty() &&
  34.162 @@ -1412,26 +1422,25 @@
  34.163              steps = steps.tail;
  34.164          }
  34.165          if (sym.kind >= AMBIGUOUS) {
  34.166 -            if (site.tsym.isPolymorphicSignatureGeneric() ||
  34.167 -                    isTransitionalDynamicCallSite(site, sym)) {
  34.168 +            if (site.tsym.isPolymorphicSignatureGeneric()) {
  34.169                  //polymorphic receiver - synthesize new method symbol
  34.170                  env.info.varArgs = false;
  34.171                  sym = findPolymorphicSignatureInstance(env,
  34.172 -                        site, name, null, argtypes, typeargtypes);
  34.173 +                        site, name, null, argtypes);
  34.174              }
  34.175              else {
  34.176                  //if nothing is found return the 'first' error
  34.177                  MethodResolutionPhase errPhase =
  34.178                          firstErroneousResolutionPhase();
  34.179                  sym = access(methodResolutionCache.get(errPhase),
  34.180 -                        pos, site, name, true, argtypes, typeargtypes);
  34.181 +                        pos, location, site, name, true, argtypes, typeargtypes);
  34.182                  env.info.varArgs = errPhase.isVarargsRequired;
  34.183              }
  34.184          } else if (allowMethodHandles && sym.isPolymorphicSignatureGeneric()) {
  34.185              //non-instantiated polymorphic signature - synthesize new method symbol
  34.186              env.info.varArgs = false;
  34.187              sym = findPolymorphicSignatureInstance(env,
  34.188 -                    site, name, (MethodSymbol)sym, argtypes, typeargtypes);
  34.189 +                    site, name, (MethodSymbol)sym, argtypes);
  34.190          }
  34.191          return sym;
  34.192      }
  34.193 @@ -1449,15 +1458,9 @@
  34.194      Symbol findPolymorphicSignatureInstance(Env<AttrContext> env, Type site,
  34.195                                              Name name,
  34.196                                              MethodSymbol spMethod,  // sig. poly. method or null if none
  34.197 -                                            List<Type> argtypes,
  34.198 -                                            List<Type> typeargtypes) {
  34.199 -        if (typeargtypes.nonEmpty() && (site.tsym.isPolymorphicSignatureGeneric() ||
  34.200 -                (spMethod != null && spMethod.isPolymorphicSignatureGeneric()))) {
  34.201 -            log.warning(env.tree.pos(), "type.parameter.on.polymorphic.signature");
  34.202 -        }
  34.203 -
  34.204 +                                            List<Type> argtypes) {
  34.205          Type mtype = infer.instantiatePolymorphicSignatureInstance(env,
  34.206 -                site, name, spMethod, argtypes, typeargtypes);
  34.207 +                site, name, spMethod, argtypes);
  34.208          long flags = ABSTRACT | HYPOTHETICAL | POLYMORPHIC_SIGNATURE |
  34.209                      (spMethod != null ?
  34.210                          spMethod.flags() & Flags.AccessFlags :
  34.211 @@ -1497,7 +1500,7 @@
  34.212                                          List<Type> argtypes,
  34.213                                          List<Type> typeargtypes) {
  34.214          Symbol sym = resolveQualifiedMethod(
  34.215 -            pos, env, site, name, argtypes, typeargtypes);
  34.216 +            pos, env, site.tsym, site, name, argtypes, typeargtypes);
  34.217          if (sym.kind == MTH) return (MethodSymbol)sym;
  34.218          else throw new FatalError(
  34.219                   diags.fragment("fatal.err.cant.locate.meth",
  34.220 @@ -1572,11 +1575,13 @@
  34.221                  null;
  34.222              Symbol errSym = new ResolveError(WRONG_MTH, "diamond error") {
  34.223                  @Override
  34.224 -                JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
  34.225 +                JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos,
  34.226 +                        Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
  34.227                      String key = details == null ?
  34.228                          "cant.apply.diamond" :
  34.229                          "cant.apply.diamond.1";
  34.230 -                    return diags.create(dkind, log.currentSource(), pos, key, diags.fragment("diamond", site.tsym), details);
  34.231 +                    return diags.create(dkind, log.currentSource(), pos, key,
  34.232 +                            diags.fragment("diamond", site.tsym), details);
  34.233                  }
  34.234              };
  34.235              MethodResolutionPhase errPhase = firstErroneousResolutionPhase();
  34.236 @@ -1755,17 +1760,18 @@
  34.237  
  34.238      public void logAccessError(Env<AttrContext> env, JCTree tree, Type type) {
  34.239          AccessError error = new AccessError(env, type.getEnclosingType(), type.tsym);
  34.240 -        logResolveError(error, tree.pos(), type.getEnclosingType(), null, null, null);
  34.241 +        logResolveError(error, tree.pos(), type.getEnclosingType().tsym, type.getEnclosingType(), null, null, null);
  34.242      }
  34.243      //where
  34.244      private void logResolveError(ResolveError error,
  34.245              DiagnosticPosition pos,
  34.246 +            Symbol location,
  34.247              Type site,
  34.248              Name name,
  34.249              List<Type> argtypes,
  34.250              List<Type> typeargtypes) {
  34.251          JCDiagnostic d = error.getDiagnostic(JCDiagnostic.DiagnosticType.ERROR,
  34.252 -                pos, site, name, argtypes, typeargtypes);
  34.253 +                pos, location, site, name, argtypes, typeargtypes);
  34.254          if (d != null) {
  34.255              d.setFlag(DiagnosticFlag.RESOLVE_ERROR);
  34.256              log.report(d);
  34.257 @@ -1835,6 +1841,7 @@
  34.258           */
  34.259          abstract JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
  34.260                  DiagnosticPosition pos,
  34.261 +                Symbol location,
  34.262                  Type site,
  34.263                  Name name,
  34.264                  List<Type> argtypes,
  34.265 @@ -1900,6 +1907,7 @@
  34.266          @Override
  34.267          JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
  34.268                  DiagnosticPosition pos,
  34.269 +                Symbol location,
  34.270                  Type site,
  34.271                  Name name,
  34.272                  List<Type> argtypes,
  34.273 @@ -1910,16 +1918,23 @@
  34.274                  return null;
  34.275  
  34.276              if (isOperator(name)) {
  34.277 +                boolean isUnaryOp = argtypes.size() == 1;
  34.278 +                String key = argtypes.size() == 1 ?
  34.279 +                    "operator.cant.be.applied" :
  34.280 +                    "operator.cant.be.applied.1";
  34.281 +                Type first = argtypes.head;
  34.282 +                Type second = !isUnaryOp ? argtypes.tail.head : null;
  34.283                  return diags.create(dkind, log.currentSource(), pos,
  34.284 -                        "operator.cant.be.applied", name, argtypes);
  34.285 +                        key, name, first, second);
  34.286              }
  34.287              boolean hasLocation = false;
  34.288 -            if (!site.tsym.name.isEmpty()) {
  34.289 -                if (site.tsym.kind == PCK && !site.tsym.exists()) {
  34.290 +            if (!location.name.isEmpty()) {
  34.291 +                if (location.kind == PCK && !site.tsym.exists()) {
  34.292                      return diags.create(dkind, log.currentSource(), pos,
  34.293 -                        "doesnt.exist", site.tsym);
  34.294 +                        "doesnt.exist", location);
  34.295                  }
  34.296 -                hasLocation = true;
  34.297 +                hasLocation = !location.name.equals(names._this) &&
  34.298 +                        !location.name.equals(names._super);
  34.299              }
  34.300              boolean isConstructor = kind == ABSENT_MTH &&
  34.301                      name == names.table.names.init;
  34.302 @@ -1930,7 +1945,7 @@
  34.303                  return diags.create(dkind, log.currentSource(), pos,
  34.304                          errKey, kindname, idname, //symbol kindname, name
  34.305                          typeargtypes, argtypes, //type parameters and arguments (if any)
  34.306 -                        typeKindName(site), site); //location kindname, type
  34.307 +                        getLocationDiag(location)); //location kindname, type
  34.308              }
  34.309              else {
  34.310                  return diags.create(dkind, log.currentSource(), pos,
  34.311 @@ -1951,6 +1966,16 @@
  34.312              }
  34.313              return key + suffix;
  34.314          }
  34.315 +        private JCDiagnostic getLocationDiag(Symbol location) {
  34.316 +            boolean isVar = location.kind == VAR;
  34.317 +            String key = isVar ?
  34.318 +                "location.1" :
  34.319 +                "location";
  34.320 +            return diags.fragment(key,
  34.321 +                    kindName(location),
  34.322 +                    location,
  34.323 +                    isVar ? location.type : null);
  34.324 +        }
  34.325      }
  34.326  
  34.327      /**
  34.328 @@ -1991,6 +2016,7 @@
  34.329          @Override
  34.330          JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
  34.331                  DiagnosticPosition pos,
  34.332 +                Symbol location,
  34.333                  Type site,
  34.334                  Name name,
  34.335                  List<Type> argtypes,
  34.336 @@ -2042,6 +2068,7 @@
  34.337          @Override
  34.338          JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
  34.339                  DiagnosticPosition pos,
  34.340 +                Symbol location,
  34.341                  Type site,
  34.342                  Name name,
  34.343                  List<Type> argtypes,
  34.344 @@ -2057,7 +2084,7 @@
  34.345                  return new JCDiagnostic.MultilineDiagnostic(err, candidateDetails(site));
  34.346              } else {
  34.347                  return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind, pos,
  34.348 -                    site, name, argtypes, typeargtypes);
  34.349 +                    location, site, name, argtypes, typeargtypes);
  34.350              }
  34.351          }
  34.352  
  34.353 @@ -2157,6 +2184,7 @@
  34.354          @Override
  34.355          JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
  34.356                  DiagnosticPosition pos,
  34.357 +                Symbol location,
  34.358                  Type site,
  34.359                  Name name,
  34.360                  List<Type> argtypes,
  34.361 @@ -2166,7 +2194,7 @@
  34.362  
  34.363              if (sym.name == names.init && sym.owner != site.tsym) {
  34.364                  return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind,
  34.365 -                        pos, site, name, argtypes, typeargtypes);
  34.366 +                        pos, location, site, name, argtypes, typeargtypes);
  34.367              }
  34.368              else if ((sym.flags() & PUBLIC) != 0
  34.369                  || (env != null && this.site != null
  34.370 @@ -2201,6 +2229,7 @@
  34.371          @Override
  34.372          JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
  34.373                  DiagnosticPosition pos,
  34.374 +                Symbol location,
  34.375                  Type site,
  34.376                  Name name,
  34.377                  List<Type> argtypes,
  34.378 @@ -2231,6 +2260,7 @@
  34.379          @Override
  34.380          JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
  34.381                  DiagnosticPosition pos,
  34.382 +                Symbol location,
  34.383                  Type site,
  34.384                  Name name,
  34.385                  List<Type> argtypes,
    35.1 --- a/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Thu Jan 27 17:28:57 2011 -0800
    35.2 +++ b/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Fri Jan 28 10:06:08 2011 -0800
    35.3 @@ -1,5 +1,5 @@
    35.4  /*
    35.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    35.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    35.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    35.8   *
    35.9   * This code is free software; you can redistribute it and/or modify it
   35.10 @@ -69,7 +69,6 @@
   35.11      private boolean allowEnums;
   35.12      private Types types;
   35.13      private final Resolve resolve;
   35.14 -    private final TypeAnnotations typeAnnotations;
   35.15  
   35.16      /**
   35.17       * Flag to indicate whether or not to generate bridge methods.
   35.18 @@ -91,7 +90,6 @@
   35.19          types = Types.instance(context);
   35.20          make = TreeMaker.instance(context);
   35.21          resolve = Resolve.instance(context);
   35.22 -        typeAnnotations = TypeAnnotations.instance(context);
   35.23      }
   35.24  
   35.25      /** A hashtable mapping bridge methods to the methods they override after
   35.26 @@ -182,7 +180,7 @@
   35.27              parameters = parameters.tail;
   35.28          }
   35.29          Type parameter = parameters.head;
   35.30 -        assert varargsElement != null || args.length() == 1;
   35.31 +        Assert.check(varargsElement != null || args.length() == 1);
   35.32          if (varargsElement != null) {
   35.33              while (args.nonEmpty()) {
   35.34                  args.head = translate(args.head, varargsElement);
   35.35 @@ -445,14 +443,12 @@
   35.36      }
   35.37  
   35.38      public void visitClassDef(JCClassDecl tree) {
   35.39 -        typeAnnotations.taFillAndLift(tree, true);
   35.40          translateClass(tree.sym);
   35.41          result = tree;
   35.42      }
   35.43  
   35.44      JCMethodDecl currentMethod = null;
   35.45      public void visitMethodDef(JCMethodDecl tree) {
   35.46 -        tree.sym.typeAnnotations = tree.sym.typeAnnotations;
   35.47          JCMethodDecl previousMethod = currentMethod;
   35.48          try {
   35.49              currentMethod = tree;
   35.50 @@ -598,7 +594,7 @@
   35.51          if (tree.varargsElement != null)
   35.52              tree.varargsElement = types.erasure(tree.varargsElement);
   35.53          else
   35.54 -            assert tree.args.length() == argtypes.length();
   35.55 +            Assert.check(tree.args.length() == argtypes.length());
   35.56          tree.args = translateArgs(tree.args, argtypes, tree.varargsElement);
   35.57  
   35.58          // Insert casts of method invocation results as needed.
    36.1 --- a/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Thu Jan 27 17:28:57 2011 -0800
    36.2 +++ b/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Fri Jan 28 10:06:08 2011 -0800
    36.3 @@ -1,5 +1,5 @@
    36.4  /*
    36.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    36.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    36.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    36.8   *
    36.9   * This code is free software; you can redistribute it and/or modify it
   36.10 @@ -472,7 +472,7 @@
   36.11       */
   36.12      protected Archive openArchive(File zipFileName) throws IOException {
   36.13          File origZipFileName = zipFileName;
   36.14 -        if (!ignoreSymbolFile && paths.isBootClassPathRtJar(zipFileName)) {
   36.15 +        if (!ignoreSymbolFile && paths.isDefaultBootClassPathRtJar(zipFileName)) {
   36.16              File file = zipFileName.getParentFile().getParentFile(); // ${java.home}
   36.17              if (new File(file.getName()).equals(new File("jre")))
   36.18                  file = file.getParentFile();
    37.1 --- a/src/share/classes/com/sun/tools/javac/file/Paths.java	Thu Jan 27 17:28:57 2011 -0800
    37.2 +++ b/src/share/classes/com/sun/tools/javac/file/Paths.java	Fri Jan 28 10:06:08 2011 -0800
    37.3 @@ -1,5 +1,5 @@
    37.4  /*
    37.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    37.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    37.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    37.8   *
    37.9   * This code is free software; you can redistribute it and/or modify it
   37.10 @@ -112,7 +112,7 @@
   37.11       * rt.jar as found on the default bootclass path.  If the user specified a
   37.12       * bootclasspath, null is used.
   37.13       */
   37.14 -    private File bootClassPathRtJar = null;
   37.15 +    private File defaultBootClassPathRtJar = null;
   37.16  
   37.17      /**
   37.18       *  Is bootclasspath the default?
   37.19 @@ -143,8 +143,10 @@
   37.20                  // no defaults for other paths
   37.21                  p = null;
   37.22          } else {
   37.23 -            if (location == PLATFORM_CLASS_PATH)
   37.24 +            if (location == PLATFORM_CLASS_PATH) {
   37.25 +                defaultBootClassPathRtJar = null;
   37.26                  isDefaultBootClassPath = false;
   37.27 +            }
   37.28              p = new Path();
   37.29              for (File f: path)
   37.30                  p.addFile(f, warn); // TODO: is use of warn appropriate?
   37.31 @@ -185,8 +187,8 @@
   37.32              : Collections.unmodifiableCollection(p);
   37.33      }
   37.34  
   37.35 -    boolean isBootClassPathRtJar(File file) {
   37.36 -        return file.equals(bootClassPathRtJar);
   37.37 +    boolean isDefaultBootClassPathRtJar(File file) {
   37.38 +        return file.equals(defaultBootClassPathRtJar);
   37.39      }
   37.40  
   37.41      /**
   37.42 @@ -355,7 +357,7 @@
   37.43      }
   37.44  
   37.45      private Path computeBootClassPath() {
   37.46 -        bootClassPathRtJar = null;
   37.47 +        defaultBootClassPathRtJar = null;
   37.48          Path path = new Path();
   37.49  
   37.50          String bootclasspathOpt = options.get(BOOTCLASSPATH);
   37.51 @@ -380,7 +382,7 @@
   37.52              File rt_jar = new File("rt.jar");
   37.53              for (File file : getPathEntries(files)) {
   37.54                  if (new File(file.getName()).equals(rt_jar))
   37.55 -                    bootClassPathRtJar = file;
   37.56 +                    defaultBootClassPathRtJar = file;
   37.57              }
   37.58          }
   37.59  
    38.1 --- a/src/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java	Thu Jan 27 17:28:57 2011 -0800
    38.2 +++ b/src/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java	Fri Jan 28 10:06:08 2011 -0800
    38.3 @@ -1,5 +1,5 @@
    38.4  /*
    38.5 - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
    38.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    38.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    38.8   *
    38.9   * This code is free software; you can redistribute it and/or modify it
   38.10 @@ -42,6 +42,7 @@
   38.11  import com.sun.tools.javac.file.JavacFileManager.Archive;
   38.12  import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
   38.13  import com.sun.tools.javac.file.RelativePath.RelativeFile;
   38.14 +import com.sun.tools.javac.util.Assert;
   38.15  import com.sun.tools.javac.util.List;
   38.16  
   38.17  /**
   38.18 @@ -146,7 +147,7 @@
   38.19          @Override
   38.20          public InputStream openInputStream() throws IOException {
   38.21              if (inputStream == null) {
   38.22 -                assert entry != null; // see constructor
   38.23 +                Assert.checkNonNull(entry); // see constructor
   38.24                  inputStream = new ByteArrayInputStream(zfIndex.read(entry));
   38.25              }
   38.26              return inputStream;
    39.1 --- a/src/share/classes/com/sun/tools/javac/jvm/CRTable.java	Thu Jan 27 17:28:57 2011 -0800
    39.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/CRTable.java	Fri Jan 28 10:06:08 2011 -0800
    39.3 @@ -1,5 +1,5 @@
    39.4  /*
    39.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    39.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    39.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    39.8   *
    39.9   * This code is free software; you can redistribute it and/or modify it
   39.10 @@ -101,7 +101,7 @@
   39.11                  continue;
   39.12  
   39.13              SourceRange pos = positions.get(entry.tree);
   39.14 -            assert pos != null : "CRT: tree source positions are undefined";
   39.15 +            Assert.checkNonNull(pos, "CRT: tree source positions are undefined");
   39.16              if ((pos.startPos == Position.NOPOS) || (pos.endPos == Position.NOPOS))
   39.17                  continue;
   39.18  
   39.19 @@ -517,7 +517,7 @@
   39.20          }
   39.21  
   39.22          public void visitTree(JCTree tree) {
   39.23 -            assert false;
   39.24 +            Assert.error();
   39.25          }
   39.26  
   39.27          /** The start position of given tree.
    40.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java	Thu Jan 27 17:28:57 2011 -0800
    40.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java	Fri Jan 28 10:06:08 2011 -0800
    40.3 @@ -1,5 +1,5 @@
    40.4  /*
    40.5 - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
    40.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    40.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    40.8   *
    40.9   * This code is free software; you can redistribute it and/or modify it
   40.10 @@ -80,6 +80,9 @@
   40.11      public final static int CONSTANT_Methodref = 10;
   40.12      public final static int CONSTANT_InterfaceMethodref = 11;
   40.13      public final static int CONSTANT_NameandType = 12;
   40.14 +    public final static int CONSTANT_MethodHandle = 15;
   40.15 +    public final static int CONSTANT_MethodType = 16;
   40.16 +    public final static int CONSTANT_InvokeDynamic = 18;
   40.17  
   40.18      public final static int MAX_PARAMETERS = 0xff;
   40.19      public final static int MAX_DIMENSIONS = 0xff;
    41.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Jan 27 17:28:57 2011 -0800
    41.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri Jan 28 10:06:08 2011 -0800
    41.3 @@ -1,5 +1,5 @@
    41.4  /*
    41.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    41.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    41.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    41.8   *
    41.9   * This code is free software; you can redistribute it and/or modify it
   41.10 @@ -207,10 +207,6 @@
   41.11      /** The minor version number of the class file being read. */
   41.12      int minorVersion;
   41.13  
   41.14 -    /** Switch: debug output for JSR 308-related operations.
   41.15 -     */
   41.16 -    boolean debugJSR308;
   41.17 -
   41.18      /** A table to hold the constant pool indices for method parameter
   41.19       * names, as given in LocalVariableTable attributes.
   41.20       */
   41.21 @@ -246,9 +242,9 @@
   41.22          if (classes != null) return;
   41.23  
   41.24          if (definitive) {
   41.25 -            assert packages == null || packages == syms.packages;
   41.26 +            Assert.check(packages == null || packages == syms.packages);
   41.27              packages = syms.packages;
   41.28 -            assert classes == null || classes == syms.classes;
   41.29 +            Assert.check(classes == null || classes == syms.classes);
   41.30              classes = syms.classes;
   41.31          } else {
   41.32              packages = new HashMap<Name, PackageSymbol>();
   41.33 @@ -297,7 +293,6 @@
   41.34              : null;
   41.35  
   41.36          typevars = new Scope(syms.noSymbol);
   41.37 -        debugJSR308 = options.isSet("TA:reader");
   41.38  
   41.39          lintClassfile = Lint.instance(context).isEnabled(LintCategory.CLASSFILE);
   41.40  
   41.41 @@ -439,14 +434,19 @@
   41.42              }
   41.43              case CONSTANT_Class:
   41.44              case CONSTANT_String:
   41.45 +            case CONSTANT_MethodType:
   41.46                  bp = bp + 2;
   41.47                  break;
   41.48 +            case CONSTANT_MethodHandle:
   41.49 +                bp = bp + 3;
   41.50 +                break;
   41.51              case CONSTANT_Fieldref:
   41.52              case CONSTANT_Methodref:
   41.53              case CONSTANT_InterfaceMethodref:
   41.54              case CONSTANT_NameandType:
   41.55              case CONSTANT_Integer:
   41.56              case CONSTANT_Float:
   41.57 +            case CONSTANT_InvokeDynamic:
   41.58                  bp = bp + 4;
   41.59                  break;
   41.60              case CONSTANT_Long:
   41.61 @@ -515,6 +515,15 @@
   41.62          case CONSTANT_Double:
   41.63              poolObj[i] = new Double(getDouble(index + 1));
   41.64              break;
   41.65 +        case CONSTANT_MethodHandle:
   41.66 +            skipBytes(4);
   41.67 +            break;
   41.68 +        case CONSTANT_MethodType:
   41.69 +            skipBytes(3);
   41.70 +            break;
   41.71 +        case CONSTANT_InvokeDynamic:
   41.72 +            skipBytes(5);
   41.73 +            break;
   41.74          default:
   41.75              throw badClassFile("bad.const.pool.tag", Byte.toString(tag));
   41.76          }
   41.77 @@ -535,7 +544,7 @@
   41.78          int index =  poolIdx[i];
   41.79          int len = getChar(index + 1);
   41.80          int start = index + 3;
   41.81 -        assert buf[start] == '[' || buf[start + len - 1] != ';';
   41.82 +        Assert.check(buf[start] == '[' || buf[start + len - 1] != ';');
   41.83          // by the above assertion, the following test can be
   41.84          // simplified to (buf[start] == '[')
   41.85          return (buf[start] == '[' || buf[start + len - 1] == ';')
   41.86 @@ -1046,7 +1055,7 @@
   41.87                          readingClassAttr = true;
   41.88                          try {
   41.89                              ClassType ct1 = (ClassType)c.type;
   41.90 -                            assert c == currentOwner;
   41.91 +                            Assert.check(c == currentOwner);
   41.92                              ct1.typarams_field = readTypeParams(nextChar());
   41.93                              ct1.supertype_field = sigToType();
   41.94                              ListBuffer<Type> is = new ListBuffer<Type>();
   41.95 @@ -1128,20 +1137,6 @@
   41.96                  }
   41.97              },
   41.98  
   41.99 -            // v51 attributes
  41.100 -            new AttributeReader(names.RuntimeVisibleTypeAnnotations, V51, CLASS_OR_MEMBER_ATTRIBUTE) {
  41.101 -                void read(Symbol sym, int attrLen) {
  41.102 -                    attachTypeAnnotations(sym);
  41.103 -                }
  41.104 -            },
  41.105 -
  41.106 -            new AttributeReader(names.RuntimeInvisibleTypeAnnotations, V51, CLASS_OR_MEMBER_ATTRIBUTE) {
  41.107 -                void read(Symbol sym, int attrLen) {
  41.108 -                    attachTypeAnnotations(sym);
  41.109 -                }
  41.110 -            },
  41.111 -
  41.112 -
  41.113              // The following attributes for a Code attribute are not currently handled
  41.114              // StackMapTable
  41.115              // SourceDebugExtension
  41.116 @@ -1351,17 +1346,6 @@
  41.117          }
  41.118      }
  41.119  
  41.120 -    void attachTypeAnnotations(final Symbol sym) {
  41.121 -        int numAttributes = nextChar();
  41.122 -        if (numAttributes != 0) {
  41.123 -            ListBuffer<TypeAnnotationProxy> proxies =
  41.124 -                ListBuffer.lb();
  41.125 -            for (int i = 0; i < numAttributes; i++)
  41.126 -                proxies.append(readTypeAnnotation());
  41.127 -            annotate.later(new TypeAnnotationCompleter(sym, proxies.toList()));
  41.128 -        }
  41.129 -    }
  41.130 -
  41.131      /** Attach the default value for an annotation element.
  41.132       */
  41.133      void attachAnnotationDefault(final Symbol sym) {
  41.134 @@ -1398,121 +1382,6 @@
  41.135          return new CompoundAnnotationProxy(t, pairs.toList());
  41.136      }
  41.137  
  41.138 -    TypeAnnotationProxy readTypeAnnotation() {
  41.139 -        CompoundAnnotationProxy proxy = readCompoundAnnotation();
  41.140 -        TypeAnnotationPosition position = readPosition();
  41.141 -
  41.142 -        if (debugJSR308)
  41.143 -            System.out.println("TA: reading: " + proxy + " @ " + position
  41.144 -                    + " in " + log.currentSourceFile());
  41.145 -
  41.146 -        return new TypeAnnotationProxy(proxy, position);
  41.147 -    }
  41.148 -
  41.149 -    TypeAnnotationPosition readPosition() {
  41.150 -        byte tag = nextByte();
  41.151 -
  41.152 -        if (!TargetType.isValidTargetTypeValue(tag))
  41.153 -            throw this.badClassFile("bad.type.annotation.value", tag);
  41.154 -
  41.155 -        TypeAnnotationPosition position = new TypeAnnotationPosition();
  41.156 -        TargetType type = TargetType.fromTargetTypeValue(tag);
  41.157 -
  41.158 -        position.type = type;
  41.159 -
  41.160 -        switch (type) {
  41.161 -        // type case
  41.162 -        case TYPECAST:
  41.163 -        case TYPECAST_GENERIC_OR_ARRAY:
  41.164 -        // object creation
  41.165 -        case INSTANCEOF:
  41.166 -        case INSTANCEOF_GENERIC_OR_ARRAY:
  41.167 -        // new expression
  41.168 -        case NEW:
  41.169 -        case NEW_GENERIC_OR_ARRAY:
  41.170 -            position.offset = nextChar();
  41.171 -            break;
  41.172 -         // local variable
  41.173 -        case LOCAL_VARIABLE:
  41.174 -        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
  41.175 -            int table_length = nextChar();
  41.176 -            position.lvarOffset = new int[table_length];
  41.177 -            position.lvarLength = new int[table_length];
  41.178 -            position.lvarIndex = new int[table_length];
  41.179 -
  41.180 -            for (int i = 0; i < table_length; ++i) {
  41.181 -                position.lvarOffset[i] = nextChar();
  41.182 -                position.lvarLength[i] = nextChar();
  41.183 -                position.lvarIndex[i] = nextChar();
  41.184 -            }
  41.185 -            break;
  41.186 -         // method receiver
  41.187 -        case METHOD_RECEIVER:
  41.188 -            // Do nothing
  41.189 -            break;
  41.190 -        // type parameters
  41.191 -        case CLASS_TYPE_PARAMETER:
  41.192 -        case METHOD_TYPE_PARAMETER:
  41.193 -            position.parameter_index = nextByte();
  41.194 -            break;
  41.195 -        // type parameter bounds
  41.196 -        case CLASS_TYPE_PARAMETER_BOUND:
  41.197 -        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
  41.198 -        case METHOD_TYPE_PARAMETER_BOUND:
  41.199 -        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
  41.200 -            position.parameter_index = nextByte();
  41.201 -            position.bound_index = nextByte();
  41.202 -            break;
  41.203 -         // wildcard
  41.204 -        case WILDCARD_BOUND:
  41.205 -        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
  41.206 -            position.wildcard_position = readPosition();
  41.207 -            break;
  41.208 -         // Class extends and implements clauses
  41.209 -        case CLASS_EXTENDS:
  41.210 -        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
  41.211 -            position.type_index = nextChar();
  41.212 -            break;
  41.213 -        // throws
  41.214 -        case THROWS:
  41.215 -            position.type_index = nextChar();
  41.216 -            break;
  41.217 -        case CLASS_LITERAL:
  41.218 -        case CLASS_LITERAL_GENERIC_OR_ARRAY:
  41.219 -            position.offset = nextChar();
  41.220 -            break;
  41.221 -        // method parameter: not specified
  41.222 -        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
  41.223 -            position.parameter_index = nextByte();
  41.224 -            break;
  41.225 -        // method type argument: wasn't specified
  41.226 -        case NEW_TYPE_ARGUMENT:
  41.227 -        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
  41.228 -        case METHOD_TYPE_ARGUMENT:
  41.229 -        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
  41.230 -            position.offset = nextChar();
  41.231 -            position.type_index = nextByte();
  41.232 -            break;
  41.233 -        // We don't need to worry abut these
  41.234 -        case METHOD_RETURN_GENERIC_OR_ARRAY:
  41.235 -        case FIELD_GENERIC_OR_ARRAY:
  41.236 -            break;
  41.237 -        case UNKNOWN:
  41.238 -            break;
  41.239 -        default:
  41.240 -            throw new AssertionError("unknown type: " + position);
  41.241 -        }
  41.242 -
  41.243 -        if (type.hasLocation()) {
  41.244 -            int len = nextChar();
  41.245 -            ListBuffer<Integer> loc = ListBuffer.lb();
  41.246 -            for (int i = 0; i < len; i++)
  41.247 -                loc = loc.append((int)nextByte());
  41.248 -            position.location = loc.toList();
  41.249 -        }
  41.250 -
  41.251 -        return position;
  41.252 -    }
  41.253      Attribute readAttributeValue() {
  41.254          char c = (char) buf[bp++];
  41.255          switch (c) {
  41.256 @@ -1825,45 +1694,6 @@
  41.257          }
  41.258      }
  41.259  
  41.260 -    class TypeAnnotationCompleter extends AnnotationCompleter {
  41.261 -
  41.262 -        List<TypeAnnotationProxy> proxies;
  41.263 -
  41.264 -        TypeAnnotationCompleter(Symbol sym,
  41.265 -                List<TypeAnnotationProxy> proxies) {
  41.266 -            super(sym, List.<CompoundAnnotationProxy>nil());
  41.267 -            this.proxies = proxies;
  41.268 -        }
  41.269 -
  41.270 -        List<Attribute.TypeCompound> deproxyTypeCompoundList(List<TypeAnnotationProxy> proxies) {
  41.271 -            ListBuffer<Attribute.TypeCompound> buf = ListBuffer.lb();
  41.272 -            for (TypeAnnotationProxy proxy: proxies) {
  41.273 -                Attribute.Compound compound = deproxyCompound(proxy.compound);
  41.274 -                Attribute.TypeCompound typeCompound = new Attribute.TypeCompound(compound, proxy.position);
  41.275 -                buf.add(typeCompound);
  41.276 -            }
  41.277 -            return buf.toList();
  41.278 -        }
  41.279 -
  41.280 -        @Override
  41.281 -        public void enterAnnotation() {
  41.282 -            JavaFileObject previousClassFile = currentClassFile;
  41.283 -            try {
  41.284 -                currentClassFile = classFile;
  41.285 -                List<Attribute.TypeCompound> newList = deproxyTypeCompoundList(proxies);
  41.286 -              if (debugJSR308)
  41.287 -              System.out.println("TA: reading: adding " + newList
  41.288 -                      + " to symbol " + sym + " in " + log.currentSourceFile());
  41.289 -                sym.typeAnnotations = ((sym.typeAnnotations == null)
  41.290 -                                        ? newList
  41.291 -                                        : newList.prependList(sym.typeAnnotations));
  41.292 -
  41.293 -            } finally {
  41.294 -                currentClassFile = previousClassFile;
  41.295 -            }
  41.296 -        }
  41.297 -    }
  41.298 -
  41.299  
  41.300  /************************************************************************
  41.301   * Reading Symbols
  41.302 @@ -2005,6 +1835,13 @@
  41.303          sym.savedParameterNames = paramNames.reverse();
  41.304      }
  41.305  
  41.306 +    /**
  41.307 +     * skip n bytes
  41.308 +     */
  41.309 +    void skipBytes(int n) {
  41.310 +        bp = bp + n;
  41.311 +    }
  41.312 +
  41.313      /** Skip a field or method
  41.314       */
  41.315      void skipMember() {
  41.316 @@ -2092,9 +1929,9 @@
  41.317          if (ct.interfaces_field == null)
  41.318              ct.interfaces_field = is.reverse();
  41.319  
  41.320 -        if (fieldCount != nextChar()) assert false;
  41.321 +        Assert.check(fieldCount == nextChar());
  41.322          for (int i = 0; i < fieldCount; i++) enterMember(c, readField());
  41.323 -        if (methodCount != nextChar()) assert false;
  41.324 +        Assert.check(methodCount == nextChar());
  41.325          for (int i = 0; i < methodCount; i++) enterMember(c, readMethod());
  41.326  
  41.327          typevars = typevars.leave();
  41.328 @@ -2203,7 +2040,7 @@
  41.329      public ClassSymbol defineClass(Name name, Symbol owner) {
  41.330          ClassSymbol c = new ClassSymbol(0, name, owner);
  41.331          if (owner.kind == PCK)
  41.332 -            assert classes.get(c.flatname) == null : c;
  41.333 +            Assert.checkNull(classes.get(c.flatname), c);
  41.334          c.completer = this;
  41.335          return c;
  41.336      }
  41.337 @@ -2343,9 +2180,9 @@
  41.338          if (classfile != null) {
  41.339              JavaFileObject previousClassFile = currentClassFile;
  41.340              try {
  41.341 -                assert !filling :
  41.342 -                    "Filling " + classfile.toUri() +
  41.343 -                    " during " + previousClassFile;
  41.344 +                if (filling) {
  41.345 +                    Assert.error("Filling " + classfile.toUri() + " during " + previousClassFile);
  41.346 +                }
  41.347                  currentClassFile = classfile;
  41.348                  if (verbose) {
  41.349                      printVerbose("loading", currentClassFile.toString());
  41.350 @@ -2491,7 +2328,7 @@
  41.351      public PackageSymbol enterPackage(Name fullname) {
  41.352          PackageSymbol p = packages.get(fullname);
  41.353          if (p == null) {
  41.354 -            assert !fullname.isEmpty() : "rootPackage missing!";
  41.355 +            Assert.check(!fullname.isEmpty(), "rootPackage missing!");
  41.356              p = new PackageSymbol(
  41.357                  Convert.shortName(fullname),
  41.358                  enterPackage(Convert.packagePart(fullname)));
    42.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Thu Jan 27 17:28:57 2011 -0800
    42.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Fri Jan 28 10:06:08 2011 -0800
    42.3 @@ -1,5 +1,5 @@
    42.4  /*
    42.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    42.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    42.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    42.8   *
    42.9   * This code is free software; you can redistribute it and/or modify it
   42.10 @@ -65,10 +65,6 @@
   42.11  
   42.12      private final Options options;
   42.13  
   42.14 -    /** Switch: debugging output for JSR 308-related operations.
   42.15 -     */
   42.16 -    private boolean debugJSR308;
   42.17 -
   42.18      /** Switch: verbose output.
   42.19       */
   42.20      private boolean verbose;
   42.21 @@ -180,7 +176,6 @@
   42.22          types = Types.instance(context);
   42.23          fileManager = context.get(JavaFileManager.class);
   42.24  
   42.25 -        debugJSR308    = options.isSet("TA:writer");
   42.26          verbose        = options.isSet(VERBOSE);
   42.27          scramble       = options.isSet("-scramble");
   42.28          scrambleAll    = options.isSet("-scrambleAll");
   42.29 @@ -224,11 +219,14 @@
   42.30      /** Return flags as a string, separated by " ".
   42.31       */
   42.32      public static String flagNames(long flags) {
   42.33 -        StringBuffer sbuf = new StringBuffer();
   42.34 +        StringBuilder sbuf = new StringBuilder();
   42.35          int i = 0;
   42.36          long f = flags & StandardFlags;
   42.37          while (f != 0) {
   42.38 -            if ((f & 1) != 0) sbuf.append(" " + flagName[i]);
   42.39 +            if ((f & 1) != 0) {
   42.40 +                sbuf.append(" ");
   42.41 +                sbuf.append(flagName[i]);
   42.42 +            }
   42.43              f = f >> 1;
   42.44              i++;
   42.45          }
   42.46 @@ -381,7 +379,7 @@
   42.47                               ? types.erasure(outer)
   42.48                               : outer);
   42.49              sigbuf.appendByte('.');
   42.50 -            assert c.flatname.startsWith(c.owner.enclClass().flatname);
   42.51 +            Assert.check(c.flatname.startsWith(c.owner.enclClass().flatname));
   42.52              sigbuf.appendName(rawOuter
   42.53                                ? c.flatname.subName(c.owner.enclClass().flatname.getByteLength()+1,c.flatname.getByteLength())
   42.54                                : c.name);
   42.55 @@ -421,7 +419,7 @@
   42.56      /** Return signature of given type
   42.57       */
   42.58      Name typeSig(Type type) {
   42.59 -        assert sigbuf.length == 0;
   42.60 +        Assert.check(sigbuf.length == 0);
   42.61          //- System.out.println(" ? " + type);
   42.62          assembleSig(type);
   42.63          Name n = sigbuf.toName(names);
   42.64 @@ -471,7 +469,7 @@
   42.65          int i = 1;
   42.66          while (i < pool.pp) {
   42.67              Object value = pool.pool[i];
   42.68 -            assert value != null;
   42.69 +            Assert.checkNonNull(value);
   42.70              if (value instanceof Pool.Method)
   42.71                  value = ((Pool.Method)value).m;
   42.72              else if (value instanceof Pool.Variable)
   42.73 @@ -534,7 +532,7 @@
   42.74                  poolbuf.appendByte(CONSTANT_Class);
   42.75                  poolbuf.appendChar(pool.put(xClassName(type)));
   42.76              } else {
   42.77 -                assert false : "writePool " + value;
   42.78 +                Assert.error("writePool " + value);
   42.79              }
   42.80              i++;
   42.81          }
   42.82 @@ -677,7 +675,6 @@
   42.83              acount++;
   42.84          }
   42.85          acount += writeJavaAnnotations(sym.getAnnotationMirrors());
   42.86 -        acount += writeTypeAnnotations(sym.typeAnnotations);
   42.87          return acount;
   42.88      }
   42.89  
   42.90 @@ -772,46 +769,6 @@
   42.91          return attrCount;
   42.92      }
   42.93  
   42.94 -    int writeTypeAnnotations(List<Attribute.TypeCompound> typeAnnos) {
   42.95 -        if (typeAnnos.isEmpty()) return 0;
   42.96 -
   42.97 -        ListBuffer<Attribute.TypeCompound> visibles = ListBuffer.lb();
   42.98 -        ListBuffer<Attribute.TypeCompound> invisibles = ListBuffer.lb();
   42.99 -
  42.100 -        for (Attribute.TypeCompound tc : typeAnnos) {
  42.101 -            if (tc.position.type == TargetType.UNKNOWN
  42.102 -                || !tc.position.emitToClassfile())
  42.103 -                continue;
  42.104 -            switch (types.getRetention(tc)) {
  42.105 -            case SOURCE: break;
  42.106 -            case CLASS: invisibles.append(tc); break;
  42.107 -            case RUNTIME: visibles.append(tc); break;
  42.108 -            default: ;// /* fail soft */ throw new AssertionError(vis);
  42.109 -            }
  42.110 -        }
  42.111 -
  42.112 -        int attrCount = 0;
  42.113 -        if (visibles.length() != 0) {
  42.114 -            int attrIndex = writeAttr(names.RuntimeVisibleTypeAnnotations);
  42.115 -            databuf.appendChar(visibles.length());
  42.116 -            for (Attribute.TypeCompound p : visibles)
  42.117 -                writeTypeAnnotation(p);
  42.118 -            endAttr(attrIndex);
  42.119 -            attrCount++;
  42.120 -        }
  42.121 -
  42.122 -        if (invisibles.length() != 0) {
  42.123 -            int attrIndex = writeAttr(names.RuntimeInvisibleTypeAnnotations);
  42.124 -            databuf.appendChar(invisibles.length());
  42.125 -            for (Attribute.TypeCompound p : invisibles)
  42.126 -                writeTypeAnnotation(p);
  42.127 -            endAttr(attrIndex);
  42.128 -            attrCount++;
  42.129 -        }
  42.130 -
  42.131 -        return attrCount;
  42.132 -    }
  42.133 -
  42.134      /** A visitor to write an attribute including its leading
  42.135       *  single-character marker.
  42.136       */
  42.137 @@ -844,7 +801,7 @@
  42.138                  databuf.appendByte('Z');
  42.139                  break;
  42.140              case CLASS:
  42.141 -                assert value instanceof String;
  42.142 +                Assert.check(value instanceof String);
  42.143                  databuf.appendByte('s');
  42.144                  value = names.fromString(value.toString()); // CONSTANT_Utf8
  42.145                  break;
  42.146 @@ -888,104 +845,6 @@
  42.147              p.snd.accept(awriter);
  42.148          }
  42.149      }
  42.150 -
  42.151 -    void writeTypeAnnotation(Attribute.TypeCompound c) {
  42.152 -        if (debugJSR308)
  42.153 -            System.out.println("TA: writing " + c + " at " + c.position
  42.154 -                    + " in " + log.currentSourceFile());
  42.155 -        writeCompoundAttribute(c);
  42.156 -        writePosition(c.position);
  42.157 -    }
  42.158 -
  42.159 -    void writePosition(TypeAnnotationPosition p) {
  42.160 -        databuf.appendByte(p.type.targetTypeValue());
  42.161 -        switch (p.type) {
  42.162 -        // type case
  42.163 -        case TYPECAST:
  42.164 -        case TYPECAST_GENERIC_OR_ARRAY:
  42.165 -        // object creation
  42.166 -        case INSTANCEOF:
  42.167 -        case INSTANCEOF_GENERIC_OR_ARRAY:
  42.168 -        // new expression
  42.169 -        case NEW:
  42.170 -        case NEW_GENERIC_OR_ARRAY:
  42.171 -            databuf.appendChar(p.offset);
  42.172 -            break;
  42.173 -         // local variable
  42.174 -        case LOCAL_VARIABLE:
  42.175 -        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
  42.176 -            databuf.appendChar(p.lvarOffset.length);  // for table length
  42.177 -            for (int i = 0; i < p.lvarOffset.length; ++i) {
  42.178 -                databuf.appendChar(p.lvarOffset[i]);
  42.179 -                databuf.appendChar(p.lvarLength[i]);
  42.180 -                databuf.appendChar(p.lvarIndex[i]);
  42.181 -            }
  42.182 -            break;
  42.183 -         // method receiver
  42.184 -        case METHOD_RECEIVER:
  42.185 -            // Do nothing
  42.186 -            break;
  42.187 -        // type parameters
  42.188 -        case CLASS_TYPE_PARAMETER:
  42.189 -        case METHOD_TYPE_PARAMETER:
  42.190 -            databuf.appendByte(p.parameter_index);
  42.191 -            break;
  42.192 -        // type parameters bounds
  42.193 -        case CLASS_TYPE_PARAMETER_BOUND:
  42.194 -        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
  42.195 -        case METHOD_TYPE_PARAMETER_BOUND:
  42.196 -        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
  42.197 -            databuf.appendByte(p.parameter_index);
  42.198 -            databuf.appendByte(p.bound_index);
  42.199 -            break;
  42.200 -         // wildcards
  42.201 -        case WILDCARD_BOUND:
  42.202 -        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
  42.203 -            writePosition(p.wildcard_position);
  42.204 -            break;
  42.205 -         // Class extends and implements clauses
  42.206 -        case CLASS_EXTENDS:
  42.207 -        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
  42.208 -            databuf.appendChar(p.type_index);
  42.209 -            break;
  42.210 -        // throws
  42.211 -        case THROWS:
  42.212 -            databuf.appendChar(p.type_index);
  42.213 -            break;
  42.214 -        case CLASS_LITERAL:
  42.215 -        case CLASS_LITERAL_GENERIC_OR_ARRAY:
  42.216 -            databuf.appendChar(p.offset);
  42.217 -            break;
  42.218 -        // method parameter: not specified
  42.219 -        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
  42.220 -            databuf.appendByte(p.parameter_index);
  42.221 -            break;
  42.222 -        // method type argument: wasn't specified
  42.223 -        case NEW_TYPE_ARGUMENT:
  42.224 -        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
  42.225 -        case METHOD_TYPE_ARGUMENT:
  42.226 -        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
  42.227 -            databuf.appendChar(p.offset);
  42.228 -            databuf.appendByte(p.type_index);
  42.229 -            break;
  42.230 -        // We don't need to worry abut these
  42.231 -        case METHOD_RETURN_GENERIC_OR_ARRAY:
  42.232 -        case FIELD_GENERIC_OR_ARRAY:
  42.233 -            break;
  42.234 -        case UNKNOWN:
  42.235 -            break;
  42.236 -        default:
  42.237 -            throw new AssertionError("unknown position: " + p);
  42.238 -        }
  42.239 -
  42.240 -        // Append location data for generics/arrays.
  42.241 -        if (p.type.hasLocation()) {
  42.242 -            databuf.appendChar(p.location.size());
  42.243 -            for (int i : p.location)
  42.244 -                databuf.appendByte((byte)i);
  42.245 -        }
  42.246 -    }
  42.247 -
  42.248  /**********************************************************************
  42.249   * Writing Objects
  42.250   **********************************************************************/
  42.251 @@ -1159,11 +1018,11 @@
  42.252                  Code.LocalVar var = code.varBuffer[i];
  42.253  
  42.254                  // write variable info
  42.255 -                assert var.start_pc >= 0;
  42.256 -                assert var.start_pc <= code.cp;
  42.257 +                Assert.check(var.start_pc >= 0
  42.258 +                        && var.start_pc <= code.cp);
  42.259                  databuf.appendChar(var.start_pc);
  42.260 -                assert var.length >= 0;
  42.261 -                assert (var.start_pc + var.length) <= code.cp;
  42.262 +                Assert.check(var.length >= 0
  42.263 +                        && (var.start_pc + var.length) <= code.cp);
  42.264                  databuf.appendChar(var.length);
  42.265                  VarSymbol sym = var.sym;
  42.266                  databuf.appendChar(pool.put(sym.name));
  42.267 @@ -1195,7 +1054,7 @@
  42.268                  databuf.appendChar(pool.put(typeSig(sym.type)));
  42.269                  databuf.appendChar(var.reg);
  42.270              }
  42.271 -            assert count == nGenericVars;
  42.272 +            Assert.check(count == nGenericVars);
  42.273              endAttr(alenIdx);
  42.274              acount++;
  42.275          }
  42.276 @@ -1266,7 +1125,7 @@
  42.277              }
  42.278              break;
  42.279          case JSR202: {
  42.280 -            assert code.stackMapBuffer == null;
  42.281 +            Assert.checkNull(code.stackMapBuffer);
  42.282              for (int i=0; i<nframes; i++) {
  42.283                  if (debugstackmap) System.out.print("  " + i + ":");
  42.284                  StackMapTableFrame frame = code.stackMapTableBuffer[i];
  42.285 @@ -1606,7 +1465,7 @@
  42.286       */
  42.287      public void writeClassFile(OutputStream out, ClassSymbol c)
  42.288          throws IOException, PoolOverflow, StringOverflow {
  42.289 -        assert (c.flags() & COMPOUND) == 0;
  42.290 +        Assert.check((c.flags() & COMPOUND) == 0);
  42.291          databuf.reset();
  42.292          poolbuf.reset();
  42.293          sigbuf.reset();
  42.294 @@ -1643,7 +1502,7 @@
  42.295              case MTH: if ((e.sym.flags() & HYPOTHETICAL) == 0) methodsCount++;
  42.296                        break;
  42.297              case TYP: enterInner((ClassSymbol)e.sym); break;
  42.298 -            default : assert false;
  42.299 +            default : Assert.error();
  42.300              }
  42.301          }
  42.302          databuf.appendChar(fieldsCount);
  42.303 @@ -1659,7 +1518,7 @@
  42.304          for (List<Type> l = interfaces; !sigReq && l.nonEmpty(); l = l.tail)
  42.305              sigReq = l.head.allparams().length() != 0;
  42.306          if (sigReq) {
  42.307 -            assert source.allowGenerics();
  42.308 +            Assert.check(source.allowGenerics());
  42.309              int alenIdx = writeAttr(names.Signature);
  42.310              if (typarams.length() != 0) assembleParamsSig(typarams);
  42.311              assembleSig(supertype);
  42.312 @@ -1698,7 +1557,6 @@
  42.313  
  42.314          acount += writeFlagAttrs(c.flags());
  42.315          acount += writeJavaAnnotations(c.getAnnotationMirrors());
  42.316 -        acount += writeTypeAnnotations(c.typeAnnotations);
  42.317          acount += writeEnclosingMethodAttribute(c);
  42.318  
  42.319          poolbuf.appendInt(JAVA_MAGIC);
    43.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Code.java	Thu Jan 27 17:28:57 2011 -0800
    43.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Code.java	Fri Jan 28 10:06:08 2011 -0800
    43.3 @@ -1,5 +1,5 @@
    43.4  /*
    43.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    43.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    43.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    43.8   *
    43.9   * This code is free software; you can redistribute it and/or modify it
   43.10 @@ -372,7 +372,7 @@
   43.11      }
   43.12  
   43.13      void postop() {
   43.14 -        assert alive || state.stacksize == 0;
   43.15 +        Assert.check(alive || state.stacksize == 0);
   43.16      }
   43.17  
   43.18      /** Emit a multinewarray instruction.
   43.19 @@ -583,7 +583,7 @@
   43.20          case areturn:
   43.21          case ireturn:
   43.22          case freturn:
   43.23 -            assert state.nlocks == 0;
   43.24 +            Assert.check(state.nlocks == 0);
   43.25              state.pop(1);
   43.26              markDead();
   43.27              break;
   43.28 @@ -604,7 +604,7 @@
   43.29              break;
   43.30          case lreturn:
   43.31          case dreturn:
   43.32 -            assert state.nlocks == 0;
   43.33 +            Assert.check(state.nlocks == 0);
   43.34              state.pop(2);
   43.35              markDead();
   43.36              break;
   43.37 @@ -612,7 +612,7 @@
   43.38              state.push(state.stack[state.stacksize-1]);
   43.39              break;
   43.40          case return_:
   43.41 -            assert state.nlocks == 0;
   43.42 +            Assert.check(state.nlocks == 0);
   43.43              markDead();
   43.44              break;
   43.45          case arraylength:
   43.46 @@ -1147,7 +1147,7 @@
   43.47          int pc = curPc();
   43.48          alive = true;
   43.49          this.state = state.dup();
   43.50 -        assert state.stacksize <= max_stack;
   43.51 +        Assert.check(state.stacksize <= max_stack);
   43.52          if (debugCode) System.err.println("entry point " + state);
   43.53          pendingStackMap = needStackMap;
   43.54          return pc;
   43.55 @@ -1160,7 +1160,7 @@
   43.56          int pc = curPc();
   43.57          alive = true;
   43.58          this.state = state.dup();
   43.59 -        assert state.stacksize <= max_stack;
   43.60 +        Assert.check(state.stacksize <= max_stack);
   43.61          this.state.push(pushed);
   43.62          if (debugCode) System.err.println("entry point " + state);
   43.63          pendingStackMap = needStackMap;
   43.64 @@ -1289,7 +1289,7 @@
   43.65          }
   43.66          frame.locals = new Type[localCount];
   43.67          for (int i=0, j=0; i<localsSize; i++, j++) {
   43.68 -            assert(j < localCount);
   43.69 +            Assert.check(j < localCount);
   43.70              frame.locals[j] = locals[i];
   43.71              if (width(locals[i]) > 1) i++;
   43.72          }
   43.73 @@ -1435,8 +1435,8 @@
   43.74          boolean changed = false;
   43.75          State newState = state;
   43.76          for (; chain != null; chain = chain.next) {
   43.77 -            assert state != chain.state;
   43.78 -            assert target > chain.pc || state.stacksize == 0;
   43.79 +            Assert.check(state != chain.state
   43.80 +                    && (target > chain.pc || state.stacksize == 0));
   43.81              if (target >= cp) {
   43.82                  target = cp;
   43.83              } else if (get1(target) == goto_) {
   43.84 @@ -1464,9 +1464,9 @@
   43.85                      fatcode = true;
   43.86                  else
   43.87                      put2(chain.pc + 1, target - chain.pc);
   43.88 -                assert !alive ||
   43.89 +                Assert.check(!alive ||
   43.90                      chain.state.stacksize == newState.stacksize &&
   43.91 -                    chain.state.nlocks == newState.nlocks;
   43.92 +                    chain.state.nlocks == newState.nlocks);
   43.93              }
   43.94              fixedPc = true;
   43.95              if (cp == target) {
   43.96 @@ -1481,7 +1481,7 @@
   43.97                  }
   43.98              }
   43.99          }
  43.100 -        assert !changed || state != newState;
  43.101 +        Assert.check(!changed || state != newState);
  43.102          if (state != newState) {
  43.103              setDefined(newState.defined);
  43.104              state = newState;
  43.105 @@ -1492,11 +1492,11 @@
  43.106      /** Resolve chain to point to current code pointer.
  43.107       */
  43.108      public void resolve(Chain chain) {
  43.109 -        assert
  43.110 +        Assert.check(
  43.111              !alive ||
  43.112              chain==null ||
  43.113              state.stacksize == chain.state.stacksize &&
  43.114 -            state.nlocks == chain.state.nlocks;
  43.115 +            state.nlocks == chain.state.nlocks);
  43.116          pendingJumps = mergeChains(chain, pendingJumps);
  43.117      }
  43.118  
  43.119 @@ -1514,9 +1514,9 @@
  43.120          // recursive merge sort
  43.121          if (chain2 == null) return chain1;
  43.122          if (chain1 == null) return chain2;
  43.123 -        assert
  43.124 +        Assert.check(
  43.125              chain1.state.stacksize == chain2.state.stacksize &&
  43.126 -            chain1.state.nlocks == chain2.state.nlocks;
  43.127 +            chain1.state.nlocks == chain2.state.nlocks);
  43.128          if (chain1.pc < chain2.pc)
  43.129              return new Chain(
  43.130                  chain2.pc,
  43.131 @@ -1631,7 +1631,7 @@
  43.132  
  43.133          void unlock(int register) {
  43.134              nlocks--;
  43.135 -            assert locks[nlocks] == register;
  43.136 +            Assert.check(locks[nlocks] == register);
  43.137              locks[nlocks] = -1;
  43.138          }
  43.139  
  43.140 @@ -1673,7 +1673,7 @@
  43.141              stacksize--;
  43.142              Type result = stack[stacksize];
  43.143              stack[stacksize] = null;
  43.144 -            assert result != null && width(result) == 1;
  43.145 +            Assert.check(result != null && width(result) == 1);
  43.146              return result;
  43.147          }
  43.148  
  43.149 @@ -1686,8 +1686,8 @@
  43.150              stacksize -= 2;
  43.151              Type result = stack[stacksize];
  43.152              stack[stacksize] = null;
  43.153 -            assert stack[stacksize+1] == null;
  43.154 -            assert result != null && width(result) == 2;
  43.155 +            Assert.check(stack[stacksize+1] == null
  43.156 +                    && result != null && width(result) == 2);
  43.157              return result;
  43.158          }
  43.159  
  43.160 @@ -1712,8 +1712,8 @@
  43.161              case ARRAY:
  43.162                  int width = width(t);
  43.163                  Type old = stack[stacksize-width];
  43.164 -                assert types.isSubtype(types.erasure(old),
  43.165 -                                       types.erasure(t));
  43.166 +                Assert.check(types.isSubtype(types.erasure(old),
  43.167 +                                       types.erasure(t)));
  43.168                  stack[stacksize-width] = t;
  43.169                  break;
  43.170              default:
  43.171 @@ -1739,8 +1739,8 @@
  43.172  
  43.173          State join(State other) {
  43.174              defined = defined.andSet(other.defined);
  43.175 -            assert stacksize == other.stacksize;
  43.176 -            assert nlocks == other.nlocks;
  43.177 +            Assert.check(stacksize == other.stacksize
  43.178 +                    && nlocks == other.nlocks);
  43.179              for (int i=0; i<stacksize; ) {
  43.180                  Type t = stack[i];
  43.181                  Type tother = other.stack[i];
  43.182 @@ -1751,7 +1751,7 @@
  43.183                      error();
  43.184                  int w = width(result);
  43.185                  stack[i] = result;
  43.186 -                if (w == 2) assert stack[i+1] == null;
  43.187 +                if (w == 2) Assert.checkNull(stack[i+1]);
  43.188                  i += w;
  43.189              }
  43.190              return this;
  43.191 @@ -1847,7 +1847,7 @@
  43.192              System.arraycopy(lvar, 0, new_lvar, 0, lvar.length);
  43.193              lvar = new_lvar;
  43.194          }
  43.195 -        assert lvar[adr] == null;
  43.196 +        Assert.checkNull(lvar[adr]);
  43.197          if (pendingJumps != null) resolvePending();
  43.198          lvar[adr] = new LocalVar(v);
  43.199          state.defined.excl(adr);
  43.200 @@ -1912,29 +1912,12 @@
  43.201                  if (length < Character.MAX_VALUE) {
  43.202                      v.length = length;
  43.203                      putVar(v);
  43.204 -                    fillLocalVarPosition(v);
  43.205                  }
  43.206              }
  43.207          }
  43.208          state.defined.excl(adr);
  43.209      }
  43.210  
  43.211 -    private void fillLocalVarPosition(LocalVar lv) {
  43.212 -        if (lv == null || lv.sym == null
  43.213 -                || lv.sym.typeAnnotations == null)
  43.214 -            return;
  43.215 -        for (Attribute.TypeCompound ta : lv.sym.typeAnnotations) {
  43.216 -            TypeAnnotationPosition p = ta.position;
  43.217 -            while (p != null) {
  43.218 -                p.lvarOffset = new int[] { (int)lv.start_pc };
  43.219 -                p.lvarLength = new int[] { (int)lv.length };
  43.220 -                p.lvarIndex = new int[] { (int)lv.reg };
  43.221 -                p.isValidOffset = true;
  43.222 -                p = p.wildcard_position;
  43.223 -            }
  43.224 -        }
  43.225 -    }
  43.226 -
  43.227      /** Put a live variable range into the buffer to be output to the
  43.228       *  class file.
  43.229       */
    44.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Jan 27 17:28:57 2011 -0800
    44.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Fri Jan 28 10:06:08 2011 -0800
    44.3 @@ -1,5 +1,5 @@
    44.4  /*
    44.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    44.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    44.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44.8   *
    44.9   * This code is free software; you can redistribute it and/or modify it
   44.10 @@ -500,7 +500,7 @@
   44.11                  }
   44.12                  break;
   44.13              default:
   44.14 -                assert false;
   44.15 +                Assert.error();
   44.16              }
   44.17          }
   44.18          // Insert any instance initializers into all constructors.
   44.19 @@ -857,7 +857,7 @@
   44.20              pts = pts.tail;
   44.21          }
   44.22          // require lists be of same length
   44.23 -        assert pts.isEmpty();
   44.24 +        Assert.check(pts.isEmpty());
   44.25      }
   44.26  
   44.27  /* ************************************************************************
   44.28 @@ -1111,7 +1111,7 @@
   44.29  
   44.30      public void visitSwitch(JCSwitch tree) {
   44.31          int limit = code.nextreg;
   44.32 -        assert tree.selector.type.tag != CLASS;
   44.33 +        Assert.check(tree.selector.type.tag != CLASS);
   44.34          int startpcCrt = genCrt ? code.curPc() : 0;
   44.35          Item sel = genExpr(tree.selector, syms.intType);
   44.36          List<JCCase> cases = tree.cases;
   44.37 @@ -1148,7 +1148,7 @@
   44.38                      if (hi < val) hi = val;
   44.39                      nlabels++;
   44.40                  } else {
   44.41 -                    assert defaultIndex == -1;
   44.42 +                    Assert.check(defaultIndex == -1);
   44.43                      defaultIndex = i;
   44.44                  }
   44.45                  l = l.tail;
   44.46 @@ -1290,7 +1290,7 @@
   44.47          syncEnv.info.finalize = new GenFinalizer() {
   44.48              void gen() {
   44.49                  genLast();
   44.50 -                assert syncEnv.info.gaps.length() % 2 == 0;
   44.51 +                Assert.check(syncEnv.info.gaps.length() % 2 == 0);
   44.52                  syncEnv.info.gaps.append(code.curPc());
   44.53              }
   44.54              void genLast() {
   44.55 @@ -1329,10 +1329,10 @@
   44.56                                        tryEnv.info.cont,
   44.57                                        jsrState);
   44.58                      }
   44.59 -                    assert tryEnv.info.gaps.length() % 2 == 0;
   44.60 +                    Assert.check(tryEnv.info.gaps.length() % 2 == 0);
   44.61                      tryEnv.info.gaps.append(code.curPc());
   44.62                  } else {
   44.63 -                    assert tryEnv.info.gaps.length() % 2 == 0;
   44.64 +                    Assert.check(tryEnv.info.gaps.length() % 2 == 0);
   44.65                      tryEnv.info.gaps.append(code.curPc());
   44.66                      genLast();
   44.67                  }
   44.68 @@ -1640,14 +1640,14 @@
   44.69  
   44.70      public void visitBreak(JCBreak tree) {
   44.71          Env<GenContext> targetEnv = unwind(tree.target, env);
   44.72 -        assert code.state.stacksize == 0;
   44.73 +        Assert.check(code.state.stacksize == 0);
   44.74          targetEnv.info.addExit(code.branch(goto_));
   44.75          endFinalizerGaps(env, targetEnv);
   44.76      }
   44.77  
   44.78      public void visitContinue(JCContinue tree) {
   44.79          Env<GenContext> targetEnv = unwind(tree.target, env);
   44.80 -        assert code.state.stacksize == 0;
   44.81 +        Assert.check(code.state.stacksize == 0);
   44.82          targetEnv.info.addCont(code.branch(goto_));
   44.83          endFinalizerGaps(env, targetEnv);
   44.84      }
   44.85 @@ -1682,7 +1682,6 @@
   44.86   *************************************************************************/
   44.87  
   44.88      public void visitApply(JCMethodInvocation tree) {
   44.89 -        setTypeAnnotationPositions(tree.pos);
   44.90          // Generate code for method.
   44.91          Item m = genExpr(tree.meth, methodType);
   44.92          // Generate code for all arguments, where the expected types are
   44.93 @@ -1718,48 +1717,10 @@
   44.94          result = items.makeStackItem(pt);
   44.95      }
   44.96  
   44.97 -    private void setTypeAnnotationPositions(int treePos) {
   44.98 -        MethodSymbol meth = code.meth;
   44.99 -
  44.100 -        for (Attribute.TypeCompound ta : meth.typeAnnotations) {
  44.101 -            if (ta.position.pos == treePos) {
  44.102 -                ta.position.offset = code.cp;
  44.103 -                ta.position.lvarOffset = new int[] { code.cp };
  44.104 -                ta.position.isValidOffset = true;
  44.105 -            }
  44.106 -        }
  44.107 -
  44.108 -        if (code.meth.getKind() != ElementKind.CONSTRUCTOR
  44.109 -                && code.meth.getKind() != ElementKind.STATIC_INIT)
  44.110 -            return;
  44.111 -
  44.112 -        for (Attribute.TypeCompound ta : meth.owner.typeAnnotations) {
  44.113 -            if (ta.position.pos == treePos) {
  44.114 -                ta.position.offset = code.cp;
  44.115 -                ta.position.lvarOffset = new int[] { code.cp };
  44.116 -                ta.position.isValidOffset = true;
  44.117 -            }
  44.118 -        }
  44.119 -
  44.120 -        ClassSymbol clazz = meth.enclClass();
  44.121 -        for (Symbol s : new com.sun.tools.javac.model.FilteredMemberList(clazz.members())) {
  44.122 -            if (!s.getKind().isField())
  44.123 -                continue;
  44.124 -            for (Attribute.TypeCompound ta : s.typeAnnotations) {
  44.125 -                if (ta.position.pos == treePos) {
  44.126 -                    ta.position.offset = code.cp;
  44.127 -                    ta.position.lvarOffset = new int[] { code.cp };
  44.128 -                    ta.position.isValidOffset = true;
  44.129 -                }
  44.130 -            }
  44.131 -        }
  44.132 -    }
  44.133 -
  44.134      public void visitNewClass(JCNewClass tree) {
  44.135          // Enclosing instances or anonymous classes should have been eliminated
  44.136          // by now.
  44.137 -        assert tree.encl == null && tree.def == null;
  44.138 -        setTypeAnnotationPositions(tree.pos);
  44.139 +        Assert.check(tree.encl == null && tree.def == null);
  44.140  
  44.141          code.emitop2(new_, makeRef(tree.pos(), tree.type));
  44.142          code.emitop0(dup);
  44.143 @@ -1774,7 +1735,6 @@
  44.144      }
  44.145  
  44.146      public void visitNewArray(JCNewArray tree) {
  44.147 -        setTypeAnnotationPositions(tree.pos);
  44.148  
  44.149          if (tree.elems != null) {
  44.150              Type elemtype = types.elemtype(tree.type);
  44.151 @@ -1942,7 +1902,7 @@
  44.152                  genNullCheck(tree.pos());
  44.153                  break;
  44.154              default:
  44.155 -                assert false;
  44.156 +                Assert.error();
  44.157              }
  44.158          }
  44.159      }
  44.160 @@ -2017,7 +1977,7 @@
  44.161              items.makeMemberItem(getStringBufferAppend(tree, t), false).invoke();
  44.162          }
  44.163          Symbol getStringBufferAppend(JCTree tree, Type t) {
  44.164 -            assert t.constValue() == null;
  44.165 +            Assert.checkNull(t.constValue());
  44.166              Symbol method = stringBufferAppend.get(t);
  44.167              if (method == null) {
  44.168                  method = rs.resolveInternalMethod(tree.pos(),
  44.169 @@ -2104,7 +2064,6 @@
  44.170          }
  44.171  
  44.172      public void visitTypeCast(JCTypeCast tree) {
  44.173 -        setTypeAnnotationPositions(tree.pos);
  44.174          result = genExpr(tree.expr, tree.clazz.type).load();
  44.175          // Additional code is only needed if we cast to a reference type
  44.176          // which is not statically a supertype of the expression's type.
  44.177 @@ -2121,8 +2080,6 @@
  44.178      }
  44.179  
  44.180      public void visitTypeTest(JCInstanceOf tree) {
  44.181 -        setTypeAnnotationPositions(tree.pos);
  44.182 -
  44.183          genExpr(tree.expr, tree.expr.type).load();
  44.184          code.emitop2(instanceof_, makeRef(tree.pos(), tree.clazz.type));
  44.185          result = items.makeStackItem(syms.booleanType);
  44.186 @@ -2163,16 +2120,10 @@
  44.187          Symbol sym = tree.sym;
  44.188  
  44.189          if (tree.name == names._class) {
  44.190 -            assert target.hasClassLiterals();
  44.191 -            setTypeAnnotationPositions(tree.pos);
  44.192 +            Assert.check(target.hasClassLiterals());
  44.193              code.emitop2(ldc2, makeRef(tree.pos(), tree.selected.type));
  44.194              result = items.makeStackItem(pt);
  44.195              return;
  44.196 -        } else if (tree.name == names.TYPE) {
  44.197 -            // Set the annotation positions for primitive class literals
  44.198 -            // (e.g. int.class) which have been converted to TYPE field
  44.199 -            // access on the corresponding boxed type (e.g. Integer.TYPE).
  44.200 -            setTypeAnnotationPositions(tree.pos);
  44.201          }
  44.202  
  44.203          Symbol ssym = TreeInfo.symbol(tree.selected);
  44.204 @@ -2202,9 +2153,6 @@
  44.205              }
  44.206              result = items.
  44.207                  makeImmediateItem(sym.type, ((VarSymbol) sym).getConstValue());
  44.208 -        } else if (allowInvokedynamic && sym.kind == MTH && ssym == syms.invokeDynamicType.tsym) {
  44.209 -            base.drop();
  44.210 -            result = items.makeDynamicItem(sym);
  44.211          } else {
  44.212              if (!accessSuper)
  44.213                  sym = binaryQualifier(sym, tree.selected.type);
    45.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Items.java	Thu Jan 27 17:28:57 2011 -0800
    45.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Items.java	Fri Jan 28 10:06:08 2011 -0800
    45.3 @@ -1,5 +1,5 @@
    45.4  /*
    45.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    45.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    45.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    45.8   *
    45.9   * This code is free software; you can redistribute it and/or modify it
   45.10 @@ -26,11 +26,11 @@
   45.11  package com.sun.tools.javac.jvm;
   45.12  
   45.13  import com.sun.tools.javac.code.*;
   45.14 -
   45.15  import com.sun.tools.javac.code.Symbol.*;
   45.16  import com.sun.tools.javac.code.Type.*;
   45.17  import com.sun.tools.javac.jvm.Code.*;
   45.18  import com.sun.tools.javac.tree.JCTree;
   45.19 +import com.sun.tools.javac.util.Assert;
   45.20  
   45.21  import static com.sun.tools.javac.jvm.ByteCodes.*;
   45.22  
   45.23 @@ -139,13 +139,6 @@
   45.24          return new StaticItem(member);
   45.25      }
   45.26  
   45.27 -    /** Make an item representing a dynamically invoked method.
   45.28 -     *  @param member   The represented symbol.
   45.29 -     */
   45.30 -    Item makeDynamicItem(Symbol member) {
   45.31 -        return new DynamicItem(member);
   45.32 -    }
   45.33 -
   45.34      /** Make an item representing an instance variable or method.
   45.35       *  @param member       The represented symbol.
   45.36       *  @param nonvirtual   Is the reference not virtual? (true for constructors
   45.37 @@ -387,7 +380,7 @@
   45.38  
   45.39          LocalItem(Type type, int reg) {
   45.40              super(Code.typecode(type));
   45.41 -            assert reg >= 0;
   45.42 +            Assert.check(reg >= 0);
   45.43              this.type = type;
   45.44              this.reg = reg;
   45.45          }
   45.46 @@ -464,38 +457,6 @@
   45.47          }
   45.48      }
   45.49  
   45.50 -    /** An item representing a dynamic call site.
   45.51 -     */
   45.52 -    class DynamicItem extends StaticItem {
   45.53 -        DynamicItem(Symbol member) {
   45.54 -            super(member);
   45.55 -            assert member.owner == syms.invokeDynamicType.tsym;
   45.56 -        }
   45.57 -
   45.58 -        Item load() {
   45.59 -            assert false;
   45.60 -            return null;
   45.61 -        }
   45.62 -
   45.63 -        void store() {
   45.64 -            assert false;
   45.65 -        }
   45.66 -
   45.67 -        Item invoke() {
   45.68 -            // assert target.hasNativeInvokeDynamic();
   45.69 -            MethodType mtype = (MethodType)member.erasure(types);
   45.70 -            int rescode = Code.typecode(mtype.restype);
   45.71 -            ClassFile.NameAndType descr = new ClassFile.NameAndType(member.name, mtype);
   45.72 -            code.emitInvokedynamic(pool.put(descr), mtype);
   45.73 -            return stackItem[rescode];
   45.74 -        }
   45.75 -
   45.76 -        public String toString() {
   45.77 -            return "dynamic(" + member + ")";
   45.78 -        }
   45.79 -    }
   45.80 -
   45.81 -
   45.82      /** An item representing an instance variable or method.
   45.83       */
   45.84      class MemberItem extends Item {
   45.85 @@ -620,7 +581,7 @@
   45.86                  ldc();
   45.87                  break;
   45.88              default:
   45.89 -                assert false;
   45.90 +                Assert.error();
   45.91              }
   45.92              return stackItem[typecode];
   45.93          }
   45.94 @@ -716,7 +677,7 @@
   45.95          }
   45.96  
   45.97          void stash(int toscode) {
   45.98 -            assert false;
   45.99 +            Assert.error();
  45.100          }
  45.101  
  45.102          int width() {
  45.103 @@ -784,7 +745,7 @@
  45.104          }
  45.105  
  45.106          void stash(int toscode) {
  45.107 -            assert false;
  45.108 +            Assert.error();
  45.109          }
  45.110  
  45.111          CondItem mkCond() {
    46.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Jan 27 17:28:57 2011 -0800
    46.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Fri Jan 28 10:06:08 2011 -0800
    46.3 @@ -1,5 +1,5 @@
    46.4  /*
    46.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    46.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    46.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    46.8   *
    46.9   * This code is free software; you can redistribute it and/or modify it
   46.10 @@ -848,7 +848,7 @@
   46.11                  break;
   46.12  
   46.13              default:
   46.14 -                assert false: "unknown compile policy";
   46.15 +                Assert.error("unknown compile policy");
   46.16              }
   46.17          } catch (Abort ex) {
   46.18              if (devVerbose)
   46.19 @@ -1066,7 +1066,7 @@
   46.20                                      classSymbols = classSymbols.prepend((ClassSymbol)sym);
   46.21                                  continue;
   46.22                              }
   46.23 -                            assert sym.kind == Kinds.PCK;
   46.24 +                            Assert.check(sym.kind == Kinds.PCK);
   46.25                              log.warning("proc.package.does.not.exist", nameStr);
   46.26                              pckSymbols = pckSymbols.prepend((PackageSymbol)sym);
   46.27                          } catch (CompletionFailure e) {
   46.28 @@ -1086,8 +1086,8 @@
   46.29                  if (c != this)
   46.30                      annotationProcessingOccurred = c.annotationProcessingOccurred = true;
   46.31                  // doProcessing will have handled deferred diagnostics
   46.32 -                assert c.log.deferDiagnostics == false;
   46.33 -                assert c.log.deferredDiagnostics.size() == 0;
   46.34 +                Assert.check(c.log.deferDiagnostics == false
   46.35 +                        && c.log.deferredDiagnostics.size() == 0);
   46.36                  return c;
   46.37              } finally {
   46.38                  procEnvImpl.close();
   46.39 @@ -1324,7 +1324,7 @@
   46.40                          return;
   46.41                      List<JCTree> pdef = lower.translateTopLevelClass(env, env.tree, localMake);
   46.42                      if (pdef.head != null) {
   46.43 -                        assert pdef.tail.isEmpty();
   46.44 +                        Assert.check(pdef.tail.isEmpty());
   46.45                          results.add(new Pair<Env<AttrContext>, JCClassDecl>(env, (JCClassDecl)pdef.head));
   46.46                      }
   46.47                  }
    47.1 --- a/src/share/classes/com/sun/tools/javac/main/Main.java	Thu Jan 27 17:28:57 2011 -0800
    47.2 +++ b/src/share/classes/com/sun/tools/javac/main/Main.java	Fri Jan 28 10:06:08 2011 -0800
    47.3 @@ -284,13 +284,6 @@
    47.4              }
    47.5          }
    47.6  
    47.7 -        // phase this out with JSR 292 PFD
    47.8 -        if ("no".equals(options.get("allowTransitionalJSR292"))) {
    47.9 -            options.put("allowTransitionalJSR292", null);
   47.10 -        } else if (target.hasInvokedynamic() && options.isUnset("allowTransitionalJSR292")) {
   47.11 -            options.put("allowTransitionalJSR292", "allowTransitionalJSR292");
   47.12 -        }
   47.13 -
   47.14          // handle this here so it works even if no other options given
   47.15          String showClass = options.get("showClass");
   47.16          if (showClass != null) {
    48.1 --- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Jan 27 17:28:57 2011 -0800
    48.2 +++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Jan 28 10:06:08 2011 -0800
    48.3 @@ -1,5 +1,5 @@
    48.4  /*
    48.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    48.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    48.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    48.8   *
    48.9   * This code is free software; you can redistribute it and/or modify it
   48.10 @@ -547,7 +547,7 @@
   48.11                  null);
   48.12              break;
   48.13          default:
   48.14 -            assert false;
   48.15 +            Assert.error();
   48.16          }
   48.17          if (t == errorTree)
   48.18              t = F.at(pos).Erroneous();
   48.19 @@ -724,7 +724,7 @@
   48.20                  topOpPos = posStack[top];
   48.21              }
   48.22          }
   48.23 -        assert top == 0;
   48.24 +        Assert.check(top == 0);
   48.25          t = odStack[0];
   48.26  
   48.27          if (t.getTag() == JCTree.PLUS) {
   48.28 @@ -2168,8 +2168,11 @@
   48.29      JCVariableDecl variableDeclaratorId(JCModifiers mods, JCExpression type) {
   48.30          int pos = S.pos();
   48.31          Name name = ident();
   48.32 -        if ((mods.flags & Flags.VARARGS) == 0)
   48.33 -            type = bracketsOpt(type);
   48.34 +        if ((mods.flags & Flags.VARARGS) != 0 &&
   48.35 +                S.token() == LBRACKET) {
   48.36 +            log.error(S.pos(), "varargs.and.old.array.syntax");
   48.37 +        }
   48.38 +        type = bracketsOpt(type);
   48.39          return toP(F.at(pos).VarDef(mods, name, type, null));
   48.40      }
   48.41  
   48.42 @@ -2569,6 +2572,12 @@
   48.43              } else {
   48.44                  pos = S.pos();
   48.45                  List<JCTypeParameter> typarams = typeParametersOpt();
   48.46 +                // if there are type parameters but no modifiers, save the start
   48.47 +                // position of the method in the modifiers.
   48.48 +                if (typarams.nonEmpty() && mods.pos == Position.NOPOS) {
   48.49 +                    mods.pos = pos;
   48.50 +                    storeEnd(mods, pos);
   48.51 +                }
   48.52                  Name name = S.name();
   48.53                  pos = S.pos();
   48.54                  JCExpression type;
    49.1 --- a/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Thu Jan 27 17:28:57 2011 -0800
    49.2 +++ b/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Fri Jan 28 10:06:08 2011 -0800
    49.3 @@ -1,5 +1,5 @@
    49.4  /*
    49.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    49.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    49.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    49.8   *
    49.9   * This code is free software; you can redistribute it and/or modify it
   49.10 @@ -445,7 +445,7 @@
   49.11       */
   49.12      private void scanHexFractionAndSuffix(boolean seendigit) {
   49.13          this.radix = 16;
   49.14 -        assert ch == '.';
   49.15 +        Assert.check(ch == '.');
   49.16          putChar(ch);
   49.17          scanChar();
   49.18          skipIllegalUnderscores();
    50.1 --- a/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Thu Jan 27 17:28:57 2011 -0800
    50.2 +++ b/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Fri Jan 28 10:06:08 2011 -0800
    50.3 @@ -1,5 +1,5 @@
    50.4  /*
    50.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    50.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    50.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    50.8   *
    50.9   * This code is free software; you can redistribute it and/or modify it
   50.10 @@ -49,7 +49,6 @@
   50.11  import javax.tools.JavaFileObject;
   50.12  import javax.tools.DiagnosticListener;
   50.13  
   50.14 -//308 import com.sun.source.util.AbstractTypeProcessor;
   50.15  import com.sun.source.util.TaskEvent;
   50.16  import com.sun.source.util.TaskListener;
   50.17  import com.sun.tools.javac.api.JavacTaskImpl;
   50.18 @@ -66,6 +65,7 @@
   50.19  import com.sun.tools.javac.tree.*;
   50.20  import com.sun.tools.javac.tree.JCTree.*;
   50.21  import com.sun.tools.javac.util.Abort;
   50.22 +import com.sun.tools.javac.util.Assert;
   50.23  import com.sun.tools.javac.util.Context;
   50.24  import com.sun.tools.javac.util.Convert;
   50.25  import com.sun.tools.javac.util.FatalError;
   50.26 @@ -712,7 +712,6 @@
   50.27              }
   50.28  
   50.29              if (matchedNames.size() > 0 || ps.contributed) {
   50.30 -//308                foundTypeProcessors = foundTypeProcessors || (ps.processor instanceof AbstractTypeProcessor);
   50.31                  boolean processingResult = callProcessor(ps.processor, typeElements, renv);
   50.32                  ps.contributed = true;
   50.33                  ps.removeSupportedOptions(unmatchedProcessorOptions);
   50.34 @@ -1048,17 +1047,17 @@
   50.35              Context next = new Context();
   50.36  
   50.37              Options options = Options.instance(context);
   50.38 -            assert options != null;
   50.39 +            Assert.checkNonNull(options);
   50.40              next.put(Options.optionsKey, options);
   50.41  
   50.42              PrintWriter out = context.get(Log.outKey);
   50.43 -            assert out != null;
   50.44 +            Assert.checkNonNull(out);
   50.45              next.put(Log.outKey, out);
   50.46  
   50.47              final boolean shareNames = true;
   50.48              if (shareNames) {
   50.49                  Names names = Names.instance(context);
   50.50 -                assert names != null;
   50.51 +                Assert.checkNonNull(names);
   50.52                  next.put(Names.namesKey, names);
   50.53              }
   50.54  
   50.55 @@ -1071,18 +1070,18 @@
   50.56                  next.put(TaskListener.class, tl);
   50.57  
   50.58              JavaFileManager jfm = context.get(JavaFileManager.class);
   50.59 -            assert jfm != null;
   50.60 +            Assert.checkNonNull(jfm);
   50.61              next.put(JavaFileManager.class, jfm);
   50.62              if (jfm instanceof JavacFileManager) {
   50.63                  ((JavacFileManager)jfm).setContext(next);
   50.64              }
   50.65  
   50.66              Names names = Names.instance(context);
   50.67 -            assert names != null;
   50.68 +            Assert.checkNonNull(names);
   50.69              next.put(Names.namesKey, names);
   50.70  
   50.71              Keywords keywords = Keywords.instance(context);
   50.72 -            assert(keywords != null);
   50.73 +            Assert.checkNonNull(keywords);
   50.74              next.put(Keywords.keywordsKey, keywords);
   50.75  
   50.76              JavaCompiler oldCompiler = JavaCompiler.instance(context);
   50.77 @@ -1241,7 +1240,7 @@
   50.78              for (JCTree node : unit.defs) {
   50.79                  if (node.getTag() == JCTree.CLASSDEF) {
   50.80                      ClassSymbol sym = ((JCClassDecl) node).sym;
   50.81 -                    assert sym != null;
   50.82 +                    Assert.checkNonNull(sym);
   50.83                      classes = classes.prepend(sym);
   50.84                  }
   50.85              }
    51.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Jan 27 17:28:57 2011 -0800
    51.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Jan 28 10:06:08 2011 -0800
    51.3 @@ -1,5 +1,5 @@
    51.4  #
    51.5 -# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    51.6 +# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    51.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    51.8  #
    51.9  # This code is free software; you can redistribute it and/or modify it
   51.10 @@ -112,11 +112,9 @@
   51.11  compiler.err.catch.without.try=\
   51.12      ''catch'' without ''try''
   51.13  compiler.err.clash.with.pkg.of.same.name=\
   51.14 -    {0} clashes with package of same name
   51.15 +    {0} {1} clashes with package of same name
   51.16  compiler.err.const.expr.req=\
   51.17      constant expression required
   51.18 -compiler.err.enum.const.req=\
   51.19 -    unqualified enumeration constant name required
   51.20  compiler.err.cont.outside.loop=\
   51.21      continue outside of loop
   51.22  compiler.err.cyclic.inheritance=\
   51.23 @@ -128,9 +126,7 @@
   51.24  compiler.err.no.superclass=\
   51.25      {0} has no superclass
   51.26  
   51.27 -compiler.warn.type.parameter.on.polymorphic.signature=\
   51.28 -    change obsolete notation for MethodHandle invocations from x.<T>invoke(y) to (T)x.invoke(y)
   51.29 -compiler.warn.wrong.target.for.polymorphic.signature.definition=\
   51.30 +compiler.err.wrong.target.for.polymorphic.signature.definition=\
   51.31      MethodHandle API building requires -target 7 runtimes or better; current is -target {0}
   51.32  
   51.33  compiler.err.concrete.inheritance.conflict=\
   51.34 @@ -186,7 +182,9 @@
   51.35  compiler.err.finally.without.try=\
   51.36      ''finally'' without ''try''
   51.37  compiler.err.foreach.not.applicable.to.type=\
   51.38 -    foreach not applicable to expression type
   51.39 +    for-each not applicable to expression type\n\
   51.40 +    required: {1}\n\
   51.41 +    found:    {0}
   51.42  compiler.err.fp.number.too.large=\
   51.43      floating point number too large
   51.44  compiler.err.fp.number.too.small=\
   51.45 @@ -198,7 +196,8 @@
   51.46      a generic class may not extend java.lang.Throwable
   51.47  
   51.48  compiler.err.icls.cant.have.static.decl=\
   51.49 -    inner classes cannot have static declarations
   51.50 +    Illegal static declaration in inner class {0}\n\
   51.51 +    modifier \''static\'' is only allowed in constant variable declarations
   51.52  compiler.err.illegal.char=\
   51.53      illegal character: \\{0}
   51.54  compiler.err.illegal.char.for.encoding=\
   51.55 @@ -240,7 +239,7 @@
   51.56  compiler.err.improperly.formed.type.param.missing=\
   51.57      improperly formed type, some parameters are missing
   51.58  compiler.err.improperly.formed.type.inner.raw.param=\
   51.59 -    improperly formed type, type parameters given on a raw type
   51.60 +    improperly formed type, type arguments given on a raw type
   51.61  compiler.err.incomparable.types=\
   51.62      incomparable types: {0} and {1}
   51.63  compiler.err.int.number.too.large=\
   51.64 @@ -267,6 +266,8 @@
   51.65      hexadecimal numbers must contain at least one hexadecimal digit
   51.66  compiler.err.invalid.meth.decl.ret.type.req=\
   51.67      invalid method declaration; return type required
   51.68 +compiler.err.varargs.and.old.array.syntax=\
   51.69 +    legacy array notation not allowed on variable-arity parameter
   51.70  
   51.71  compiler.err.label.already.in.use=\
   51.72      label {0} already in use
   51.73 @@ -356,7 +357,11 @@
   51.74      not an enclosing class: {0}
   51.75  
   51.76  compiler.err.operator.cant.be.applied=\
   51.77 -    operator {0} cannot be applied to {1}
   51.78 +    bad operand type {1} for unary operator ''{0}''
   51.79 +compiler.err.operator.cant.be.applied.1=\
   51.80 +    bad operand types for binary operator ''{0}''\n\
   51.81 +    first type:  {1}\n\
   51.82 +    second type: {2}
   51.83  
   51.84  compiler.err.pkg.annotations.sb.in.package-info.java=\
   51.85      package annotations should be in file package-info.java
   51.86 @@ -483,9 +488,10 @@
   51.87  compiler.err.undef.label=\
   51.88      undefined label: {0}
   51.89  compiler.err.undetermined.type=\
   51.90 -    type parameters of {0} cannot be determined
   51.91 +    cannot infer type arguments for {0}
   51.92  compiler.err.undetermined.type.1=\
   51.93 -    type parameters of {0} cannot be determined; {1}
   51.94 +    cannot infer type arguments for {0};\n\
   51.95 +    reason: {1}
   51.96  compiler.err.invalid.inferred.types=\
   51.97      invalid inferred types for {0}; {1}
   51.98  compiler.err.cant.apply.diamond=\
   51.99 @@ -865,7 +871,7 @@
  51.100  
  51.101  compiler.warn.raw.class.use=\
  51.102      found raw type: {0}\n\
  51.103 -    missing type parameters for generic class {1}
  51.104 +    missing type arguments for generic class {1}
  51.105  
  51.106  compiler.warn.diamond.redundant.args=\
  51.107      redundant type arguments in new expression (use diamond operator instead).
  51.108 @@ -971,8 +977,6 @@
  51.109      bad constant pool tag: {0} at {1}
  51.110  compiler.misc.bad.signature=\
  51.111      bad signature: {0}
  51.112 -compiler.misc.bad.type.annotation.value=\
  51.113 -    bad type annotation target type value: {0}
  51.114  compiler.misc.class.file.wrong.class=\
  51.115      class file contains wrong class: {0}
  51.116  compiler.misc.class.file.not.found=\
  51.117 @@ -995,10 +999,7 @@
  51.118  #####
  51.119  
  51.120  compiler.err.not.within.bounds=\
  51.121 -    type parameter {0} is not within its bound
  51.122 -
  51.123 -compiler.err.not.within.bounds.explain=\
  51.124 -    type parameter {0} is not within its bound; {1}
  51.125 +    type argument {0} is not within bounds of type-variable {1}
  51.126  
  51.127  ## The following are all possible strings for the second argument ({1}) of the
  51.128  ## above string.
  51.129 @@ -1065,6 +1066,8 @@
  51.130      class
  51.131  compiler.misc.type.req.class.array=\
  51.132      class or array
  51.133 +compiler.misc.type.req.array.or.iterable=\
  51.134 +    array or java.lang.Iterable
  51.135  compiler.misc.type.req.ref=\
  51.136      reference
  51.137  compiler.misc.type.req.exact=\
  51.138 @@ -1148,22 +1151,31 @@
  51.139      symbol: {0} <{2}>{1}({3})
  51.140  
  51.141  ## arguments from {0} to {3} have the same meaning as above
  51.142 -## The fifth argument {4} is the location "kindname" (e.g. 'constructor', 'field', etc.)
  51.143 -## The sixth argument {5} is the location type
  51.144 +## The fifth argument {4} is a location subdiagnostic (see below)
  51.145  compiler.err.cant.resolve.location=\
  51.146      cannot find symbol\n\
  51.147      symbol:   {0} {1}\n\
  51.148 -    location: {4} {5}
  51.149 +    location: {4}
  51.150  
  51.151  compiler.err.cant.resolve.location.args=\
  51.152      cannot find symbol\n\
  51.153      symbol:   {0} {1}({3})\n\
  51.154 -    location: {4} {5}
  51.155 +    location: {4}
  51.156  
  51.157  compiler.err.cant.resolve.location.args.params=\
  51.158      cannot find symbol\n\
  51.159      symbol:   {0} <{2}>{1}({3})\n\
  51.160 -    location: {4} {5}
  51.161 +    location: {4}
  51.162 +
  51.163 +##a location subdiagnostic is composed as follows:
  51.164 +## The first argument {0} is the location "kindname" (e.g. 'constructor', 'field', etc.)
  51.165 +## The second argument {1} is the location name
  51.166 +## The third argument {2} is the location type (only when {1} is a variable name)
  51.167 +
  51.168 +compiler.misc.location=\
  51.169 +    {0} {1}
  51.170 +compiler.misc.location.1=\
  51.171 +    {0} {1} of type {2}
  51.172  
  51.173  ## The following are all possible string for "kindname".
  51.174  ## They should be called whatever the JLS calls them after it been translated
    52.1 --- a/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Thu Jan 27 17:28:57 2011 -0800
    52.2 +++ b/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Fri Jan 28 10:06:08 2011 -0800
    52.3 @@ -1,5 +1,5 @@
    52.4  /*
    52.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    52.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    52.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    52.8   *
    52.9   * This code is free software; you can redistribute it and/or modify it
   52.10 @@ -640,7 +640,6 @@
   52.11          public JCExpression restype;
   52.12          public List<JCTypeParameter> typarams;
   52.13          public List<JCVariableDecl> params;
   52.14 -        public List<JCTypeAnnotation> receiverAnnotations;
   52.15          public List<JCExpression> thrown;
   52.16          public JCBlock body;
   52.17          public JCExpression defaultValue; // for annotation types
   52.18 @@ -650,7 +649,6 @@
   52.19                              JCExpression restype,
   52.20                              List<JCTypeParameter> typarams,
   52.21                              List<JCVariableDecl> params,
   52.22 -                            List<JCTypeAnnotation> receiver,
   52.23                              List<JCExpression> thrown,
   52.24                              JCBlock body,
   52.25                              JCExpression defaultValue,
   52.26 @@ -661,7 +659,6 @@
   52.27              this.restype = restype;
   52.28              this.typarams = typarams;
   52.29              this.params = params;
   52.30 -            this.receiverAnnotations = (receiver != null ? receiver : List.<JCTypeAnnotation>nil());
   52.31              this.thrown = thrown;
   52.32              this.body = body;
   52.33              this.defaultValue = defaultValue;
   52.34 @@ -680,7 +677,6 @@
   52.35          public List<JCVariableDecl> getParameters() {
   52.36              return params;
   52.37          }
   52.38 -        public List<JCTypeAnnotation> getReceiverAnnotations() { return receiverAnnotations; }
   52.39          public List<JCExpression> getThrows() {
   52.40              return thrown;
   52.41          }
   52.42 @@ -1402,8 +1398,6 @@
   52.43      public static class JCNewArray extends JCExpression implements NewArrayTree {
   52.44          public JCExpression elemtype;
   52.45          public List<JCExpression> dims;
   52.46 -        public List<JCTypeAnnotation> annotations;
   52.47 -        public List<List<JCTypeAnnotation>> dimAnnotations;
   52.48          public List<JCExpression> elems;
   52.49          protected JCNewArray(JCExpression elemtype,
   52.50                             List<JCExpression> dims,
   52.51 @@ -1411,8 +1405,6 @@
   52.52          {
   52.53              this.elemtype = elemtype;
   52.54              this.dims = dims;
   52.55 -            this.annotations = List.nil();
   52.56 -            this.dimAnnotations = List.nil();
   52.57              this.elems = elems;
   52.58          }
   52.59          @Override
   52.60 @@ -1923,11 +1915,9 @@
   52.61      public static class JCTypeParameter extends JCTree implements TypeParameterTree {
   52.62          public Name name;
   52.63          public List<JCExpression> bounds;
   52.64 -        public List<JCTypeAnnotation> annotations;
   52.65 -        protected JCTypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annotations) {
   52.66 +        protected JCTypeParameter(Name name, List<JCExpression> bounds) {
   52.67              this.name = name;
   52.68              this.bounds = bounds;
   52.69 -            this.annotations = annotations;
   52.70          }
   52.71          @Override
   52.72          public void accept(Visitor v) { v.visitTypeParameter(this); }
   52.73 @@ -1937,9 +1927,6 @@
   52.74          public List<JCExpression> getBounds() {
   52.75              return bounds;
   52.76          }
   52.77 -        public List<JCTypeAnnotation> getAnnotations() {
   52.78 -            return annotations;
   52.79 -        }
   52.80          @Override
   52.81          public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   52.82              return v.visitTypeParameter(this, d);
   52.83 @@ -2030,16 +2017,6 @@
   52.84          }
   52.85      }
   52.86  
   52.87 -    public static class JCTypeAnnotation extends JCAnnotation {
   52.88 -        public TypeAnnotationPosition annotation_position;
   52.89 -        public Attribute.TypeCompound attribute_field;
   52.90 -
   52.91 -        protected JCTypeAnnotation(JCTree annotationType, List<JCExpression> args) {
   52.92 -            super(annotationType, args);
   52.93 -            this.annotation_position = new TypeAnnotationPosition();
   52.94 -        }
   52.95 -    }
   52.96 -
   52.97      public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
   52.98          public long flags;
   52.99          public List<JCAnnotation> annotations;
  52.100 @@ -2067,40 +2044,6 @@
  52.101          }
  52.102      }
  52.103  
  52.104 -    public static class JCAnnotatedType extends JCExpression
  52.105 -//308            implements com.sun.source.tree.AnnotatedTypeTree
  52.106 -    {
  52.107 -        public List<JCTypeAnnotation> annotations;
  52.108 -        public JCExpression underlyingType;
  52.109 -        protected JCAnnotatedType(List<JCTypeAnnotation> annotations, JCExpression underlyingType) {
  52.110 -            throw new UnsupportedOperationException();
  52.111 -//308            this.annotations = annotations;
  52.112 -//308            this.underlyingType = underlyingType;
  52.113 -        }
  52.114 -        @Override
  52.115 -        public void accept(Visitor v) { v.visitAnnotatedType(this); }
  52.116 -
  52.117 -        public Kind getKind() {
  52.118 -            throw new UnsupportedOperationException();
  52.119 -//308            return Kind.ANNOTATED_TYPE;
  52.120 -        }
  52.121 -        public List<JCTypeAnnotation> getAnnotations() {
  52.122 -            return annotations;
  52.123 -        }
  52.124 -        public JCExpression getUnderlyingType() {
  52.125 -            return underlyingType;
  52.126 -        }
  52.127 -        @Override
  52.128 -        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  52.129 -            throw new UnsupportedOperationException();
  52.130 -//308            return v.visitAnnotatedType(this, d);
  52.131 -        }
  52.132 -        @Override
  52.133 -        public int getTag() {
  52.134 -            return ANNOTATED_TYPE;
  52.135 -        }
  52.136 -    }
  52.137 -
  52.138      public static class JCErroneous extends JCExpression
  52.139              implements com.sun.source.tree.ErroneousTree {
  52.140          public List<? extends JCTree> errs;
  52.141 @@ -2168,7 +2111,6 @@
  52.142                              JCExpression restype,
  52.143                              List<JCTypeParameter> typarams,
  52.144                              List<JCVariableDecl> params,
  52.145 -                            List<JCTypeAnnotation> receiver,
  52.146                              List<JCExpression> thrown,
  52.147                              JCBlock body,
  52.148                              JCExpression defaultValue);
  52.149 @@ -2290,11 +2232,10 @@
  52.150          public void visitTypeBoundKind(TypeBoundKind that)   { visitTree(that); }
  52.151          public void visitAnnotation(JCAnnotation that)       { visitTree(that); }
  52.152          public void visitModifiers(JCModifiers that)         { visitTree(that); }
  52.153 -        public void visitAnnotatedType(JCAnnotatedType that) { visitTree(that); }
  52.154          public void visitErroneous(JCErroneous that)         { visitTree(that); }
  52.155          public void visitLetExpr(LetExpr that)               { visitTree(that); }
  52.156  
  52.157 -        public void visitTree(JCTree that)                   { assert false; }
  52.158 +        public void visitTree(JCTree that)                   { Assert.error(); }
  52.159      }
  52.160  
  52.161  }
    53.1 --- a/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Thu Jan 27 17:28:57 2011 -0800
    53.2 +++ b/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Fri Jan 28 10:06:08 2011 -0800
    53.3 @@ -1,5 +1,5 @@
    53.4  /*
    53.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    53.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    53.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    53.8   *
    53.9   * This code is free software; you can redistribute it and/or modify it
   53.10 @@ -224,15 +224,6 @@
   53.11          }
   53.12      }
   53.13  
   53.14 -    public void printTypeAnnotations(List<JCTypeAnnotation> trees) throws IOException {
   53.15 -        if (trees.nonEmpty())
   53.16 -            print(" ");
   53.17 -        for (List<JCTypeAnnotation> l = trees; l.nonEmpty(); l = l.tail) {
   53.18 -            printExpr(l.head);
   53.19 -            print(" ");
   53.20 -        }
   53.21 -    }
   53.22 -
   53.23      /** Print documentation comment, if it exists
   53.24       *  @param tree    The tree for which a documentation comment should be printed.
   53.25       */
   53.26 @@ -890,33 +881,21 @@
   53.27          try {
   53.28              if (tree.elemtype != null) {
   53.29                  print("new ");
   53.30 -                printTypeAnnotations(tree.annotations);
   53.31                  JCTree elem = tree.elemtype;
   53.32 -                printBaseElementType(elem);
   53.33 -                boolean isElemAnnoType = elem instanceof JCAnnotatedType;
   53.34 -                int i = 0;
   53.35 -                List<List<JCTypeAnnotation>> da = tree.dimAnnotations;
   53.36 +                if (elem.getTag() == JCTree.TYPEARRAY)
   53.37 +                    printBaseElementType((JCArrayTypeTree) elem);
   53.38 +                else
   53.39 +                    printExpr(elem);
   53.40                  for (List<JCExpression> l = tree.dims; l.nonEmpty(); l = l.tail) {
   53.41 -                    if (da.size() > i) {
   53.42 -                        printTypeAnnotations(da.get(i));
   53.43 -                    }
   53.44                      print("[");
   53.45 -                    i++;
   53.46                      printExpr(l.head);
   53.47                      print("]");
   53.48                  }
   53.49 -                if (tree.elems != null) {
   53.50 -                    if (isElemAnnoType) {
   53.51 -                        printTypeAnnotations(((JCAnnotatedType)tree.elemtype).annotations);
   53.52 -                    }
   53.53 -                    print("[]");
   53.54 -                }
   53.55 -                if (isElemAnnoType)
   53.56 -                    elem = ((JCAnnotatedType)elem).underlyingType;
   53.57                  if (elem instanceof JCArrayTypeTree)
   53.58                      printBrackets((JCArrayTypeTree) elem);
   53.59              }
   53.60              if (tree.elems != null) {
   53.61 +                if (tree.elemtype != null) print("[]");
   53.62                  print("{");
   53.63                  printExprs(tree.elems);
   53.64                  print("}");
   53.65 @@ -1173,11 +1152,6 @@
   53.66          JCTree elem;
   53.67          while (true) {
   53.68              elem = tree.elemtype;
   53.69 -            if (elem.getTag() == JCTree.ANNOTATED_TYPE) {
   53.70 -                JCAnnotatedType atype = (JCAnnotatedType) elem;
   53.71 -                printTypeAnnotations(atype.annotations);
   53.72 -                elem = atype.underlyingType;
   53.73 -            }
   53.74              print("[]");
   53.75              if (elem.getTag() != JCTree.TYPEARRAY) break;
   53.76              tree = (JCArrayTypeTree) elem;
   53.77 @@ -1272,15 +1246,6 @@
   53.78          }
   53.79      }
   53.80  
   53.81 -    public void visitAnnotatedType(JCAnnotatedType tree) {
   53.82 -        try {
   53.83 -            printTypeAnnotations(tree.annotations);
   53.84 -            printExpr(tree.underlyingType);
   53.85 -        } catch (IOException e) {
   53.86 -            throw new UncheckedIOException(e);
   53.87 -        }
   53.88 -    }
   53.89 -
   53.90      public void visitTree(JCTree tree) {
   53.91          try {
   53.92              print("(UNKNOWN: " + tree + ")");
    54.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Thu Jan 27 17:28:57 2011 -0800
    54.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Fri Jan 28 10:06:08 2011 -0800
    54.3 @@ -1,5 +1,5 @@
    54.4  /*
    54.5 - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    54.6 + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
    54.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    54.8   *
    54.9   * This code is free software; you can redistribute it and/or modify it
   54.10 @@ -71,13 +71,6 @@
   54.11          return lb.toList();
   54.12      }
   54.13  
   54.14 -//308    public JCTree visitAnnotatedType(AnnotatedTypeTree node, P p) {
   54.15 -//308        JCAnnotatedType t = (JCAnnotatedType) node;
   54.16 -//308        List<JCTypeAnnotation> annotations = copy(t.annotations, p);
   54.17 -//308        JCExpression underlyingType = copy(t.underlyingType, p);
   54.18 -//308        return M.at(t.pos).AnnotatedType(annotations, underlyingType);
   54.19 -//308    }
   54.20 -
   54.21      public JCTree visitAnnotation(AnnotationTree node, P p) {
   54.22          JCAnnotation t = (JCAnnotation) node;
   54.23          JCTree annotationType = copy(t.annotationType, p);
   54.24 @@ -240,11 +233,10 @@
   54.25          JCExpression restype = copy(t.restype, p);
   54.26          List<JCTypeParameter> typarams = copy(t.typarams, p);
   54.27          List<JCVariableDecl> params = copy(t.params, p);
   54.28 -        List<JCTypeAnnotation> receiver = copy(t.receiverAnnotations, p);
   54.29          List<JCExpression> thrown = copy(t.thrown, p);
   54.30          JCBlock body = copy(t.body, p);
   54.31          JCExpression defaultValue = copy(t.defaultValue, p);
   54.32 -        return M.at(t.pos).MethodDef(mods, t.name, restype, typarams, params, receiver, thrown, body, defaultValue);
   54.33 +        return M.at(t.pos).MethodDef(mods, t.name, restype, typarams, params, thrown, body, defaultValue);
   54.34      }
   54.35  
   54.36      public JCTree visitMethodInvocation(MethodInvocationTree node, P p) {
   54.37 @@ -372,9 +364,8 @@
   54.38  
   54.39      public JCTree visitTypeParameter(TypeParameterTree node, P p) {
   54.40          JCTypeParameter t = (JCTypeParameter) node;
   54.41 -        List<JCTypeAnnotation> annos = copy(t.annotations, p);
   54.42          List<JCExpression> bounds = copy(t.bounds, p);
   54.43 -        return M.at(t.pos).TypeParameter(t.name, bounds, annos);
   54.44 +        return M.at(t.pos).TypeParameter(t.name, bounds);
   54.45      }
   54.46  
   54.47      public JCTree visitInstanceOf(InstanceOfTree node, P p) {
    55.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Thu Jan 27 17:28:57 2011 -0800
    55.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Fri Jan 28 10:06:08 2011 -0800
    55.3 @@ -1,5 +1,5 @@
    55.4  /*
    55.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    55.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    55.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    55.8   *
    55.9   * This code is free software; you can redistribute it and/or modify it
   55.10 @@ -311,12 +311,6 @@
   55.11          case(JCTree.POSTINC):
   55.12          case(JCTree.POSTDEC):
   55.13              return getStartPos(((JCUnary) tree).arg);
   55.14 -        case(JCTree.ANNOTATED_TYPE): {
   55.15 -            JCAnnotatedType node = (JCAnnotatedType) tree;
   55.16 -            if (node.annotations.nonEmpty())
   55.17 -                return getStartPos(node.annotations.head);
   55.18 -            return getStartPos(node.underlyingType);
   55.19 -        }
   55.20          case(JCTree.NEWCLASS): {
   55.21              JCNewClass node = (JCNewClass)tree;
   55.22              if (node.encl != null)
   55.23 @@ -420,8 +414,6 @@
   55.24              return getEndPos(((JCUnary) tree).arg, endPositions);
   55.25          case(JCTree.WHILELOOP):
   55.26              return getEndPos(((JCWhileLoop) tree).body, endPositions);
   55.27 -        case(JCTree.ANNOTATED_TYPE):
   55.28 -            return getEndPos(((JCAnnotatedType) tree).underlyingType, endPositions);
   55.29          case(JCTree.ERRONEOUS): {
   55.30              JCErroneous node = (JCErroneous)tree;
   55.31              if (node.errs != null && node.errs.nonEmpty())
   55.32 @@ -453,7 +445,7 @@
   55.33      public static int finalizerPos(JCTree tree) {
   55.34          if (tree.getTag() == JCTree.TRY) {
   55.35              JCTry t = (JCTry) tree;
   55.36 -            assert t.finalizer != null;
   55.37 +            Assert.checkNonNull(t.finalizer);
   55.38              return firstStatPos(t.finalizer);
   55.39          } else if (tree.getTag() == JCTree.SYNCHRONIZED) {
   55.40              return endPos(((JCSynchronized) tree).body);
   55.41 @@ -909,8 +901,6 @@
   55.42       */
   55.43      public static JCExpression typeIn(JCExpression tree) {
   55.44          switch (tree.getTag()) {
   55.45 -        case JCTree.ANNOTATED_TYPE:
   55.46 -            return ((JCAnnotatedType)tree).underlyingType;
   55.47          case JCTree.IDENT: /* simple names */
   55.48          case JCTree.TYPEIDENT: /* primitive name */
   55.49          case JCTree.SELECT: /* qualified name */
   55.50 @@ -930,8 +920,6 @@
   55.51              return innermostType(((JCArrayTypeTree)type).elemtype);
   55.52          case JCTree.WILDCARD:
   55.53              return innermostType(((JCWildcard)type).inner);
   55.54 -        case JCTree.ANNOTATED_TYPE:
   55.55 -            return innermostType(((JCAnnotatedType)type).underlyingType);
   55.56          default:
   55.57              return type;
   55.58          }
    56.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Thu Jan 27 17:28:57 2011 -0800
    56.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Fri Jan 28 10:06:08 2011 -0800
    56.3 @@ -1,5 +1,5 @@
    56.4  /*
    56.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    56.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    56.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    56.8   *
    56.9   * This code is free software; you can redistribute it and/or modify it
   56.10 @@ -122,15 +122,15 @@
   56.11      public JCCompilationUnit TopLevel(List<JCAnnotation> packageAnnotations,
   56.12                                        JCExpression pid,
   56.13                                        List<JCTree> defs) {
   56.14 -        assert packageAnnotations != null;
   56.15 +        Assert.checkNonNull(packageAnnotations);
   56.16          for (JCTree node : defs)
   56.17 -            assert node instanceof JCClassDecl
   56.18 +            Assert.check(node instanceof JCClassDecl
   56.19                  || node instanceof JCImport
   56.20                  || node instanceof JCSkip
   56.21                  || node instanceof JCErroneous
   56.22                  || (node instanceof JCExpressionStatement
   56.23 -                    && ((JCExpressionStatement)node).expr instanceof JCErroneous)
   56.24 -                 : node.getClass().getSimpleName();
   56.25 +                    && ((JCExpressionStatement)node).expr instanceof JCErroneous),
   56.26 +                node.getClass().getSimpleName());
   56.27          JCCompilationUnit tree = new JCCompilationUnit(packageAnnotations, pid, defs,
   56.28                                       null, null, null, null);
   56.29          tree.pos = pos;
   56.30 @@ -169,27 +169,11 @@
   56.31                                 List<JCExpression> thrown,
   56.32                                 JCBlock body,
   56.33                                 JCExpression defaultValue) {
   56.34 -        return MethodDef(
   56.35 -                mods, name, restype, typarams, params,
   56.36 -                null, thrown, body, defaultValue);
   56.37 -    }
   56.38 -
   56.39 -    public JCMethodDecl MethodDef(JCModifiers mods,
   56.40 -                               Name name,
   56.41 -                               JCExpression restype,
   56.42 -                               List<JCTypeParameter> typarams,
   56.43 -                               List<JCVariableDecl> params,
   56.44 -                               List<JCTypeAnnotation> receiver,
   56.45 -                               List<JCExpression> thrown,
   56.46 -                               JCBlock body,
   56.47 -                               JCExpression defaultValue)
   56.48 -    {
   56.49          JCMethodDecl tree = new JCMethodDecl(mods,
   56.50                                         name,
   56.51                                         restype,
   56.52                                         typarams,
   56.53                                         params,
   56.54 -                                       receiver,
   56.55                                         thrown,
   56.56                                         body,
   56.57                                         defaultValue,
   56.58 @@ -458,11 +442,7 @@
   56.59      }
   56.60  
   56.61      public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds) {
   56.62 -        return TypeParameter(name, bounds, List.<JCTypeAnnotation>nil());
   56.63 -    }
   56.64 -
   56.65 -    public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annos) {
   56.66 -        JCTypeParameter tree = new JCTypeParameter(name, bounds, annos);
   56.67 +        JCTypeParameter tree = new JCTypeParameter(name, bounds);
   56.68          tree.pos = pos;
   56.69          return tree;
   56.70      }
   56.71 @@ -485,12 +465,6 @@
   56.72          return tree;
   56.73      }
   56.74  
   56.75 -    public JCTypeAnnotation TypeAnnotation(JCTree annotationType, List<JCExpression> args) {
   56.76 -        JCTypeAnnotation tree = new JCTypeAnnotation(annotationType, args);
   56.77 -        tree.pos = pos;
   56.78 -        return tree;
   56.79 -    }
   56.80 -
   56.81      public JCModifiers Modifiers(long flags, List<JCAnnotation> annotations) {
   56.82          JCModifiers tree = new JCModifiers(flags, annotations);
   56.83          boolean noFlags = (flags & (Flags.ModifierFlags | Flags.ANNOTATION)) == 0;
   56.84 @@ -502,12 +476,6 @@
   56.85          return Modifiers(flags, List.<JCAnnotation>nil());
   56.86      }
   56.87  
   56.88 -    public JCAnnotatedType AnnotatedType(List<JCTypeAnnotation> annotations, JCExpression underlyingType) {
   56.89 -        JCAnnotatedType tree = new JCAnnotatedType(annotations, underlyingType);
   56.90 -        tree.pos = pos;
   56.91 -        return tree;
   56.92 -    }
   56.93 -
   56.94      public JCErroneous Erroneous() {
   56.95          return Erroneous(List.<JCTree>nil());
   56.96      }
   56.97 @@ -679,19 +647,14 @@
   56.98          }
   56.99          return tp.setType(t);
  56.100      }
  56.101 -//where
  56.102 -        private JCExpression Selectors(JCExpression base, Symbol sym, Symbol limit) {
  56.103 -            if (sym == limit) return base;
  56.104 -            else return Select(Selectors(base, sym.owner, limit), sym);
  56.105 -        }
  56.106  
  56.107      /** Create a list of trees representing given list of types.
  56.108       */
  56.109      public List<JCExpression> Types(List<Type> ts) {
  56.110 -        ListBuffer<JCExpression> types = new ListBuffer<JCExpression>();
  56.111 +        ListBuffer<JCExpression> lb = new ListBuffer<JCExpression>();
  56.112          for (List<Type> l = ts; l.nonEmpty(); l = l.tail)
  56.113 -            types.append(Type(l.head));
  56.114 -        return types.toList();
  56.115 +            lb.append(Type(l.head));
  56.116 +        return lb.toList();
  56.117      }
  56.118  
  56.119      /** Create a variable definition from a variable symbol and an initializer
  56.120 @@ -821,7 +784,6 @@
  56.121                  Type(mtype.getReturnType()),
  56.122                  TypeParams(mtype.getTypeArguments()),
  56.123                  Params(mtype.getParameterTypes(), m),
  56.124 -                null,
  56.125                  Types(mtype.getThrownTypes()),
  56.126                  body,
  56.127                  null,
    57.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java	Thu Jan 27 17:28:57 2011 -0800
    57.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java	Fri Jan 28 10:06:08 2011 -0800
    57.3 @@ -1,5 +1,5 @@
    57.4  /*
    57.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    57.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    57.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    57.8   *
    57.9   * This code is free software; you can redistribute it and/or modify it
   57.10 @@ -85,7 +85,6 @@
   57.11          scan(tree.restype);
   57.12          scan(tree.typarams);
   57.13          scan(tree.params);
   57.14 -        scan(tree.receiverAnnotations);
   57.15          scan(tree.thrown);
   57.16          scan(tree.defaultValue);
   57.17          scan(tree.body);
   57.18 @@ -208,11 +207,8 @@
   57.19      }
   57.20  
   57.21      public void visitNewArray(JCNewArray tree) {
   57.22 -        scan(tree.annotations);
   57.23          scan(tree.elemtype);
   57.24          scan(tree.dims);
   57.25 -        for (List<JCTypeAnnotation> annos : tree.dimAnnotations)
   57.26 -            scan(annos);
   57.27          scan(tree.elems);
   57.28      }
   57.29  
   57.30 @@ -281,7 +277,6 @@
   57.31      }
   57.32  
   57.33      public void visitTypeParameter(JCTypeParameter tree) {
   57.34 -        scan(tree.annotations);
   57.35          scan(tree.bounds);
   57.36      }
   57.37  
   57.38 @@ -305,11 +300,6 @@
   57.39          scan(tree.args);
   57.40      }
   57.41  
   57.42 -    public void visitAnnotatedType(JCAnnotatedType tree) {
   57.43 -        scan(tree.annotations);
   57.44 -        scan(tree.underlyingType);
   57.45 -    }
   57.46 -
   57.47      public void visitErroneous(JCErroneous tree) {
   57.48      }
   57.49  
   57.50 @@ -319,6 +309,6 @@
   57.51      }
   57.52  
   57.53      public void visitTree(JCTree tree) {
   57.54 -        assert false;
   57.55 +        Assert.error();
   57.56      }
   57.57  }
    58.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java	Thu Jan 27 17:28:57 2011 -0800
    58.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java	Fri Jan 28 10:06:08 2011 -0800
    58.3 @@ -1,5 +1,5 @@
    58.4  /*
    58.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    58.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    58.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    58.8   *
    58.9   * This code is free software; you can redistribute it and/or modify it
   58.10 @@ -283,11 +283,6 @@
   58.11      }
   58.12  
   58.13      public void visitNewArray(JCNewArray tree) {
   58.14 -        tree.annotations = translate(tree.annotations);
   58.15 -        List<List<JCTypeAnnotation>> dimAnnos = List.nil();
   58.16 -        for (List<JCTypeAnnotation> origDimAnnos : tree.dimAnnotations)
   58.17 -            dimAnnos = dimAnnos.append(translate(origDimAnnos));
   58.18 -        tree.dimAnnotations = dimAnnos;
   58.19          tree.elemtype = translate(tree.elemtype);
   58.20          tree.dims = translate(tree.dims);
   58.21          tree.elems = translate(tree.elems);
   58.22 @@ -374,7 +369,6 @@
   58.23      }
   58.24  
   58.25      public void visitTypeParameter(JCTypeParameter tree) {
   58.26 -        tree.annotations = translate(tree.annotations);
   58.27          tree.bounds = translate(tree.bounds);
   58.28          result = tree;
   58.29      }
   58.30 @@ -412,12 +406,6 @@
   58.31          result = tree;
   58.32      }
   58.33  
   58.34 -    public void visitAnnotatedType(JCAnnotatedType tree) {
   58.35 -        tree.annotations = translate(tree.annotations);
   58.36 -        tree.underlyingType = translate(tree.underlyingType);
   58.37 -        result = tree;
   58.38 -    }
   58.39 -
   58.40      public void visitTree(JCTree tree) {
   58.41          throw new AssertionError(tree);
   58.42      }
    59.1 --- a/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Thu Jan 27 17:28:57 2011 -0800
    59.2 +++ b/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Fri Jan 28 10:06:08 2011 -0800
    59.3 @@ -1,5 +1,5 @@
    59.4  /*
    59.5 - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
    59.6 + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
    59.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    59.8   *
    59.9   * This code is free software; you can redistribute it and/or modify it
   59.10 @@ -117,7 +117,7 @@
   59.11      protected abstract String formatDiagnostic(JCDiagnostic d, Locale locale);
   59.12  
   59.13      public String formatPosition(JCDiagnostic d, PositionKind pk,Locale l) {
   59.14 -        assert (d.getPosition() != Position.NOPOS);
   59.15 +        Assert.check(d.getPosition() != Position.NOPOS);
   59.16          return String.valueOf(getPosition(d, pk));
   59.17      }
   59.18      //where
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/src/share/classes/com/sun/tools/javac/util/Assert.java	Fri Jan 28 10:06:08 2011 -0800
    60.3 @@ -0,0 +1,138 @@
    60.4 +/*
    60.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    60.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    60.7 + *
    60.8 + * This code is free software; you can redistribute it and/or modify it
    60.9 + * under the terms of the GNU General Public License version 2 only, as
   60.10 + * published by the Free Software Foundation.  Oracle designates this
   60.11 + * particular file as subject to the "Classpath" exception as provided
   60.12 + * by Oracle in the LICENSE file that accompanied this code.
   60.13 + *
   60.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   60.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   60.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   60.17 + * version 2 for more details (a copy is included in the LICENSE file that
   60.18 + * accompanied this code).
   60.19 + *
   60.20 + * You should have received a copy of the GNU General Public License version
   60.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   60.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   60.23 + *
   60.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   60.25 + * or visit www.oracle.com if you need additional information or have any
   60.26 + * questions.
   60.27 + */
   60.28 +
   60.29 +package com.sun.tools.javac.util;
   60.30 +
   60.31 +
   60.32 +/**
   60.33 + * Simple facility for unconditional assertions.
   60.34 + * The methods in this class are described in terms of equivalent assert
   60.35 + * statements, assuming that assertions have been enabled.
   60.36 + *
   60.37 + *  <p><b>This is NOT part of any supported API.
   60.38 + *  If you write code that depends on this, you do so at your own risk.
   60.39 + *  This code and its internal interfaces are subject to change or
   60.40 + *  deletion without notice.</b>
   60.41 + */
   60.42 +public class Assert {
   60.43 +    /** Equivalent to
   60.44 +     *   assert cond;
   60.45 +     */
   60.46 +    public static void check(boolean cond) {
   60.47 +        if (!cond)
   60.48 +            error();
   60.49 +    }
   60.50 +
   60.51 +    /** Equivalent to
   60.52 +     *   assert (o == null);
   60.53 +     */
   60.54 +    public static void checkNull(Object o) {
   60.55 +        if (o != null)
   60.56 +            error();
   60.57 +    }
   60.58 +
   60.59 +    /** Equivalent to
   60.60 +     *   assert (t != null); return t;
   60.61 +     */
   60.62 +    public static <T> T checkNonNull(T t) {
   60.63 +        if (t == null)
   60.64 +            error();
   60.65 +        return t;
   60.66 +    }
   60.67 +
   60.68 +    /** Equivalent to
   60.69 +     *   assert cond : value;
   60.70 +     */
   60.71 +    public static void check(boolean cond, int value) {
   60.72 +        if (!cond)
   60.73 +            error(String.valueOf(value));
   60.74 +    }
   60.75 +
   60.76 +    /** Equivalent to
   60.77 +     *   assert cond : value;
   60.78 +     */
   60.79 +    public static void check(boolean cond, long value) {
   60.80 +        if (!cond)
   60.81 +            error(String.valueOf(value));
   60.82 +    }
   60.83 +
   60.84 +    /** Equivalent to
   60.85 +     *   assert cond : value;
   60.86 +     */
   60.87 +    public static void check(boolean cond, Object value) {
   60.88 +        if (!cond)
   60.89 +            error(String.valueOf(value));
   60.90 +    }
   60.91 +
   60.92 +    /** Equivalent to
   60.93 +     *   assert cond : value;
   60.94 +     */
   60.95 +    public static void check(boolean cond, String msg) {
   60.96 +        if (!cond)
   60.97 +            error(msg);
   60.98 +    }
   60.99 +
  60.100 +    /** Equivalent to
  60.101 +     *   assert (o == null) : value;
  60.102 +     */
  60.103 +    public static void checkNull(Object o, Object value) {
  60.104 +        if (o != null)
  60.105 +            error(String.valueOf(value));
  60.106 +    }
  60.107 +
  60.108 +    /** Equivalent to
  60.109 +     *   assert (o == null) : value;
  60.110 +     */
  60.111 +    public static void checkNull(Object o, String msg) {
  60.112 +        if (o != null)
  60.113 +            error(msg);
  60.114 +    }
  60.115 +
  60.116 +    /** Equivalent to
  60.117 +     *   assert (o != null) : value;
  60.118 +     */
  60.119 +    public static <T> T checkNonNull(T t, String msg) {
  60.120 +        if (t == null)
  60.121 +            error(msg);
  60.122 +        return t;
  60.123 +    }
  60.124 +
  60.125 +    /** Equivalent to
  60.126 +     *   assert false;
  60.127 +     */
  60.128 +    public static void error() {
  60.129 +        throw new AssertionError();
  60.130 +    }
  60.131 +
  60.132 +    /** Equivalent to
  60.133 +     *   assert false : msg;
  60.134 +     */
  60.135 +    public static void error(String msg) {
  60.136 +        throw new AssertionError(msg);
  60.137 +    }
  60.138 +
  60.139 +    /** Prevent instantiation. */
  60.140 +    private Assert() { }
  60.141 +}
    61.1 --- a/src/share/classes/com/sun/tools/javac/util/Bits.java	Thu Jan 27 17:28:57 2011 -0800
    61.2 +++ b/src/share/classes/com/sun/tools/javac/util/Bits.java	Fri Jan 28 10:06:08 2011 -0800
    61.3 @@ -1,5 +1,5 @@
    61.4  /*
    61.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    61.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    61.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    61.8   *
    61.9   * This code is free software; you can redistribute it and/or modify it
   61.10 @@ -85,7 +85,7 @@
   61.11      /** Include x in this set.
   61.12       */
   61.13      public void incl(int x) {
   61.14 -        assert x >= 0;
   61.15 +        Assert.check(x >= 0);
   61.16          sizeTo((x >>> wordshift) + 1);
   61.17          bits[x >>> wordshift] = bits[x >>> wordshift] |
   61.18              (1 << (x & wordmask));
   61.19 @@ -113,7 +113,7 @@
   61.20      /** Exclude x from this set.
   61.21       */
   61.22      public void excl(int x) {
   61.23 -        assert x >= 0;
   61.24 +        Assert.check(x >= 0);
   61.25          sizeTo((x >>> wordshift) + 1);
   61.26          bits[x >>> wordshift] = bits[x >>> wordshift] &
   61.27              ~(1 << (x & wordmask));
   61.28 @@ -169,7 +169,7 @@
   61.29       *  Delight" by Henry S. Warren Jr. (figure 5-13)
   61.30       */
   61.31      private static int trailingZeroBits(int x) {
   61.32 -        assert wordlen == 32;
   61.33 +        Assert.check(wordlen == 32);
   61.34          if (x == 0) return 32;
   61.35          int n = 1;
   61.36          if ((x & 0xffff) == 0) { n += 16; x >>>= 16; }
    62.1 --- a/src/share/classes/com/sun/tools/javac/util/Context.java	Thu Jan 27 17:28:57 2011 -0800
    62.2 +++ b/src/share/classes/com/sun/tools/javac/util/Context.java	Fri Jan 28 10:06:08 2011 -0800
    62.3 @@ -1,5 +1,5 @@
    62.4  /*
    62.5 - * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
    62.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    62.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    62.8   *
    62.9   * This code is free software; you can redistribute it and/or modify it
   62.10 @@ -145,7 +145,7 @@
   62.11              o = fac.make();
   62.12              if (o instanceof Factory<?>)
   62.13                  throw new AssertionError("T extends Context.Factory");
   62.14 -            assert ht.get(key) == o;
   62.15 +            Assert.check(ht.get(key) == o);
   62.16          }
   62.17  
   62.18          /* The following cast can't fail unless there was
    63.1 --- a/src/share/classes/com/sun/tools/javac/util/List.java	Thu Jan 27 17:28:57 2011 -0800
    63.2 +++ b/src/share/classes/com/sun/tools/javac/util/List.java	Fri Jan 28 10:06:08 2011 -0800
    63.3 @@ -1,5 +1,5 @@
    63.4  /*
    63.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    63.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    63.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    63.8   *
    63.9   * This code is free software; you can redistribute it and/or modify it
   63.10 @@ -184,7 +184,7 @@
   63.11          // return this.prependList(xs.tail).prepend(xs.head);
   63.12          List<A> result = this;
   63.13          List<A> rev = xs.reverse();
   63.14 -        assert rev != xs;
   63.15 +        Assert.check(rev != xs);
   63.16          // since xs.reverse() returned a new list, we can reuse the
   63.17          // individual List objects, instead of allocating new ones.
   63.18          while (rev.nonEmpty()) {
    64.1 --- a/src/share/classes/com/sun/tools/javac/util/Names.java	Thu Jan 27 17:28:57 2011 -0800
    64.2 +++ b/src/share/classes/com/sun/tools/javac/util/Names.java	Fri Jan 28 10:06:08 2011 -0800
    64.3 @@ -74,7 +74,6 @@
    64.4      public final Name serialVersionUID;
    64.5      public final Name java_lang_Enum;
    64.6      public final Name java_dyn_MethodHandle;
    64.7 -    public final Name java_dyn_InvokeDynamic;
    64.8      public final Name package_info;
    64.9      public final Name ConstantValue;
   64.10      public final Name LineNumberTable;
   64.11 @@ -115,7 +114,6 @@
   64.12      public final Name value;
   64.13      public final Name getMessage;
   64.14      public final Name getClass;
   64.15 -    public final Name invoke;  //allowTransitionalJSR292 only
   64.16      public final Name TYPE;
   64.17      public final Name TYPE_USE;
   64.18      public final Name TYPE_PARAMETER;
   64.19 @@ -186,7 +184,6 @@
   64.20          java_io_Serializable = fromString("java.io.Serializable");
   64.21          java_lang_Enum = fromString("java.lang.Enum");
   64.22          java_dyn_MethodHandle = fromString("java.dyn.MethodHandle");
   64.23 -        java_dyn_InvokeDynamic = fromString("java.dyn.InvokeDynamic");
   64.24          package_info = fromString("package-info");
   64.25          serialVersionUID = fromString("serialVersionUID");
   64.26          ConstantValue = fromString("ConstantValue");
   64.27 @@ -230,7 +227,6 @@
   64.28          value = fromString("value");
   64.29          getMessage = fromString("getMessage");
   64.30          getClass = fromString("getClass");
   64.31 -        invoke = fromString("invoke");  //allowTransitionalJSR292 only
   64.32  
   64.33          TYPE = fromString("TYPE");
   64.34          TYPE_USE = fromString("TYPE_USE");
    65.1 --- a/src/share/classes/com/sun/tools/javac/util/UnsharedNameTable.java	Thu Jan 27 17:28:57 2011 -0800
    65.2 +++ b/src/share/classes/com/sun/tools/javac/util/UnsharedNameTable.java	Fri Jan 28 10:06:08 2011 -0800
    65.3 @@ -1,5 +1,5 @@
    65.4  /*
    65.5 - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
    65.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    65.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    65.8   *
    65.9   * This code is free software; you can redistribute it and/or modify it
   65.10 @@ -107,7 +107,7 @@
   65.11                      hashes[h] = firstTableEntry = element.next;
   65.12                  }
   65.13                  else {
   65.14 -                    assert previousNonNullTableEntry != null : "previousNonNullTableEntry cannot be null here.";
   65.15 +                    Assert.checkNonNull(previousNonNullTableEntry, "previousNonNullTableEntry cannot be null here.");
   65.16                      previousNonNullTableEntry.next = element.next;
   65.17                  }
   65.18              }
   65.19 @@ -133,7 +133,7 @@
   65.20              hashes[h] = newEntry;
   65.21          }
   65.22          else {
   65.23 -            assert previousNonNullTableEntry.next == null : "previousNonNullTableEntry.next must be null.";
   65.24 +            Assert.checkNull(previousNonNullTableEntry.next, "previousNonNullTableEntry.next must be null.");
   65.25              previousNonNullTableEntry.next = newEntry;
   65.26          }
   65.27  
    66.1 --- a/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Thu Jan 27 17:28:57 2011 -0800
    66.2 +++ b/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Fri Jan 28 10:06:08 2011 -0800
    66.3 @@ -1,5 +1,5 @@
    66.4  /*
    66.5 - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
    66.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
    66.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    66.8   *
    66.9   * This code is free software; you can redistribute it and/or modify it
   66.10 @@ -26,7 +26,6 @@
   66.11  package com.sun.tools.javap;
   66.12  
   66.13  import com.sun.tools.classfile.Annotation;
   66.14 -import com.sun.tools.classfile.ExtendedAnnotation;
   66.15  import com.sun.tools.classfile.Annotation.Annotation_element_value;
   66.16  import com.sun.tools.classfile.Annotation.Array_element_value;
   66.17  import com.sun.tools.classfile.Annotation.Class_element_value;
   66.18 @@ -77,129 +76,6 @@
   66.19              print(")");
   66.20      }
   66.21  
   66.22 -    public void write(ExtendedAnnotation annot) {
   66.23 -        write(annot, true, false);
   66.24 -    }
   66.25 -
   66.26 -    public void write(ExtendedAnnotation annot, boolean showOffsets, boolean resolveIndices) {
   66.27 -        write(annot.annotation, resolveIndices);
   66.28 -        print(": ");
   66.29 -        write(annot.position, showOffsets);
   66.30 -    }
   66.31 -
   66.32 -    public void write(ExtendedAnnotation.Position pos, boolean showOffsets) {
   66.33 -        print(pos.type);
   66.34 -
   66.35 -        switch (pos.type) {
   66.36 -        // type case
   66.37 -        case TYPECAST:
   66.38 -        case TYPECAST_GENERIC_OR_ARRAY:
   66.39 -        // object creation
   66.40 -        case INSTANCEOF:
   66.41 -        case INSTANCEOF_GENERIC_OR_ARRAY:
   66.42 -        // new expression
   66.43 -        case NEW:
   66.44 -        case NEW_GENERIC_OR_ARRAY:
   66.45 -        case NEW_TYPE_ARGUMENT:
   66.46 -        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
   66.47 -            if (showOffsets) {
   66.48 -                print(", offset=");
   66.49 -                print(pos.offset);
   66.50 -            }
   66.51 -            break;
   66.52 -         // local variable
   66.53 -        case LOCAL_VARIABLE:
   66.54 -        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
   66.55 -            print(", {");
   66.56 -            for (int i = 0; i < pos.lvarOffset.length; ++i) {
   66.57 -                if (i != 0) print("; ");
   66.58 -                if (showOffsets) {
   66.59 -                    print(", start_pc=");
   66.60 -                    print(pos.lvarOffset[i]);
   66.61 -                }
   66.62 -                print(", length=");
   66.63 -                print(pos.lvarLength[i]);
   66.64 -                print(", index=");
   66.65 -                print(pos.lvarIndex[i]);
   66.66 -            }
   66.67 -            print("}");
   66.68 -            break;
   66.69 -         // method receiver
   66.70 -        case METHOD_RECEIVER:
   66.71 -            // Do nothing
   66.72 -            break;
   66.73 -        // type parameters
   66.74 -        case CLASS_TYPE_PARAMETER:
   66.75 -        case METHOD_TYPE_PARAMETER:
   66.76 -            print(", param_index=");
   66.77 -            print(pos.parameter_index);
   66.78 -            break;
   66.79 -        // type parameters bound
   66.80 -        case CLASS_TYPE_PARAMETER_BOUND:
   66.81 -        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
   66.82 -        case METHOD_TYPE_PARAMETER_BOUND:
   66.83 -        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
   66.84 -            print(", param_index=");
   66.85 -            print(pos.parameter_index);
   66.86 -            print(", bound_index=");
   66.87 -            print(pos.bound_index);
   66.88 -            break;
   66.89 -         // wildcard
   66.90 -        case WILDCARD_BOUND:
   66.91 -        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
   66.92 -            print(", wild_card=");
   66.93 -            print(pos.wildcard_position);
   66.94 -            break;
   66.95 -         // Class extends and implements clauses
   66.96 -        case CLASS_EXTENDS:
   66.97 -        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
   66.98 -            print(", type_index=");
   66.99 -            print(pos.type_index);
  66.100 -            break;
  66.101 -        // throws
  66.102 -        case THROWS:
  66.103 -            print(", type_index=");
  66.104 -            print(pos.type_index);
  66.105 -            break;
  66.106 -        case CLASS_LITERAL:
  66.107 -        case CLASS_LITERAL_GENERIC_OR_ARRAY:
  66.108 -            if (showOffsets) {
  66.109 -                print(", offset=");
  66.110 -                print(pos.offset);
  66.111 -            }
  66.112 -            break;
  66.113 -        // method parameter: not specified
  66.114 -        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
  66.115 -            print(", param_index=");
  66.116 -            print(pos.parameter_index);
  66.117 -            break;
  66.118 -        // method type argument: wasn't specified
  66.119 -        case METHOD_TYPE_ARGUMENT:
  66.120 -        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
  66.121 -            if (showOffsets) {
  66.122 -                print(", offset=");
  66.123 -                print(pos.offset);
  66.124 -            }
  66.125 -            print(", type_index=");
  66.126 -            print(pos.type_index);
  66.127 -            break;
  66.128 -        // We don't need to worry abut these
  66.129 -        case METHOD_RETURN_GENERIC_OR_ARRAY:
  66.130 -        case FIELD_GENERIC_OR_ARRAY:
  66.131 -            break;
  66.132 -        case UNKNOWN:
  66.133 -            break;
  66.134 -        default:
  66.135 -            throw new AssertionError("unknown type: " + pos.type);
  66.136 -        }
  66.137 -
  66.138 -        // Append location data for generics/arrays.
  66.139 -        if (pos.type.hasLocation()) {
  66.140 -            print(", location=");
  66.141 -            print(pos.location);
  66.142 -        }
  66.143 -    }
  66.144 -
  66.145      public void write(Annotation.element_value_pair pair) {
  66.146          write(pair, false);
  66.147      }
    67.1 --- a/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Thu Jan 27 17:28:57 2011 -0800
    67.2 +++ b/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Fri Jan 28 10:06:08 2011 -0800
    67.3 @@ -1,5 +1,5 @@
    67.4  /*
    67.5 - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
    67.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
    67.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    67.8   *
    67.9   * This code is free software; you can redistribute it and/or modify it
   67.10 @@ -31,6 +31,7 @@
   67.11  import com.sun.tools.classfile.AnnotationDefault_attribute;
   67.12  import com.sun.tools.classfile.Attribute;
   67.13  import com.sun.tools.classfile.Attributes;
   67.14 +import com.sun.tools.classfile.BootstrapMethods_attribute;
   67.15  import com.sun.tools.classfile.CharacterRangeTable_attribute;
   67.16  import com.sun.tools.classfile.Code_attribute;
   67.17  import com.sun.tools.classfile.CompilationID_attribute;
   67.18 @@ -47,10 +48,8 @@
   67.19  import com.sun.tools.classfile.LocalVariableTypeTable_attribute;
   67.20  import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute;
   67.21  import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute;
   67.22 -import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
   67.23  import com.sun.tools.classfile.RuntimeVisibleAnnotations_attribute;
   67.24  import com.sun.tools.classfile.RuntimeVisibleParameterAnnotations_attribute;
   67.25 -import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;
   67.26  import com.sun.tools.classfile.Signature_attribute;
   67.27  import com.sun.tools.classfile.SourceDebugExtension_attribute;
   67.28  import com.sun.tools.classfile.SourceFile_attribute;
   67.29 @@ -153,6 +152,25 @@
   67.30          return null;
   67.31      }
   67.32  
   67.33 +    public Void visitBootstrapMethods(BootstrapMethods_attribute attr, Void p) {
   67.34 +        println(Attribute.BootstrapMethods + ":");
   67.35 +        for (int i = 0; i < attr.bootstrap_method_specifiers.length ; i++) {
   67.36 +            BootstrapMethods_attribute.BootstrapMethodSpecifier bsm = attr.bootstrap_method_specifiers[i];
   67.37 +            indent(+1);
   67.38 +            print(i + ": #" + bsm.bootstrap_method_ref + " ");
   67.39 +            println(constantWriter.stringValue(bsm.bootstrap_method_ref));
   67.40 +            indent(+1);
   67.41 +            println("Method arguments:");
   67.42 +            indent(+1);
   67.43 +            for (int j = 0; j < bsm.bootstrap_arguments.length; j++) {
   67.44 +                print("#" + bsm.bootstrap_arguments[j] + " ");
   67.45 +                println(constantWriter.stringValue(bsm.bootstrap_arguments[j]));
   67.46 +            }
   67.47 +            indent(-3);
   67.48 +        }
   67.49 +        return null;
   67.50 +    }
   67.51 +
   67.52      public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr, Void ignore) {
   67.53          println("CharacterRangeTable:");
   67.54          indent(+1);
   67.55 @@ -392,30 +410,6 @@
   67.56          return null;
   67.57      }
   67.58  
   67.59 -    public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, Void ignore) {
   67.60 -        println("RuntimeVisibleTypeAnnotations:");
   67.61 -        indent(+1);
   67.62 -        for (int i = 0; i < attr.annotations.length; i++) {
   67.63 -            print(i + ": ");
   67.64 -            annotationWriter.write(attr.annotations[i]);
   67.65 -            println();
   67.66 -        }
   67.67 -        indent(-1);
   67.68 -        return null;
   67.69 -    }
   67.70 -
   67.71 -    public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, Void ignore) {
   67.72 -        println("RuntimeInvisibleTypeAnnotations:");
   67.73 -        indent(+1);
   67.74 -        for (int i = 0; i < attr.annotations.length; i++) {
   67.75 -            print(i + ": ");
   67.76 -            annotationWriter.write(attr.annotations[i]);
   67.77 -            println();
   67.78 -        }
   67.79 -        indent(-1);
   67.80 -        return null;
   67.81 -    }
   67.82 -
   67.83      public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, Void ignore) {
   67.84          println("RuntimeVisibleParameterAnnotations:");
   67.85          indent(+1);
    68.1 --- a/src/share/classes/com/sun/tools/javap/CodeWriter.java	Thu Jan 27 17:28:57 2011 -0800
    68.2 +++ b/src/share/classes/com/sun/tools/javap/CodeWriter.java	Fri Jan 28 10:06:08 2011 -0800
    68.3 @@ -1,5 +1,5 @@
    68.4  /*
    68.5 - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
    68.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
    68.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    68.8   *
    68.9   * This code is free software; you can redistribute it and/or modify it
   68.10 @@ -64,7 +64,6 @@
   68.11          stackMapWriter = StackMapWriter.instance(context);
   68.12          localVariableTableWriter = LocalVariableTableWriter.instance(context);
   68.13          localVariableTypeTableWriter = LocalVariableTypeTableWriter.instance(context);
   68.14 -        typeAnnotationWriter = TypeAnnotationWriter.instance(context);
   68.15          options = Options.instance(context);
   68.16      }
   68.17  
   68.18 @@ -266,11 +265,6 @@
   68.19              detailWriters.add(tryBlockWriter);
   68.20          }
   68.21  
   68.22 -        if (options.details.contains(InstructionDetailWriter.Kind.TYPE_ANNOS)) {
   68.23 -            typeAnnotationWriter.reset(attr);
   68.24 -            detailWriters.add(typeAnnotationWriter);
   68.25 -        }
   68.26 -
   68.27          return detailWriters;
   68.28      }
   68.29  
   68.30 @@ -279,7 +273,6 @@
   68.31      private ConstantWriter constantWriter;
   68.32      private LocalVariableTableWriter localVariableTableWriter;
   68.33      private LocalVariableTypeTableWriter localVariableTypeTableWriter;
   68.34 -    private TypeAnnotationWriter typeAnnotationWriter;
   68.35      private SourceWriter sourceWriter;
   68.36      private StackMapWriter stackMapWriter;
   68.37      private TryBlockWriter tryBlockWriter;
    69.1 --- a/src/share/classes/com/sun/tools/javap/ConstantWriter.java	Thu Jan 27 17:28:57 2011 -0800
    69.2 +++ b/src/share/classes/com/sun/tools/javap/ConstantWriter.java	Fri Jan 28 10:06:08 2011 -0800
    69.3 @@ -1,5 +1,5 @@
    69.4  /*
    69.5 - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
    69.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
    69.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    69.8   *
    69.9   * This code is free software; you can redistribute it and/or modify it
   69.10 @@ -97,6 +97,13 @@
   69.11                  return 1;
   69.12              }
   69.13  
   69.14 +            public Integer visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
   69.15 +                print("#" + info.bootstrap_method_attr_index + ":#" + info.name_and_type_index);
   69.16 +                tab();
   69.17 +                println("//  " + stringValue(info));
   69.18 +                return 1;
   69.19 +            }
   69.20 +
   69.21              public Integer visitLong(CONSTANT_Long_info info, Void p) {
   69.22                  println(stringValue(info));
   69.23                  return 2;
   69.24 @@ -116,6 +123,20 @@
   69.25                  return 1;
   69.26              }
   69.27  
   69.28 +            public Integer visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
   69.29 +                print("#" + info.reference_kind.tag + ":#" + info.reference_index);
   69.30 +                tab();
   69.31 +                println("//  " + stringValue(info));
   69.32 +                return 1;
   69.33 +            }
   69.34 +
   69.35 +            public Integer visitMethodType(CONSTANT_MethodType_info info, Void p) {
   69.36 +                print("#" + info.descriptor_index);
   69.37 +                tab();
   69.38 +                println("//  " + stringValue(info));
   69.39 +                return 1;
   69.40 +            }
   69.41 +
   69.42              public Integer visitString(CONSTANT_String_info info, Void p) {
   69.43                  print("#" + info.string_index);
   69.44                  tab();
   69.45 @@ -201,14 +222,20 @@
   69.46                  return "String";
   69.47              case CONSTANT_Fieldref:
   69.48                  return "Field";
   69.49 +            case CONSTANT_MethodHandle:
   69.50 +                return "MethodHandle";
   69.51 +            case CONSTANT_MethodType:
   69.52 +                return "MethodType";
   69.53              case CONSTANT_Methodref:
   69.54                  return "Method";
   69.55              case CONSTANT_InterfaceMethodref:
   69.56                  return "InterfaceMethod";
   69.57 +            case CONSTANT_InvokeDynamic:
   69.58 +                return "InvokeDynamic";
   69.59              case CONSTANT_NameAndType:
   69.60                  return "NameAndType";
   69.61              default:
   69.62 -                return "(unknown tag)";
   69.63 +                return "(unknown tag " + tag + ")";
   69.64          }
   69.65      }
   69.66  
   69.67 @@ -264,6 +291,15 @@
   69.68              return visitRef(info, p);
   69.69          }
   69.70  
   69.71 +        public String visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
   69.72 +            try {
   69.73 +                String callee = stringValue(info.getNameAndTypeInfo());
   69.74 +                return "#" + info.bootstrap_method_attr_index + ":" + callee;
   69.75 +            } catch (ConstantPoolException e) {
   69.76 +                return report(e);
   69.77 +            }
   69.78 +        }
   69.79 +
   69.80          public String visitLong(CONSTANT_Long_info info, Void p) {
   69.81              return info.value + "l";
   69.82          }
   69.83 @@ -288,6 +324,22 @@
   69.84              }
   69.85          }
   69.86  
   69.87 +        public String visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
   69.88 +            try {
   69.89 +                return info.reference_kind.name + " " + stringValue(info.getCPRefInfo());
   69.90 +            } catch (ConstantPoolException e) {
   69.91 +                return report(e);
   69.92 +            }
   69.93 +        }
   69.94 +
   69.95 +        public String visitMethodType(CONSTANT_MethodType_info info, Void p) {
   69.96 +            try {
   69.97 +                return info.getType();
   69.98 +            } catch (ConstantPoolException e) {
   69.99 +                return report(e);
  69.100 +            }
  69.101 +        }
  69.102 +
  69.103          public String visitMethodref(CONSTANT_Methodref_info info, Void p) {
  69.104              return visitRef(info, p);
  69.105          }
  69.106 @@ -347,7 +399,6 @@
  69.107          }
  69.108      }
  69.109  
  69.110 -
  69.111      /* If name is a valid binary name, return it; otherwise quote it. */
  69.112      private static String checkName(String name) {
  69.113          if (name == null)
    70.1 --- a/src/share/classes/com/sun/tools/javap/InstructionDetailWriter.java	Thu Jan 27 17:28:57 2011 -0800
    70.2 +++ b/src/share/classes/com/sun/tools/javap/InstructionDetailWriter.java	Fri Jan 28 10:06:08 2011 -0800
    70.3 @@ -1,5 +1,5 @@
    70.4  /*
    70.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    70.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
    70.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    70.8   *
    70.9   * This code is free software; you can redistribute it and/or modify it
   70.10 @@ -42,13 +42,13 @@
   70.11          LOCAL_VAR_TYPES("localVariableTypes"),
   70.12          SOURCE("source"),
   70.13          STACKMAPS("stackMaps"),
   70.14 -        TRY_BLOCKS("tryBlocks"),
   70.15 -        TYPE_ANNOS("typeAnnotations");
   70.16 +        TRY_BLOCKS("tryBlocks");
   70.17          Kind(String option) {
   70.18              this.option = option;
   70.19          }
   70.20          final String option;
   70.21      }
   70.22 +
   70.23      InstructionDetailWriter(Context context) {
   70.24          super(context);
   70.25      }
    71.1 --- a/src/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java	Thu Jan 27 17:28:57 2011 -0800
    71.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.3 @@ -1,126 +0,0 @@
    71.4 -/*
    71.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    71.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    71.7 - *
    71.8 - * This code is free software; you can redistribute it and/or modify it
    71.9 - * under the terms of the GNU General Public License version 2 only, as
   71.10 - * published by the Free Software Foundation.  Oracle designates this
   71.11 - * particular file as subject to the "Classpath" exception as provided
   71.12 - * by Oracle in the LICENSE file that accompanied this code.
   71.13 - *
   71.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   71.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   71.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   71.17 - * version 2 for more details (a copy is included in the LICENSE file that
   71.18 - * accompanied this code).
   71.19 - *
   71.20 - * You should have received a copy of the GNU General Public License version
   71.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   71.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   71.23 - *
   71.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   71.25 - * or visit www.oracle.com if you need additional information or have any
   71.26 - * questions.
   71.27 - */
   71.28 -package com.sun.tools.javap;
   71.29 -
   71.30 -import com.sun.tools.classfile.Attribute;
   71.31 -import com.sun.tools.classfile.Code_attribute;
   71.32 -import com.sun.tools.classfile.ExtendedAnnotation;
   71.33 -import com.sun.tools.classfile.ExtendedAnnotation.Position;
   71.34 -import com.sun.tools.classfile.Instruction;
   71.35 -import com.sun.tools.classfile.Method;
   71.36 -import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
   71.37 -import com.sun.tools.classfile.RuntimeTypeAnnotations_attribute;
   71.38 -import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;
   71.39 -import java.util.ArrayList;
   71.40 -import java.util.HashMap;
   71.41 -import java.util.List;
   71.42 -import java.util.Map;
   71.43 -
   71.44 -/**
   71.45 - * Annotate instructions with details about type annotations.
   71.46 - *
   71.47 - *  <p><b>This is NOT part of any supported API.
   71.48 - *  If you write code that depends on this, you do so at your own risk.
   71.49 - *  This code and its internal interfaces are subject to change or
   71.50 - *  deletion without notice.</b>
   71.51 - */
   71.52 -public class TypeAnnotationWriter extends InstructionDetailWriter {
   71.53 -    public enum NoteKind { VISIBLE, INVISIBLE };
   71.54 -    public static class Note {
   71.55 -        Note(NoteKind kind, ExtendedAnnotation anno) {
   71.56 -            this.kind = kind;
   71.57 -            this.anno = anno;
   71.58 -        }
   71.59 -        public final NoteKind kind;
   71.60 -        public final ExtendedAnnotation anno;
   71.61 -    }
   71.62 -
   71.63 -    static TypeAnnotationWriter instance(Context context) {
   71.64 -        TypeAnnotationWriter instance = context.get(TypeAnnotationWriter.class);
   71.65 -        if (instance == null)
   71.66 -            instance = new TypeAnnotationWriter(context);
   71.67 -        return instance;
   71.68 -    }
   71.69 -
   71.70 -    protected TypeAnnotationWriter(Context context) {
   71.71 -        super(context);
   71.72 -        context.put(TypeAnnotationWriter.class, this);
   71.73 -        annotationWriter = AnnotationWriter.instance(context);
   71.74 -        classWriter = ClassWriter.instance(context);
   71.75 -    }
   71.76 -
   71.77 -    public void reset(Code_attribute attr) {
   71.78 -        Method m = classWriter.getMethod();
   71.79 -        pcMap = new HashMap<Integer, List<Note>>();
   71.80 -        check(NoteKind.VISIBLE, (RuntimeVisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeVisibleTypeAnnotations));
   71.81 -        check(NoteKind.INVISIBLE, (RuntimeInvisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeInvisibleTypeAnnotations));
   71.82 -    }
   71.83 -
   71.84 -    private void check(NoteKind kind, RuntimeTypeAnnotations_attribute attr) {
   71.85 -        if (attr == null)
   71.86 -            return;
   71.87 -
   71.88 -        for (ExtendedAnnotation anno: attr.annotations) {
   71.89 -            Position p = anno.position;
   71.90 -            Note note = null;
   71.91 -            if (p.offset != -1)
   71.92 -                addNote(p.offset, note = new Note(kind, anno));
   71.93 -            if (p.lvarOffset != null) {
   71.94 -                for (int i = 0; i < p.lvarOffset.length; i++) {
   71.95 -                    if (note == null)
   71.96 -                        note = new Note(kind, anno);
   71.97 -                    addNote(p.lvarOffset[i], note);
   71.98 -                }
   71.99 -            }
  71.100 -        }
  71.101 -    }
  71.102 -
  71.103 -    private void addNote(int pc, Note note) {
  71.104 -        List<Note> list = pcMap.get(pc);
  71.105 -        if (list == null)
  71.106 -            pcMap.put(pc, list = new ArrayList<Note>());
  71.107 -        list.add(note);
  71.108 -    }
  71.109 -
  71.110 -    @Override
  71.111 -    void writeDetails(Instruction instr) {
  71.112 -        String indent = space(2); // get from Options?
  71.113 -        int pc = instr.getPC();
  71.114 -        List<Note> notes = pcMap.get(pc);
  71.115 -        if (notes != null) {
  71.116 -            for (Note n: notes) {
  71.117 -                print(indent);
  71.118 -                print("@");
  71.119 -                annotationWriter.write(n.anno, false, true);
  71.120 -                print(", ");
  71.121 -                println(n.kind.toString().toLowerCase());
  71.122 -            }
  71.123 -        }
  71.124 -    }
  71.125 -
  71.126 -    private AnnotationWriter annotationWriter;
  71.127 -    private ClassWriter classWriter;
  71.128 -    private Map<Integer, List<Note>> pcMap;
  71.129 -}
    72.1 --- a/src/share/classes/javax/tools/JavaCompiler.java	Thu Jan 27 17:28:57 2011 -0800
    72.2 +++ b/src/share/classes/javax/tools/JavaCompiler.java	Fri Jan 28 10:06:08 2011 -0800
    72.3 @@ -1,5 +1,5 @@
    72.4  /*
    72.5 - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
    72.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    72.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    72.8   *
    72.9   * This code is free software; you can redistribute it and/or modify it
   72.10 @@ -137,9 +137,9 @@
   72.11   *       StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null);
   72.12   *       compiler.getTask(null, fileManager, diagnostics, null, null, compilationUnits).call();
   72.13   *
   72.14 - *       for (Diagnostic diagnostic : diagnostics.getDiagnostics())
   72.15 - *           System.out.format("Error on line %d in %d%n",
   72.16 - *                             diagnostic.getLineNumber()
   72.17 + *       for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics.getDiagnostics())
   72.18 + *           System.out.format("Error on line %d in %s%n",
   72.19 + *                             diagnostic.getLineNumber(),
   72.20   *                             diagnostic.getSource().toUri());
   72.21   *
   72.22   *       fileManager.close();</pre>
    73.1 --- a/src/share/classes/javax/tools/ToolProvider.java	Thu Jan 27 17:28:57 2011 -0800
    73.2 +++ b/src/share/classes/javax/tools/ToolProvider.java	Fri Jan 28 10:06:08 2011 -0800
    73.3 @@ -1,5 +1,5 @@
    73.4  /*
    73.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    73.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    73.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    73.8   *
    73.9   * This code is free software; you can redistribute it and/or modify it
   73.10 @@ -172,7 +172,7 @@
   73.11      {
   73.12          // try loading class directly, in case tool is on the bootclasspath
   73.13          try {
   73.14 -            return enableAsserts(Class.forName(toolClassName, false, null));
   73.15 +            return Class.forName(toolClassName, false, null);
   73.16          } catch (ClassNotFoundException e) {
   73.17              trace(FINE, e);
   73.18  
   73.19 @@ -194,27 +194,10 @@
   73.20                  trace(FINE, urls[0].toString());
   73.21  
   73.22                  cl = URLClassLoader.newInstance(urls);
   73.23 -                cl.setPackageAssertionStatus("com.sun.tools.javac", true);
   73.24                  refToolClassLoader = new WeakReference<ClassLoader>(cl);
   73.25              }
   73.26  
   73.27              return Class.forName(toolClassName, false, cl);
   73.28          }
   73.29 -
   73.30      }
   73.31 -
   73.32 -    private static Class<?> enableAsserts(Class<?> cls) {
   73.33 -        try {
   73.34 -            ClassLoader loader = cls.getClassLoader();
   73.35 -            if (loader != null)
   73.36 -                loader.setPackageAssertionStatus("com.sun.tools.javac", true);
   73.37 -            else
   73.38 -                trace(FINE, "loader == null");
   73.39 -        } catch (SecurityException ex) {
   73.40 -            trace(FINE, ex);
   73.41 -        }
   73.42 -        return cls;
   73.43 -    }
   73.44 -
   73.45 -
   73.46  }
    74.1 --- a/test/tools/javac/6304921/T6304921.out	Thu Jan 27 17:28:57 2011 -0800
    74.2 +++ b/test/tools/javac/6304921/T6304921.out	Fri Jan 28 10:06:08 2011 -0800
    74.3 @@ -1,7 +1,7 @@
    74.4  T6304921.java:29:34: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
    74.5  T6304921.java:29:30: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.ArrayList, java.util.List<java.lang.Integer>
    74.6  - compiler.err.warnings.and.werror
    74.7 -T6304921.java:35:15: compiler.err.cant.resolve.location: kindname.variable, orr, , , kindname.class, java.lang.System
    74.8 -T6304921.java:38:20: compiler.err.operator.cant.be.applied: +, int,boolean
    74.9 +T6304921.java:35:15: compiler.err.cant.resolve.location: kindname.variable, orr, , , (compiler.misc.location: kindname.class, java.lang.System, null)
   74.10 +T6304921.java:38:20: compiler.err.operator.cant.be.applied.1: +, int, boolean
   74.11  3 errors
   74.12  2 warnings
    75.1 --- a/test/tools/javac/6330920/T6330920.out	Thu Jan 27 17:28:57 2011 -0800
    75.2 +++ b/test/tools/javac/6330920/T6330920.out	Fri Jan 28 10:06:08 2011 -0800
    75.3 @@ -1,2 +1,2 @@
    75.4 -T6330920.java:11:22: compiler.err.cant.resolve.location: kindname.class, T6330920Missing, , , kindname.class, T6330920
    75.5 +T6330920.java:11:22: compiler.err.cant.resolve.location: kindname.class, T6330920Missing, , , (compiler.misc.location: kindname.class, T6330920, null)
    75.6  1 error
    76.1 --- a/test/tools/javac/6717241/T6717241a.out	Thu Jan 27 17:28:57 2011 -0800
    76.2 +++ b/test/tools/javac/6717241/T6717241a.out	Fri Jan 28 10:06:08 2011 -0800
    76.3 @@ -1,4 +1,4 @@
    76.4 -T6717241a.java:13:21: compiler.err.cant.resolve: kindname.variable, v, , 
    76.5 -T6717241a.java:15:10: compiler.err.cant.resolve.args: kindname.method, m1, , int,java.lang.String
    76.6 -T6717241a.java:17:10: compiler.err.cant.resolve.args.params: kindname.method, m2, java.lang.Integer,java.lang.Double, int,java.lang.String
    76.7 +T6717241a.java:13:21: compiler.err.cant.resolve.location: kindname.variable, v, , , (compiler.misc.location.1: kindname.variable, x, X)
    76.8 +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)
    76.9 +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)
   76.10  3 errors
    77.1 --- a/test/tools/javac/6717241/T6717241b.out	Thu Jan 27 17:28:57 2011 -0800
    77.2 +++ b/test/tools/javac/6717241/T6717241b.out	Fri Jan 28 10:06:08 2011 -0800
    77.3 @@ -1,4 +1,4 @@
    77.4 -T6717241b.java:12:20: compiler.err.cant.resolve.location: kindname.variable, v, , , kindname.class, T6717241b
    77.5 -T6717241b.java:14:9: compiler.err.cant.resolve.location.args: kindname.method, m1, , int,java.lang.String, kindname.class, T6717241b
    77.6 -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
    77.7 +T6717241b.java:12:20: compiler.err.cant.resolve.location: kindname.variable, v, , , (compiler.misc.location: kindname.class, T6717241b, null)
    77.8 +T6717241b.java:14:9: compiler.err.cant.resolve.location.args: kindname.method, m1, , int,java.lang.String, (compiler.misc.location: kindname.class, T6717241b, null)
    77.9 +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)
   77.10  3 errors
    78.1 --- a/test/tools/javac/6857948/T6857948.out	Thu Jan 27 17:28:57 2011 -0800
    78.2 +++ b/test/tools/javac/6857948/T6857948.out	Fri Jan 28 10:06:08 2011 -0800
    78.3 @@ -1,3 +1,3 @@
    78.4 -T6857948.java:16:32: compiler.err.cant.resolve.location.args: kindname.method, nosuchfunction, , , kindname.class, Test
    78.5 +T6857948.java:16:32: compiler.err.cant.resolve.location.args: kindname.method, nosuchfunction, , , (compiler.misc.location: kindname.class, Test, null)
    78.6  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)
    78.7  2 errors
    79.1 --- a/test/tools/javac/6863465/T6863465c.out	Thu Jan 27 17:28:57 2011 -0800
    79.2 +++ b/test/tools/javac/6863465/T6863465c.out	Fri Jan 28 10:06:08 2011 -0800
    79.3 @@ -1,3 +1,3 @@
    79.4 -T6863465c.java:13:47: compiler.err.cant.resolve.location: kindname.class, d, , , kindname.class, T6863465c.z
    79.5 +T6863465c.java:13:47: compiler.err.cant.resolve.location: kindname.class, d, , , (compiler.misc.location: kindname.class, T6863465c.z, null)
    79.6  T6863465c.java:11:12: compiler.err.cyclic.inheritance: T6863465c.z
    79.7  2 errors
    80.1 --- a/test/tools/javac/6863465/T6863465d.out	Thu Jan 27 17:28:57 2011 -0800
    80.2 +++ b/test/tools/javac/6863465/T6863465d.out	Fri Jan 28 10:06:08 2011 -0800
    80.3 @@ -1,3 +1,3 @@
    80.4 -T6863465d.java:13:47: compiler.err.cant.resolve.location: kindname.class, w, , , kindname.class, T6863465d.c
    80.5 +T6863465d.java:13:47: compiler.err.cant.resolve.location: kindname.class, w, , , (compiler.misc.location: kindname.class, T6863465d.c, null)
    80.6  T6863465d.java:11:12: compiler.err.cyclic.inheritance: T6863465d.c
    80.7  2 errors
    81.1 --- a/test/tools/javac/InnerNamedConstant_2.out	Thu Jan 27 17:28:57 2011 -0800
    81.2 +++ b/test/tools/javac/InnerNamedConstant_2.out	Fri Jan 28 10:06:08 2011 -0800
    81.3 @@ -1,5 +1,5 @@
    81.4 -InnerNamedConstant_2.java:22:20: compiler.err.icls.cant.have.static.decl
    81.5 -InnerNamedConstant_2.java:23:29: compiler.err.icls.cant.have.static.decl
    81.6 +InnerNamedConstant_2.java:22:20: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner2
    81.7 +InnerNamedConstant_2.java:23:29: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner2
    81.8  InnerNamedConstant_2.java:25:13: compiler.err.cant.assign.val.to.final.var: z
    81.9 -InnerNamedConstant_2.java:34:26: compiler.err.icls.cant.have.static.decl
   81.10 +InnerNamedConstant_2.java:34:26: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner3
   81.11  4 errors
    82.1 --- a/test/tools/javac/T6247324.out	Thu Jan 27 17:28:57 2011 -0800
    82.2 +++ b/test/tools/javac/T6247324.out	Fri Jan 28 10:06:08 2011 -0800
    82.3 @@ -1,2 +1,2 @@
    82.4 -T6247324.java:18:6: compiler.err.cant.resolve.location: kindname.class, Seetharam, , , kindname.class, Pair<X,Y>
    82.5 +T6247324.java:18:6: compiler.err.cant.resolve.location: kindname.class, Seetharam, , , (compiler.misc.location: kindname.class, Pair, null)
    82.6  1 error
    83.1 --- a/test/tools/javac/TryWithResources/ResourceOutsideTry.out	Thu Jan 27 17:28:57 2011 -0800
    83.2 +++ b/test/tools/javac/TryWithResources/ResourceOutsideTry.out	Fri Jan 28 10:06:08 2011 -0800
    83.3 @@ -1,3 +1,3 @@
    83.4 -ResourceOutsideTry.java:14:13: compiler.err.cant.resolve.location: kindname.variable, c, , , kindname.class, ResourceOutsideTry
    83.5 -ResourceOutsideTry.java:16:13: compiler.err.cant.resolve.location: kindname.variable, c, , , kindname.class, ResourceOutsideTry
    83.6 +ResourceOutsideTry.java:14:13: compiler.err.cant.resolve.location: kindname.variable, c, , , (compiler.misc.location: kindname.class, ResourceOutsideTry, null)
    83.7 +ResourceOutsideTry.java:16:13: compiler.err.cant.resolve.location: kindname.variable, c, , , (compiler.misc.location: kindname.class, ResourceOutsideTry, null)
    83.8  2 errors
    84.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    84.2 +++ b/test/tools/javac/api/T6419926.java	Fri Jan 28 10:06:08 2011 -0800
    84.3 @@ -0,0 +1,51 @@
    84.4 +/*
    84.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    84.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    84.7 + *
    84.8 + * This code is free software; you can redistribute it and/or modify it
    84.9 + * under the terms of the GNU General Public License version 2 only, as
   84.10 + * published by the Free Software Foundation.
   84.11 + *
   84.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   84.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   84.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   84.15 + * version 2 for more details (a copy is included in the LICENSE file that
   84.16 + * accompanied this code).
   84.17 + *
   84.18 + * You should have received a copy of the GNU General Public License version
   84.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   84.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   84.21 + *
   84.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   84.23 + * or visit www.oracle.com if you need additional information or have any
   84.24 + * questions.
   84.25 + */
   84.26 +
   84.27 +/*
   84.28 + * @test
   84.29 + * @bug     6419926
   84.30 + * @summary JSR 199: FileObject.toUri() generates URI without schema (Solaris)
   84.31 + */
   84.32 +
   84.33 +import java.io.*;
   84.34 +import java.net.*;
   84.35 +import java.util.*;
   84.36 +import javax.tools.*;
   84.37 +
   84.38 +public class T6419926 {
   84.39 +    public static void main(String[] argv) throws Exception {
   84.40 +        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
   84.41 +        StandardJavaFileManager mgr = compiler.getStandardFileManager( new DiagnosticCollector<JavaFileObject>(), null, null);
   84.42 +        System.out.println( new File( new File(".").toURI() ).getAbsolutePath() );
   84.43 +        mgr.setLocation(StandardLocation.CLASS_OUTPUT,
   84.44 +                            Collections.singleton(new File(".")));
   84.45 +
   84.46 +        FileObject fo = mgr.getFileForOutput(StandardLocation.CLASS_OUTPUT,
   84.47 +                                "", "file.to.delete", null);
   84.48 +        URI uri = fo.toUri();
   84.49 +        System.out.println( uri );
   84.50 +
   84.51 +        if (!"file".equals(uri.getScheme()))
   84.52 +            throw new Exception("unexpected scheme for uri: " + uri.getScheme());
   84.53 +    }
   84.54 +}
    85.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    85.2 +++ b/test/tools/javac/api/T6430241.java	Fri Jan 28 10:06:08 2011 -0800
    85.3 @@ -0,0 +1,237 @@
    85.4 +    /*
    85.5 +     * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    85.6 +     * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    85.7 +     *
    85.8 +     * This code is free software; you can redistribute it and/or modify it
    85.9 +     * under the terms of the GNU General Public License version 2 only, as
   85.10 +     * published by the Free Software Foundation.
   85.11 +     *
   85.12 +     * This code is distributed in the hope that it will be useful, but WITHOUT
   85.13 +     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   85.14 +     * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   85.15 +     * version 2 for more details (a copy is included in the LICENSE file that
   85.16 +     * accompanied this code).
   85.17 +     *
   85.18 +     * You should have received a copy of the GNU General Public License version
   85.19 +     * 2 along with this work; if not, write to the Free Software Foundation,
   85.20 +     * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   85.21 +     *
   85.22 +     * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   85.23 +     * or visit www.oracle.com if you need additional information or have any
   85.24 +     * questions.
   85.25 +     */
   85.26 +
   85.27 +    /*
   85.28 +     * @test
   85.29 +     * @bug 6430241
   85.30 +     * @summary Hard to disable symbol file feature through API
   85.31 +     */
   85.32 +
   85.33 +    import java.io.*;
   85.34 +    import java.util.*;
   85.35 +    import javax.tools.*;
   85.36 +
   85.37 +    import com.sun.source.util.JavacTask;
   85.38 +    import com.sun.tools.javac.api.JavacTool;
   85.39 +
   85.40 +    public class T6430241 {
   85.41 +        public static void main(String... args) throws Exception {
   85.42 +            new T6430241().run();
   85.43 +        }
   85.44 +
   85.45 +        void run() throws Exception {
   85.46 +            setup();
   85.47 +            testCommandLine();
   85.48 +            testSimpleAPI();
   85.49 +            testTaskAPI();
   85.50 +
   85.51 +            if (errors > 0)
   85.52 +                throw new Exception(errors + " errors found");
   85.53 +        }
   85.54 +
   85.55 +        void setup() throws Exception {
   85.56 +            classesDir = new File("classes");
   85.57 +            classesDir.mkdirs();
   85.58 +
   85.59 +            emptyDir = new File("empty");
   85.60 +            emptyDir.mkdirs();
   85.61 +
   85.62 +            bootClassPath = System.getProperty("sun.boot.class.path");
   85.63 +
   85.64 +            File srcDir = new File("src");
   85.65 +            String test = "import sun.misc.Unsafe; class Test { }";
   85.66 +            testFile = writeFile(srcDir, "Test.java", test);
   85.67 +        }
   85.68 +
   85.69 +        //----- tests for command line invocation
   85.70 +
   85.71 +        void testCommandLine() throws Exception {
   85.72 +            testCommandLine(true);
   85.73 +            testCommandLine(true,  "-Xbootclasspath/p:" + emptyDir);
   85.74 +            testCommandLine(false, "-Xbootclasspath:" + bootClassPath);
   85.75 +            testCommandLine(true,  "-Xbootclasspath/a:" + emptyDir);
   85.76 +            testCommandLine(false, "-XDignore.symbol.file");
   85.77 +            System.err.println();
   85.78 +        }
   85.79 +
   85.80 +        void testCommandLine(boolean expectWarnings, String... opts) throws Exception {
   85.81 +            System.err.println("test command line: " + Arrays.asList(opts));
   85.82 +
   85.83 +            String[] args = initArgs(opts);
   85.84 +
   85.85 +            StringWriter sw = new StringWriter();
   85.86 +            PrintWriter pw = new PrintWriter(sw);
   85.87 +            int rc = com.sun.tools.javac.Main.compile(args, pw);
   85.88 +            String out = showOutput(sw.toString());
   85.89 +
   85.90 +            checkCompilationOK(rc);
   85.91 +            checkOutput(out, expectWarnings);
   85.92 +        }
   85.93 +
   85.94 +        //----- tests for simple API invocation
   85.95 +
   85.96 +        void testSimpleAPI() {
   85.97 +            testSimpleAPI(true);
   85.98 +            testSimpleAPI(true,  "-Xbootclasspath/p:" + emptyDir);
   85.99 +            testSimpleAPI(false, "-Xbootclasspath:" + bootClassPath);
  85.100 +            testSimpleAPI(true,  "-Xbootclasspath/a:" + emptyDir);
  85.101 +            testSimpleAPI(false, "-XDignore.symbol.file");
  85.102 +            System.err.println();
  85.103 +        }
  85.104 +
  85.105 +        void testSimpleAPI(boolean expectWarnings, String... opts) {
  85.106 +            System.err.println("test simple API: " + Arrays.asList(opts));
  85.107 +
  85.108 +            String[] args = initArgs(opts);
  85.109 +
  85.110 +            ByteArrayOutputStream baos = new ByteArrayOutputStream();
  85.111 +            PrintStream ps = new PrintStream(baos);
  85.112 +
  85.113 +            JavacTool tool = JavacTool.create();
  85.114 +            int rc = tool.run(null, null, ps, args);
  85.115 +
  85.116 +            String out = showOutput(baos.toString());
  85.117 +
  85.118 +            checkCompilationOK(rc);
  85.119 +            checkOutput(out, expectWarnings);
  85.120 +        }
  85.121 +
  85.122 +        //----- tests for CompilationTask API invocation
  85.123 +
  85.124 +        void testTaskAPI() throws Exception {
  85.125 +            List<File> bcp = new ArrayList<File>();
  85.126 +            for (String f: bootClassPath.split(File.pathSeparator)) {
  85.127 +                if (!f.isEmpty())
  85.128 +                    bcp.add(new File(f));
  85.129 +            }
  85.130 +
  85.131 +            testTaskAPI(true, null);
  85.132 +            testTaskAPI(false, bcp);
  85.133 +            System.err.println();
  85.134 +        }
  85.135 +
  85.136 +        void testTaskAPI(boolean expectWarnings, Iterable<? extends File> pcp) throws Exception {
  85.137 +            System.err.println("test task API: " + pcp);
  85.138 +
  85.139 +            JavacTool tool = JavacTool.create();
  85.140 +            StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
  85.141 +
  85.142 +            if (pcp != null)
  85.143 +                fm.setLocation(StandardLocation.PLATFORM_CLASS_PATH, pcp);
  85.144 +
  85.145 +            Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(testFile);
  85.146 +
  85.147 +            StringWriter sw = new StringWriter();
  85.148 +            PrintWriter pw = new PrintWriter(sw);
  85.149 +            JavacTask task = tool.getTask(pw, fm, null, null, null, files);
  85.150 +            boolean ok = task.call();
  85.151 +            String out = showOutput(sw.toString());
  85.152 +
  85.153 +            checkCompilationOK(ok);
  85.154 +            checkOutput(out, expectWarnings);
  85.155 +        }
  85.156 +
  85.157 +        //----- utility methods
  85.158 +
  85.159 +        /**
  85.160 +         * Create a file with given content.
  85.161 +         */
  85.162 +        File writeFile(File dir, String path, String content) throws IOException {
  85.163 +            File f = new File(dir, path);
  85.164 +            f.getParentFile().mkdirs();
  85.165 +            FileWriter out = new FileWriter(f);
  85.166 +            try {
  85.167 +                out.write(content);
  85.168 +            } finally {
  85.169 +                out.close();
  85.170 +            }
  85.171 +            return f;
  85.172 +        }
  85.173 +
  85.174 +        /**
  85.175 +         * Initialize args for compilation with given opts.
  85.176 +         * @return opts -d classesDir testFile
  85.177 +         */
  85.178 +        String[] initArgs(String[] opts) {
  85.179 +            List<String> args = new ArrayList<String>();
  85.180 +            args.addAll(Arrays.asList(opts));
  85.181 +            args.add("-d");
  85.182 +            args.add(classesDir.getPath());
  85.183 +            args.add(testFile.getPath());
  85.184 +            return args.toArray(new String[args.size()]);
  85.185 +        }
  85.186 +
  85.187 +        /**
  85.188 +         * Show output from compilation if non empty.
  85.189 +         */
  85.190 +        String showOutput(String out) {
  85.191 +            if (!out.isEmpty())
  85.192 +                System.err.println(out);
  85.193 +            return out;
  85.194 +        }
  85.195 +
  85.196 +        /**
  85.197 +         * Verify compilation succeeeded.
  85.198 +         */
  85.199 +        void checkCompilationOK(boolean ok) {
  85.200 +            if (!ok)
  85.201 +                error("compilation failed");
  85.202 +        }
  85.203 +
  85.204 +        /**
  85.205 +         * Verify compilation succeeeded.
  85.206 +         */
  85.207 +        void checkCompilationOK(int rc) {
  85.208 +            if (rc != 0)
  85.209 +                error("compilation failed, rc: " + rc);
  85.210 +        }
  85.211 +
  85.212 +        /**
  85.213 +         * Check whether output contains warnings if and only if warnings
  85.214 +         * are expected.
  85.215 +         */
  85.216 +        void checkOutput(String out, boolean expectWarnings) {
  85.217 +            boolean foundWarnings = out.contains("warning");
  85.218 +            if (foundWarnings) {
  85.219 +                if (!expectWarnings)
  85.220 +                    error("unexpected warnings found");
  85.221 +            } else {
  85.222 +                if (expectWarnings)
  85.223 +                    error("expected warnings not found");
  85.224 +            }
  85.225 +        }
  85.226 +
  85.227 +        /**
  85.228 +         * Report an error.
  85.229 +         */
  85.230 +        void error(String msg) {
  85.231 +            System.err.println("error: " + msg);
  85.232 +            errors++;
  85.233 +        }
  85.234 +
  85.235 +        String bootClassPath;
  85.236 +        File classesDir;
  85.237 +        File emptyDir;
  85.238 +        File testFile;
  85.239 +        int errors;
  85.240 +    }
    86.1 --- a/test/tools/javac/diags/examples.not-yet.txt	Thu Jan 27 17:28:57 2011 -0800
    86.2 +++ b/test/tools/javac/diags/examples.not-yet.txt	Fri Jan 28 10:06:08 2011 -0800
    86.3 @@ -24,7 +24,6 @@
    86.4  compiler.err.no.encl.instance.of.type.in.scope          # cannot occur; always followed by assert false;
    86.5  compiler.err.no.match.entry                             # UNUSED?
    86.6  compiler.err.not.annotation.type                        # cannot occur given preceding checkType
    86.7 -compiler.err.not.within.bounds.explain                  # UNUSED?
    86.8  compiler.err.prob.found.req.1                           # Check: DEAD, in unused method
    86.9  compiler.err.proc.bad.config.file                       # JavacProcessingEnvironment
   86.10  compiler.err.proc.cant.access                           # completion failure
   86.11 @@ -43,6 +42,7 @@
   86.12  compiler.err.unexpected.type
   86.13  compiler.err.unknown.enum.constant                      # in bad class file
   86.14  compiler.err.unsupported.cross.fp.lit                   # Scanner: host system dependent
   86.15 +compiler.err.wrong.target.for.polymorphic.signature.definition     # Transitional 292
   86.16  compiler.misc.assignment.from.super-bound
   86.17  compiler.misc.assignment.to.extends-bound
   86.18  compiler.misc.bad.class.file.header                     # bad class file
   86.19 @@ -52,7 +52,6 @@
   86.20  compiler.misc.bad.enclosing.method                      # bad class file
   86.21  compiler.misc.bad.runtime.invisible.param.annotations   # bad class file
   86.22  compiler.misc.bad.signature                             # bad class file
   86.23 -compiler.misc.bad.type.annotation.value
   86.24  compiler.misc.base.membership                           # UNUSED
   86.25  compiler.misc.ccf.found.later.version
   86.26  compiler.misc.ccf.unrecognized.attribute
   86.27 @@ -113,4 +112,3 @@
   86.28  compiler.warn.unchecked.assign                          # DEAD, replaced by compiler.misc.unchecked.assign
   86.29  compiler.warn.unchecked.cast.to.type                    # DEAD, replaced by compiler.misc.unchecked.cast.to.type
   86.30  compiler.warn.unexpected.archive.file                   # Paths: zip file with unknown extn
   86.31 -compiler.warn.wrong.target.for.polymorphic.signature.definition     # Transitional 292
    87.1 --- a/test/tools/javac/diags/examples/CantResolve.java	Thu Jan 27 17:28:57 2011 -0800
    87.2 +++ b/test/tools/javac/diags/examples/CantResolve.java	Fri Jan 28 10:06:08 2011 -0800
    87.3 @@ -1,5 +1,5 @@
    87.4  /*
    87.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    87.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    87.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    87.8   *
    87.9   * This code is free software; you can redistribute it and/or modify it
   87.10 @@ -23,9 +23,8 @@
   87.11  
   87.12  // key: compiler.err.cant.resolve
   87.13  
   87.14 -class CantResolve<T extends Object & java.io.Serializable> {
   87.15 -    T t;
   87.16 -    void m() {
   87.17 -        Object o = t.v;
   87.18 -    }
   87.19 +class CantResolve {
   87.20 +    Object o = new Object() {
   87.21 +        int i = f;
   87.22 +    };
   87.23  }
    88.1 --- a/test/tools/javac/diags/examples/CantResolveArgsParams.java	Thu Jan 27 17:28:57 2011 -0800
    88.2 +++ b/test/tools/javac/diags/examples/CantResolveArgsParams.java	Fri Jan 28 10:06:08 2011 -0800
    88.3 @@ -1,5 +1,5 @@
    88.4  /*
    88.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    88.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    88.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    88.8   *
    88.9   * This code is free software; you can redistribute it and/or modify it
   88.10 @@ -23,9 +23,8 @@
   88.11  
   88.12  // key: compiler.err.cant.resolve.args.params
   88.13  
   88.14 -class CantResolveArgsParams<T extends Object & java.io.Serializable> {
   88.15 -    T t;
   88.16 -    void m() {
   88.17 -        t.<Integer,Double>m2(1, "");
   88.18 -    }
   88.19 +class CantResolveArgsParams {
   88.20 +    Object o = new Object() {
   88.21 +        { this.<Integer,Double>m2(1, ""); }
   88.22 +    };
   88.23  }
    89.1 --- a/test/tools/javac/diags/examples/CantResolveLocation.java	Thu Jan 27 17:28:57 2011 -0800
    89.2 +++ b/test/tools/javac/diags/examples/CantResolveLocation.java	Fri Jan 28 10:06:08 2011 -0800
    89.3 @@ -1,5 +1,5 @@
    89.4  /*
    89.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    89.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    89.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    89.8   *
    89.9   * This code is free software; you can redistribute it and/or modify it
   89.10 @@ -22,6 +22,7 @@
   89.11   */
   89.12  
   89.13  // key: compiler.err.cant.resolve.location
   89.14 +// key: compiler.misc.location
   89.15  
   89.16  class CantResolveLocation {
   89.17      Unknown y;
    90.1 --- a/test/tools/javac/diags/examples/CantResolveLocationArgs.java	Thu Jan 27 17:28:57 2011 -0800
    90.2 +++ b/test/tools/javac/diags/examples/CantResolveLocationArgs.java	Fri Jan 28 10:06:08 2011 -0800
    90.3 @@ -1,5 +1,5 @@
    90.4  /*
    90.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    90.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    90.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    90.8   *
    90.9   * This code is free software; you can redistribute it and/or modify it
   90.10 @@ -22,6 +22,7 @@
   90.11   */
   90.12  
   90.13  // key: compiler.err.cant.resolve.location.args
   90.14 +// key: compiler.misc.location
   90.15  
   90.16  class X {
   90.17      void m() {
    91.1 --- a/test/tools/javac/diags/examples/CantResolveLocationArgsParams.java	Thu Jan 27 17:28:57 2011 -0800
    91.2 +++ b/test/tools/javac/diags/examples/CantResolveLocationArgsParams.java	Fri Jan 28 10:06:08 2011 -0800
    91.3 @@ -1,5 +1,5 @@
    91.4  /*
    91.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    91.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    91.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    91.8   *
    91.9   * This code is free software; you can redistribute it and/or modify it
   91.10 @@ -22,6 +22,7 @@
   91.11   */
   91.12  
   91.13  // key: compiler.err.cant.resolve.location.args.params
   91.14 +// key: compiler.misc.location
   91.15  
   91.16  import java.util.*;
   91.17  
    92.1 --- a/test/tools/javac/diags/examples/EnumConstRequired.java	Thu Jan 27 17:28:57 2011 -0800
    92.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    92.3 @@ -1,35 +0,0 @@
    92.4 -/*
    92.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    92.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    92.7 - *
    92.8 - * This code is free software; you can redistribute it and/or modify it
    92.9 - * under the terms of the GNU General Public License version 2 only, as
   92.10 - * published by the Free Software Foundation.
   92.11 - *
   92.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   92.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   92.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   92.15 - * version 2 for more details (a copy is included in the LICENSE file that
   92.16 - * accompanied this code).
   92.17 - *
   92.18 - * You should have received a copy of the GNU General Public License version
   92.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   92.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   92.21 - *
   92.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   92.23 - * or visit www.oracle.com if you need additional information or have any
   92.24 - * questions.
   92.25 - */
   92.26 -
   92.27 -// key: compiler.err.enum.const.req
   92.28 -
   92.29 -class EnumConstRequired {
   92.30 -    enum E { A, B, C };
   92.31 -
   92.32 -    void m(E e) {
   92.33 -        switch (e) {
   92.34 -            case e:
   92.35 -                System.err.println("It's me!");
   92.36 -        }
   92.37 -    }
   92.38 -}
    93.1 --- a/test/tools/javac/diags/examples/ForeachNotApplicable.java	Thu Jan 27 17:28:57 2011 -0800
    93.2 +++ b/test/tools/javac/diags/examples/ForeachNotApplicable.java	Fri Jan 28 10:06:08 2011 -0800
    93.3 @@ -1,5 +1,5 @@
    93.4  /*
    93.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    93.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    93.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    93.8   *
    93.9   * This code is free software; you can redistribute it and/or modify it
   93.10 @@ -22,6 +22,7 @@
   93.11   */
   93.12  
   93.13  // key: compiler.err.foreach.not.applicable.to.type
   93.14 +// key: compiler.misc.type.req.array.or.iterable
   93.15  
   93.16  class ForeachNotApplicable {
   93.17      void m(String arg) {
    94.1 --- a/test/tools/javac/diags/examples/KindnameClass.java	Thu Jan 27 17:28:57 2011 -0800
    94.2 +++ b/test/tools/javac/diags/examples/KindnameClass.java	Fri Jan 28 10:06:08 2011 -0800
    94.3 @@ -1,5 +1,5 @@
    94.4  /*
    94.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    94.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    94.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    94.8   *
    94.9   * This code is free software; you can redistribute it and/or modify it
   94.10 @@ -23,6 +23,7 @@
   94.11  
   94.12  // key: compiler.misc.kindname.class
   94.13  // key: compiler.err.cant.resolve.location
   94.14 +// key: compiler.misc.location
   94.15  // key: compiler.misc.count.error
   94.16  // run: backdoor
   94.17  
    95.1 --- a/test/tools/javac/diags/examples/KindnameMethod.java	Thu Jan 27 17:28:57 2011 -0800
    95.2 +++ b/test/tools/javac/diags/examples/KindnameMethod.java	Fri Jan 28 10:06:08 2011 -0800
    95.3 @@ -1,5 +1,5 @@
    95.4  /*
    95.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    95.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    95.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    95.8   *
    95.9   * This code is free software; you can redistribute it and/or modify it
   95.10 @@ -24,6 +24,7 @@
   95.11  // key: compiler.misc.kindname.method
   95.12  // key: compiler.misc.kindname.class
   95.13  // key: compiler.err.cant.resolve.location.args
   95.14 +// key: compiler.misc.location
   95.15  // key: compiler.misc.count.error
   95.16  // run: backdoor
   95.17  
    96.1 --- a/test/tools/javac/diags/examples/KindnameVariable.java	Thu Jan 27 17:28:57 2011 -0800
    96.2 +++ b/test/tools/javac/diags/examples/KindnameVariable.java	Fri Jan 28 10:06:08 2011 -0800
    96.3 @@ -1,5 +1,5 @@
    96.4  /*
    96.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    96.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    96.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    96.8   *
    96.9   * This code is free software; you can redistribute it and/or modify it
   96.10 @@ -24,6 +24,7 @@
   96.11  // key: compiler.misc.kindname.variable
   96.12  // key: compiler.misc.kindname.class
   96.13  // key: compiler.err.cant.resolve.location
   96.14 +// key: compiler.misc.location
   96.15  // key: compiler.misc.count.error
   96.16  // run: backdoor
   96.17  
    97.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    97.2 +++ b/test/tools/javac/diags/examples/Location.java	Fri Jan 28 10:06:08 2011 -0800
    97.3 @@ -0,0 +1,29 @@
    97.4 +/*
    97.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    97.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    97.7 + *
    97.8 + * This code is free software; you can redistribute it and/or modify it
    97.9 + * under the terms of the GNU General Public License version 2 only, as
   97.10 + * published by the Free Software Foundation.
   97.11 + *
   97.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   97.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   97.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   97.15 + * version 2 for more details (a copy is included in the LICENSE file that
   97.16 + * accompanied this code).
   97.17 + *
   97.18 + * You should have received a copy of the GNU General Public License version
   97.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   97.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   97.21 + *
   97.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   97.23 + * or visit www.oracle.com if you need additional information or have any
   97.24 + * questions.
   97.25 + */
   97.26 +
   97.27 +// key: compiler.err.cant.resolve.location
   97.28 +// key: compiler.misc.location
   97.29 +
   97.30 +class Location {
   97.31 +    { Object o = v; }
   97.32 +}
    98.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    98.2 +++ b/test/tools/javac/diags/examples/Location1.java	Fri Jan 28 10:06:08 2011 -0800
    98.3 @@ -0,0 +1,30 @@
    98.4 +/*
    98.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    98.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    98.7 + *
    98.8 + * This code is free software; you can redistribute it and/or modify it
    98.9 + * under the terms of the GNU General Public License version 2 only, as
   98.10 + * published by the Free Software Foundation.
   98.11 + *
   98.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   98.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   98.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   98.15 + * version 2 for more details (a copy is included in the LICENSE file that
   98.16 + * accompanied this code).
   98.17 + *
   98.18 + * You should have received a copy of the GNU General Public License version
   98.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   98.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   98.21 + *
   98.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   98.23 + * or visit www.oracle.com if you need additional information or have any
   98.24 + * questions.
   98.25 + */
   98.26 +
   98.27 +// key: compiler.err.cant.resolve.location
   98.28 +// key: compiler.misc.location.1
   98.29 +
   98.30 +class Location1 {
   98.31 +    Object o = null;
   98.32 +    { Object o2 = o.v; }
   98.33 +}
    99.1 --- a/test/tools/javac/diags/examples/OperatorCantBeApplied.java	Thu Jan 27 17:28:57 2011 -0800
    99.2 +++ b/test/tools/javac/diags/examples/OperatorCantBeApplied.java	Fri Jan 28 10:06:08 2011 -0800
    99.3 @@ -1,5 +1,5 @@
    99.4  /*
    99.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    99.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    99.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    99.8   *
    99.9   * This code is free software; you can redistribute it and/or modify it
   99.10 @@ -24,5 +24,6 @@
   99.11  // key: compiler.err.operator.cant.be.applied
   99.12  
   99.13  class OperatorCantBeApplied {
   99.14 -    String s = ("a" - "b");
   99.15 +    String s = null;
   99.16 +    { s++; }
   99.17  }
   100.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   100.2 +++ b/test/tools/javac/diags/examples/OperatorCantBeApplied1.java	Fri Jan 28 10:06:08 2011 -0800
   100.3 @@ -0,0 +1,28 @@
   100.4 +/*
   100.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   100.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   100.7 + *
   100.8 + * This code is free software; you can redistribute it and/or modify it
   100.9 + * under the terms of the GNU General Public License version 2 only, as
  100.10 + * published by the Free Software Foundation.
  100.11 + *
  100.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  100.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  100.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  100.15 + * version 2 for more details (a copy is included in the LICENSE file that
  100.16 + * accompanied this code).
  100.17 + *
  100.18 + * You should have received a copy of the GNU General Public License version
  100.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  100.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  100.21 + *
  100.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  100.23 + * or visit www.oracle.com if you need additional information or have any
  100.24 + * questions.
  100.25 + */
  100.26 +
  100.27 +// key: compiler.err.operator.cant.be.applied.1
  100.28 +
  100.29 +class OperatorCantBeApplied1 {
  100.30 +    String s = ("a" - "b");
  100.31 +}
   101.1 --- a/test/tools/javac/diags/examples/StaticImportOnlyClassesAndInterfaces/StaticImportOnlyClassesAndInterfaces.java	Thu Jan 27 17:28:57 2011 -0800
   101.2 +++ b/test/tools/javac/diags/examples/StaticImportOnlyClassesAndInterfaces/StaticImportOnlyClassesAndInterfaces.java	Fri Jan 28 10:06:08 2011 -0800
   101.3 @@ -1,5 +1,5 @@
   101.4  /*
   101.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
   101.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
   101.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   101.8   *
   101.9   * This code is free software; you can redistribute it and/or modify it
  101.10 @@ -23,6 +23,7 @@
  101.11  
  101.12  // key: compiler.err.static.imp.only.classes.and.interfaces
  101.13  // key: compiler.err.cant.resolve.location
  101.14 +// key: compiler.misc.location
  101.15  
  101.16  import static p.Other.array.length;
  101.17  
   102.1 --- a/test/tools/javac/diags/examples/TypeParameterOnPolymorphicSignature.java	Thu Jan 27 17:28:57 2011 -0800
   102.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   102.3 @@ -1,33 +0,0 @@
   102.4 -/*
   102.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
   102.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   102.7 - *
   102.8 - * This code is free software; you can redistribute it and/or modify it
   102.9 - * under the terms of the GNU General Public License version 2 only, as
  102.10 - * published by the Free Software Foundation.
  102.11 - *
  102.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
  102.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  102.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  102.15 - * version 2 for more details (a copy is included in the LICENSE file that
  102.16 - * accompanied this code).
  102.17 - *
  102.18 - * You should have received a copy of the GNU General Public License version
  102.19 - * 2 along with this work; if not, write to the Free Software Foundation,
  102.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  102.21 - *
  102.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  102.23 - * or visit www.oracle.com if you need additional information or have any
  102.24 - * questions.
  102.25 - */
  102.26 -
  102.27 -// key: compiler.warn.type.parameter.on.polymorphic.signature
  102.28 -// key: compiler.err.unreported.exception.need.to.catch.or.throw
  102.29 -
  102.30 -import java.dyn.MethodHandle;
  102.31 -
  102.32 -class TypeParameterOnPolymorphicSignature {
  102.33 -    void test(MethodHandle mh) {
  102.34 -        mh.<void>invokeExact("",123);
  102.35 -    }
  102.36 -}
   103.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   103.2 +++ b/test/tools/javac/diags/examples/VarargsAndOldArraySyntax.java	Fri Jan 28 10:06:08 2011 -0800
   103.3 @@ -0,0 +1,28 @@
   103.4 +/*
   103.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   103.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   103.7 + *
   103.8 + * This code is free software; you can redistribute it and/or modify it
   103.9 + * under the terms of the GNU General Public License version 2 only, as
  103.10 + * published by the Free Software Foundation.
  103.11 + *
  103.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  103.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  103.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  103.15 + * version 2 for more details (a copy is included in the LICENSE file that
  103.16 + * accompanied this code).
  103.17 + *
  103.18 + * You should have received a copy of the GNU General Public License version
  103.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  103.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  103.21 + *
  103.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  103.23 + * or visit www.oracle.com if you need additional information or have any
  103.24 + * questions.
  103.25 + */
  103.26 +
  103.27 +// key: compiler.err.varargs.and.old.array.syntax
  103.28 +
  103.29 +class VarargsAndOldArraySyntax {
  103.30 +    void  m1 (Integer... i[]) { }
  103.31 +}
   104.1 --- a/test/tools/javac/failover/FailOver01.out	Thu Jan 27 17:28:57 2011 -0800
   104.2 +++ b/test/tools/javac/failover/FailOver01.out	Fri Jan 28 10:06:08 2011 -0800
   104.3 @@ -1,3 +1,3 @@
   104.4  FailOver01.java:10:22: compiler.err.expected: ';'
   104.5 -FailOver01.java:10:16: compiler.err.cant.resolve.location: kindname.variable, x, , , kindname.class, Test
   104.6 +FailOver01.java:10:16: compiler.err.cant.resolve.location: kindname.variable, x, , , (compiler.misc.location: kindname.class, Test, null)
   104.7  2 errors
   105.1 --- a/test/tools/javac/failover/FailOver02.out	Thu Jan 27 17:28:57 2011 -0800
   105.2 +++ b/test/tools/javac/failover/FailOver02.out	Fri Jan 28 10:06:08 2011 -0800
   105.3 @@ -1,3 +1,3 @@
   105.4  FailOver02.java:10:1: compiler.err.does.not.override.abstract: Test, close(), java.lang.AutoCloseable
   105.5 -FailOver02.java:12:9: compiler.err.cant.resolve.location.args: kindname.method, close, , , kindname.class, Test
   105.6 +FailOver02.java:12:9: compiler.err.cant.resolve.location.args: kindname.method, close, , , (compiler.misc.location: kindname.class, Test, null)
   105.7  2 errors
   106.1 --- a/test/tools/javac/failover/FailOver04.out	Thu Jan 27 17:28:57 2011 -0800
   106.2 +++ b/test/tools/javac/failover/FailOver04.out	Fri Jan 28 10:06:08 2011 -0800
   106.3 @@ -1,2 +1,2 @@
   106.4 -FailOver04.java:11:10: compiler.err.cant.resolve.location: kindname.class, Unknown, , , kindname.class, Test
   106.5 +FailOver04.java:11:10: compiler.err.cant.resolve.location: kindname.class, Unknown, , , (compiler.misc.location: kindname.class, Test, null)
   106.6  1 error
   107.1 --- a/test/tools/javac/generics/6711619/T6711619a.out	Thu Jan 27 17:28:57 2011 -0800
   107.2 +++ b/test/tools/javac/generics/6711619/T6711619a.out	Fri Jan 28 10:06:08 2011 -0800
   107.3 @@ -1,5 +1,5 @@
   107.4 -T6711619a.java:40:14: compiler.err.cant.resolve.args: kindname.method, a, , 
   107.5 -T6711619a.java:41:14: compiler.err.cant.resolve.args: kindname.method, b, , 
   107.6 +T6711619a.java:40:14: compiler.err.cant.resolve.location.args: kindname.method, a, , , (compiler.misc.location.1: kindname.variable, t, T)
   107.7 +T6711619a.java:41:14: compiler.err.cant.resolve.location.args: kindname.method, b, , , (compiler.misc.location.1: kindname.variable, t, T)
   107.8  T6711619a.java:46:19: compiler.err.report.access: a, private, T6711619a.A
   107.9  T6711619a.java:47:19: compiler.err.report.access: b, private, T6711619a.B
  107.10  T6711619a.java:48:19: compiler.err.report.access: a, private, T6711619a.A
   108.1 --- a/test/tools/javac/generics/diamond/neg/Neg01.out	Thu Jan 27 17:28:57 2011 -0800
   108.2 +++ b/test/tools/javac/generics/diamond/neg/Neg01.out	Fri Jan 28 10:06:08 2011 -0800
   108.3 @@ -1,29 +1,29 @@
   108.4 -Neg01.java:18:15: compiler.err.not.within.bounds: java.lang.String
   108.5 +Neg01.java:18:15: compiler.err.not.within.bounds: java.lang.String, X
   108.6  Neg01.java:18:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   108.7 -Neg01.java:19:15: compiler.err.not.within.bounds: ? extends java.lang.String
   108.8 +Neg01.java:19:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
   108.9  Neg01.java:19:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
  108.10  Neg01.java:20:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
  108.11 -Neg01.java:21:15: compiler.err.not.within.bounds: ? super java.lang.String
  108.12 +Neg01.java:21:15: compiler.err.not.within.bounds: ? super java.lang.String, X
  108.13  Neg01.java:21:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
  108.14 -Neg01.java:23:15: compiler.err.not.within.bounds: java.lang.String
  108.15 +Neg01.java:23:15: compiler.err.not.within.bounds: java.lang.String, X
  108.16  Neg01.java:23:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
  108.17 -Neg01.java:24:15: compiler.err.not.within.bounds: ? extends java.lang.String
  108.18 +Neg01.java:24:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
  108.19  Neg01.java:24:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
  108.20  Neg01.java:25:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
  108.21 -Neg01.java:26:15: compiler.err.not.within.bounds: ? super java.lang.String
  108.22 +Neg01.java:26:15: compiler.err.not.within.bounds: ? super java.lang.String, X
  108.23  Neg01.java:26:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
  108.24 -Neg01.java:28:15: compiler.err.not.within.bounds: java.lang.String
  108.25 +Neg01.java:28:15: compiler.err.not.within.bounds: java.lang.String, X
  108.26  Neg01.java:28:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
  108.27 -Neg01.java:29:15: compiler.err.not.within.bounds: ? extends java.lang.String
  108.28 +Neg01.java:29:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
  108.29  Neg01.java:29:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
  108.30  Neg01.java:30:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
  108.31 -Neg01.java:31:9: compiler.err.cant.resolve.location: kindname.class, Foo, , , kindname.class, Neg01<X>
  108.32 +Neg01.java:31:9: compiler.err.cant.resolve.location: kindname.class, Foo, , , (compiler.misc.location: kindname.class, Neg01, null)
  108.33  Neg01.java:31:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
  108.34 -Neg01.java:33:15: compiler.err.not.within.bounds: java.lang.String
  108.35 +Neg01.java:33:15: compiler.err.not.within.bounds: java.lang.String, X
  108.36  Neg01.java:33:29: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
  108.37 -Neg01.java:34:15: compiler.err.not.within.bounds: ? extends java.lang.String
  108.38 +Neg01.java:34:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
  108.39  Neg01.java:34:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
  108.40  Neg01.java:35:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
  108.41 -Neg01.java:36:15: compiler.err.not.within.bounds: ? super java.lang.String
  108.42 +Neg01.java:36:15: compiler.err.not.within.bounds: ? super java.lang.String, X
  108.43  Neg01.java:36:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
  108.44  28 errors
   109.1 --- a/test/tools/javac/generics/diamond/neg/Neg02.out	Thu Jan 27 17:28:57 2011 -0800
   109.2 +++ b/test/tools/javac/generics/diamond/neg/Neg02.out	Fri Jan 28 10:06:08 2011 -0800
   109.3 @@ -1,57 +1,57 @@
   109.4 -Neg02.java:19:13: compiler.err.not.within.bounds: java.lang.String
   109.5 +Neg02.java:19:13: compiler.err.not.within.bounds: java.lang.String, X
   109.6  Neg02.java:19:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   109.7 -Neg02.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String
   109.8 +Neg02.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
   109.9  Neg02.java:20:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.10  Neg02.java:21:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.11 -Neg02.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String
  109.12 +Neg02.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String, X
  109.13  Neg02.java:22:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.14 -Neg02.java:24:13: compiler.err.not.within.bounds: java.lang.String
  109.15 +Neg02.java:24:13: compiler.err.not.within.bounds: java.lang.String, X
  109.16  Neg02.java:24:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.17 -Neg02.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String
  109.18 +Neg02.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
  109.19  Neg02.java:25:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.20  Neg02.java:26:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.21 -Neg02.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String
  109.22 +Neg02.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String, X
  109.23  Neg02.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.24 -Neg02.java:29:13: compiler.err.not.within.bounds: java.lang.String
  109.25 +Neg02.java:29:13: compiler.err.not.within.bounds: java.lang.String, X
  109.26  Neg02.java:29:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.27 -Neg02.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String
  109.28 +Neg02.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
  109.29  Neg02.java:30:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.30  Neg02.java:31:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.31 -Neg02.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String
  109.32 +Neg02.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String, X
  109.33  Neg02.java:32:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.34 -Neg02.java:34:13: compiler.err.not.within.bounds: java.lang.String
  109.35 +Neg02.java:34:13: compiler.err.not.within.bounds: java.lang.String, X
  109.36  Neg02.java:34:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.37 -Neg02.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String
  109.38 +Neg02.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
  109.39  Neg02.java:35:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.40  Neg02.java:36:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.41 -Neg02.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String
  109.42 +Neg02.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String, X
  109.43  Neg02.java:37:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.44 -Neg02.java:41:13: compiler.err.not.within.bounds: java.lang.String
  109.45 +Neg02.java:41:13: compiler.err.not.within.bounds: java.lang.String, X
  109.46  Neg02.java:41:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.47 -Neg02.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String
  109.48 +Neg02.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
  109.49  Neg02.java:42:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.50  Neg02.java:43:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.51 -Neg02.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String
  109.52 +Neg02.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String, X
  109.53  Neg02.java:44:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.54 -Neg02.java:46:13: compiler.err.not.within.bounds: java.lang.String
  109.55 +Neg02.java:46:13: compiler.err.not.within.bounds: java.lang.String, X
  109.56  Neg02.java:46:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.57 -Neg02.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String
  109.58 +Neg02.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
  109.59  Neg02.java:47:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.60  Neg02.java:48:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.61 -Neg02.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String
  109.62 +Neg02.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String, X
  109.63  Neg02.java:49:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.64 -Neg02.java:51:13: compiler.err.not.within.bounds: java.lang.String
  109.65 +Neg02.java:51:13: compiler.err.not.within.bounds: java.lang.String, X
  109.66  Neg02.java:51:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.67 -Neg02.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String
  109.68 +Neg02.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
  109.69  Neg02.java:52:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.70  Neg02.java:53:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.71 -Neg02.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String
  109.72 +Neg02.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String, X
  109.73  Neg02.java:54:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.74 -Neg02.java:56:13: compiler.err.not.within.bounds: java.lang.String
  109.75 +Neg02.java:56:13: compiler.err.not.within.bounds: java.lang.String, X
  109.76  Neg02.java:56:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.77 -Neg02.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String
  109.78 +Neg02.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
  109.79  Neg02.java:57:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.80  Neg02.java:58:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.81 -Neg02.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String
  109.82 +Neg02.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String, X
  109.83  Neg02.java:59:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
  109.84  56 errors
   110.1 --- a/test/tools/javac/generics/diamond/neg/Neg03.out	Thu Jan 27 17:28:57 2011 -0800
   110.2 +++ b/test/tools/javac/generics/diamond/neg/Neg03.out	Fri Jan 28 10:06:08 2011 -0800
   110.3 @@ -1,85 +1,85 @@
   110.4 -Neg03.java:19:13: compiler.err.not.within.bounds: java.lang.String
   110.5 +Neg03.java:19:13: compiler.err.not.within.bounds: java.lang.String, V
   110.6  Neg03.java:19:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   110.7 -Neg03.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String
   110.8 +Neg03.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   110.9  Neg03.java:20:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.10  Neg03.java:21:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.11 -Neg03.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String
  110.12 +Neg03.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  110.13  Neg03.java:22:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.14 -Neg03.java:24:13: compiler.err.not.within.bounds: java.lang.String
  110.15 +Neg03.java:24:13: compiler.err.not.within.bounds: java.lang.String, V
  110.16  Neg03.java:24:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.17 -Neg03.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String
  110.18 +Neg03.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
  110.19  Neg03.java:25:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.20  Neg03.java:26:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.21 -Neg03.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String
  110.22 +Neg03.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  110.23  Neg03.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.24 -Neg03.java:29:13: compiler.err.not.within.bounds: java.lang.String
  110.25 +Neg03.java:29:13: compiler.err.not.within.bounds: java.lang.String, V
  110.26  Neg03.java:29:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.27 -Neg03.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String
  110.28 +Neg03.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
  110.29  Neg03.java:30:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.30  Neg03.java:31:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.31 -Neg03.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String
  110.32 +Neg03.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  110.33  Neg03.java:32:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.34 -Neg03.java:34:13: compiler.err.not.within.bounds: java.lang.String
  110.35 +Neg03.java:34:13: compiler.err.not.within.bounds: java.lang.String, V
  110.36  Neg03.java:34:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.37 -Neg03.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String
  110.38 +Neg03.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
  110.39  Neg03.java:35:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.40  Neg03.java:36:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.41 -Neg03.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String
  110.42 +Neg03.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  110.43  Neg03.java:37:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.44 -Neg03.java:41:13: compiler.err.not.within.bounds: java.lang.String
  110.45 +Neg03.java:41:13: compiler.err.not.within.bounds: java.lang.String, V
  110.46  Neg03.java:41:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.47 -Neg03.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String
  110.48 +Neg03.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
  110.49  Neg03.java:42:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.50  Neg03.java:43:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.51 -Neg03.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String
  110.52 +Neg03.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  110.53  Neg03.java:44:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.54 -Neg03.java:46:13: compiler.err.not.within.bounds: java.lang.String
  110.55 +Neg03.java:46:13: compiler.err.not.within.bounds: java.lang.String, V
  110.56  Neg03.java:46:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.57 -Neg03.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String
  110.58 +Neg03.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
  110.59  Neg03.java:47:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.60  Neg03.java:48:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.61 -Neg03.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String
  110.62 +Neg03.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  110.63  Neg03.java:49:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.64 -Neg03.java:51:13: compiler.err.not.within.bounds: java.lang.String
  110.65 +Neg03.java:51:13: compiler.err.not.within.bounds: java.lang.String, V
  110.66  Neg03.java:51:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.67 -Neg03.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String
  110.68 +Neg03.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
  110.69  Neg03.java:52:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.70  Neg03.java:53:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.71 -Neg03.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String
  110.72 +Neg03.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  110.73  Neg03.java:54:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.74 -Neg03.java:56:13: compiler.err.not.within.bounds: java.lang.String
  110.75 +Neg03.java:56:13: compiler.err.not.within.bounds: java.lang.String, V
  110.76  Neg03.java:56:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.77 -Neg03.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String
  110.78 +Neg03.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
  110.79  Neg03.java:57:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.80  Neg03.java:58:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.81 -Neg03.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String
  110.82 +Neg03.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  110.83  Neg03.java:59:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.84 -Neg03.java:63:13: compiler.err.not.within.bounds: java.lang.String
  110.85 +Neg03.java:63:13: compiler.err.not.within.bounds: java.lang.String, V
  110.86  Neg03.java:63:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.87 -Neg03.java:64:13: compiler.err.not.within.bounds: ? extends java.lang.String
  110.88 +Neg03.java:64:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
  110.89  Neg03.java:64:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.90  Neg03.java:65:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.91 -Neg03.java:66:13: compiler.err.not.within.bounds: ? super java.lang.String
  110.92 +Neg03.java:66:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  110.93  Neg03.java:66:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.94 -Neg03.java:68:13: compiler.err.not.within.bounds: java.lang.String
  110.95 +Neg03.java:68:13: compiler.err.not.within.bounds: java.lang.String, V
  110.96  Neg03.java:68:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  110.97 -Neg03.java:69:13: compiler.err.not.within.bounds: ? extends java.lang.String
  110.98 +Neg03.java:69:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
  110.99  Neg03.java:69:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 110.100  Neg03.java:70:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 110.101 -Neg03.java:71:13: compiler.err.not.within.bounds: ? super java.lang.String
 110.102 +Neg03.java:71:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 110.103  Neg03.java:71:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 110.104 -Neg03.java:73:13: compiler.err.not.within.bounds: java.lang.String
 110.105 +Neg03.java:73:13: compiler.err.not.within.bounds: java.lang.String, V
 110.106  Neg03.java:73:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 110.107 -Neg03.java:74:13: compiler.err.not.within.bounds: ? extends java.lang.String
 110.108 +Neg03.java:74:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 110.109  Neg03.java:74:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 110.110  Neg03.java:75:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 110.111 -Neg03.java:76:13: compiler.err.not.within.bounds: ? super java.lang.String
 110.112 +Neg03.java:76:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 110.113  Neg03.java:76:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 110.114 -Neg03.java:78:13: compiler.err.not.within.bounds: java.lang.String
 110.115 +Neg03.java:78:13: compiler.err.not.within.bounds: java.lang.String, V
 110.116  Neg03.java:78:29: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 110.117 -Neg03.java:79:13: compiler.err.not.within.bounds: ? extends java.lang.String
 110.118 +Neg03.java:79:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
 110.119  Neg03.java:79:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 110.120  Neg03.java:80:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 110.121 -Neg03.java:81:13: compiler.err.not.within.bounds: ? super java.lang.String
 110.122 +Neg03.java:81:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 110.123  Neg03.java:81:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 110.124  84 errors
   111.1 --- a/test/tools/javac/generics/diamond/neg/Neg04.out	Thu Jan 27 17:28:57 2011 -0800
   111.2 +++ b/test/tools/javac/generics/diamond/neg/Neg04.out	Fri Jan 28 10:06:08 2011 -0800
   111.3 @@ -1,29 +1,29 @@
   111.4 -Neg04.java:18:13: compiler.err.not.within.bounds: java.lang.String
   111.5 +Neg04.java:18:13: compiler.err.not.within.bounds: java.lang.String, V
   111.6  Neg04.java:18:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   111.7 -Neg04.java:19:13: compiler.err.not.within.bounds: ? extends java.lang.String
   111.8 +Neg04.java:19:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   111.9  Neg04.java:19:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
  111.10  Neg04.java:20:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
  111.11 -Neg04.java:21:13: compiler.err.not.within.bounds: ? super java.lang.String
  111.12 +Neg04.java:21:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  111.13  Neg04.java:21:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
  111.14 -Neg04.java:23:13: compiler.err.not.within.bounds: java.lang.String
  111.15 +Neg04.java:23:13: compiler.err.not.within.bounds: java.lang.String, V
  111.16  Neg04.java:23:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
  111.17 -Neg04.java:24:13: compiler.err.not.within.bounds: ? extends java.lang.String
  111.18 +Neg04.java:24:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
  111.19  Neg04.java:24:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
  111.20  Neg04.java:25:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
  111.21 -Neg04.java:26:13: compiler.err.not.within.bounds: ? super java.lang.String
  111.22 +Neg04.java:26:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  111.23  Neg04.java:26:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
  111.24 -Neg04.java:28:13: compiler.err.not.within.bounds: java.lang.String
  111.25 +Neg04.java:28:13: compiler.err.not.within.bounds: java.lang.String, V
  111.26  Neg04.java:28:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
  111.27 -Neg04.java:29:13: compiler.err.not.within.bounds: ? extends java.lang.String
  111.28 +Neg04.java:29:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
  111.29  Neg04.java:29:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
  111.30  Neg04.java:30:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
  111.31 -Neg04.java:31:13: compiler.err.not.within.bounds: ? super java.lang.String
  111.32 +Neg04.java:31:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  111.33  Neg04.java:31:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
  111.34 -Neg04.java:33:13: compiler.err.not.within.bounds: java.lang.String
  111.35 +Neg04.java:33:13: compiler.err.not.within.bounds: java.lang.String, V
  111.36  Neg04.java:33:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
  111.37 -Neg04.java:34:13: compiler.err.not.within.bounds: ? extends java.lang.String
  111.38 +Neg04.java:34:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
  111.39  Neg04.java:34:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
  111.40  Neg04.java:35:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
  111.41 -Neg04.java:36:13: compiler.err.not.within.bounds: ? super java.lang.String
  111.42 +Neg04.java:36:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  111.43  Neg04.java:36:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
  111.44  28 errors
   112.1 --- a/test/tools/javac/generics/diamond/neg/Neg11.out	Thu Jan 27 17:28:57 2011 -0800
   112.2 +++ b/test/tools/javac/generics/diamond/neg/Neg11.out	Fri Jan 28 10:06:08 2011 -0800
   112.3 @@ -1,3 +1,3 @@
   112.4 -Neg11.java:15:25: compiler.err.cant.resolve.location: kindname.class, UndeclaredName, , , kindname.class, Neg11
   112.5 -Neg11.java:16:25: compiler.err.cant.resolve.location: kindname.class, UndeclaredName, , , kindname.class, Neg11
   112.6 +Neg11.java:15:25: compiler.err.cant.resolve.location: kindname.class, UndeclaredName, , , (compiler.misc.location: kindname.class, Neg11, null)
   112.7 +Neg11.java:16:25: compiler.err.cant.resolve.location: kindname.class, UndeclaredName, , , (compiler.misc.location: kindname.class, Neg11, null)
   112.8  2 errors
   113.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   113.2 +++ b/test/tools/javac/generics/inference/6943278/T6943278.java	Fri Jan 28 10:06:08 2011 -0800
   113.3 @@ -0,0 +1,12 @@
   113.4 +/**
   113.5 + * @test /nodynamiccopyright/
   113.6 + * @bug 6943278
   113.7 + * @summary spurious error message for inference and type-variable with erroneous bound
   113.8 + * @compile/fail/ref=T6943278.out -XDrawDiagnostics -Xlint:unchecked T6943278.java
   113.9 + */
  113.10 +class T6943278<X extends Number & NonExistentInterface> {
  113.11 +    <X> T6943278<X> m() { return null;}
  113.12 +    <X extends Number & NonExistentInterface> T6943278<X> m(X x) { return null;}
  113.13 +    T6943278<?> f1 = m();
  113.14 +    T6943278<?> f2 = m("");
  113.15 +}
   114.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   114.2 +++ b/test/tools/javac/generics/inference/6943278/T6943278.out	Fri Jan 28 10:06:08 2011 -0800
   114.3 @@ -0,0 +1,3 @@
   114.4 +T6943278.java:7:35: compiler.err.cant.resolve: kindname.class, NonExistentInterface, , 
   114.5 +T6943278.java:9:25: compiler.err.cant.resolve.location: kindname.class, NonExistentInterface, , , (compiler.misc.location: kindname.class, T6943278, null)
   114.6 +2 errors
   115.1 --- a/test/tools/javac/generics/typevars/5060485/Compatibility.out	Thu Jan 27 17:28:57 2011 -0800
   115.2 +++ b/test/tools/javac/generics/typevars/5060485/Compatibility.out	Fri Jan 28 10:06:08 2011 -0800
   115.3 @@ -1,2 +1,2 @@
   115.4 -Compatibility.java:36:35: compiler.err.not.within.bounds: Test.Y
   115.5 +Compatibility.java:36:35: compiler.err.not.within.bounds: Test.Y, T
   115.6  1 error
   116.1 --- a/test/tools/javac/generics/typevars/5060485/Compatibility02.out	Thu Jan 27 17:28:57 2011 -0800
   116.2 +++ b/test/tools/javac/generics/typevars/5060485/Compatibility02.out	Fri Jan 28 10:06:08 2011 -0800
   116.3 @@ -1,2 +1,2 @@
   116.4 -Compatibility.java:36:35: compiler.err.not.within.bounds: Test.Y
   116.5 +Compatibility.java:36:35: compiler.err.not.within.bounds: Test.Y, T
   116.6  1 error
   117.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   117.2 +++ b/test/tools/javac/generics/typevars/6968793/T6968793.java	Fri Jan 28 10:06:08 2011 -0800
   117.3 @@ -0,0 +1,11 @@
   117.4 +/*
   117.5 + * @test /nodynamiccopyright/
   117.6 + * @bug     6968793
   117.7 + * @summary javac generates spourious diagnostics for ill-formed type-variable bounds
   117.8 + * @author  mcimadamore
   117.9 + * @compile/fail/ref=T6968793.out -XDrawDiagnostics T6968793.java
  117.10 + */
  117.11 +
  117.12 +class T6968793<X extends Number, Y extends X, Z extends Object & Comparable<Y>> {
  117.13 +    T6968793<Object, Object, Object> o;
  117.14 +}
   118.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   118.2 +++ b/test/tools/javac/generics/typevars/6968793/T6968793.out	Fri Jan 28 10:06:08 2011 -0800
   118.3 @@ -0,0 +1,4 @@
   118.4 +T6968793.java:10:14: compiler.err.not.within.bounds: java.lang.Object, X
   118.5 +T6968793.java:10:22: compiler.err.not.within.bounds: java.lang.Object, Y
   118.6 +T6968793.java:10:30: compiler.err.not.within.bounds: java.lang.Object, Z
   118.7 +3 errors
   119.1 --- a/test/tools/javac/meth/InvokeDynTrans.out	Thu Jan 27 17:28:57 2011 -0800
   119.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   119.3 @@ -1,5 +0,0 @@
   119.4 -InvokeDynTrans.java:55:39: compiler.warn.type.parameter.on.polymorphic.signature
   119.5 -InvokeDynTrans.java:57:34: compiler.warn.type.parameter.on.polymorphic.signature
   119.6 -- compiler.err.warnings.and.werror
   119.7 -1 error
   119.8 -2 warnings
   120.1 --- a/test/tools/javac/meth/InvokeMHTrans.java	Thu Jan 27 17:28:57 2011 -0800
   120.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   120.3 @@ -1,102 +0,0 @@
   120.4 -/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
   120.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   120.6 - *
   120.7 - * This code is free software; you can redistribute it and/or modify it
   120.8 - * under the terms of the GNU General Public License version 2 only, as
   120.9 - * published by the Free Software Foundation.
  120.10 - *
  120.11 - * This code is distributed in the hope that it will be useful, but WITHOUT
  120.12 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  120.13 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  120.14 - * version 2 for more details (a copy is included in the LICENSE file that
  120.15 - * accompanied this code).
  120.16 - *
  120.17 - * You should have received a copy of the GNU General Public License version
  120.18 - * 2 along with this work; if not, write to the Free Software Foundation,
  120.19 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  120.20 - *
  120.21 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  120.22 - * or visit www.oracle.com if you need additional information or have any
  120.23 - * questions.
  120.24 - */
  120.25 -
  120.26 -/*
  120.27 - * @test
  120.28 - * @bug 6754038 6979327
  120.29 - * @summary Generate call sites for method handle
  120.30 - * @author jrose
  120.31 - *
  120.32 - * @compile/fail/ref=InvokeMHTrans.out -Werror -XDrawDiagnostics -source 7 -target 7 InvokeMHTrans.java
  120.33 - */
  120.34 -
  120.35 -/*
  120.36 - * Standalone testing:
  120.37 - * <code>
  120.38 - * $ cd $MY_REPO_DIR/langtools
  120.39 - * $ (cd make; make)
  120.40 - * $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/meth/InvokeMH.java
  120.41 - * $ javap -c -classpath dist meth.InvokeMH
  120.42 - * </code>
  120.43 - */
  120.44 -
  120.45 -package meth;
  120.46 -
  120.47 -import java.dyn.MethodHandle;
  120.48 -
  120.49 -public class InvokeMHTrans {
  120.50 -    void test(MethodHandle mh_SiO,
  120.51 -              MethodHandle mh_vS,
  120.52 -              MethodHandle mh_vi,
  120.53 -              MethodHandle mh_vv) throws Throwable {
  120.54 -        Object o; String s; int i;  // for return type testing
  120.55 -
  120.56 -        // next five must have sig = (String,int)Object
  120.57 -        mh_SiO.invokeExact("world", 123);
  120.58 -        mh_SiO.invokeExact("mundus", 456);
  120.59 -        Object k = "kosmos";
  120.60 -        mh_SiO.invokeExact((String)k, 789);
  120.61 -        o = mh_SiO.invokeExact((String)null, 000);
  120.62 -        o = mh_SiO.<Object>invokeExact("arda", -123);
  120.63 -
  120.64 -        // sig = ()String
  120.65 -        s = mh_vS.<String>invokeExact();
  120.66 -
  120.67 -        // sig = ()int
  120.68 -        i = mh_vi.<int>invokeExact();
  120.69 -        o = mh_vi.<int>invokeExact();
  120.70 -        //s = mh_vi.<int>invokeExact(); //BAD
  120.71 -        mh_vi.<int>invokeExact();
  120.72 -
  120.73 -        // sig = ()void
  120.74 -        //o = mh_vv.<void>invokeExact(); //BAD
  120.75 -        mh_vv.<void>invokeExact();
  120.76 -    }
  120.77 -
  120.78 -    void testGen(MethodHandle mh_SiO,
  120.79 -                 MethodHandle mh_vS,
  120.80 -                 MethodHandle mh_vi,
  120.81 -                 MethodHandle mh_vv) throws Throwable {
  120.82 -        Object o; String s; int i;  // for return type testing
  120.83 -
  120.84 -        // next five must have sig = (*,*)*
  120.85 -        mh_SiO.invokeGeneric((Object)"world", (Object)123);
  120.86 -        mh_SiO.<void>invokeGeneric((Object)"mundus", (Object)456);
  120.87 -        Object k = "kosmos";
  120.88 -        mh_SiO.invokeGeneric(k, 789);
  120.89 -        o = mh_SiO.invokeGeneric(null, 000);
  120.90 -        o = mh_SiO.<Object>invokeGeneric("arda", -123);
  120.91 -
  120.92 -        // sig = ()String
  120.93 -        o = mh_vS.invokeGeneric();
  120.94 -
  120.95 -        // sig = ()int
  120.96 -        i = mh_vi.<int>invokeGeneric();
  120.97 -        o = mh_vi.invokeGeneric();
  120.98 -        //s = mh_vi.<int>invokeGeneric(); //BAD
  120.99 -        mh_vi.<void>invokeGeneric();
 120.100 -
 120.101 -        // sig = ()void
 120.102 -        //o = mh_vv.<void>invokeGeneric(); //BAD
 120.103 -        o = mh_vv.invokeGeneric();
 120.104 -    }
 120.105 -}
   121.1 --- a/test/tools/javac/meth/InvokeMHTrans.out	Thu Jan 27 17:28:57 2011 -0800
   121.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   121.3 @@ -1,13 +0,0 @@
   121.4 -InvokeMHTrans.java:59:39: compiler.warn.type.parameter.on.polymorphic.signature
   121.5 -InvokeMHTrans.java:62:38: compiler.warn.type.parameter.on.polymorphic.signature
   121.6 -InvokeMHTrans.java:65:35: compiler.warn.type.parameter.on.polymorphic.signature
   121.7 -InvokeMHTrans.java:66:35: compiler.warn.type.parameter.on.polymorphic.signature
   121.8 -InvokeMHTrans.java:68:31: compiler.warn.type.parameter.on.polymorphic.signature
   121.9 -InvokeMHTrans.java:72:32: compiler.warn.type.parameter.on.polymorphic.signature
  121.10 -InvokeMHTrans.java:83:35: compiler.warn.type.parameter.on.polymorphic.signature
  121.11 -InvokeMHTrans.java:87:41: compiler.warn.type.parameter.on.polymorphic.signature
  121.12 -InvokeMHTrans.java:93:37: compiler.warn.type.parameter.on.polymorphic.signature
  121.13 -InvokeMHTrans.java:96:34: compiler.warn.type.parameter.on.polymorphic.signature
  121.14 -- compiler.err.warnings.and.werror
  121.15 -1 error
  121.16 -10 warnings
   122.1 --- a/test/tools/javac/meth/TestCP.java	Thu Jan 27 17:28:57 2011 -0800
   122.2 +++ b/test/tools/javac/meth/TestCP.java	Fri Jan 28 10:06:08 2011 -0800
   122.3 @@ -42,13 +42,15 @@
   122.4  
   122.5      static class TestClass {
   122.6          void test(MethodHandle mh) throws Throwable {
   122.7 -            Number n = mh.<Number>invokeExact("daddy",1,'n');
   122.8 +            Number n = (Number)mh.invokeExact("daddy",1,'n');
   122.9              n = (Number)mh.invokeExact("bunny",1,'d');
  122.10 +            n = (Number)(mh.invokeExact("foo",1,'d'));
  122.11 +            n = (Number)((mh.invokeExact("bar",1,'d')));
  122.12          }
  122.13      }
  122.14  
  122.15      static final String PS_TYPE = "(Ljava/lang/String;IC)Ljava/lang/Number;";
  122.16 -    static final int PS_CALLS_COUNT = 2;
  122.17 +    static final int PS_CALLS_COUNT = 4;
  122.18      static final String SUBTEST_NAME = TestClass.class.getName() + ".class";
  122.19      static final String TEST_METHOD_NAME = "test";
  122.20  
   123.1 --- a/test/tools/javac/meth/XlintWarn.java	Thu Jan 27 17:28:57 2011 -0800
   123.2 +++ b/test/tools/javac/meth/XlintWarn.java	Fri Jan 28 10:06:08 2011 -0800
   123.3 @@ -35,6 +35,19 @@
   123.4  class XlintWarn {
   123.5      void test(MethodHandle mh) throws Throwable {
   123.6          int i1 = (int)mh.invokeExact();
   123.7 -        int i2 = (int)mh.invokeVarargs();
   123.8 +        int i2 = (int)mh.invokeGeneric();
   123.9 +        int i3 = (int)mh.invokeWithArguments();
  123.10 +    }
  123.11 +
  123.12 +    void test2(MethodHandle mh) throws Throwable {
  123.13 +        int i1 = (int)(mh.invokeExact());
  123.14 +        int i2 = (int)(mh.invokeGeneric());
  123.15 +        int i3 = (int)(mh.invokeWithArguments());
  123.16 +    }
  123.17 +
  123.18 +    void test3(MethodHandle mh) throws Throwable {
  123.19 +        int i1 = (int)((mh.invokeExact()));
  123.20 +        int i2 = (int)((mh.invokeGeneric()));
  123.21 +        int i3 = (int)((mh.invokeWithArguments()));
  123.22      }
  123.23  }
   124.1 --- a/test/tools/javac/policy/test1/byfile.ABD.out	Thu Jan 27 17:28:57 2011 -0800
   124.2 +++ b/test/tools/javac/policy/test1/byfile.ABD.out	Fri Jan 28 10:06:08 2011 -0800
   124.3 @@ -12,6 +12,6 @@
   124.4  [generate code A2]
   124.5  [attribute B]
   124.6  [attribute B1]
   124.7 -B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , kindname.class, B1
   124.8 +B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , (compiler.misc.location: kindname.class, B1, null)
   124.9  [attribute B2]
  124.10  1 error
   125.1 --- a/test/tools/javac/policy/test1/bytodo.ABD.out	Thu Jan 27 17:28:57 2011 -0800
   125.2 +++ b/test/tools/javac/policy/test1/bytodo.ABD.out	Fri Jan 28 10:06:08 2011 -0800
   125.3 @@ -15,7 +15,7 @@
   125.4  [desugar B]
   125.5  [generate code B]
   125.6  [attribute B1]
   125.7 -B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , kindname.class, B1
   125.8 +B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , (compiler.misc.location: kindname.class, B1, null)
   125.9  [attribute B2]
  125.10  [attribute D]
  125.11  [attribute D1]
   126.1 --- a/test/tools/javac/policy/test1/simple.ABD.out	Thu Jan 27 17:28:57 2011 -0800
   126.2 +++ b/test/tools/javac/policy/test1/simple.ABD.out	Fri Jan 28 10:06:08 2011 -0800
   126.3 @@ -3,7 +3,7 @@
   126.4  [attribute A2]
   126.5  [attribute B]
   126.6  [attribute B1]
   126.7 -B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , kindname.class, B1
   126.8 +B.java:12:9: compiler.err.cant.resolve.location: kindname.variable, x, , , (compiler.misc.location: kindname.class, B1, null)
   126.9  [attribute B2]
  126.10  [attribute D]
  126.11  [attribute D1]
   127.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   127.2 +++ b/test/tools/javac/tree/T6993305.java	Fri Jan 28 10:06:08 2011 -0800
   127.3 @@ -0,0 +1,124 @@
   127.4 +/*
   127.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   127.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   127.7 + *
   127.8 + * This code is free software; you can redistribute it and/or modify it
   127.9 + * under the terms of the GNU General Public License version 2 only, as
  127.10 + * published by the Free Software Foundation.
  127.11 + *
  127.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  127.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  127.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  127.15 + * version 2 for more details (a copy is included in the LICENSE file that
  127.16 + * accompanied this code).
  127.17 + *
  127.18 + * You should have received a copy of the GNU General Public License version
  127.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  127.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  127.21 + *
  127.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  127.23 + * or visit www.oracle.com if you need additional information or have any
  127.24 + * questions.
  127.25 + */
  127.26 +
  127.27 +/*
  127.28 + * @test
  127.29 + * @bug 6993305
  127.30 + * @summary starting position of a method without modifiers and with type parameters is incorrect
  127.31 + */
  127.32 +
  127.33 +import java.io.File;
  127.34 +import javax.tools.JavaFileObject;
  127.35 +import javax.tools.StandardJavaFileManager;
  127.36 +
  127.37 +import com.sun.source.tree.CompilationUnitTree;
  127.38 +import com.sun.source.tree.MethodTree;
  127.39 +import com.sun.source.util.JavacTask;
  127.40 +import com.sun.source.util.SourcePositions;
  127.41 +import com.sun.source.util.TreeScanner;
  127.42 +import com.sun.source.util.Trees;
  127.43 +import com.sun.tools.javac.api.JavacTool;
  127.44 +import java.io.IOException;
  127.45 +
  127.46 +/*
  127.47 + * Test verifies the starting position of all methods by computing the start position
  127.48 + * of each method as the first non-white character on the first line containing
  127.49 + * (" " + methodName + "("), and then comparing this value against the reported
  127.50 + * value in the SourcePositions table.
  127.51 + */
  127.52 +public class T6993305 {
  127.53 +    <T> void test1(T t) { }  // this is the primary case to be tested
  127.54 +    public <T> void test2(T t) { }
  127.55 +    @Deprecated <T> void test3(T t) { }
  127.56 +
  127.57 +    public static void main(String... args) throws Exception {
  127.58 +        new T6993305().run();
  127.59 +    }
  127.60 +
  127.61 +    void run() throws Exception {
  127.62 +        File testSrc = new File(System.getProperty("test.src"));
  127.63 +
  127.64 +        JavacTool tool = JavacTool.create();
  127.65 +        StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
  127.66 +
  127.67 +        File f = new File(testSrc, T6993305.class.getSimpleName() + ".java");
  127.68 +        Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjects(f);
  127.69 +        JavacTask task = tool.getTask(null, fm, null, null, null, fos);
  127.70 +        Iterable<? extends CompilationUnitTree> cus = task.parse();
  127.71 +
  127.72 +        TestScanner s = new TestScanner();
  127.73 +        s.scan(cus, task);
  127.74 +
  127.75 +        if (errors > 0)
  127.76 +            throw new Exception(errors + " errors occurred");
  127.77 +    }
  127.78 +
  127.79 +    void error(String msg) {
  127.80 +        System.err.println("Error: " + msg);
  127.81 +        errors++;
  127.82 +    }
  127.83 +
  127.84 +    int errors;
  127.85 +
  127.86 +    class TestScanner extends TreeScanner<Void, JavacTask> {
  127.87 +        CompilationUnitTree cu;
  127.88 +        SourcePositions sourcePositions;
  127.89 +        String source;
  127.90 +
  127.91 +        void show(String label, int pos) {
  127.92 +            System.err.println(label + ": " +
  127.93 +                    source.substring(pos, Math.min(source.length(), pos + 10)));
  127.94 +        }
  127.95 +
  127.96 +        @Override public Void visitCompilationUnit(CompilationUnitTree tree, JavacTask task) {
  127.97 +            cu = tree;
  127.98 +            Trees trees = Trees.instance(task);
  127.99 +            sourcePositions = trees.getSourcePositions();
 127.100 +            try {
 127.101 +                source = String.valueOf(tree.getSourceFile().getCharContent(true));
 127.102 +            } catch (IOException e) {
 127.103 +                throw new Error(e);
 127.104 +            }
 127.105 +            return super.visitCompilationUnit(tree, task);
 127.106 +        }
 127.107 +
 127.108 +        // this is the core of the test
 127.109 +        @Override public Void visitMethod(MethodTree tree, JavacTask task) {
 127.110 +            String name = String.valueOf(tree.getName());
 127.111 +            int pos = source.indexOf(" " + name + "(");
 127.112 +            while (source.charAt(pos - 1) != '\n') pos--;
 127.113 +            while (source.charAt(pos) == ' ') pos++;
 127.114 +            int expectedStart = pos;
 127.115 +            int reportedStart = (int) sourcePositions.getStartPosition(cu, tree);
 127.116 +            System.err.println("Method " + name
 127.117 +                    + " expectedStart:" + expectedStart
 127.118 +                    + " reportedStart:" + reportedStart);
 127.119 +            if (expectedStart != reportedStart) {
 127.120 +                error("Unexpected value for " + name);
 127.121 +                show("expected", expectedStart);
 127.122 +                show("reported", reportedStart);
 127.123 +            }
 127.124 +            return super.visitMethod(tree, task);
 127.125 +        }
 127.126 +    }
 127.127 +}
   128.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   128.2 +++ b/test/tools/javac/types/GenericTypeWellFormednessTest.java	Fri Jan 28 10:06:08 2011 -0800
   128.3 @@ -0,0 +1,261 @@
   128.4 +/*
   128.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
   128.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   128.7 + *
   128.8 + * This code is free software; you can redistribute it and/or modify it
   128.9 + * under the terms of the GNU General Public License version 2 only, as
  128.10 + * published by the Free Software Foundation.
  128.11 + *
  128.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  128.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  128.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  128.15 + * version 2 for more details (a copy is included in the LICENSE file that
  128.16 + * accompanied this code).
  128.17 + *
  128.18 + * You should have received a copy of the GNU General Public License version
  128.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  128.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  128.21 + *
  128.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  128.23 + * or visit www.oracle.com if you need additional information or have any
  128.24 + * questions.
  128.25 + */
  128.26 +
  128.27 +/*
  128.28 + * @test
  128.29 + * @bug 7007432 7006109
  128.30 + * @summary Test generic types well-formedness
  128.31 + * @author mcimadamore
  128.32 + * @library .
  128.33 + * @run main GenericTypeWellFormednessTest
  128.34 + */
  128.35 +
  128.36 +import com.sun.tools.javac.code.BoundKind;
  128.37 +import com.sun.tools.javac.code.Type;
  128.38 +import com.sun.tools.javac.code.Type.*;
  128.39 +import com.sun.tools.javac.code.Symbol;
  128.40 +import com.sun.tools.javac.code.Symbol.*;
  128.41 +import java.lang.reflect.Array;
  128.42 +
  128.43 +/**
  128.44 + * Check parameterized type well-formedness. This test executes a number of checks
  128.45 + * in order to establish as to whether an instantiation of a generic type conforms
  128.46 + * to the generic class' declared bounds.
  128.47 + */
  128.48 +public class GenericTypeWellFormednessTest extends TypeHarness {
  128.49 +
  128.50 +    static int executedCount = 0;
  128.51 +    static int ignoredCount = 0;
  128.52 +
  128.53 +    InstantiableType[] rows;
  128.54 +    Type[] columns;
  128.55 +
  128.56 +    static class InstantiableType {
  128.57 +        protected Type type;
  128.58 +
  128.59 +        public InstantiableType(Type type) {
  128.60 +            this.type = type;
  128.61 +        }
  128.62 +
  128.63 +        Type inst(Type clazz) {
  128.64 +            return type;
  128.65 +        }
  128.66 +    }
  128.67 +
  128.68 +    enum Result {
  128.69 +        /* generic type is well-formed w.r.t. declared bounds */
  128.70 +        OK(true),
  128.71 +        /* generic type is not well-formed w.r.t. declared bounds */
  128.72 +        FAIL(false),
  128.73 +        /* generic type is not well-formed w.r.t. declared bounds according to the JLS 3rd,
  128.74 +         * but javac allows it (spec for generic type well-formedness is overly restrictive)
  128.75 +         * See regression test test/tools/generics/wildcards/T5097548.java
  128.76 +         */
  128.77 +        IGNORE(false);
  128.78 +
  128.79 +        boolean value;
  128.80 +
  128.81 +        Result(boolean value) {
  128.82 +            this.value = value;
  128.83 +        }
  128.84 +    }
  128.85 +
  128.86 +    static final Result T = Result.OK;
  128.87 +    static final Result F = Result.FAIL;
  128.88 +    static final Result I = Result.IGNORE;
  128.89 +
  128.90 +    /*is a type in 'rows' a valid instantiation for the generic class in 'col' ? */
  128.91 +    Result[][] isValidInstantiation = {
  128.92 +                     //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<?>>
  128.93 +    /*Foo<Object>*/  { T     , T                , F                , F                , F                 , F                 , F },
  128.94 +    /*Foo<Number>*/  { T     , T                , T                , F                , F                 , F                 , F },
  128.95 +    /*Foo<Integer>*/ { T     , T                , T                , F                , F                 , F                 , F },
  128.96 +    /*Foo<Double>*/  { T     , T                , T                , F                , F                 , F                 , F },
  128.97 +    /*Foo<String>*/  { T     , T                , F                , F                , F                 , F                 , F },
  128.98 +    /*Foo<X1>*/      { T     , T                , F                , F                , F                 , F                 , F },
  128.99 +    /*Foo<X2>*/      { T     , T                , T                , F                , F                 , F                 , F },
 128.100 +    /*Foo<X3>*/      { T     , T                , T                , F                , F                 , F                 , F },
 128.101 +    /*Foo<X4>*/      { T     , T                , T                , F                , F                 , F                 , F },
 128.102 +    /*Foo<X5>*/      { T     , T                , F                , F                , F                 , F                 , F },
 128.103 +    /*Foo<X6>*/      { T     , T                , F                , T                , T                 , T                 , T },
 128.104 +    /*Foo<+Object>*/ { T     , T                , I                , I                , I                 , I                 , I },
 128.105 +    /*Foo<+Number>*/ { T     , T                , T                , F                , F                 , F                 , F },
 128.106 +    /*Foo<+Integer>*/{ T     , T                , T                , F                , F                 , F                 , F },
 128.107 +    /*Foo<+Double>*/ { T     , T                , T                , F                , F                 , F                 , F },
 128.108 +    /*Foo<+String>*/ { T     , T                , F                , F                , F                 , F                 , F },
 128.109 +    /*Foo<+X1>*/     { T     , T                , F                , F                , F                 , F                 , F },
 128.110 +    /*Foo<+X2>*/     { T     , T                , T                , F                , F                 , F                 , F },
 128.111 +    /*Foo<+X3>*/     { T     , T                , T                , F                , F                 , F                 , F },
 128.112 +    /*Foo<+X4>*/     { T     , T                , T                , F                , F                 , F                 , F },
 128.113 +    /*Foo<+X5>*/     { T     , T                , F                , F                , F                 , F                 , F },
 128.114 +    /*Foo<+X6>*/     { T     , T                , F                , T                , T                 , I                 , T },
 128.115 +    /*Foo<-Object>*/ { T     , T                , F                , F                , F                 , F                 , F },
 128.116 +    /*Foo<-Number>*/ { T     , T                , T                , F                , F                 , F                 , F },
 128.117 +    /*Foo<-Integer>*/{ T     , T                , T                , F                , F                 , F                 , F },
 128.118 +    /*Foo<-Double>*/ { T     , T                , T                , F                , F                 , F                 , F },
 128.119 +    /*Foo<-String>*/ { T     , T                , F                , F                , F                 , F                 , F },
 128.120 +    /*Foo<-X1>*/     { T     , T                , I                , I                , I                 , I                 , I },
 128.121 +    /*Foo<-X2>*/     { T     , T                , I                , F                , F                 , F                 , F },
 128.122 +    /*Foo<-X3>*/     { T     , T                , I                , F                , F                 , F                 , F },
 128.123 +    /*Foo<-X4>*/     { T     , T                , I                , F                , F                 , F                 , F },
 128.124 +    /*Foo<-X5>*/     { T     , T                , I                , F                , F                 , F                 , F },
 128.125 +    /*Foo<-X6>*/     { T     , T                , F                , T                , I                 , I                 , T },
 128.126 +    /*Foo<?>*/       { T     , T                , T                , T                , T                 , T                 , T }};
 128.127 +
 128.128 +    GenericTypeWellFormednessTest() {
 128.129 +        InstantiableType[] basicTypes = {
 128.130 +            new InstantiableType(predef.objectType),
 128.131 +            new InstantiableType(NumberType()),
 128.132 +            new InstantiableType(box(predef.intType)),
 128.133 +            new InstantiableType(box(predef.doubleType)),
 128.134 +            new InstantiableType(predef.stringType) };
 128.135 +
 128.136 +        InstantiableType[] typeVars = new InstantiableType[basicTypes.length + 1];
 128.137 +        for (int i = 0 ; i < basicTypes.length ; i++) {
 128.138 +           typeVars[i] = new InstantiableType(fac.TypeVariable(basicTypes[i].type));
 128.139 +        }
 128.140 +        typeVars[typeVars.length - 1] = new InstantiableType(null) {
 128.141 +            Type inst(Type clazz) {
 128.142 +                TypeVar tvar = fac.TypeVariable();
 128.143 +                tvar.bound = subst(clazz, Mapping(clazz.getTypeArguments().head, tvar));
 128.144 +                return tvar;
 128.145 +            }
 128.146 +        };
 128.147 +
 128.148 +        InstantiableType[] typeArgs = join(InstantiableType.class, basicTypes, typeVars);
 128.149 +
 128.150 +        InstantiableType[] invariantTypes = new InstantiableType[typeArgs.length];
 128.151 +        for (int i = 0 ; i < typeArgs.length ; i++) {
 128.152 +           final InstantiableType type1 = typeArgs[i];
 128.153 +           invariantTypes[i] = new InstantiableType(typeArgs[i].type) {
 128.154 +               Type inst(Type clazz) {
 128.155 +                   return subst(clazz, Mapping(clazz.getTypeArguments().head, type1.inst(clazz)));
 128.156 +               }
 128.157 +            };
 128.158 +        }
 128.159 +
 128.160 +        InstantiableType[] covariantTypes = new InstantiableType[typeArgs.length];
 128.161 +        for (int i = 0 ; i < typeArgs.length ; i++) {
 128.162 +           final InstantiableType type1 = typeArgs[i];
 128.163 +           covariantTypes[i] = new InstantiableType(null) {
 128.164 +               Type inst(Type clazz) {
 128.165 +                   Type t = fac.Wildcard(BoundKind.EXTENDS, type1.inst(clazz));
 128.166 +                   return subst(clazz, Mapping(clazz.getTypeArguments().head, t));
 128.167 +               }
 128.168 +            };
 128.169 +        }
 128.170 +
 128.171 +        InstantiableType[] contravariantTypes = new InstantiableType[typeArgs.length];
 128.172 +        for (int i = 0 ; i < typeArgs.length ; i++) {
 128.173 +           final InstantiableType type1 = typeArgs[i];
 128.174 +           contravariantTypes[i] = new InstantiableType(null) {
 128.175 +               Type inst(Type clazz) {
 128.176 +                   Type t = fac.Wildcard(BoundKind.SUPER, type1.inst(clazz));
 128.177 +                   return subst(clazz, Mapping(clazz.getTypeArguments().head, t));
 128.178 +               }
 128.179 +            };
 128.180 +        }
 128.181 +
 128.182 +        InstantiableType[] bivariantTypes = {
 128.183 +            new InstantiableType(fac.Wildcard(BoundKind.UNBOUND, predef.objectType)) {
 128.184 +               Type inst(Type clazz) {
 128.185 +                   return subst(clazz, Mapping(clazz.getTypeArguments().head, type));
 128.186 +               }
 128.187 +            }
 128.188 +        };
 128.189 +
 128.190 +        rows = join(InstantiableType.class, invariantTypes, covariantTypes, contravariantTypes, bivariantTypes);
 128.191 +
 128.192 +        Type tv1 = fac.TypeVariable();
 128.193 +        Type decl1 = fac.Class(tv1);
 128.194 +
 128.195 +        Type tv2 = fac.TypeVariable(predef.objectType);
 128.196 +        Type decl2 = fac.Class(tv2);
 128.197 +
 128.198 +        Type tv3 = fac.TypeVariable(NumberType());
 128.199 +        Type decl3 = fac.Class(tv3);
 128.200 +
 128.201 +        TypeVar tv4 = fac.TypeVariable();
 128.202 +        Type decl4 = fac.Class(tv4);
 128.203 +        tv4.bound = decl4;
 128.204 +        tv4.tsym.name = predef.exceptionType.tsym.name;
 128.205 +
 128.206 +        TypeVar tv5 = fac.TypeVariable();
 128.207 +        Type decl5 = fac.Class(tv5);
 128.208 +        tv5.bound = subst(decl5, Mapping(tv5, fac.Wildcard(BoundKind.EXTENDS, tv5)));
 128.209 +
 128.210 +        TypeVar tv6 = fac.TypeVariable();
 128.211 +        Type decl6 = fac.Class(tv6);
 128.212 +        tv6.bound = subst(decl6, Mapping(tv6, fac.Wildcard(BoundKind.SUPER, tv6)));
 128.213 +
 128.214 +        TypeVar tv7 = fac.TypeVariable();
 128.215 +        Type decl7 = fac.Class(tv7);
 128.216 +        tv7.bound = subst(decl7, Mapping(tv7, fac.Wildcard(BoundKind.UNBOUND, predef.objectType)));
 128.217 +
 128.218 +        columns = new Type[] {
 128.219 +            decl1, decl2, decl3, decl4, decl5, decl6, decl7
 128.220 +        };
 128.221 +    }
 128.222 +
 128.223 +    void test() {
 128.224 +        for (int i = 0; i < rows.length ; i++) {
 128.225 +            for (int j = 0; j < columns.length ; j++) {
 128.226 +                Type decl = columns[j];
 128.227 +                Type inst = rows[i].inst(decl);
 128.228 +                if (isValidInstantiation[i][j] != Result.IGNORE) {
 128.229 +                    executedCount++;
 128.230 +                    assertValidGenericType(inst, isValidInstantiation[i][j].value);
 128.231 +                } else {
 128.232 +                    ignoredCount++;
 128.233 +                }
 128.234 +            }
 128.235 +        }
 128.236 +    }
 128.237 +
 128.238 +    Type NumberType() {
 128.239 +        Symbol s = box(predef.intType).tsym;
 128.240 +        s.complete();
 128.241 +        return ((ClassType)s.type).supertype_field;
 128.242 +    }
 128.243 +
 128.244 +    @SuppressWarnings("unchecked")
 128.245 +    <T> T[] join(Class<T> type, T[]... args) {
 128.246 +        int totalLength = 0;
 128.247 +        for (T[] arr : args) {
 128.248 +            totalLength += arr.length;
 128.249 +        }
 128.250 +        T[] new_arr = (T[])Array.newInstance(type, totalLength);
 128.251 +        int idx = 0;
 128.252 +        for (T[] arr : args) {
 128.253 +            System.arraycopy(arr, 0, new_arr, idx, arr.length);
 128.254 +            idx += arr.length;
 128.255 +        }
 128.256 +        return new_arr;
 128.257 +    }
 128.258 +
 128.259 +    public static void main(String[] args) {
 128.260 +        new GenericTypeWellFormednessTest().test();
 128.261 +        System.out.println("Executed checks : " + executedCount);
 128.262 +        System.out.println("Ignored checks : " + ignoredCount);
 128.263 +    }
 128.264 +}
   129.1 --- a/test/tools/javac/types/TypeHarness.java	Thu Jan 27 17:28:57 2011 -0800
   129.2 +++ b/test/tools/javac/types/TypeHarness.java	Fri Jan 28 10:06:08 2011 -0800
   129.3 @@ -29,6 +29,7 @@
   129.4  import com.sun.tools.javac.code.Type;
   129.5  import com.sun.tools.javac.code.Type.*;
   129.6  import com.sun.tools.javac.code.Symbol.*;
   129.7 +import com.sun.tools.javac.comp.Check;
   129.8  import com.sun.tools.javac.util.List;
   129.9  import com.sun.tools.javac.util.ListBuffer;
  129.10  import com.sun.tools.javac.util.Name;
  129.11 @@ -68,6 +69,7 @@
  129.12  public class TypeHarness {
  129.13  
  129.14      protected Types types;
  129.15 +    protected Check chk;
  129.16      protected Symtab predef;
  129.17      protected Names names;
  129.18      protected Factory fac;
  129.19 @@ -76,6 +78,7 @@
  129.20          Context ctx = new Context();
  129.21          JavacFileManager.preRegister(ctx);
  129.22          types = Types.instance(ctx);
  129.23 +        chk = Check.instance(ctx);
  129.24          predef = Symtab.instance(ctx);
  129.25          names = Names.instance(ctx);
  129.26          fac = new Factory();
  129.27 @@ -157,6 +160,21 @@
  129.28              error(s + msg + t);
  129.29          }
  129.30      }
  129.31 +
  129.32 +    /** assert that generic type 't' is well-formed */
  129.33 +    public void assertValidGenericType(Type t) {
  129.34 +        assertValidGenericType(t, true);
  129.35 +    }
  129.36 +
  129.37 +    /** assert that 's' is/is not assignable to 't' */
  129.38 +    public void assertValidGenericType(Type t, boolean expected) {
  129.39 +        if (chk.checkValidGenericType(t) != expected) {
  129.40 +            String msg = expected ?
  129.41 +                " is not a valid generic type" :
  129.42 +                " is a valid generic type";
  129.43 +            error(t + msg + "   " + t.tsym.type);
  129.44 +        }
  129.45 +    }
  129.46      // </editor-fold>
  129.47  
  129.48      private void error(String msg) {
   130.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   130.2 +++ b/test/tools/javac/varargs/6569633/T6569633.java	Fri Jan 28 10:06:08 2011 -0800
   130.3 @@ -0,0 +1,13 @@
   130.4 +/*
   130.5 + * @test /nodynamiccopyright/
   130.6 + * @bug     6569633
   130.7 + * @author mcimadamore
   130.8 + * @summary  Varargs: parser error when varargs element type is an array
   130.9 + * @compile/fail/ref=T6569633.out -XDrawDiagnostics T6569633.java
  130.10 + */
  130.11 +
  130.12 +class T6569633 {
  130.13 +    void  m1 (Integer... i[]) { }
  130.14 +    void  m2 (Integer[]... i) { }
  130.15 +    void  m3 (Integer[]... i[]) { }
  130.16 +}
   131.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   131.2 +++ b/test/tools/javac/varargs/6569633/T6569633.out	Fri Jan 28 10:06:08 2011 -0800
   131.3 @@ -0,0 +1,3 @@
   131.4 +T6569633.java:10:27: compiler.err.varargs.and.old.array.syntax
   131.5 +T6569633.java:12:29: compiler.err.varargs.and.old.array.syntax
   131.6 +2 errors
   132.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   132.2 +++ b/test/tools/javac/varargs/T7013865.java	Fri Jan 28 10:06:08 2011 -0800
   132.3 @@ -0,0 +1,36 @@
   132.4 +/*
   132.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   132.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   132.7 + *
   132.8 + * This code is free software; you can redistribute it and/or modify it
   132.9 + * under the terms of the GNU General Public License version 2 only, as
  132.10 + * published by the Free Software Foundation.
  132.11 + *
  132.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  132.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  132.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  132.15 + * version 2 for more details (a copy is included in the LICENSE file that
  132.16 + * accompanied this code).
  132.17 + *
  132.18 + * You should have received a copy of the GNU General Public License version
  132.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  132.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  132.21 + *
  132.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  132.23 + * or visit www.oracle.com if you need additional information or have any
  132.24 + * questions.
  132.25 + */
  132.26 +
  132.27 +/*
  132.28 + * @test
  132.29 + * @bug     7013865
  132.30 + * @summary varargs: javac crashes during overload resolution with generic varargs
  132.31 + * @compile T7013865.java
  132.32 + */
  132.33 +
  132.34 +class T7013865 {
  132.35 +    public <X extends Number> void m(X... args) { }
  132.36 +    public void m(Object... args) { }
  132.37 +
  132.38 +    { m(null, null); }
  132.39 +}

mercurial