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 * <p>When used in the context of annotation processing, an accurate 30 * model of the element being represented must be returned. As this 31 * is a language model, the source code provides the fiducial 32 * (reference) representation of the construct in question rather than 33 * a representation in an executable output like a class file. 34 * Executable output may serve as the basis for creating a modeling 35 * element. However, the process of translating source code to 36 * executable output may not permit recovering some aspects of the 37 * source code representation. For example, annotations with 38 * {@linkplain java.lang.annotation.RetentionPolicy#SOURCE source} 39 * {@linkplain java.lang.annotation.Retention retention} cannot be 40 * recovered from class files and class files might not be able to 41 * provide source position information. The {@linkplain 42 * javax.lang.model.element.Modifier modifiers} on an element may 43 * differ in some cases including 44 * 45 * <ul> 46 * <li> {@code strictfp} on a class or interface 47 * <li> {@code final} on a parameter 48 * <li> {@code protected}, {@code private}, and {@code static} on classes and interfaces 49 * </ul> 50 * 51 * Additionally, synthetic constructs in a class file, such as 52 * accessor methods used in implementing nested classes and bridge 53 * methods used in implementing covariant returns, are translation 54 * artifacts outside of this model. 55 * 56 * <p>During annotation processing, operating on incomplete or 57 * erroneous programs is necessary; however, there are fewer 58 * guarantees about the nature of the resulting model. If the source 59 * code is not syntactically well-formed, a model may or may not be 60 * provided as a quality of implementation issue. If a program is 61 * syntactically valid but erroneous in some other fashion, the 62 * returned model must have no less information than if all the method 63 * bodies in the program were replaced by {@code "throw new 64 * RuntimeException();"}. If a program refers to a missing type XYZ, 65 * the returned model must contain no less information than if the 66 * declaration of type XYZ were assumed to be {@code "class XYZ {}"}, 67 * {@code "interface XYZ {}"}, {@code "enum XYZ {}"}, or {@code 68 * "@interface XYZ {}"}. If a program refers to a missing type {@code 69 * XYZ<K1, ... ,Kn>}, the returned model must contain no less 70 * information than if the declaration of XYZ were assumed to be 71 * {@code "class XYZ<T1, ... ,Tn> {}"} or {@code "interface XYZ<T1, 72 * ... ,Tn> {}"} 73 * 74 * <p> Unless otherwise specified in a particular implementation, the 75 * collections returned by methods in this package should be expected 76 * to be unmodifiable by the caller and unsafe for concurrent access. 77 * 78 * <p> Unless otherwise specified, methods in this package will throw 79 * a {@code NullPointerException} if given a {@code null} argument. 80 * 81 * @author Joseph D. Darcy 82 * @author Scott Seligman 83 * @author Peter von der Ahé 84 * @since 1.6 85 */ 86 package javax.lang.model.element;