Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/src/share/classes/javax/lang/model/element/package-info.java
38899 views
/*1* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425/**26* Interfaces used to model elements of the Java programming language.27*28* The term "element" in this package is used to refer to program29* elements, the declared entities that make up a program. Elements30* include classes, interfaces, methods, constructors, and fields.31* The interfaces in this package do not model the structure of a32* program inside a method body; for example there is no33* representation of a {@code for} loop or {@code try}-{@code finally}34* block. However, the interfaces can model some structures only35* appearing inside method bodies, such as local variables and36* anonymous classes.37*38* <p>When used in the context of annotation processing, an accurate39* model of the element being represented must be returned. As this40* is a language model, the source code provides the fiducial41* (reference) representation of the construct in question rather than42* a representation in an executable output like a class file.43* Executable output may serve as the basis for creating a modeling44* element. However, the process of translating source code to45* executable output may not permit recovering some aspects of the46* source code representation. For example, annotations with47* {@linkplain java.lang.annotation.RetentionPolicy#SOURCE source}48* {@linkplain java.lang.annotation.Retention retention} cannot be49* recovered from class files and class files might not be able to50* provide source position information.51*52* Names of parameters may not be recoverable from class files.53*54* The {@linkplain javax.lang.model.element.Modifier modifiers} on an55* element may differ in some cases including:56*57* <ul>58* <li> {@code strictfp} on a class or interface59* <li> {@code final} on a parameter60* <li> {@code protected}, {@code private}, and {@code static} on classes and interfaces61* </ul>62*63* Additionally, synthetic constructs in a class file, such as64* accessor methods used in implementing nested classes and bridge65* methods used in implementing covariant returns, are translation66* artifacts outside of this model.67*68* <p>During annotation processing, operating on incomplete or69* erroneous programs is necessary; however, there are fewer70* guarantees about the nature of the resulting model. If the source71* code is not syntactically well-formed or has some other72* irrecoverable error that could not be removed by the generation of73* new types, a model may or may not be provided as a quality of74* implementation issue.75* If a program is syntactically valid but erroneous in some other76* fashion, any returned model must have no less information than if77* all the method bodies in the program were replaced by {@code "throw78* new RuntimeException();"}. If a program refers to a missing type XYZ,79* the returned model must contain no less information than if the80* declaration of type XYZ were assumed to be {@code "class XYZ {}"},81* {@code "interface XYZ {}"}, {@code "enum XYZ {}"}, or {@code82* "@interface XYZ {}"}. If a program refers to a missing type {@code83* XYZ<K1, ... ,Kn>}, the returned model must contain no less84* information than if the declaration of XYZ were assumed to be85* {@code "class XYZ<T1, ... ,Tn> {}"} or {@code "interface XYZ<T1,86* ... ,Tn> {}"}87*88* <p> Unless otherwise specified in a particular implementation, the89* collections returned by methods in this package should be expected90* to be unmodifiable by the caller and unsafe for concurrent access.91*92* <p> Unless otherwise specified, methods in this package will throw93* a {@code NullPointerException} if given a {@code null} argument.94*95* @author Joseph D. Darcy96* @author Scott Seligman97* @author Peter von der Ahé98* @since 1.699*/100package javax.lang.model.element;101102103