TargetType.java revision 308
2N/A * Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved. 2N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2N/A * This code is free software; you can redistribute it and/or modify it 2N/A * under the terms of the GNU General Public License version 2 only, as 2N/A * published by the Free Software Foundation. Sun designates this 2N/A * particular file as subject to the "Classpath" exception as provided 2N/A * by Sun in the LICENSE file that accompanied this code. 2N/A * This code is distributed in the hope that it will be useful, but WITHOUT 2N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 2N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 2N/A * version 2 for more details (a copy is included in the LICENSE file that 2N/A * accompanied this code). 2N/A * You should have received a copy of the GNU General Public License version 2N/A * 2 along with this work; if not, write to the Free Software Foundation, 2N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 2N/A * CA 95054 USA or visit www.sun.com if you need additional information or 2N/A * have any questions. * Describes the type of program element an extended annotation (or extended * compound attribute) targets. * By comparison, a Tree.Kind has enum values for all elements in the AST, and * it does not provide enough resolution for type arguments (i.e., whether an * annotation targets a type argument in a local variable, method return type, * <p><b>This is NOT part of any API supported by Sun Microsystems. 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> // Some target types are commented out, because Java doesn't permit such // targets. They are included here to confirm that their omission is // intentional omission not an accidental omission. /** For annotations on typecasts. */ /** For annotations on a type argument or nested array of a typecast. */ /** For annotations on type tests. */ /** For annotations on a type argument or nested array of a type test. */ /** For annotations on object creation expressions. */ * For annotations on a type argument or nested array of an object creation /** For annotations on the method receiver. */ //@Deprecated METHOD_RECEIVER_GENERIC_OR_ARRAY(0x07, HasLocation), /** For annotations on local variables. */ /** For annotations on a type argument or nested array of a local. */ // handled by regular annotations //@Deprecated METHOD_RETURN(0x0A), * For annotations on a type argument or nested array of a method return // handled by regular annotations //@Deprecated METHOD_PARAMETER(0x0C), /** For annotations on a type argument or nested array of a method parameter. */ // handled by regular annotations //@Deprecated FIELD(0x0E), /** For annotations on a type argument or nested array of a field. */ /** For annotations on a bound of a type parameter of a class. */ * For annotations on a type argument or nested array of a bound of a type /** For annotations on a bound of a type parameter of a method. */ * For annotations on a type argument or nested array of a bound of a type /** For annotations on the type of an "extends" or "implements" clause. */ /** For annotations on the inner type of an "extends" or "implements" clause. */ /** For annotations on a throws clause in a method declaration. */ //@Deprecated THROWS_GENERIC_OR_ARRAY(0x17, HasLocation), /** For annotations in type arguments of object creation expressions. */ //@Deprecated METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY(0x21, HasLocation, HasParameter), //@Deprecated CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY(0x23, HasLocation, HasParameter), /** For annotations with an unknown target. */ * 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 * Returns whether or not this TargetType represents an annotation whose * target has a parameter index. * @return true if this TargetType has a parameter index, * 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