6992999: fully remove JSR 308 from langtools
authorjjg
Mon, 10 Jan 2011 14:57:59 -0800
changeset 8031 d5fe2c1cecfc
parent 7848 884a6d60b235
child 8032 e1aa25ccdabb
6992999: fully remove JSR 308 from langtools Reviewed-by: mcimadamore
langtools/src/share/classes/com/sun/source/tree/MethodTree.java
langtools/src/share/classes/com/sun/source/tree/Tree.java
langtools/src/share/classes/com/sun/source/tree/TreeVisitor.java
langtools/src/share/classes/com/sun/source/tree/TypeParameterTree.java
langtools/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java
langtools/src/share/classes/com/sun/source/util/TreeScanner.java
langtools/src/share/classes/com/sun/tools/classfile/Attribute.java
langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java
langtools/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java
langtools/src/share/classes/com/sun/tools/classfile/RuntimeInvisibleTypeAnnotations_attribute.java
langtools/src/share/classes/com/sun/tools/classfile/RuntimeTypeAnnotations_attribute.java
langtools/src/share/classes/com/sun/tools/classfile/RuntimeVisibleTypeAnnotations_attribute.java
langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java
langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java
langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java
langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java
langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java
langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java
langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java
langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java
langtools/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java
langtools/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java
langtools/src/share/classes/com/sun/tools/javap/AnnotationWriter.java
langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java
langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java
langtools/src/share/classes/com/sun/tools/javap/InstructionDetailWriter.java
langtools/src/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java
langtools/test/tools/javac/diags/examples.not-yet.txt
--- a/langtools/src/share/classes/com/sun/source/tree/MethodTree.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/source/tree/MethodTree.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,6 @@
     Tree getReturnType();
     List<? extends TypeParameterTree> getTypeParameters();
     List<? extends VariableTree> getParameters();
-//308    List<? extends AnnotationTree> getReceiverAnnotations();
     List<? extends ExpressionTree> getThrows();
     BlockTree getBody();
     Tree getDefaultValue(); // for annotation types
--- a/langtools/src/share/classes/com/sun/source/tree/Tree.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/source/tree/Tree.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,8 +46,6 @@
      */
     public enum Kind {
 
-//308        ANNOTATED_TYPE(AnnotatedTypeTree.class),
-
         /**
          * Used for instances of {@link AnnotationTree}.
          */
--- a/langtools/src/share/classes/com/sun/source/tree/TreeVisitor.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/source/tree/TreeVisitor.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,6 @@
  * @since 1.6
  */
 public interface TreeVisitor<R,P> {
-//308    R visitAnnotatedType(AnnotatedTypeTree node, P p);
     R visitAnnotation(AnnotationTree node, P p);
     R visitMethodInvocation(MethodInvocationTree node, P p);
     R visitAssert(AssertTree node, P p);
--- a/langtools/src/share/classes/com/sun/source/tree/TypeParameterTree.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/source/tree/TypeParameterTree.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,5 +47,4 @@
 public interface TypeParameterTree extends Tree {
     Name getName();
     List<? extends Tree> getBounds();
-//308    List<? extends AnnotationTree> getAnnotations();
 }
--- a/langtools/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -248,10 +248,6 @@
         return defaultAction(node, p);
     }
 
-//308    public R visitAnnotatedType(AnnotatedTypeTree node, P p) {
-//308        return defaultAction(node, p);
-//308    }
-
     public R visitErroneous(ErroneousTree node, P p) {
         return defaultAction(node, p);
     }
--- a/langtools/src/share/classes/com/sun/source/util/TreeScanner.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/source/util/TreeScanner.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -138,7 +138,6 @@
         r = scanAndReduce(node.getReturnType(), p, r);
         r = scanAndReduce(node.getTypeParameters(), p, r);
         r = scanAndReduce(node.getParameters(), p, r);
-//308        r = scanAndReduce(node.getReceiverAnnotations(), p, r);
         r = scanAndReduce(node.getThrows(), p, r);
         r = scanAndReduce(node.getBody(), p, r);
         r = scanAndReduce(node.getDefaultValue(), p, r);
@@ -362,7 +361,6 @@
 
     public R visitTypeParameter(TypeParameterTree node, P p) {
         R r = scan(node.getBounds(), p);
-//308        R r = scanAndReduce(node.getAnnotations(), p, r);
         return r;
     }
 
@@ -380,12 +378,6 @@
         return r;
     }
 
-//308   public R visitAnnotatedType(AnnotatedTypeTree node, P p) {
-//308       R r = scan(node.getAnnotations(), p);
-//308       r = scanAndReduce(node.getUnderlyingType(), p, r);
-//308       return r;
-//308   }
-
     public R visitOther(Tree node, P p) {
         return null;
     }
--- a/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,8 +54,6 @@
     public static final String RuntimeInvisibleAnnotations = "RuntimeInvisibleAnnotations";
     public static final String RuntimeVisibleParameterAnnotations = "RuntimeVisibleParameterAnnotations";
     public static final String RuntimeInvisibleParameterAnnotations = "RuntimeInvisibleParameterAnnotations";
-    public static final String RuntimeVisibleTypeAnnotations = "RuntimeVisibleTypeAnnotations";
-    public static final String RuntimeInvisibleTypeAnnotations = "RuntimeInvisibleTypeAnnotations";
     public static final String Signature                = "Signature";
     public static final String SourceDebugExtension     = "SourceDebugExtension";
     public static final String SourceFile               = "SourceFile";
@@ -118,8 +116,6 @@
                 standardAttributes.put(RuntimeInvisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations_attribute.class);
                 standardAttributes.put(RuntimeVisibleAnnotations, RuntimeVisibleAnnotations_attribute.class);
                 standardAttributes.put(RuntimeVisibleParameterAnnotations, RuntimeVisibleParameterAnnotations_attribute.class);
-                standardAttributes.put(RuntimeVisibleTypeAnnotations, RuntimeVisibleTypeAnnotations_attribute.class);
-                standardAttributes.put(RuntimeInvisibleTypeAnnotations, RuntimeInvisibleTypeAnnotations_attribute.class);
                 standardAttributes.put(Signature,     Signature_attribute.class);
                 standardAttributes.put(SourceID, SourceID_attribute.class);
             }
@@ -176,8 +172,6 @@
         R visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, P p);
         R visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, P p);
         R visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, P p);
-        R visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, P p);
-        R visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, P p);
         R visitSignature(Signature_attribute attr, P p);
         R visitSourceDebugExtension(SourceDebugExtension_attribute attr, P p);
         R visitSourceFile(SourceFile_attribute attr, P p);
--- a/langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,6 +1,6 @@
 
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -459,16 +459,6 @@
             return null;
         }
 
-        public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
-            annotationWriter.write(attr.annotations, out);
-            return null;
-        }
-
-        public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
-            annotationWriter.write(attr.annotations, out);
-            return null;
-        }
-
         public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, ClassOutputStream out) {
             out.writeByte(attr.parameter_annotations.length);
             for (Annotation[] annos: attr.parameter_annotations)
@@ -628,12 +618,6 @@
                 write(anno, out);
         }
 
-        public void write(ExtendedAnnotation[] annos, ClassOutputStream out) {
-            out.writeShort(annos.length);
-            for (ExtendedAnnotation anno: annos)
-                write(anno, out);
-        }
-
         public void write(Annotation anno, ClassOutputStream out) {
             out.writeShort(anno.type_index);
             out.writeShort(anno.element_value_pairs.length);
@@ -641,11 +625,6 @@
                 write(p, out);
         }
 
-        public void write(ExtendedAnnotation anno, ClassOutputStream out) {
-            write(anno.annotation, out);
-            write(anno.position, out);
-        }
-
         public void write(element_value_pair pair, ClassOutputStream out) {
             out.writeShort(pair.element_name_index);
             write(pair.value, out);
@@ -684,95 +663,5 @@
             return null;
         }
 
-        private void write(ExtendedAnnotation.Position p, ClassOutputStream out) {
-            out.writeByte(p.type.targetTypeValue());
-            switch (p.type) {
-            // type case
-            case TYPECAST:
-            case TYPECAST_GENERIC_OR_ARRAY:
-            // object creation
-            case INSTANCEOF:
-            case INSTANCEOF_GENERIC_OR_ARRAY:
-            // new expression
-            case NEW:
-            case NEW_GENERIC_OR_ARRAY:
-            case NEW_TYPE_ARGUMENT:
-            case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-                out.writeShort(p.offset);
-                break;
-             // local variable
-            case LOCAL_VARIABLE:
-            case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-                int table_length = p.lvarOffset.length;
-                out.writeShort(table_length);
-                for (int i = 0; i < table_length; ++i) {
-                    out.writeShort(1);  // for table length
-                    out.writeShort(p.lvarOffset[i]);
-                    out.writeShort(p.lvarLength[i]);
-                    out.writeShort(p.lvarIndex[i]);
-                }
-                break;
-             // method receiver
-            case METHOD_RECEIVER:
-                // Do nothing
-                break;
-            // type parameters
-            case CLASS_TYPE_PARAMETER:
-            case METHOD_TYPE_PARAMETER:
-                out.writeByte(p.parameter_index);
-                break;
-            // type parameters bounds
-            case CLASS_TYPE_PARAMETER_BOUND:
-            case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            case METHOD_TYPE_PARAMETER_BOUND:
-            case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-                out.writeByte(p.parameter_index);
-                out.writeByte(p.bound_index);
-                break;
-             // wildcards
-            case WILDCARD_BOUND:
-            case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-                write(p.wildcard_position, out);
-                break;
-            // Class extends and implements clauses
-            case CLASS_EXTENDS:
-            case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-                out.writeByte(p.type_index);
-                break;
-            // throws
-            case THROWS:
-                out.writeByte(p.type_index);
-                break;
-            case CLASS_LITERAL:
-            case CLASS_LITERAL_GENERIC_OR_ARRAY:
-                out.writeShort(p.offset);
-                break;
-            // method parameter: not specified
-            case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-                out.writeByte(p.parameter_index);
-                break;
-            // method type argument: wasn't specified
-            case METHOD_TYPE_ARGUMENT:
-            case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-                out.writeShort(p.offset);
-                out.writeByte(p.type_index);
-                break;
-            // We don't need to worry abut these
-            case METHOD_RETURN_GENERIC_OR_ARRAY:
-            case FIELD_GENERIC_OR_ARRAY:
-                break;
-            case UNKNOWN:
-                break;
-            default:
-                throw new AssertionError("unknown type: " + p);
-            }
-
-            // Append location data for generics/arrays.
-            if (p.type.hasLocation()) {
-                out.writeShort(p.location.size());
-                for (int i : p.location)
-                    out.writeByte((byte)i);
-            }
-        }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java	Wed Jan 05 09:59:01 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,612 +0,0 @@
-/*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Set;
-
-import static com.sun.tools.classfile.ExtendedAnnotation.TargetAttribute.*;
-
-/**
- * See JSR 308 specification, section 4.1
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class ExtendedAnnotation {
-    ExtendedAnnotation(ClassReader cr) throws IOException, Annotation.InvalidAnnotation {
-        annotation = new Annotation(cr);
-        position = read_position(cr);
-    }
-
-    public ExtendedAnnotation(ConstantPool constant_pool,
-            Annotation annotation, Position position) {
-        this.annotation = annotation;
-        this.position = position;
-    }
-
-    public int length() {
-        int n = annotation.length();
-        n += position_length(position);
-        return n;
-    }
-
-    public final Annotation annotation;
-    public final Position position;
-
-    private static Position read_position(ClassReader cr) throws IOException, Annotation.InvalidAnnotation {
-        // Copied from ClassReader
-        int tag = (byte)cr.readUnsignedByte();  // cast to introduce signedness
-        if (!TargetType.isValidTargetTypeValue(tag))
-            throw new Annotation.InvalidAnnotation("invalid type annotation target type value: " + tag);
-
-        TargetType type = TargetType.fromTargetTypeValue(tag);
-
-        Position position = new Position();
-        position.type = type;
-
-        switch (type) {
-        // type case
-        case TYPECAST:
-        case TYPECAST_GENERIC_OR_ARRAY:
-        // object creation
-        case INSTANCEOF:
-        case INSTANCEOF_GENERIC_OR_ARRAY:
-        // new expression
-        case NEW:
-        case NEW_GENERIC_OR_ARRAY:
-            position.offset = cr.readUnsignedShort();
-            break;
-         // local variable
-        case LOCAL_VARIABLE:
-        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-            int table_length = cr.readUnsignedShort();
-            position.lvarOffset = new int[table_length];
-            position.lvarLength = new int[table_length];
-            position.lvarIndex = new int[table_length];
-            for (int i = 0; i < table_length; ++i) {
-                position.lvarOffset[i] = cr.readUnsignedShort();
-                position.lvarLength[i] = cr.readUnsignedShort();
-                position.lvarIndex[i] = cr.readUnsignedShort();
-            }
-            break;
-         // method receiver
-        case METHOD_RECEIVER:
-            // Do nothing
-            break;
-        // type parameters
-        case CLASS_TYPE_PARAMETER:
-        case METHOD_TYPE_PARAMETER:
-            position.parameter_index = cr.readUnsignedByte();
-            break;
-        // type parameter bounds
-        case CLASS_TYPE_PARAMETER_BOUND:
-        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_PARAMETER_BOUND:
-        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            position.parameter_index = cr.readUnsignedByte();
-            position.bound_index = cr.readUnsignedByte();
-            break;
-         // wildcards
-        case WILDCARD_BOUND:
-        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-            position.wildcard_position = read_position(cr);
-            break;
-         // Class extends and implements clauses
-        case CLASS_EXTENDS:
-        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            int in = cr.readUnsignedShort();
-            if (in == 0xFFFF)
-                in = -1;
-            position.type_index = in;
-            break;
-        // throws
-        case THROWS:
-            position.type_index = cr.readUnsignedShort();
-            break;
-        case CLASS_LITERAL:
-        case CLASS_LITERAL_GENERIC_OR_ARRAY:
-            position.offset = cr.readUnsignedShort();
-            break;
-        // method parameter: not specified
-        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-            position.parameter_index = cr.readUnsignedByte();
-            break;
-        // method type argument: wasn't specified
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_ARGUMENT:
-        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            position.offset = cr.readUnsignedShort();
-            position.type_index = cr.readUnsignedByte();
-            break;
-        // We don't need to worry abut these
-        case METHOD_RETURN_GENERIC_OR_ARRAY:
-        case FIELD_GENERIC_OR_ARRAY:
-            break;
-        case UNKNOWN:
-            break;
-        default:
-            throw new AssertionError("Cannot be here");
-        }
-
-        if (type.hasLocation()) {
-            int len = cr.readUnsignedShort();
-            List<Integer> loc = new ArrayList<Integer>(len);
-            for (int i = 0; i < len; i++)
-                loc.add(cr.readUnsignedByte());
-            position.location = loc;
-        }
-        return position;
-    }
-
-    private static int position_length(Position pos) {
-        int n = 0;
-        n += 1; // target_type
-        switch (pos.type) {
-        // type case
-        case TYPECAST:
-        case TYPECAST_GENERIC_OR_ARRAY:
-        // object creation
-        case INSTANCEOF:
-        case INSTANCEOF_GENERIC_OR_ARRAY:
-        // new expression
-        case NEW:
-        case NEW_GENERIC_OR_ARRAY:
-            n += 2;
-            break;
-         // local variable
-        case LOCAL_VARIABLE:
-        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-            n += 2; // table_length;
-            int table_length = pos.lvarOffset.length;
-            n += 2 * table_length; // offset
-            n += 2 * table_length; // length;
-            n += 2 * table_length; // index
-            break;
-         // method receiver
-        case METHOD_RECEIVER:
-            // Do nothing
-            break;
-        // type parameters
-        case CLASS_TYPE_PARAMETER:
-        case METHOD_TYPE_PARAMETER:
-            n += 1; // parameter_index;
-            break;
-        // type parameter bounds
-        case CLASS_TYPE_PARAMETER_BOUND:
-        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_PARAMETER_BOUND:
-        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            n += 1; // parameter_index
-            n += 1; // bound_index
-            break;
-        case WILDCARD_BOUND:
-        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-            n += position_length(pos.wildcard_position);
-            break;
-         // Class extends and implements clauses
-        case CLASS_EXTENDS:
-        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            n += 2; // type_index
-            break;
-        // throws
-        case THROWS:
-            n += 2; // type_index
-            break;
-        case CLASS_LITERAL:
-        case CLASS_LITERAL_GENERIC_OR_ARRAY:
-            n += 1; // offset
-            break;
-        // method parameter: not specified
-        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-            n += 1; // parameter_index
-            break;
-        // method type argument: wasn't specified
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_ARGUMENT:
-        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            n += 2; // offset
-            n += 1; // type index
-            break;
-        // We don't need to worry abut these
-        case METHOD_RETURN_GENERIC_OR_ARRAY:
-        case FIELD_GENERIC_OR_ARRAY:
-            break;
-        case UNKNOWN:
-            break;
-        default:
-        }
-
-        if (pos.type.hasLocation()) {
-            n += 2; // length
-            n += 1 * pos.location.size(); // actual array size
-        }
-
-        return n;
-    }
-
-    // Code duplicated from com.sun.tools.javac.code.TypeAnnotations.Position
-    public static class Position {
-
-        public TargetType type = TargetType.UNKNOWN;
-
-        // For generic/array types.
-        public List<Integer> location = new ArrayList<Integer>();
-
-        // For typecasts, type tests, new (and locals, as start_pc).
-        public int offset = -1;
-
-        // For locals.
-        public int[] lvarOffset = null;
-        public int[] lvarLength = null;
-        public int[] lvarIndex = null;
-
-        // For type parameter bound
-        public int bound_index = Integer.MIN_VALUE;
-
-        // For type parameter and method parameter
-        public int parameter_index = Integer.MIN_VALUE;
-
-        // For class extends, implements, and throws classes
-        public int type_index = Integer.MIN_VALUE;
-
-        // For wildcards
-        public Position wildcard_position = null;
-
-        @Override
-        public String toString() {
-            StringBuilder sb = new StringBuilder();
-            sb.append('[');
-            sb.append(type);
-
-            switch (type) {
-            // type case
-            case TYPECAST:
-            case TYPECAST_GENERIC_OR_ARRAY:
-            // object creation
-            case INSTANCEOF:
-            case INSTANCEOF_GENERIC_OR_ARRAY:
-            // new expression
-            case NEW:
-            case NEW_GENERIC_OR_ARRAY:
-            case NEW_TYPE_ARGUMENT:
-            case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-                sb.append(", offset = ");
-                sb.append(offset);
-                break;
-             // local variable
-            case LOCAL_VARIABLE:
-            case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-                sb.append(", {");
-                for (int i = 0; i < lvarOffset.length; ++i) {
-                    if (i != 0) sb.append("; ");
-                    sb.append(", start_pc = ");
-                    sb.append(lvarOffset[i]);
-                    sb.append(", length = ");
-                    sb.append(lvarLength[i]);
-                    sb.append(", index = ");
-                    sb.append(lvarIndex[i]);
-                }
-                sb.append("}");
-                break;
-             // method receiver
-            case METHOD_RECEIVER:
-                // Do nothing
-                break;
-            // type parameters
-            case CLASS_TYPE_PARAMETER:
-            case METHOD_TYPE_PARAMETER:
-                sb.append(", param_index = ");
-                sb.append(parameter_index);
-                break;
-            // type parameters bound
-            case CLASS_TYPE_PARAMETER_BOUND:
-            case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            case METHOD_TYPE_PARAMETER_BOUND:
-            case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-                sb.append(", param_index = ");
-                sb.append(parameter_index);
-                sb.append(", bound_index = ");
-                sb.append(bound_index);
-                break;
-             // wildcard
-            case WILDCARD_BOUND:
-            case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-                sb.append(", wild_card = ");
-                sb.append(wildcard_position);
-                break;
-             // Class extends and implements clauses
-            case CLASS_EXTENDS:
-            case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-                sb.append(", type_index = ");
-                sb.append(type_index);
-                break;
-            // throws
-            case THROWS:
-                sb.append(", type_index = ");
-                sb.append(type_index);
-                break;
-            case CLASS_LITERAL:
-            case CLASS_LITERAL_GENERIC_OR_ARRAY:
-                sb.append(", offset = ");
-                sb.append(offset);
-                break;
-            // method parameter: not specified
-            case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-                sb.append(", param_index = ");
-                sb.append(parameter_index);
-                break;
-            // method type argument: wasn't specified
-            case METHOD_TYPE_ARGUMENT:
-            case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-                sb.append(", offset = ");
-                sb.append(offset);
-                sb.append(", type_index = ");
-                sb.append(type_index);
-                break;
-            // We don't need to worry abut these
-            case METHOD_RETURN_GENERIC_OR_ARRAY:
-            case FIELD_GENERIC_OR_ARRAY:
-                break;
-            case UNKNOWN:
-                break;
-            default:
-                throw new AssertionError("unknown type: " + type);
-            }
-
-            // Append location data for generics/arrays.
-            if (type.hasLocation()) {
-                sb.append(", location = (");
-                sb.append(location);
-                sb.append(")");
-            }
-
-            sb.append(']');
-            return sb.toString();
-        }
-    }
-
-    // Code duplicated from com.sun.tools.javac.comp.TargetType
-    public enum TargetType {
-
-        /** For annotations on typecasts. */
-        TYPECAST(0x00),
-
-        /** For annotations on a type argument or nested array of a typecast. */
-        TYPECAST_GENERIC_OR_ARRAY(0x01, HasLocation),
-
-        /** For annotations on type tests. */
-        INSTANCEOF(0x02),
-
-        /** For annotations on a type argument or nested array of a type test. */
-        INSTANCEOF_GENERIC_OR_ARRAY(0x03, HasLocation),
-
-        /** For annotations on object creation expressions. */
-        NEW(0x04),
-
-        /**
-         * For annotations on a type argument or nested array of an object creation
-         * expression.
-         */
-        NEW_GENERIC_OR_ARRAY(0x05, HasLocation),
-
-
-        /** For annotations on the method receiver. */
-        METHOD_RECEIVER(0x06),
-
-        // invalid location
-        // METHOD_RECEIVER_GENERIC_OR_ARRAY(0x07, HasLocation),
-
-        /** For annotations on local variables. */
-        LOCAL_VARIABLE(0x08),
-
-        /** For annotations on a type argument or nested array of a local. */
-        LOCAL_VARIABLE_GENERIC_OR_ARRAY(0x09, HasLocation),
-
-        // already handled by regular annotations
-        // METHOD_RETURN(0x0A),
-
-        /**
-         * For annotations on a type argument or nested array of a method return
-         * type.
-         */
-        METHOD_RETURN_GENERIC_OR_ARRAY(0x0B, HasLocation),
-
-        // already handled by regular annotations
-        // METHOD_PARAMETER(0x0C),
-
-        /** For annotations on a type argument or nested array of a method parameter. */
-        METHOD_PARAMETER_GENERIC_OR_ARRAY(0x0D, HasLocation),
-
-        // already handled by regular annotations
-        // FIELD(0x0E),
-
-        /** For annotations on a type argument or nested array of a field. */
-        FIELD_GENERIC_OR_ARRAY(0x0F, HasLocation),
-
-        /** For annotations on a bound of a type parameter of a class. */
-        CLASS_TYPE_PARAMETER_BOUND(0x10, HasBound, HasParameter),
-
-        /**
-         * For annotations on a type argument or nested array of a bound of a type
-         * parameter of a class.
-         */
-        CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY(0x11, HasBound, HasLocation, HasParameter),
-
-        /** For annotations on a bound of a type parameter of a method. */
-        METHOD_TYPE_PARAMETER_BOUND(0x12, HasBound, HasParameter),
-
-        /**
-         * For annotations on a type argument or nested array of a bound of a type
-         * parameter of a method.
-         */
-        METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY(0x13, HasBound, HasLocation, HasParameter),
-
-        /** For annotations on the type of an "extends" or "implements" clause. */
-        CLASS_EXTENDS(0x14),
-
-        /** For annotations on the inner type of an "extends" or "implements" clause. */
-        CLASS_EXTENDS_GENERIC_OR_ARRAY(0x15, HasLocation),
-
-        /** For annotations on a throws clause in a method declaration. */
-        THROWS(0x16),
-
-        // invalid location
-        // THROWS_GENERIC_OR_ARRAY(0x17, HasLocation),
-
-        /** For annotations in type arguments of object creation expressions. */
-        NEW_TYPE_ARGUMENT(0x18),
-        NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY(0x19, HasLocation),
-
-        METHOD_TYPE_ARGUMENT(0x1A),
-        METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY(0x1B, HasLocation),
-
-        WILDCARD_BOUND(0x1C, HasBound),
-        WILDCARD_BOUND_GENERIC_OR_ARRAY(0x1D, HasBound, HasLocation),
-
-        CLASS_LITERAL(0x1E),
-        CLASS_LITERAL_GENERIC_OR_ARRAY(0x1F, HasLocation),
-
-        METHOD_TYPE_PARAMETER(0x20, HasParameter),
-
-        // invalid location
-        // METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY(0x21, HasLocation, HasParameter),
-
-        CLASS_TYPE_PARAMETER(0x22, HasParameter),
-
-        // invalid location
-        // CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY(0x23, HasLocation, HasParameter),
-
-        /** For annotations with an unknown target. */
-        UNKNOWN(-1);
-
-        static final int MAXIMUM_TARGET_TYPE_VALUE = 0x22;
-
-        private final int targetTypeValue;
-        private Set<TargetAttribute> flags;
-
-        TargetType(int targetTypeValue, TargetAttribute... attrs) {
-            if (targetTypeValue < Byte.MIN_VALUE
-                || targetTypeValue > Byte.MAX_VALUE)
-                throw new AssertionError("attribute type value needs to be a byte: " + targetTypeValue);
-            this.targetTypeValue = (byte)targetTypeValue;
-            this.flags = EnumSet.noneOf(TargetAttribute.class);
-            for (TargetAttribute attr : attrs)
-                this.flags.add(attr);
-        }
-
-        /**
-         * Returns whether or not this TargetType represents an annotation whose
-         * target is an inner type of a generic or array type.
-         *
-         * @return true if this TargetType represents an annotation on an inner
-         *         type, false otherwise
-         */
-        public boolean hasLocation() {
-            return flags.contains(HasLocation);
-        }
-
-        public TargetType getGenericComplement() {
-            if (hasLocation())
-                return this;
-            else
-                return fromTargetTypeValue(targetTypeValue() + 1);
-        }
-
-        /**
-         * Returns whether or not this TargetType represents an annotation whose
-         * target has a parameter index.
-         *
-         * @return true if this TargetType has a parameter index,
-         *         false otherwise
-         */
-        public boolean hasParameter() {
-            return flags.contains(HasParameter);
-        }
-
-        /**
-         * Returns whether or not this TargetType represents an annotation whose
-         * target is a type parameter bound.
-         *
-         * @return true if this TargetType represents an type parameter bound
-         *         annotation, false otherwise
-         */
-        public boolean hasBound() {
-            return flags.contains(HasBound);
-        }
-
-        public int targetTypeValue() {
-            return this.targetTypeValue;
-        }
-
-        private static TargetType[] targets = null;
-
-        private static TargetType[] buildTargets() {
-            TargetType[] targets = new TargetType[MAXIMUM_TARGET_TYPE_VALUE + 1];
-            TargetType[] alltargets = values();
-            for (TargetType target : alltargets)
-                if (target.targetTypeValue >= 0)
-                    targets[target.targetTypeValue] = target;
-            for (int i = 0; i <= MAXIMUM_TARGET_TYPE_VALUE; ++i)
-                if (targets[i] == null)
-                    targets[i] = UNKNOWN;
-            return targets;
-        }
-
-        public static boolean isValidTargetTypeValue(int tag) {
-            if (targets == null)
-                targets = buildTargets();
-
-            if (((byte)tag) == ((byte)UNKNOWN.targetTypeValue))
-                return true;
-
-            return (tag >= 0 && tag < targets.length);
-        }
-
-        public static TargetType fromTargetTypeValue(int tag) {
-            if (targets == null)
-                targets = buildTargets();
-
-            if (((byte)tag) == ((byte)UNKNOWN.targetTypeValue))
-                return UNKNOWN;
-
-            if (tag < 0 || tag >= targets.length)
-                throw new IllegalArgumentException("Unknown TargetType: " + tag);
-            return targets[tag];
-        }
-    }
-
-    static enum TargetAttribute {
-        HasLocation, HasParameter, HasBound;
-    }
-}
--- a/langtools/src/share/classes/com/sun/tools/classfile/RuntimeInvisibleTypeAnnotations_attribute.java	Wed Jan 05 09:59:01 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JSR 308 specification, section 4.1
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class RuntimeInvisibleTypeAnnotations_attribute extends RuntimeTypeAnnotations_attribute {
-    RuntimeInvisibleTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
-            throws IOException, Annotation.InvalidAnnotation {
-        super(cr, name_index, length);
-    }
-
-    public RuntimeInvisibleTypeAnnotations_attribute(ConstantPool cp, ExtendedAnnotation[] annotations)
-            throws ConstantPoolException {
-        this(cp.getUTF8Index(Attribute.RuntimeInvisibleTypeAnnotations), annotations);
-    }
-
-    public RuntimeInvisibleTypeAnnotations_attribute(int name_index, ExtendedAnnotation[] annotations) {
-        super(name_index, annotations);
-    }
-
-    public <R, P> R accept(Visitor<R, P> visitor, P p) {
-        return visitor.visitRuntimeInvisibleTypeAnnotations(this, p);
-    }
-}
--- a/langtools/src/share/classes/com/sun/tools/classfile/RuntimeTypeAnnotations_attribute.java	Wed Jan 05 09:59:01 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JSR 308 specification, section 4
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public abstract class RuntimeTypeAnnotations_attribute extends Attribute {
-    protected RuntimeTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
-            throws IOException, Annotation.InvalidAnnotation {
-        super(name_index, length);
-        int num_annotations = cr.readUnsignedShort();
-        annotations = new ExtendedAnnotation[num_annotations];
-        for (int i = 0; i < annotations.length; i++)
-            annotations[i] = new ExtendedAnnotation(cr);
-    }
-
-    protected RuntimeTypeAnnotations_attribute(int name_index, ExtendedAnnotation[] annotations) {
-        super(name_index, length(annotations));
-        this.annotations = annotations;
-    }
-
-    private static int length(ExtendedAnnotation[] annos) {
-        int n = 2;
-        for (ExtendedAnnotation anno: annos)
-            n += anno.length();
-        return n;
-    }
-
-    public final ExtendedAnnotation[] annotations;
-}
--- a/langtools/src/share/classes/com/sun/tools/classfile/RuntimeVisibleTypeAnnotations_attribute.java	Wed Jan 05 09:59:01 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JSR 308 specification, section 4.1
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class RuntimeVisibleTypeAnnotations_attribute extends RuntimeTypeAnnotations_attribute {
-    RuntimeVisibleTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
-            throws IOException, Annotation.InvalidAnnotation {
-        super(cr, name_index, length);
-    }
-
-    public RuntimeVisibleTypeAnnotations_attribute(ConstantPool cp, ExtendedAnnotation[] annotations)
-            throws ConstantPoolException {
-        this(cp.getUTF8Index(Attribute.RuntimeVisibleTypeAnnotations), annotations);
-    }
-
-    public RuntimeVisibleTypeAnnotations_attribute(int name_index, ExtendedAnnotation[] annotations) {
-        super(name_index, annotations);
-    }
-
-    public <R, P> R accept(Visitor<R, P> visitor, P p) {
-        return visitor.visitRuntimeVisibleTypeAnnotations(this, p);
-    }
-}
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -204,21 +204,6 @@
         }
     }
 
-    public static class TypeCompound extends Compound {
-        public TypeAnnotationPosition position;
-        public TypeCompound(Compound compound,
-                TypeAnnotationPosition position) {
-            this(compound.type, compound.values, position);
-        }
-        public TypeCompound(Type type,
-                List<Pair<MethodSymbol, Attribute>> values,
-                TypeAnnotationPosition position) {
-            super(type, values);
-            this.position = position;
-        }
-
-    }
-
     /** The value for an annotation element of an array type.
      */
     public static class Array extends Attribute {
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -100,17 +100,6 @@
      */
     public Type type;
 
-    /** The type annotations targeted to a tree directly owned by this symbol
-     */
-    // type annotations are stored here for two purposes:
-    //  - convenient location to store annotations for generation after erasure
-    //  - a private interface for accessing type annotations parsed from
-    //    classfiles
-    //  the field is populated for the following declaration only
-    //  class, field, variable and type parameters
-    //
-    public List<Attribute.TypeCompound> typeAnnotations;
-
     /** The owner of this symbol.
      */
     public Symbol owner;
@@ -133,7 +122,6 @@
         this.completer = null;
         this.erasure_field = null;
         this.attributes_field = List.nil();
-        this.typeAnnotations = List.nil();
         this.name = name;
     }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Wed Jan 05 09:59:01 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,403 +0,0 @@
-/*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.code;
-
-import javax.lang.model.element.ElementKind;
-
-import com.sun.tools.javac.code.Symbol.VarSymbol;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.TreeInfo;
-import com.sun.tools.javac.tree.TreeScanner;
-import com.sun.tools.javac.tree.JCTree.*;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
-
-/**
- * Contains operations specific to processing type annotations
- */
-public class TypeAnnotations {
-    private static final Context.Key<TypeAnnotations> key
-        = new Context.Key<TypeAnnotations>();
-
-    public static TypeAnnotations instance(Context context) {
-        TypeAnnotations instance = context.get(key);
-        if (instance == null)
-            instance = new TypeAnnotations(context);
-        return instance;
-    }
-
-    protected TypeAnnotations(Context context) {
-        context.put(key, this);
-    }
-
-    public void taFillAndLift(JCClassDecl tree, boolean visitBodies) {
-//308        new TypeAnnotationPositions().scan(tree);
-//308        new TypeAnnotationLift().scan(tree);
-    }
-
-    private static class TypeAnnotationPositions extends TreeScanner {
-
-        private ListBuffer<JCTree> frames = ListBuffer.lb();
-        private void push(JCTree t) { frames = frames.prepend(t); }
-        private JCTree pop() { return frames.next(); }
-        private JCTree peek2() { return frames.toList().tail.head; }
-
-        @Override
-        public void scan(JCTree tree) {
-            push(tree);
-            super.scan(tree);
-            pop();
-        }
-
-        private boolean inClass = false;
-
-        @Override
-        public void visitClassDef(JCClassDecl tree) {
-           if (!inClass) {
-               // Do not recurse into nested and inner classes since
-               // TransTypes.visitClassDef makes an invocation for each class
-               // separately.
-               inClass = true;
-               try {
-                   super.visitClassDef(tree);
-               } finally {
-                   inClass = false;
-               }
-           }
-        }
-
-        private TypeAnnotationPosition resolveFrame(JCTree tree, JCTree frame,
-                List<JCTree> path, TypeAnnotationPosition p) {
-            switch (frame.getKind()) {
-                case TYPE_CAST:
-                    p.type = TargetType.TYPECAST;
-                    p.pos = frame.pos;
-                    return p;
-
-                case INSTANCE_OF:
-                    p.type = TargetType.INSTANCEOF;
-                    p.pos = frame.pos;
-                    return p;
-
-                case NEW_CLASS:
-                    p.type = TargetType.NEW;
-                    p.pos = frame.pos;
-                    return p;
-
-                case NEW_ARRAY:
-                    p.type = TargetType.NEW;
-                    p.pos = frame.pos;
-                    return p;
-
-                case ANNOTATION_TYPE:
-                case CLASS:
-                case ENUM:
-                case INTERFACE:
-                    p.pos = frame.pos;
-                    if (((JCClassDecl)frame).extending == tree) {
-                        p.type = TargetType.CLASS_EXTENDS;
-                        p.type_index = -1;
-                    } else if (((JCClassDecl)frame).implementing.contains(tree)) {
-                        p.type = TargetType.CLASS_EXTENDS;
-                        p.type_index = ((JCClassDecl)frame).implementing.indexOf(tree);
-                    } else if (((JCClassDecl)frame).typarams.contains(tree)) {
-                        p.type = TargetType.CLASS_TYPE_PARAMETER;
-                        p.parameter_index = ((JCClassDecl)frame).typarams.indexOf(tree);
-                    } else
-                        throw new AssertionError();
-                    return p;
-
-                case METHOD: {
-                    JCMethodDecl frameMethod = (JCMethodDecl)frame;
-                    p.pos = frame.pos;
-                    if (frameMethod.receiverAnnotations.contains(tree))
-                        p.type = TargetType.METHOD_RECEIVER;
-                    else if (frameMethod.thrown.contains(tree)) {
-                        p.type = TargetType.THROWS;
-                        p.type_index = frameMethod.thrown.indexOf(tree);
-                    } else if (((JCMethodDecl)frame).restype == tree) {
-                        p.type = TargetType.METHOD_RETURN_GENERIC_OR_ARRAY;
-                    } else if (frameMethod.typarams.contains(tree)) {
-                        p.type = TargetType.METHOD_TYPE_PARAMETER;
-                        p.parameter_index = frameMethod.typarams.indexOf(tree);
-                    } else
-                        throw new AssertionError();
-                    return p;
-                }
-                case MEMBER_SELECT: {
-                    JCFieldAccess fieldFrame = (JCFieldAccess)frame;
-                    if ("class".contentEquals(fieldFrame.name)) {
-                        p.type = TargetType.CLASS_LITERAL;
-                        p.pos = TreeInfo.innermostType(fieldFrame.selected).pos;
-                    } else
-                        throw new AssertionError();
-                    return p;
-                }
-                case PARAMETERIZED_TYPE: {
-                    TypeAnnotationPosition nextP;
-                    if (((JCTypeApply)frame).clazz == tree)
-                        nextP = p; // generic: RAW; noop
-                    else if (((JCTypeApply)frame).arguments.contains(tree))
-                        p.location = p.location.prepend(
-                                ((JCTypeApply)frame).arguments.indexOf(tree));
-                    else
-                        throw new AssertionError();
-
-                    List<JCTree> newPath = path.tail;
-                    return resolveFrame(newPath.head, newPath.tail.head, newPath, p);
-                }
-
-                case ARRAY_TYPE: {
-                    p.location = p.location.prepend(0);
-                    List<JCTree> newPath = path.tail;
-                    return resolveFrame(newPath.head, newPath.tail.head, newPath, p);
-                }
-
-                case TYPE_PARAMETER:
-                    if (path.tail.tail.head.getTag() == JCTree.CLASSDEF) {
-                        JCClassDecl clazz = (JCClassDecl)path.tail.tail.head;
-                        p.type = TargetType.CLASS_TYPE_PARAMETER_BOUND;
-                        p.parameter_index = clazz.typarams.indexOf(path.tail.head);
-                        p.bound_index = ((JCTypeParameter)frame).bounds.indexOf(tree);
-                    } else if (path.tail.tail.head.getTag() == JCTree.METHODDEF) {
-                        JCMethodDecl method = (JCMethodDecl)path.tail.tail.head;
-                        p.type = TargetType.METHOD_TYPE_PARAMETER_BOUND;
-                        p.parameter_index = method.typarams.indexOf(path.tail.head);
-                        p.bound_index = ((JCTypeParameter)frame).bounds.indexOf(tree);
-                    } else
-                        throw new AssertionError();
-                    p.pos = frame.pos;
-                    return p;
-
-                case VARIABLE:
-                    VarSymbol v = ((JCVariableDecl)frame).sym;
-                    p.pos = frame.pos;
-                    switch (v.getKind()) {
-                        case LOCAL_VARIABLE:
-                            p.type = TargetType.LOCAL_VARIABLE; break;
-                        case FIELD:
-                            p.type = TargetType.FIELD_GENERIC_OR_ARRAY; break;
-                        case PARAMETER:
-                            p.type = TargetType.METHOD_PARAMETER_GENERIC_OR_ARRAY;
-                            p.parameter_index = methodParamIndex(path, frame);
-                            break;
-                        default: throw new AssertionError();
-                    }
-                    return p;
-
-//308                case ANNOTATED_TYPE: {
-//308                    List<JCTree> newPath = path.tail;
-//308                    return resolveFrame(newPath.head, newPath.tail.head,
-//308                            newPath, p);
-//308                }
-
-                case METHOD_INVOCATION: {
-                    JCMethodInvocation invocation = (JCMethodInvocation)frame;
-                    if (!invocation.typeargs.contains(tree))
-                        throw new AssertionError("{" + tree + "} is not an argument in the invocation: " + invocation);
-                    p.type = TargetType.METHOD_TYPE_ARGUMENT;
-                    p.pos = invocation.pos;
-                    p.type_index = invocation.typeargs.indexOf(tree);
-                    return p;
-                }
-
-                case EXTENDS_WILDCARD:
-                case SUPER_WILDCARD: {
-                    p.type = TargetType.WILDCARD_BOUND;
-                    List<JCTree> newPath = path.tail;
-
-                    TypeAnnotationPosition wildcard =
-                        resolveFrame(newPath.head, newPath.tail.head, newPath,
-                                new TypeAnnotationPosition());
-                    if (!wildcard.location.isEmpty())
-                        wildcard.type = wildcard.type.getGenericComplement();
-                    p.wildcard_position = wildcard;
-                    p.pos = frame.pos;
-                    return p;
-                }
-            }
-            return p;
-        }
-
-        private void setTypeAnnotationPos(List<JCTypeAnnotation> annotations, TypeAnnotationPosition position) {
-            for (JCTypeAnnotation anno : annotations) {
-                anno.annotation_position = position;
-                anno.attribute_field.position = position;
-            }
-        }
-
-        @Override
-        public void visitNewArray(JCNewArray tree) {
-            findPosition(tree, tree, tree.annotations);
-            int dimAnnosCount = tree.dimAnnotations.size();
-
-            // handle annotations associated with dimentions
-            for (int i = 0; i < dimAnnosCount; ++i) {
-                TypeAnnotationPosition p = new TypeAnnotationPosition();
-                p.type = TargetType.NEW_GENERIC_OR_ARRAY;
-                p.pos = tree.pos;
-                p.location = p.location.append(i);
-                setTypeAnnotationPos(tree.dimAnnotations.get(i), p);
-            }
-
-            // handle "free" annotations
-            int i = dimAnnosCount == 0 ? 0 : dimAnnosCount - 1;
-            JCExpression elemType = tree.elemtype;
-            while (elemType != null) {
-                if (elemType.getTag() == JCTree.ANNOTATED_TYPE) {
-                    JCAnnotatedType at = (JCAnnotatedType)elemType;
-                    TypeAnnotationPosition p = new TypeAnnotationPosition();
-                    p.type = TargetType.NEW_GENERIC_OR_ARRAY;
-                    p.pos = tree.pos;
-                    p.location = p.location.append(i);
-                    setTypeAnnotationPos(at.annotations, p);
-                    elemType = at.underlyingType;
-                } else if (elemType.getTag() == JCTree.TYPEARRAY) {
-                    ++i;
-                    elemType = ((JCArrayTypeTree)elemType).elemtype;
-                } else
-                    break;
-            }
-
-            // find annotations locations of initializer elements
-            scan(tree.elems);
-        }
-
-        @Override
-        public void visitAnnotatedType(JCAnnotatedType tree) {
-            findPosition(tree, peek2(), tree.annotations);
-            super.visitAnnotatedType(tree);
-        }
-
-        @Override
-        public void visitMethodDef(JCMethodDecl tree) {
-            TypeAnnotationPosition p = new TypeAnnotationPosition();
-            p.type = TargetType.METHOD_RECEIVER;
-            setTypeAnnotationPos(tree.receiverAnnotations, p);
-            super.visitMethodDef(tree);
-        }
-        @Override
-        public void visitTypeParameter(JCTypeParameter tree) {
-            findPosition(tree, peek2(), tree.annotations);
-            super.visitTypeParameter(tree);
-        }
-
-        void findPosition(JCTree tree, JCTree frame, List<JCTypeAnnotation> annotations) {
-            if (!annotations.isEmpty()) {
-                TypeAnnotationPosition p =
-                        resolveFrame(tree, frame, frames.toList(),
-                                new TypeAnnotationPosition());
-                if (!p.location.isEmpty())
-                    p.type = p.type.getGenericComplement();
-                setTypeAnnotationPos(annotations, p);
-            }
-        }
-
-        private int methodParamIndex(List<JCTree> path, JCTree param) {
-            List<JCTree> curr = path;
-            if (curr.head != param)
-                curr = path.tail;
-            JCMethodDecl method = (JCMethodDecl)curr.tail.head;
-            return method.params.indexOf(param);
-        }
-    }
-
-    private static class TypeAnnotationLift extends TreeScanner {
-        List<Attribute.TypeCompound> recordedTypeAnnotations = List.nil();
-
-        boolean isInner = false;
-        @Override
-        public void visitClassDef(JCClassDecl tree) {
-            if (isInner) {
-                // tree is an inner class tree.  stop now.
-                // TransTypes.visitClassDef makes an invocation for each class
-                // separately.
-                return;
-            }
-            isInner = true;
-            List<Attribute.TypeCompound> prevTAs = recordedTypeAnnotations;
-            recordedTypeAnnotations = List.nil();
-            try {
-                super.visitClassDef(tree);
-            } finally {
-                tree.sym.typeAnnotations = tree.sym.typeAnnotations.appendList(recordedTypeAnnotations);
-                recordedTypeAnnotations = prevTAs;
-            }
-        }
-
-        @Override
-        public void visitMethodDef(JCMethodDecl tree) {
-            List<Attribute.TypeCompound> prevTAs = recordedTypeAnnotations;
-            recordedTypeAnnotations = List.nil();
-            try {
-                super.visitMethodDef(tree);
-            } finally {
-                tree.sym.typeAnnotations = tree.sym.typeAnnotations.appendList(recordedTypeAnnotations);
-                recordedTypeAnnotations = prevTAs;
-            }
-        }
-
-        @Override
-        public void visitVarDef(JCVariableDecl tree) {
-            List<Attribute.TypeCompound> prevTAs = recordedTypeAnnotations;
-            recordedTypeAnnotations = List.nil();
-            ElementKind kind = tree.sym.getKind();
-            if (kind == ElementKind.LOCAL_VARIABLE && tree.mods.annotations.nonEmpty()) {
-                // need to lift the annotations
-                TypeAnnotationPosition position = new TypeAnnotationPosition();
-                position.pos = tree.pos;
-                position.type = TargetType.LOCAL_VARIABLE;
-                for (Attribute.Compound attribute : tree.sym.attributes_field) {
-                    Attribute.TypeCompound tc =
-                        new Attribute.TypeCompound(attribute.type, attribute.values, position);
-                    recordedTypeAnnotations = recordedTypeAnnotations.append(tc);
-                }
-            }
-            try {
-                super.visitVarDef(tree);
-            } finally {
-                if (kind.isField() || kind == ElementKind.LOCAL_VARIABLE)
-                    tree.sym.typeAnnotations = tree.sym.typeAnnotations.appendList(recordedTypeAnnotations);
-                recordedTypeAnnotations = kind.isField() ? prevTAs : prevTAs.appendList(recordedTypeAnnotations);
-            }
-        }
-
-        @Override
-        public void visitApply(JCMethodInvocation tree) {
-            scan(tree.meth);
-            scan(tree.typeargs);
-            scan(tree.args);
-        }
-
-        public void visitAnnotation(JCAnnotation tree) {
-            if (tree instanceof JCTypeAnnotation)
-                recordedTypeAnnotations = recordedTypeAnnotations.append(((JCTypeAnnotation)tree).attribute_field);
-            super.visitAnnotation(tree);
-        }
-    }
-
-}
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2989,10 +2989,6 @@
         result = tree.type = syms.errType;
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        result = tree.type = attribType(tree.getUnderlyingType(), env);
-    }
-
     public void visitErroneous(JCErroneous tree) {
         if (tree.errs != null)
             for (JCTree err : tree.errs)
@@ -3184,9 +3180,6 @@
             (c.flags() & ABSTRACT) == 0) {
             checkSerialVersionUID(tree, c);
         }
-
-        // Check type annotations applicability rules
-        validateTypeAnnotations(tree);
     }
         // where
         /** check if a class is a subtype of Serializable, if that is available. */
@@ -3234,35 +3227,6 @@
         return types.capture(type);
     }
 
-    private void validateTypeAnnotations(JCTree tree) {
-        tree.accept(typeAnnotationsValidator);
-    }
-    //where
-    private final JCTree.Visitor typeAnnotationsValidator =
-        new TreeScanner() {
-        public void visitAnnotation(JCAnnotation tree) {
-            if (tree instanceof JCTypeAnnotation) {
-                chk.validateTypeAnnotation((JCTypeAnnotation)tree, false);
-            }
-            super.visitAnnotation(tree);
-        }
-        public void visitTypeParameter(JCTypeParameter tree) {
-            chk.validateTypeAnnotations(tree.annotations, true);
-            // don't call super. skip type annotations
-            scan(tree.bounds);
-        }
-        public void visitMethodDef(JCMethodDecl tree) {
-            // need to check static methods
-            if ((tree.sym.flags() & Flags.STATIC) != 0) {
-                for (JCTypeAnnotation a : tree.receiverAnnotations) {
-                    if (chk.isTypeAnnotation(a, false))
-                        log.error(a.pos(), "annotation.type.not.applicable");
-                }
-            }
-            super.visitMethodDef(tree);
-        }
-    };
-
     // <editor-fold desc="post-attribution visitor">
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1086,11 +1086,6 @@
             }
         }
 
-        @Override
-        public void visitAnnotatedType(JCAnnotatedType tree) {
-            tree.underlyingType.accept(this);
-        }
-
         /** Default visitor method: do nothing.
          */
         @Override
@@ -2239,14 +2234,6 @@
             validateAnnotation(a, s);
     }
 
-    /** Check the type annotations
-     */
-    public void validateTypeAnnotations(List<JCTypeAnnotation> annotations, boolean isTypeParameter) {
-        if (skipAnnotations) return;
-        for (JCTypeAnnotation a : annotations)
-            validateTypeAnnotation(a, isTypeParameter);
-    }
-
     /** Check an annotation of a symbol.
      */
     public void validateAnnotation(JCAnnotation a, Symbol s) {
@@ -2261,15 +2248,6 @@
         }
     }
 
-    public void validateTypeAnnotation(JCTypeAnnotation a, boolean isTypeParameter) {
-        if (a.type == null)
-            throw new AssertionError("annotation tree hasn't been attributed yet: " + a);
-        validateAnnotationTree(a);
-
-        if (!isTypeAnnotation(a, isTypeParameter))
-            log.error(a.pos(), "annotation.type.not.applicable");
-    }
-
     /** Is s a method symbol that overrides a method in a superclass? */
     boolean isOverrider(Symbol s) {
         if (s.kind != MTH || s.isStatic())
@@ -2288,25 +2266,6 @@
         return false;
     }
 
-    /** Is the annotation applicable to type annotations */
-    boolean isTypeAnnotation(JCTypeAnnotation a, boolean isTypeParameter) {
-        Attribute.Compound atTarget =
-            a.annotationType.type.tsym.attribute(syms.annotationTargetType.tsym);
-        if (atTarget == null) return true;
-        Attribute atValue = atTarget.member(names.value);
-        if (!(atValue instanceof Attribute.Array)) return true; // error recovery
-        Attribute.Array arr = (Attribute.Array) atValue;
-        for (Attribute app : arr.values) {
-            if (!(app instanceof Attribute.Enum)) return true; // recovery
-            Attribute.Enum e = (Attribute.Enum) app;
-            if (!isTypeParameter && e.value.name == names.TYPE_USE)
-                return true;
-            else if (isTypeParameter && e.value.name == names.TYPE_PARAMETER)
-                return true;
-        }
-        return false;
-    }
-
     /** Is the annotation applicable to the symbol? */
     boolean annotationApplicable(JCAnnotation a, Symbol s) {
         Attribute.Compound atTarget =
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,6 @@
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 
 import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.comp.Resolve;
 import com.sun.tools.javac.tree.JCTree.*;
 
 import static com.sun.tools.javac.code.Flags.*;
@@ -1350,11 +1349,6 @@
         }
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        // annotations don't get scanned
-        tree.underlyingType.accept(this);
-    }
-
     public void visitIdent(JCIdent tree) {
         if (tree.sym.kind == VAR) {
             checkInit(tree.pos(), (VarSymbol)tree.sym);
@@ -1373,7 +1367,6 @@
         if (!tree.type.isErroneous()
             && lint.isEnabled(Lint.LintCategory.CAST)
             && types.isSameType(tree.expr.type, tree.clazz.type)
-            && !(ignoreAnnotatedCasts && containsTypeAnnotation(tree.clazz))
             && !is292targetTypeCast(tree)) {
             log.warning(Lint.LintCategory.CAST,
                     tree.pos(), "redundant.cast", tree.expr.type);
@@ -1397,23 +1390,6 @@
     }
 
 /**************************************************************************
- * utility methods for ignoring type-annotated casts lint checking
- *************************************************************************/
-    private static final boolean ignoreAnnotatedCasts = true;
-    private static class AnnotationFinder extends TreeScanner {
-        public boolean foundTypeAnno = false;
-        public void visitAnnotation(JCAnnotation tree) {
-            foundTypeAnno = foundTypeAnno || (tree instanceof JCTypeAnnotation);
-        }
-    }
-
-    private boolean containsTypeAnnotation(JCTree e) {
-        AnnotationFinder finder = new AnnotationFinder();
-        finder.scan(e);
-        return finder.foundTypeAnno;
-    }
-
-/**************************************************************************
  * main method
  *************************************************************************/
 
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2585,11 +2585,6 @@
         result = tree;
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        tree.underlyingType = translate(tree.underlyingType);
-        result = tree.underlyingType;
-    }
-
     public void visitTypeCast(JCTypeCast tree) {
         tree.clazz = translate(tree.clazz);
         if (tree.type.isPrimitive() != tree.expr.type.isPrimitive())
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -928,10 +928,6 @@
             if (hasDeprecatedAnnotation(tree.mods.annotations))
                 c.flags_field |= DEPRECATED;
             annotateLater(tree.mods.annotations, baseEnv, c);
-            // class type parameters use baseEnv but everything uses env
-            for (JCTypeParameter tp : tree.typarams)
-                tp.accept(new TypeAnnotate(baseEnv));
-            tree.accept(new TypeAnnotate(env));
 
             chk.checkNonCyclicDecl(tree);
 
@@ -1014,86 +1010,6 @@
         }
     }
 
-    // A sub-phase that "compiles" annotations in annotated types.
-    private class TypeAnnotate extends TreeScanner {
-        private Env<AttrContext> env;
-        public TypeAnnotate(Env<AttrContext> env) { this.env = env; }
-
-        private void enterTypeAnnotations(List<JCTypeAnnotation> annotations) {
-            Set<TypeSymbol> annotated = new HashSet<TypeSymbol>();
-            if (!skipAnnotations)
-                for (List<JCTypeAnnotation> al = annotations; al.nonEmpty(); al = al.tail) {
-                    JCTypeAnnotation a = al.head;
-                    Attribute.Compound c = annotate.enterAnnotation(a,
-                            syms.annotationType,
-                            env);
-                    if (c == null) continue;
-                    Attribute.TypeCompound tc = new Attribute.TypeCompound(c.type, c.values, a.annotation_position);
-                    a.attribute_field = tc;
-                    // Note: @Deprecated has no effect on local variables and parameters
-                    if (!annotated.add(a.type.tsym))
-                        log.error(a.pos, "duplicate.annotation");
-                }
-        }
-
-        // each class (including enclosed inner classes) should be visited
-        // separately through MemberEnter.complete(Symbol)
-        // this flag is used to prevent from visiting inner classes.
-        private boolean isEnclosingClass = false;
-        @Override
-        public void visitClassDef(final JCClassDecl tree) {
-            if (isEnclosingClass)
-                return;
-            isEnclosingClass = true;
-            scan(tree.mods);
-            // type parameter need to be visited with a separate env
-            // scan(tree.typarams);
-            scan(tree.extending);
-            scan(tree.implementing);
-            scan(tree.defs);
-        }
-
-        private void annotate(final JCTree tree, final List<JCTypeAnnotation> annotations) {
-            annotate.later(new Annotate.Annotator() {
-                public String toString() {
-                    return "annotate " + annotations + " onto " + tree;
-                }
-                public void enterAnnotation() {
-                    JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
-                    try {
-                        enterTypeAnnotations(annotations);
-                    } finally {
-                        log.useSource(prev);
-                    }
-                }
-            });
-        }
-
-        @Override
-        public void visitAnnotatedType(final JCAnnotatedType tree) {
-            annotate(tree, tree.annotations);
-            super.visitAnnotatedType(tree);
-        }
-        @Override
-        public void visitTypeParameter(final JCTypeParameter tree) {
-            annotate(tree, tree.annotations);
-            super.visitTypeParameter(tree);
-        }
-        @Override
-        public void visitNewArray(final JCNewArray tree) {
-            annotate(tree, tree.annotations);
-            for (List<JCTypeAnnotation> dimAnnos : tree.dimAnnotations)
-                annotate(tree, dimAnnos);
-            super.visitNewArray(tree);
-        }
-        @Override
-        public void visitMethodDef(JCMethodDecl tree) {
-            annotate(tree, tree.receiverAnnotations);
-            super.visitMethodDef(tree);
-        }
-    }
-
-
     private Env<AttrContext> baseEnv(JCClassDecl tree, Env<AttrContext> env) {
         Scope baseScope = new Scope.ClassScope(tree.sym, scopeCounter);
         //import already entered local classes into base scope
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,7 +69,6 @@
     private boolean allowEnums;
     private Types types;
     private final Resolve resolve;
-    private final TypeAnnotations typeAnnotations;
 
     /**
      * Flag to indicate whether or not to generate bridge methods.
@@ -91,7 +90,6 @@
         types = Types.instance(context);
         make = TreeMaker.instance(context);
         resolve = Resolve.instance(context);
-        typeAnnotations = TypeAnnotations.instance(context);
     }
 
     /** A hashtable mapping bridge methods to the methods they override after
@@ -445,14 +443,12 @@
     }
 
     public void visitClassDef(JCClassDecl tree) {
-        typeAnnotations.taFillAndLift(tree, true);
         translateClass(tree.sym);
         result = tree;
     }
 
     JCMethodDecl currentMethod = null;
     public void visitMethodDef(JCMethodDecl tree) {
-        tree.sym.typeAnnotations = tree.sym.typeAnnotations;
         JCMethodDecl previousMethod = currentMethod;
         try {
             currentMethod = tree;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -207,10 +207,6 @@
     /** The minor version number of the class file being read. */
     int minorVersion;
 
-    /** Switch: debug output for JSR 308-related operations.
-     */
-    boolean debugJSR308;
-
     /** A table to hold the constant pool indices for method parameter
      * names, as given in LocalVariableTable attributes.
      */
@@ -297,7 +293,6 @@
             : null;
 
         typevars = new Scope(syms.noSymbol);
-        debugJSR308 = options.isSet("TA:reader");
 
         lintClassfile = Lint.instance(context).isEnabled(LintCategory.CLASSFILE);
 
@@ -1128,20 +1123,6 @@
                 }
             },
 
-            // v51 attributes
-            new AttributeReader(names.RuntimeVisibleTypeAnnotations, V51, CLASS_OR_MEMBER_ATTRIBUTE) {
-                void read(Symbol sym, int attrLen) {
-                    attachTypeAnnotations(sym);
-                }
-            },
-
-            new AttributeReader(names.RuntimeInvisibleTypeAnnotations, V51, CLASS_OR_MEMBER_ATTRIBUTE) {
-                void read(Symbol sym, int attrLen) {
-                    attachTypeAnnotations(sym);
-                }
-            },
-
-
             // The following attributes for a Code attribute are not currently handled
             // StackMapTable
             // SourceDebugExtension
@@ -1351,17 +1332,6 @@
         }
     }
 
-    void attachTypeAnnotations(final Symbol sym) {
-        int numAttributes = nextChar();
-        if (numAttributes != 0) {
-            ListBuffer<TypeAnnotationProxy> proxies =
-                ListBuffer.lb();
-            for (int i = 0; i < numAttributes; i++)
-                proxies.append(readTypeAnnotation());
-            annotate.later(new TypeAnnotationCompleter(sym, proxies.toList()));
-        }
-    }
-
     /** Attach the default value for an annotation element.
      */
     void attachAnnotationDefault(final Symbol sym) {
@@ -1398,121 +1368,6 @@
         return new CompoundAnnotationProxy(t, pairs.toList());
     }
 
-    TypeAnnotationProxy readTypeAnnotation() {
-        CompoundAnnotationProxy proxy = readCompoundAnnotation();
-        TypeAnnotationPosition position = readPosition();
-
-        if (debugJSR308)
-            System.out.println("TA: reading: " + proxy + " @ " + position
-                    + " in " + log.currentSourceFile());
-
-        return new TypeAnnotationProxy(proxy, position);
-    }
-
-    TypeAnnotationPosition readPosition() {
-        byte tag = nextByte();
-
-        if (!TargetType.isValidTargetTypeValue(tag))
-            throw this.badClassFile("bad.type.annotation.value", tag);
-
-        TypeAnnotationPosition position = new TypeAnnotationPosition();
-        TargetType type = TargetType.fromTargetTypeValue(tag);
-
-        position.type = type;
-
-        switch (type) {
-        // type case
-        case TYPECAST:
-        case TYPECAST_GENERIC_OR_ARRAY:
-        // object creation
-        case INSTANCEOF:
-        case INSTANCEOF_GENERIC_OR_ARRAY:
-        // new expression
-        case NEW:
-        case NEW_GENERIC_OR_ARRAY:
-            position.offset = nextChar();
-            break;
-         // local variable
-        case LOCAL_VARIABLE:
-        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-            int table_length = nextChar();
-            position.lvarOffset = new int[table_length];
-            position.lvarLength = new int[table_length];
-            position.lvarIndex = new int[table_length];
-
-            for (int i = 0; i < table_length; ++i) {
-                position.lvarOffset[i] = nextChar();
-                position.lvarLength[i] = nextChar();
-                position.lvarIndex[i] = nextChar();
-            }
-            break;
-         // method receiver
-        case METHOD_RECEIVER:
-            // Do nothing
-            break;
-        // type parameters
-        case CLASS_TYPE_PARAMETER:
-        case METHOD_TYPE_PARAMETER:
-            position.parameter_index = nextByte();
-            break;
-        // type parameter bounds
-        case CLASS_TYPE_PARAMETER_BOUND:
-        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_PARAMETER_BOUND:
-        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            position.parameter_index = nextByte();
-            position.bound_index = nextByte();
-            break;
-         // wildcard
-        case WILDCARD_BOUND:
-        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-            position.wildcard_position = readPosition();
-            break;
-         // Class extends and implements clauses
-        case CLASS_EXTENDS:
-        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            position.type_index = nextChar();
-            break;
-        // throws
-        case THROWS:
-            position.type_index = nextChar();
-            break;
-        case CLASS_LITERAL:
-        case CLASS_LITERAL_GENERIC_OR_ARRAY:
-            position.offset = nextChar();
-            break;
-        // method parameter: not specified
-        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-            position.parameter_index = nextByte();
-            break;
-        // method type argument: wasn't specified
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_ARGUMENT:
-        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            position.offset = nextChar();
-            position.type_index = nextByte();
-            break;
-        // We don't need to worry abut these
-        case METHOD_RETURN_GENERIC_OR_ARRAY:
-        case FIELD_GENERIC_OR_ARRAY:
-            break;
-        case UNKNOWN:
-            break;
-        default:
-            throw new AssertionError("unknown type: " + position);
-        }
-
-        if (type.hasLocation()) {
-            int len = nextChar();
-            ListBuffer<Integer> loc = ListBuffer.lb();
-            for (int i = 0; i < len; i++)
-                loc = loc.append((int)nextByte());
-            position.location = loc.toList();
-        }
-
-        return position;
-    }
     Attribute readAttributeValue() {
         char c = (char) buf[bp++];
         switch (c) {
@@ -1825,45 +1680,6 @@
         }
     }
 
-    class TypeAnnotationCompleter extends AnnotationCompleter {
-
-        List<TypeAnnotationProxy> proxies;
-
-        TypeAnnotationCompleter(Symbol sym,
-                List<TypeAnnotationProxy> proxies) {
-            super(sym, List.<CompoundAnnotationProxy>nil());
-            this.proxies = proxies;
-        }
-
-        List<Attribute.TypeCompound> deproxyTypeCompoundList(List<TypeAnnotationProxy> proxies) {
-            ListBuffer<Attribute.TypeCompound> buf = ListBuffer.lb();
-            for (TypeAnnotationProxy proxy: proxies) {
-                Attribute.Compound compound = deproxyCompound(proxy.compound);
-                Attribute.TypeCompound typeCompound = new Attribute.TypeCompound(compound, proxy.position);
-                buf.add(typeCompound);
-            }
-            return buf.toList();
-        }
-
-        @Override
-        public void enterAnnotation() {
-            JavaFileObject previousClassFile = currentClassFile;
-            try {
-                currentClassFile = classFile;
-                List<Attribute.TypeCompound> newList = deproxyTypeCompoundList(proxies);
-              if (debugJSR308)
-              System.out.println("TA: reading: adding " + newList
-                      + " to symbol " + sym + " in " + log.currentSourceFile());
-                sym.typeAnnotations = ((sym.typeAnnotations == null)
-                                        ? newList
-                                        : newList.prependList(sym.typeAnnotations));
-
-            } finally {
-                currentClassFile = previousClassFile;
-            }
-        }
-    }
-
 
 /************************************************************************
  * Reading Symbols
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,10 +65,6 @@
 
     private final Options options;
 
-    /** Switch: debugging output for JSR 308-related operations.
-     */
-    private boolean debugJSR308;
-
     /** Switch: verbose output.
      */
     private boolean verbose;
@@ -180,7 +176,6 @@
         types = Types.instance(context);
         fileManager = context.get(JavaFileManager.class);
 
-        debugJSR308    = options.isSet("TA:writer");
         verbose        = options.isSet(VERBOSE);
         scramble       = options.isSet("-scramble");
         scrambleAll    = options.isSet("-scrambleAll");
@@ -677,7 +672,6 @@
             acount++;
         }
         acount += writeJavaAnnotations(sym.getAnnotationMirrors());
-        acount += writeTypeAnnotations(sym.typeAnnotations);
         return acount;
     }
 
@@ -772,46 +766,6 @@
         return attrCount;
     }
 
-    int writeTypeAnnotations(List<Attribute.TypeCompound> typeAnnos) {
-        if (typeAnnos.isEmpty()) return 0;
-
-        ListBuffer<Attribute.TypeCompound> visibles = ListBuffer.lb();
-        ListBuffer<Attribute.TypeCompound> invisibles = ListBuffer.lb();
-
-        for (Attribute.TypeCompound tc : typeAnnos) {
-            if (tc.position.type == TargetType.UNKNOWN
-                || !tc.position.emitToClassfile())
-                continue;
-            switch (types.getRetention(tc)) {
-            case SOURCE: break;
-            case CLASS: invisibles.append(tc); break;
-            case RUNTIME: visibles.append(tc); break;
-            default: ;// /* fail soft */ throw new AssertionError(vis);
-            }
-        }
-
-        int attrCount = 0;
-        if (visibles.length() != 0) {
-            int attrIndex = writeAttr(names.RuntimeVisibleTypeAnnotations);
-            databuf.appendChar(visibles.length());
-            for (Attribute.TypeCompound p : visibles)
-                writeTypeAnnotation(p);
-            endAttr(attrIndex);
-            attrCount++;
-        }
-
-        if (invisibles.length() != 0) {
-            int attrIndex = writeAttr(names.RuntimeInvisibleTypeAnnotations);
-            databuf.appendChar(invisibles.length());
-            for (Attribute.TypeCompound p : invisibles)
-                writeTypeAnnotation(p);
-            endAttr(attrIndex);
-            attrCount++;
-        }
-
-        return attrCount;
-    }
-
     /** A visitor to write an attribute including its leading
      *  single-character marker.
      */
@@ -888,104 +842,6 @@
             p.snd.accept(awriter);
         }
     }
-
-    void writeTypeAnnotation(Attribute.TypeCompound c) {
-        if (debugJSR308)
-            System.out.println("TA: writing " + c + " at " + c.position
-                    + " in " + log.currentSourceFile());
-        writeCompoundAttribute(c);
-        writePosition(c.position);
-    }
-
-    void writePosition(TypeAnnotationPosition p) {
-        databuf.appendByte(p.type.targetTypeValue());
-        switch (p.type) {
-        // type case
-        case TYPECAST:
-        case TYPECAST_GENERIC_OR_ARRAY:
-        // object creation
-        case INSTANCEOF:
-        case INSTANCEOF_GENERIC_OR_ARRAY:
-        // new expression
-        case NEW:
-        case NEW_GENERIC_OR_ARRAY:
-            databuf.appendChar(p.offset);
-            break;
-         // local variable
-        case LOCAL_VARIABLE:
-        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-            databuf.appendChar(p.lvarOffset.length);  // for table length
-            for (int i = 0; i < p.lvarOffset.length; ++i) {
-                databuf.appendChar(p.lvarOffset[i]);
-                databuf.appendChar(p.lvarLength[i]);
-                databuf.appendChar(p.lvarIndex[i]);
-            }
-            break;
-         // method receiver
-        case METHOD_RECEIVER:
-            // Do nothing
-            break;
-        // type parameters
-        case CLASS_TYPE_PARAMETER:
-        case METHOD_TYPE_PARAMETER:
-            databuf.appendByte(p.parameter_index);
-            break;
-        // type parameters bounds
-        case CLASS_TYPE_PARAMETER_BOUND:
-        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_PARAMETER_BOUND:
-        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            databuf.appendByte(p.parameter_index);
-            databuf.appendByte(p.bound_index);
-            break;
-         // wildcards
-        case WILDCARD_BOUND:
-        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-            writePosition(p.wildcard_position);
-            break;
-         // Class extends and implements clauses
-        case CLASS_EXTENDS:
-        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            databuf.appendChar(p.type_index);
-            break;
-        // throws
-        case THROWS:
-            databuf.appendChar(p.type_index);
-            break;
-        case CLASS_LITERAL:
-        case CLASS_LITERAL_GENERIC_OR_ARRAY:
-            databuf.appendChar(p.offset);
-            break;
-        // method parameter: not specified
-        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-            databuf.appendByte(p.parameter_index);
-            break;
-        // method type argument: wasn't specified
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_ARGUMENT:
-        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            databuf.appendChar(p.offset);
-            databuf.appendByte(p.type_index);
-            break;
-        // We don't need to worry abut these
-        case METHOD_RETURN_GENERIC_OR_ARRAY:
-        case FIELD_GENERIC_OR_ARRAY:
-            break;
-        case UNKNOWN:
-            break;
-        default:
-            throw new AssertionError("unknown position: " + p);
-        }
-
-        // Append location data for generics/arrays.
-        if (p.type.hasLocation()) {
-            databuf.appendChar(p.location.size());
-            for (int i : p.location)
-                databuf.appendByte((byte)i);
-        }
-    }
-
 /**********************************************************************
  * Writing Objects
  **********************************************************************/
@@ -1698,7 +1554,6 @@
 
         acount += writeFlagAttrs(c.flags());
         acount += writeJavaAnnotations(c.getAnnotationMirrors());
-        acount += writeTypeAnnotations(c.typeAnnotations);
         acount += writeEnclosingMethodAttribute(c);
 
         poolbuf.appendInt(JAVA_MAGIC);
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1912,29 +1912,12 @@
                 if (length < Character.MAX_VALUE) {
                     v.length = length;
                     putVar(v);
-                    fillLocalVarPosition(v);
                 }
             }
         }
         state.defined.excl(adr);
     }
 
-    private void fillLocalVarPosition(LocalVar lv) {
-        if (lv == null || lv.sym == null
-                || lv.sym.typeAnnotations == null)
-            return;
-        for (Attribute.TypeCompound ta : lv.sym.typeAnnotations) {
-            TypeAnnotationPosition p = ta.position;
-            while (p != null) {
-                p.lvarOffset = new int[] { (int)lv.start_pc };
-                p.lvarLength = new int[] { (int)lv.length };
-                p.lvarIndex = new int[] { (int)lv.reg };
-                p.isValidOffset = true;
-                p = p.wildcard_position;
-            }
-        }
-    }
-
     /** Put a live variable range into the buffer to be output to the
      *  class file.
      */
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1682,7 +1682,6 @@
  *************************************************************************/
 
     public void visitApply(JCMethodInvocation tree) {
-        setTypeAnnotationPositions(tree.pos);
         // Generate code for method.
         Item m = genExpr(tree.meth, methodType);
         // Generate code for all arguments, where the expected types are
@@ -1718,48 +1717,10 @@
         result = items.makeStackItem(pt);
     }
 
-    private void setTypeAnnotationPositions(int treePos) {
-        MethodSymbol meth = code.meth;
-
-        for (Attribute.TypeCompound ta : meth.typeAnnotations) {
-            if (ta.position.pos == treePos) {
-                ta.position.offset = code.cp;
-                ta.position.lvarOffset = new int[] { code.cp };
-                ta.position.isValidOffset = true;
-            }
-        }
-
-        if (code.meth.getKind() != ElementKind.CONSTRUCTOR
-                && code.meth.getKind() != ElementKind.STATIC_INIT)
-            return;
-
-        for (Attribute.TypeCompound ta : meth.owner.typeAnnotations) {
-            if (ta.position.pos == treePos) {
-                ta.position.offset = code.cp;
-                ta.position.lvarOffset = new int[] { code.cp };
-                ta.position.isValidOffset = true;
-            }
-        }
-
-        ClassSymbol clazz = meth.enclClass();
-        for (Symbol s : new com.sun.tools.javac.model.FilteredMemberList(clazz.members())) {
-            if (!s.getKind().isField())
-                continue;
-            for (Attribute.TypeCompound ta : s.typeAnnotations) {
-                if (ta.position.pos == treePos) {
-                    ta.position.offset = code.cp;
-                    ta.position.lvarOffset = new int[] { code.cp };
-                    ta.position.isValidOffset = true;
-                }
-            }
-        }
-    }
-
     public void visitNewClass(JCNewClass tree) {
         // Enclosing instances or anonymous classes should have been eliminated
         // by now.
         assert tree.encl == null && tree.def == null;
-        setTypeAnnotationPositions(tree.pos);
 
         code.emitop2(new_, makeRef(tree.pos(), tree.type));
         code.emitop0(dup);
@@ -1774,7 +1735,6 @@
     }
 
     public void visitNewArray(JCNewArray tree) {
-        setTypeAnnotationPositions(tree.pos);
 
         if (tree.elems != null) {
             Type elemtype = types.elemtype(tree.type);
@@ -2104,7 +2064,6 @@
         }
 
     public void visitTypeCast(JCTypeCast tree) {
-        setTypeAnnotationPositions(tree.pos);
         result = genExpr(tree.expr, tree.clazz.type).load();
         // Additional code is only needed if we cast to a reference type
         // which is not statically a supertype of the expression's type.
@@ -2121,8 +2080,6 @@
     }
 
     public void visitTypeTest(JCInstanceOf tree) {
-        setTypeAnnotationPositions(tree.pos);
-
         genExpr(tree.expr, tree.expr.type).load();
         code.emitop2(instanceof_, makeRef(tree.pos(), tree.clazz.type));
         result = items.makeStackItem(syms.booleanType);
@@ -2164,15 +2121,9 @@
 
         if (tree.name == names._class) {
             assert target.hasClassLiterals();
-            setTypeAnnotationPositions(tree.pos);
             code.emitop2(ldc2, makeRef(tree.pos(), tree.selected.type));
             result = items.makeStackItem(pt);
             return;
-        } else if (tree.name == names.TYPE) {
-            // Set the annotation positions for primitive class literals
-            // (e.g. int.class) which have been converted to TYPE field
-            // access on the corresponding boxed type (e.g. Integer.TYPE).
-            setTypeAnnotationPositions(tree.pos);
         }
 
         Symbol ssym = TreeInfo.symbol(tree.selected);
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,7 +49,6 @@
 import javax.tools.JavaFileObject;
 import javax.tools.DiagnosticListener;
 
-//308 import com.sun.source.util.AbstractTypeProcessor;
 import com.sun.source.util.TaskEvent;
 import com.sun.source.util.TaskListener;
 import com.sun.tools.javac.api.JavacTaskImpl;
@@ -712,7 +711,6 @@
             }
 
             if (matchedNames.size() > 0 || ps.contributed) {
-//308                foundTypeProcessors = foundTypeProcessors || (ps.processor instanceof AbstractTypeProcessor);
                 boolean processingResult = callProcessor(ps.processor, typeElements, renv);
                 ps.contributed = true;
                 ps.removeSupportedOptions(unmatchedProcessorOptions);
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -971,8 +971,6 @@
     bad constant pool tag: {0} at {1}
 compiler.misc.bad.signature=\
     bad signature: {0}
-compiler.misc.bad.type.annotation.value=\
-    bad type annotation target type value: {0}
 compiler.misc.class.file.wrong.class=\
     class file contains wrong class: {0}
 compiler.misc.class.file.not.found=\
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -640,7 +640,6 @@
         public JCExpression restype;
         public List<JCTypeParameter> typarams;
         public List<JCVariableDecl> params;
-        public List<JCTypeAnnotation> receiverAnnotations;
         public List<JCExpression> thrown;
         public JCBlock body;
         public JCExpression defaultValue; // for annotation types
@@ -650,7 +649,6 @@
                             JCExpression restype,
                             List<JCTypeParameter> typarams,
                             List<JCVariableDecl> params,
-                            List<JCTypeAnnotation> receiver,
                             List<JCExpression> thrown,
                             JCBlock body,
                             JCExpression defaultValue,
@@ -661,7 +659,6 @@
             this.restype = restype;
             this.typarams = typarams;
             this.params = params;
-            this.receiverAnnotations = (receiver != null ? receiver : List.<JCTypeAnnotation>nil());
             this.thrown = thrown;
             this.body = body;
             this.defaultValue = defaultValue;
@@ -680,7 +677,6 @@
         public List<JCVariableDecl> getParameters() {
             return params;
         }
-        public List<JCTypeAnnotation> getReceiverAnnotations() { return receiverAnnotations; }
         public List<JCExpression> getThrows() {
             return thrown;
         }
@@ -1402,8 +1398,6 @@
     public static class JCNewArray extends JCExpression implements NewArrayTree {
         public JCExpression elemtype;
         public List<JCExpression> dims;
-        public List<JCTypeAnnotation> annotations;
-        public List<List<JCTypeAnnotation>> dimAnnotations;
         public List<JCExpression> elems;
         protected JCNewArray(JCExpression elemtype,
                            List<JCExpression> dims,
@@ -1411,8 +1405,6 @@
         {
             this.elemtype = elemtype;
             this.dims = dims;
-            this.annotations = List.nil();
-            this.dimAnnotations = List.nil();
             this.elems = elems;
         }
         @Override
@@ -1923,11 +1915,9 @@
     public static class JCTypeParameter extends JCTree implements TypeParameterTree {
         public Name name;
         public List<JCExpression> bounds;
-        public List<JCTypeAnnotation> annotations;
-        protected JCTypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annotations) {
+        protected JCTypeParameter(Name name, List<JCExpression> bounds) {
             this.name = name;
             this.bounds = bounds;
-            this.annotations = annotations;
         }
         @Override
         public void accept(Visitor v) { v.visitTypeParameter(this); }
@@ -1937,9 +1927,6 @@
         public List<JCExpression> getBounds() {
             return bounds;
         }
-        public List<JCTypeAnnotation> getAnnotations() {
-            return annotations;
-        }
         @Override
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitTypeParameter(this, d);
@@ -2030,16 +2017,6 @@
         }
     }
 
-    public static class JCTypeAnnotation extends JCAnnotation {
-        public TypeAnnotationPosition annotation_position;
-        public Attribute.TypeCompound attribute_field;
-
-        protected JCTypeAnnotation(JCTree annotationType, List<JCExpression> args) {
-            super(annotationType, args);
-            this.annotation_position = new TypeAnnotationPosition();
-        }
-    }
-
     public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
         public long flags;
         public List<JCAnnotation> annotations;
@@ -2067,40 +2044,6 @@
         }
     }
 
-    public static class JCAnnotatedType extends JCExpression
-//308            implements com.sun.source.tree.AnnotatedTypeTree
-    {
-        public List<JCTypeAnnotation> annotations;
-        public JCExpression underlyingType;
-        protected JCAnnotatedType(List<JCTypeAnnotation> annotations, JCExpression underlyingType) {
-            throw new UnsupportedOperationException();
-//308            this.annotations = annotations;
-//308            this.underlyingType = underlyingType;
-        }
-        @Override
-        public void accept(Visitor v) { v.visitAnnotatedType(this); }
-
-        public Kind getKind() {
-            throw new UnsupportedOperationException();
-//308            return Kind.ANNOTATED_TYPE;
-        }
-        public List<JCTypeAnnotation> getAnnotations() {
-            return annotations;
-        }
-        public JCExpression getUnderlyingType() {
-            return underlyingType;
-        }
-        @Override
-        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
-            throw new UnsupportedOperationException();
-//308            return v.visitAnnotatedType(this, d);
-        }
-        @Override
-        public int getTag() {
-            return ANNOTATED_TYPE;
-        }
-    }
-
     public static class JCErroneous extends JCExpression
             implements com.sun.source.tree.ErroneousTree {
         public List<? extends JCTree> errs;
@@ -2168,7 +2111,6 @@
                             JCExpression restype,
                             List<JCTypeParameter> typarams,
                             List<JCVariableDecl> params,
-                            List<JCTypeAnnotation> receiver,
                             List<JCExpression> thrown,
                             JCBlock body,
                             JCExpression defaultValue);
@@ -2290,7 +2232,6 @@
         public void visitTypeBoundKind(TypeBoundKind that)   { visitTree(that); }
         public void visitAnnotation(JCAnnotation that)       { visitTree(that); }
         public void visitModifiers(JCModifiers that)         { visitTree(that); }
-        public void visitAnnotatedType(JCAnnotatedType that) { visitTree(that); }
         public void visitErroneous(JCErroneous that)         { visitTree(that); }
         public void visitLetExpr(LetExpr that)               { visitTree(that); }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -224,15 +224,6 @@
         }
     }
 
-    public void printTypeAnnotations(List<JCTypeAnnotation> trees) throws IOException {
-        if (trees.nonEmpty())
-            print(" ");
-        for (List<JCTypeAnnotation> l = trees; l.nonEmpty(); l = l.tail) {
-            printExpr(l.head);
-            print(" ");
-        }
-    }
-
     /** Print documentation comment, if it exists
      *  @param tree    The tree for which a documentation comment should be printed.
      */
@@ -890,33 +881,21 @@
         try {
             if (tree.elemtype != null) {
                 print("new ");
-                printTypeAnnotations(tree.annotations);
                 JCTree elem = tree.elemtype;
-                printBaseElementType(elem);
-                boolean isElemAnnoType = elem instanceof JCAnnotatedType;
-                int i = 0;
-                List<List<JCTypeAnnotation>> da = tree.dimAnnotations;
+                if (elem.getTag() == JCTree.TYPEARRAY)
+                    printBaseElementType((JCArrayTypeTree) elem);
+                else
+                    printExpr(elem);
                 for (List<JCExpression> l = tree.dims; l.nonEmpty(); l = l.tail) {
-                    if (da.size() > i) {
-                        printTypeAnnotations(da.get(i));
-                    }
                     print("[");
-                    i++;
                     printExpr(l.head);
                     print("]");
                 }
-                if (tree.elems != null) {
-                    if (isElemAnnoType) {
-                        printTypeAnnotations(((JCAnnotatedType)tree.elemtype).annotations);
-                    }
-                    print("[]");
-                }
-                if (isElemAnnoType)
-                    elem = ((JCAnnotatedType)elem).underlyingType;
                 if (elem instanceof JCArrayTypeTree)
                     printBrackets((JCArrayTypeTree) elem);
             }
             if (tree.elems != null) {
+                if (tree.elemtype != null) print("[]");
                 print("{");
                 printExprs(tree.elems);
                 print("}");
@@ -1173,11 +1152,6 @@
         JCTree elem;
         while (true) {
             elem = tree.elemtype;
-            if (elem.getTag() == JCTree.ANNOTATED_TYPE) {
-                JCAnnotatedType atype = (JCAnnotatedType) elem;
-                printTypeAnnotations(atype.annotations);
-                elem = atype.underlyingType;
-            }
             print("[]");
             if (elem.getTag() != JCTree.TYPEARRAY) break;
             tree = (JCArrayTypeTree) elem;
@@ -1272,15 +1246,6 @@
         }
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        try {
-            printTypeAnnotations(tree.annotations);
-            printExpr(tree.underlyingType);
-        } catch (IOException e) {
-            throw new UncheckedIOException(e);
-        }
-    }
-
     public void visitTree(JCTree tree) {
         try {
             print("(UNKNOWN: " + tree + ")");
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,13 +71,6 @@
         return lb.toList();
     }
 
-//308    public JCTree visitAnnotatedType(AnnotatedTypeTree node, P p) {
-//308        JCAnnotatedType t = (JCAnnotatedType) node;
-//308        List<JCTypeAnnotation> annotations = copy(t.annotations, p);
-//308        JCExpression underlyingType = copy(t.underlyingType, p);
-//308        return M.at(t.pos).AnnotatedType(annotations, underlyingType);
-//308    }
-
     public JCTree visitAnnotation(AnnotationTree node, P p) {
         JCAnnotation t = (JCAnnotation) node;
         JCTree annotationType = copy(t.annotationType, p);
@@ -240,11 +233,10 @@
         JCExpression restype = copy(t.restype, p);
         List<JCTypeParameter> typarams = copy(t.typarams, p);
         List<JCVariableDecl> params = copy(t.params, p);
-        List<JCTypeAnnotation> receiver = copy(t.receiverAnnotations, p);
         List<JCExpression> thrown = copy(t.thrown, p);
         JCBlock body = copy(t.body, p);
         JCExpression defaultValue = copy(t.defaultValue, p);
-        return M.at(t.pos).MethodDef(mods, t.name, restype, typarams, params, receiver, thrown, body, defaultValue);
+        return M.at(t.pos).MethodDef(mods, t.name, restype, typarams, params, thrown, body, defaultValue);
     }
 
     public JCTree visitMethodInvocation(MethodInvocationTree node, P p) {
@@ -372,9 +364,8 @@
 
     public JCTree visitTypeParameter(TypeParameterTree node, P p) {
         JCTypeParameter t = (JCTypeParameter) node;
-        List<JCTypeAnnotation> annos = copy(t.annotations, p);
         List<JCExpression> bounds = copy(t.bounds, p);
-        return M.at(t.pos).TypeParameter(t.name, bounds, annos);
+        return M.at(t.pos).TypeParameter(t.name, bounds);
     }
 
     public JCTree visitInstanceOf(InstanceOfTree node, P p) {
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -311,12 +311,6 @@
         case(JCTree.POSTINC):
         case(JCTree.POSTDEC):
             return getStartPos(((JCUnary) tree).arg);
-        case(JCTree.ANNOTATED_TYPE): {
-            JCAnnotatedType node = (JCAnnotatedType) tree;
-            if (node.annotations.nonEmpty())
-                return getStartPos(node.annotations.head);
-            return getStartPos(node.underlyingType);
-        }
         case(JCTree.NEWCLASS): {
             JCNewClass node = (JCNewClass)tree;
             if (node.encl != null)
@@ -420,8 +414,6 @@
             return getEndPos(((JCUnary) tree).arg, endPositions);
         case(JCTree.WHILELOOP):
             return getEndPos(((JCWhileLoop) tree).body, endPositions);
-        case(JCTree.ANNOTATED_TYPE):
-            return getEndPos(((JCAnnotatedType) tree).underlyingType, endPositions);
         case(JCTree.ERRONEOUS): {
             JCErroneous node = (JCErroneous)tree;
             if (node.errs != null && node.errs.nonEmpty())
@@ -909,8 +901,6 @@
      */
     public static JCExpression typeIn(JCExpression tree) {
         switch (tree.getTag()) {
-        case JCTree.ANNOTATED_TYPE:
-            return ((JCAnnotatedType)tree).underlyingType;
         case JCTree.IDENT: /* simple names */
         case JCTree.TYPEIDENT: /* primitive name */
         case JCTree.SELECT: /* qualified name */
@@ -930,8 +920,6 @@
             return innermostType(((JCArrayTypeTree)type).elemtype);
         case JCTree.WILDCARD:
             return innermostType(((JCWildcard)type).inner);
-        case JCTree.ANNOTATED_TYPE:
-            return innermostType(((JCAnnotatedType)type).underlyingType);
         default:
             return type;
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -169,27 +169,11 @@
                                List<JCExpression> thrown,
                                JCBlock body,
                                JCExpression defaultValue) {
-        return MethodDef(
-                mods, name, restype, typarams, params,
-                null, thrown, body, defaultValue);
-    }
-
-    public JCMethodDecl MethodDef(JCModifiers mods,
-                               Name name,
-                               JCExpression restype,
-                               List<JCTypeParameter> typarams,
-                               List<JCVariableDecl> params,
-                               List<JCTypeAnnotation> receiver,
-                               List<JCExpression> thrown,
-                               JCBlock body,
-                               JCExpression defaultValue)
-    {
         JCMethodDecl tree = new JCMethodDecl(mods,
                                        name,
                                        restype,
                                        typarams,
                                        params,
-                                       receiver,
                                        thrown,
                                        body,
                                        defaultValue,
@@ -458,11 +442,7 @@
     }
 
     public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds) {
-        return TypeParameter(name, bounds, List.<JCTypeAnnotation>nil());
-    }
-
-    public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annos) {
-        JCTypeParameter tree = new JCTypeParameter(name, bounds, annos);
+        JCTypeParameter tree = new JCTypeParameter(name, bounds);
         tree.pos = pos;
         return tree;
     }
@@ -485,12 +465,6 @@
         return tree;
     }
 
-    public JCTypeAnnotation TypeAnnotation(JCTree annotationType, List<JCExpression> args) {
-        JCTypeAnnotation tree = new JCTypeAnnotation(annotationType, args);
-        tree.pos = pos;
-        return tree;
-    }
-
     public JCModifiers Modifiers(long flags, List<JCAnnotation> annotations) {
         JCModifiers tree = new JCModifiers(flags, annotations);
         boolean noFlags = (flags & (Flags.ModifierFlags | Flags.ANNOTATION)) == 0;
@@ -502,12 +476,6 @@
         return Modifiers(flags, List.<JCAnnotation>nil());
     }
 
-    public JCAnnotatedType AnnotatedType(List<JCTypeAnnotation> annotations, JCExpression underlyingType) {
-        JCAnnotatedType tree = new JCAnnotatedType(annotations, underlyingType);
-        tree.pos = pos;
-        return tree;
-    }
-
     public JCErroneous Erroneous() {
         return Erroneous(List.<JCTree>nil());
     }
@@ -821,7 +789,6 @@
                 Type(mtype.getReturnType()),
                 TypeParams(mtype.getTypeArguments()),
                 Params(mtype.getParameterTypes(), m),
-                null,
                 Types(mtype.getThrownTypes()),
                 body,
                 null,
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -85,7 +85,6 @@
         scan(tree.restype);
         scan(tree.typarams);
         scan(tree.params);
-        scan(tree.receiverAnnotations);
         scan(tree.thrown);
         scan(tree.defaultValue);
         scan(tree.body);
@@ -208,11 +207,8 @@
     }
 
     public void visitNewArray(JCNewArray tree) {
-        scan(tree.annotations);
         scan(tree.elemtype);
         scan(tree.dims);
-        for (List<JCTypeAnnotation> annos : tree.dimAnnotations)
-            scan(annos);
         scan(tree.elems);
     }
 
@@ -281,7 +277,6 @@
     }
 
     public void visitTypeParameter(JCTypeParameter tree) {
-        scan(tree.annotations);
         scan(tree.bounds);
     }
 
@@ -305,11 +300,6 @@
         scan(tree.args);
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        scan(tree.annotations);
-        scan(tree.underlyingType);
-    }
-
     public void visitErroneous(JCErroneous tree) {
     }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -283,11 +283,6 @@
     }
 
     public void visitNewArray(JCNewArray tree) {
-        tree.annotations = translate(tree.annotations);
-        List<List<JCTypeAnnotation>> dimAnnos = List.nil();
-        for (List<JCTypeAnnotation> origDimAnnos : tree.dimAnnotations)
-            dimAnnos = dimAnnos.append(translate(origDimAnnos));
-        tree.dimAnnotations = dimAnnos;
         tree.elemtype = translate(tree.elemtype);
         tree.dims = translate(tree.dims);
         tree.elems = translate(tree.elems);
@@ -374,7 +369,6 @@
     }
 
     public void visitTypeParameter(JCTypeParameter tree) {
-        tree.annotations = translate(tree.annotations);
         tree.bounds = translate(tree.bounds);
         result = tree;
     }
@@ -412,12 +406,6 @@
         result = tree;
     }
 
-    public void visitAnnotatedType(JCAnnotatedType tree) {
-        tree.annotations = translate(tree.annotations);
-        tree.underlyingType = translate(tree.underlyingType);
-        result = tree;
-    }
-
     public void visitTree(JCTree tree) {
         throw new AssertionError(tree);
     }
--- a/langtools/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
 package com.sun.tools.javap;
 
 import com.sun.tools.classfile.Annotation;
-import com.sun.tools.classfile.ExtendedAnnotation;
 import com.sun.tools.classfile.Annotation.Annotation_element_value;
 import com.sun.tools.classfile.Annotation.Array_element_value;
 import com.sun.tools.classfile.Annotation.Class_element_value;
@@ -77,129 +76,6 @@
             print(")");
     }
 
-    public void write(ExtendedAnnotation annot) {
-        write(annot, true, false);
-    }
-
-    public void write(ExtendedAnnotation annot, boolean showOffsets, boolean resolveIndices) {
-        write(annot.annotation, resolveIndices);
-        print(": ");
-        write(annot.position, showOffsets);
-    }
-
-    public void write(ExtendedAnnotation.Position pos, boolean showOffsets) {
-        print(pos.type);
-
-        switch (pos.type) {
-        // type case
-        case TYPECAST:
-        case TYPECAST_GENERIC_OR_ARRAY:
-        // object creation
-        case INSTANCEOF:
-        case INSTANCEOF_GENERIC_OR_ARRAY:
-        // new expression
-        case NEW:
-        case NEW_GENERIC_OR_ARRAY:
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            if (showOffsets) {
-                print(", offset=");
-                print(pos.offset);
-            }
-            break;
-         // local variable
-        case LOCAL_VARIABLE:
-        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
-            print(", {");
-            for (int i = 0; i < pos.lvarOffset.length; ++i) {
-                if (i != 0) print("; ");
-                if (showOffsets) {
-                    print(", start_pc=");
-                    print(pos.lvarOffset[i]);
-                }
-                print(", length=");
-                print(pos.lvarLength[i]);
-                print(", index=");
-                print(pos.lvarIndex[i]);
-            }
-            print("}");
-            break;
-         // method receiver
-        case METHOD_RECEIVER:
-            // Do nothing
-            break;
-        // type parameters
-        case CLASS_TYPE_PARAMETER:
-        case METHOD_TYPE_PARAMETER:
-            print(", param_index=");
-            print(pos.parameter_index);
-            break;
-        // type parameters bound
-        case CLASS_TYPE_PARAMETER_BOUND:
-        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-        case METHOD_TYPE_PARAMETER_BOUND:
-        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
-            print(", param_index=");
-            print(pos.parameter_index);
-            print(", bound_index=");
-            print(pos.bound_index);
-            break;
-         // wildcard
-        case WILDCARD_BOUND:
-        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-            print(", wild_card=");
-            print(pos.wildcard_position);
-            break;
-         // Class extends and implements clauses
-        case CLASS_EXTENDS:
-        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            print(", type_index=");
-            print(pos.type_index);
-            break;
-        // throws
-        case THROWS:
-            print(", type_index=");
-            print(pos.type_index);
-            break;
-        case CLASS_LITERAL:
-        case CLASS_LITERAL_GENERIC_OR_ARRAY:
-            if (showOffsets) {
-                print(", offset=");
-                print(pos.offset);
-            }
-            break;
-        // method parameter: not specified
-        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
-            print(", param_index=");
-            print(pos.parameter_index);
-            break;
-        // method type argument: wasn't specified
-        case METHOD_TYPE_ARGUMENT:
-        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
-            if (showOffsets) {
-                print(", offset=");
-                print(pos.offset);
-            }
-            print(", type_index=");
-            print(pos.type_index);
-            break;
-        // We don't need to worry abut these
-        case METHOD_RETURN_GENERIC_OR_ARRAY:
-        case FIELD_GENERIC_OR_ARRAY:
-            break;
-        case UNKNOWN:
-            break;
-        default:
-            throw new AssertionError("unknown type: " + pos.type);
-        }
-
-        // Append location data for generics/arrays.
-        if (pos.type.hasLocation()) {
-            print(", location=");
-            print(pos.location);
-        }
-    }
-
     public void write(Annotation.element_value_pair pair) {
         write(pair, false);
     }
--- a/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,10 +47,8 @@
 import com.sun.tools.classfile.LocalVariableTypeTable_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeVisibleAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeVisibleParameterAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;
 import com.sun.tools.classfile.Signature_attribute;
 import com.sun.tools.classfile.SourceDebugExtension_attribute;
 import com.sun.tools.classfile.SourceFile_attribute;
@@ -392,30 +390,6 @@
         return null;
     }
 
-    public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, Void ignore) {
-        println("RuntimeVisibleTypeAnnotations:");
-        indent(+1);
-        for (int i = 0; i < attr.annotations.length; i++) {
-            print(i + ": ");
-            annotationWriter.write(attr.annotations[i]);
-            println();
-        }
-        indent(-1);
-        return null;
-    }
-
-    public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, Void ignore) {
-        println("RuntimeInvisibleTypeAnnotations:");
-        indent(+1);
-        for (int i = 0; i < attr.annotations.length; i++) {
-            print(i + ": ");
-            annotationWriter.write(attr.annotations[i]);
-            println();
-        }
-        indent(-1);
-        return null;
-    }
-
     public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, Void ignore) {
         println("RuntimeVisibleParameterAnnotations:");
         indent(+1);
--- a/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,7 +64,6 @@
         stackMapWriter = StackMapWriter.instance(context);
         localVariableTableWriter = LocalVariableTableWriter.instance(context);
         localVariableTypeTableWriter = LocalVariableTypeTableWriter.instance(context);
-        typeAnnotationWriter = TypeAnnotationWriter.instance(context);
         options = Options.instance(context);
     }
 
@@ -266,11 +265,6 @@
             detailWriters.add(tryBlockWriter);
         }
 
-        if (options.details.contains(InstructionDetailWriter.Kind.TYPE_ANNOS)) {
-            typeAnnotationWriter.reset(attr);
-            detailWriters.add(typeAnnotationWriter);
-        }
-
         return detailWriters;
     }
 
@@ -279,7 +273,6 @@
     private ConstantWriter constantWriter;
     private LocalVariableTableWriter localVariableTableWriter;
     private LocalVariableTypeTableWriter localVariableTypeTableWriter;
-    private TypeAnnotationWriter typeAnnotationWriter;
     private SourceWriter sourceWriter;
     private StackMapWriter stackMapWriter;
     private TryBlockWriter tryBlockWriter;
--- a/langtools/src/share/classes/com/sun/tools/javap/InstructionDetailWriter.java	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javap/InstructionDetailWriter.java	Mon Jan 10 14:57:59 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,13 +42,13 @@
         LOCAL_VAR_TYPES("localVariableTypes"),
         SOURCE("source"),
         STACKMAPS("stackMaps"),
-        TRY_BLOCKS("tryBlocks"),
-        TYPE_ANNOS("typeAnnotations");
+        TRY_BLOCKS("tryBlocks");
         Kind(String option) {
             this.option = option;
         }
         final String option;
     }
+
     InstructionDetailWriter(Context context) {
         super(context);
     }
--- a/langtools/src/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java	Wed Jan 05 09:59:01 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.tools.javap;
-
-import com.sun.tools.classfile.Attribute;
-import com.sun.tools.classfile.Code_attribute;
-import com.sun.tools.classfile.ExtendedAnnotation;
-import com.sun.tools.classfile.ExtendedAnnotation.Position;
-import com.sun.tools.classfile.Instruction;
-import com.sun.tools.classfile.Method;
-import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeTypeAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Annotate instructions with details about type annotations.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class TypeAnnotationWriter extends InstructionDetailWriter {
-    public enum NoteKind { VISIBLE, INVISIBLE };
-    public static class Note {
-        Note(NoteKind kind, ExtendedAnnotation anno) {
-            this.kind = kind;
-            this.anno = anno;
-        }
-        public final NoteKind kind;
-        public final ExtendedAnnotation anno;
-    }
-
-    static TypeAnnotationWriter instance(Context context) {
-        TypeAnnotationWriter instance = context.get(TypeAnnotationWriter.class);
-        if (instance == null)
-            instance = new TypeAnnotationWriter(context);
-        return instance;
-    }
-
-    protected TypeAnnotationWriter(Context context) {
-        super(context);
-        context.put(TypeAnnotationWriter.class, this);
-        annotationWriter = AnnotationWriter.instance(context);
-        classWriter = ClassWriter.instance(context);
-    }
-
-    public void reset(Code_attribute attr) {
-        Method m = classWriter.getMethod();
-        pcMap = new HashMap<Integer, List<Note>>();
-        check(NoteKind.VISIBLE, (RuntimeVisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeVisibleTypeAnnotations));
-        check(NoteKind.INVISIBLE, (RuntimeInvisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeInvisibleTypeAnnotations));
-    }
-
-    private void check(NoteKind kind, RuntimeTypeAnnotations_attribute attr) {
-        if (attr == null)
-            return;
-
-        for (ExtendedAnnotation anno: attr.annotations) {
-            Position p = anno.position;
-            Note note = null;
-            if (p.offset != -1)
-                addNote(p.offset, note = new Note(kind, anno));
-            if (p.lvarOffset != null) {
-                for (int i = 0; i < p.lvarOffset.length; i++) {
-                    if (note == null)
-                        note = new Note(kind, anno);
-                    addNote(p.lvarOffset[i], note);
-                }
-            }
-        }
-    }
-
-    private void addNote(int pc, Note note) {
-        List<Note> list = pcMap.get(pc);
-        if (list == null)
-            pcMap.put(pc, list = new ArrayList<Note>());
-        list.add(note);
-    }
-
-    @Override
-    void writeDetails(Instruction instr) {
-        String indent = space(2); // get from Options?
-        int pc = instr.getPC();
-        List<Note> notes = pcMap.get(pc);
-        if (notes != null) {
-            for (Note n: notes) {
-                print(indent);
-                print("@");
-                annotationWriter.write(n.anno, false, true);
-                print(", ");
-                println(n.kind.toString().toLowerCase());
-            }
-        }
-    }
-
-    private AnnotationWriter annotationWriter;
-    private ClassWriter classWriter;
-    private Map<Integer, List<Note>> pcMap;
-}
--- a/langtools/test/tools/javac/diags/examples.not-yet.txt	Wed Jan 05 09:59:01 2011 +0000
+++ b/langtools/test/tools/javac/diags/examples.not-yet.txt	Mon Jan 10 14:57:59 2011 -0800
@@ -52,7 +52,6 @@
 compiler.misc.bad.enclosing.method                      # bad class file
 compiler.misc.bad.runtime.invisible.param.annotations   # bad class file
 compiler.misc.bad.signature                             # bad class file
-compiler.misc.bad.type.annotation.value
 compiler.misc.base.membership                           # UNUSED
 compiler.misc.ccf.found.later.version
 compiler.misc.ccf.unrecognized.attribute