1 /* 2 * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Sun designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Sun in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 22 * CA 95054 USA or visit www.sun.com if you need additional information or 23 * have any questions. 24 */ 25 26 /** 27 * Interfaces used to model elements of the Java programming language. 28 * 29 * The term "element" in this package is used to refer to program 30 * elements, the declared entities that make up a program. Elements 31 * include classes, interfaces, methods, constructors, and fields. 32 * The interfaces in this package do not model the structure of a 33 * program inside a method body; for example there is no 34 * representation of a {@code for} loop or {@code try}-{@code finally} 35 * block. However, the interfaces can model some structures only 36 * appearing inside method bodies, such as local variables and 37 * anonymous classes. 38 * 39 * <p>When used in the context of annotation processing, an accurate 40 * model of the element being represented must be returned. As this 41 * is a language model, the source code provides the fiducial 42 * (reference) representation of the construct in question rather than 43 * a representation in an executable output like a class file. 44 * Executable output may serve as the basis for creating a modeling 45 * element. However, the process of translating source code to 46 * executable output may not permit recovering some aspects of the 47 * source code representation. For example, annotations with 48 * {@linkplain java.lang.annotation.RetentionPolicy#SOURCE source} 49 * {@linkplain java.lang.annotation.Retention retention} cannot be 50 * recovered from class files and class files might not be able to 51 * provide source position information. The {@linkplain 52 * javax.lang.model.element.Modifier modifiers} on an element may 53 * differ in some cases including 54 * 55 * <ul> 56 * <li> {@code strictfp} on a class or interface 57 * <li> {@code final} on a parameter 58 * <li> {@code protected}, {@code private}, and {@code static} on classes and interfaces 59 * </ul> 60 * 61 * Additionally, synthetic constructs in a class file, such as 62 * accessor methods used in implementing nested classes and bridge 63 * methods used in implementing covariant returns, are translation 64 * artifacts outside of this model. 65 * 66 * <p>During annotation processing, operating on incomplete or 67 * erroneous programs is necessary; however, there are fewer 68 * guarantees about the nature of the resulting model. If the source 69 * code is not syntactically well-formed, a model may or may not be 70 * provided as a quality of implementation issue. If a program is 71 * syntactically valid but erroneous in some other fashion, the 72 * returned model must have no less information than if all the method 73 * bodies in the program were replaced by {@code "throw new 74 * RuntimeException();"}. If a program refers to a missing type XYZ, 75 * the returned model must contain no less information than if the 76 * declaration of type XYZ were assumed to be {@code "class XYZ {}"}, 77 * {@code "interface XYZ {}"}, {@code "enum XYZ {}"}, or {@code 78 * "@interface XYZ {}"}. If a program refers to a missing type {@code 79 * XYZ<K1, ... ,Kn>}, the returned model must contain no less 80 * information than if the declaration of XYZ were assumed to be 81 * {@code "class XYZ<T1, ... ,Tn> {}"} or {@code "interface XYZ<T1, 82 * ... ,Tn> {}"} 83 * 84 * <p> Unless otherwise specified in a particular implementation, the 85 * collections returned by methods in this package should be expected 86 * to be unmodifiable by the caller and unsafe for concurrent access. 87 * 88 * <p> Unless otherwise specified, methods in this package will throw 89 * a {@code NullPointerException} if given a {@code null} argument. 90 * 91 * @author Joseph D. Darcy 92 * @author Scott Seligman 93 * @author Peter von der Ahé 94 * @since 1.6 95 */ 96 package javax.lang.model.element;