package-info.java revision 3936:ec4be8a26914
11573Srgrimes/* 21573Srgrimes * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. 31573Srgrimes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41573Srgrimes * 51573Srgrimes * This code is free software; you can redistribute it and/or modify it 61573Srgrimes * under the terms of the GNU General Public License version 2 only, as 71573Srgrimes * published by the Free Software Foundation. Oracle designates this 81573Srgrimes * particular file as subject to the "Classpath" exception as provided 91573Srgrimes * by Oracle in the LICENSE file that accompanied this code. 101573Srgrimes * 111573Srgrimes * This code is distributed in the hope that it will be useful, but WITHOUT 121573Srgrimes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 131573Srgrimes * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 141573Srgrimes * version 2 for more details (a copy is included in the LICENSE file that 151573Srgrimes * accompanied this code). 161573Srgrimes * 171573Srgrimes * You should have received a copy of the GNU General Public License version 181573Srgrimes * 2 along with this work; if not, write to the Free Software Foundation, 191573Srgrimes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 201573Srgrimes * 211573Srgrimes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 221573Srgrimes * or visit www.oracle.com if you need additional information or have any 231573Srgrimes * questions. 241573Srgrimes */ 251573Srgrimes 261573Srgrimes/** 271573Srgrimes * Interfaces used to model elements of the Java programming language. 281573Srgrimes * 291573Srgrimes * The term "element" in this package is used to refer to program 301573Srgrimes * elements, the declared entities that make up a program. Elements 313565Swollman * include classes, interfaces, methods, constructors, and fields. 321573Srgrimes * The interfaces in this package do not model the structure of a 3390039Sobrien * program inside a method body; for example there is no 3490039Sobrien * representation of a {@code for} loop or {@code try}-{@code finally} 351573Srgrimes * block. However, the interfaces can model some structures only 361573Srgrimes * appearing inside method bodies, such as local variables and 371573Srgrimes * anonymous classes. 381573Srgrimes * 393565Swollman * <p>When used in the context of annotation processing, an accurate 40153009Sambrisko * model of the element being represented must be returned. As this 41153009Sambrisko * is a language model, the source code provides the fiducial 421573Srgrimes * (reference) representation of the construct in question rather than 431573Srgrimes * a representation in an executable output like a class file. 4474729Speter * Executable output may serve as the basis for creating a modeling 451573Srgrimes * element. However, the process of translating source code to 461573Srgrimes * executable output may not permit recovering some aspects of the 471573Srgrimes * source code representation. For example, annotations with 48184177Skib * {@linkplain java.lang.annotation.RetentionPolicy#SOURCE source} 493565Swollman * {@linkplain java.lang.annotation.Retention retention} cannot be 501573Srgrimes * recovered from class files and class files might not be able to 511573Srgrimes * provide source position information. 52184177Skib * 531573Srgrimes * Names of parameters may not be recoverable from class files. 541573Srgrimes * 55184177Skib * The {@linkplain javax.lang.model.element.Modifier modifiers} on an 56184177Skib * element created from a class file may differ in some cases from an 57184177Skib * element for the same declaration created from a source file 58184177Skib * including: 59184177Skib * 60184177Skib * <ul> 61184177Skib * <li> {@code strictfp} on a class or interface 62184177Skib * <li> {@code final} on a parameter 63184177Skib * <li> {@code protected}, {@code private}, and {@code static} on classes and interfaces 64184177Skib * </ul> 65184177Skib * 66184177Skib * Some elements which are {@linkplain 67184177Skib * javax.lang.model.util.Elements.Origin#MANDATED mandated} may not be 68184177Skib * marked as such when created from class files. 693565Swollman * 70184177Skib * Additionally, {@linkplain 711573Srgrimes * javax.lang.model.util.Elements.Origin#SYNTHETIC synthetic} 721573Srgrimes * constructs in a class file, such as accessor methods used in 73184177Skib * implementing nested classes and {@linkplain 743565Swollman * javax.lang.model.util.Elements.Origin#isBridge(ExecutableElement) 75184177Skib * bridge methods} used in implementing covariant returns, are 76184177Skib * translation artifacts strictly outside of this model. However, when 773565Swollman * operating on class files, it is helpful be able to operate on such 783565Swollman * elements, screening them out when appropriate. 793565Swollman * 803565Swollman * <p>During annotation processing, operating on incomplete or 81184177Skib * erroneous programs is necessary; however, there are fewer 82184177Skib * guarantees about the nature of the resulting model. If the source 831573Srgrimes * code is not syntactically well-formed or has some other 84153002Sambrisko * irrecoverable error that could not be removed by the generation of 85184177Skib * new types, a model may or may not be provided as a quality of 86184177Skib * implementation issue. 87184177Skib * If a program is syntactically valid but erroneous in some other 88184177Skib * fashion, any returned model must have no less information than if 89184177Skib * all the method bodies in the program were replaced by {@code "throw 90184177Skib * new RuntimeException();"}. If a program refers to a missing type Xyz, 91184177Skib * the returned model must contain no less information than if the 92184177Skib * declaration of type Xyz were assumed to be {@code "class Xyz {}"}, 939817Smpp * {@code "interface Xyz {}"}, {@code "enum Xyz {}"}, or {@code 94184177Skib * "@interface Xyz {}"}. If a program refers to a missing type {@code 953565Swollman * Xyz<K1, ... ,Kn>}, the returned model must contain no less 96184177Skib * information than if the declaration of Xyz were assumed to be 973565Swollman * {@code "class Xyz<T1, ... ,Tn> {}"} or {@code "interface Xyz<T1, 98184177Skib * ... ,Tn> {}"} 99184177Skib * 100153002Sambrisko * <p> Unless otherwise specified in a particular implementation, the 101184177Skib * collections returned by methods in this package should be expected 102184177Skib * to be unmodifiable by the caller and unsafe for concurrent access. 1031573Srgrimes * 104184177Skib * <p> Unless otherwise specified, methods in this package will throw 105184177Skib * a {@code NullPointerException} if given a {@code null} argument. 106184177Skib * 107184177Skib * @author Joseph D. Darcy 108184177Skib * @author Scott Seligman 109184177Skib * @author Peter von der Ahé 110184177Skib * @since 1.6 111184177Skib */ 112184177Skibpackage javax.lang.model.element; 113184177Skib