src/java.compiler/share/classes/javax/lang/model/element/package-info.java
author pliden
Fri, 23 Aug 2019 08:48:27 +0200
changeset 57852 92f994585e25
parent 53944 2c50e900e8af
permissions -rw-r--r--
8229127: Make some methods in the allocation path non-virtual Reviewed-by: eosterlund
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
53944
2c50e900e8af 8219805: Cross-link javax.lang.model.{type, element} packages to utility interfaces
darcy
parents: 47216
diff changeset
     2
 * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 4547
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 4547
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 4547
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 4547
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 4547
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
 * Interfaces used to model elements of the Java programming language.
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
 *
4547
5c18795ef8e4 6909538: Clarify meaning of "element" in javax.lang.model.element API
darcy
parents: 10
diff changeset
    29
 * The term "element" in this package is used to refer to program
5c18795ef8e4 6909538: Clarify meaning of "element" in javax.lang.model.element API
darcy
parents: 10
diff changeset
    30
 * elements, the declared entities that make up a program.  Elements
5c18795ef8e4 6909538: Clarify meaning of "element" in javax.lang.model.element API
darcy
parents: 10
diff changeset
    31
 * include classes, interfaces, methods, constructors, and fields.
5c18795ef8e4 6909538: Clarify meaning of "element" in javax.lang.model.element API
darcy
parents: 10
diff changeset
    32
 * The interfaces in this package do not model the structure of a
5c18795ef8e4 6909538: Clarify meaning of "element" in javax.lang.model.element API
darcy
parents: 10
diff changeset
    33
 * program inside a method body; for example there is no
5c18795ef8e4 6909538: Clarify meaning of "element" in javax.lang.model.element API
darcy
parents: 10
diff changeset
    34
 * representation of a {@code for} loop or {@code try}-{@code finally}
5c18795ef8e4 6909538: Clarify meaning of "element" in javax.lang.model.element API
darcy
parents: 10
diff changeset
    35
 * block.  However, the interfaces can model some structures only
5c18795ef8e4 6909538: Clarify meaning of "element" in javax.lang.model.element API
darcy
parents: 10
diff changeset
    36
 * appearing inside method bodies, such as local variables and
5c18795ef8e4 6909538: Clarify meaning of "element" in javax.lang.model.element API
darcy
parents: 10
diff changeset
    37
 * anonymous classes.
5c18795ef8e4 6909538: Clarify meaning of "element" in javax.lang.model.element API
darcy
parents: 10
diff changeset
    38
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * <p>When used in the context of annotation processing, an accurate
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 * model of the element being represented must be returned.  As this
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 * is a language model, the source code provides the fiducial
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 * (reference) representation of the construct in question rather than
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 * a representation in an executable output like a class file.
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 * Executable output may serve as the basis for creating a modeling
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 * element.  However, the process of translating source code to
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 * executable output may not permit recovering some aspects of the
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 * source code representation.  For example, annotations with
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
 * {@linkplain java.lang.annotation.RetentionPolicy#SOURCE source}
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
 * {@linkplain java.lang.annotation.Retention retention} cannot be
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 * recovered from class files and class files might not be able to
15042
88ce00b3841a 8004730: Add language model support for parameter reflection
darcy
parents: 7626
diff changeset
    51
 * provide source position information.
88ce00b3841a 8004730: Add language model support for parameter reflection
darcy
parents: 7626
diff changeset
    52
 *
88ce00b3841a 8004730: Add language model support for parameter reflection
darcy
parents: 7626
diff changeset
    53
 * Names of parameters may not be recoverable from class files.
88ce00b3841a 8004730: Add language model support for parameter reflection
darcy
parents: 7626
diff changeset
    54
 *
88ce00b3841a 8004730: Add language model support for parameter reflection
darcy
parents: 7626
diff changeset
    55
 * The {@linkplain javax.lang.model.element.Modifier modifiers} on an
42825
c22877f68145 8163315: Implement an API to identify an implicitly declared annotation (or declaration)
darcy
parents: 25874
diff changeset
    56
 * element created from a class file may differ in some cases from an
c22877f68145 8163315: Implement an API to identify an implicitly declared annotation (or declaration)
darcy
parents: 25874
diff changeset
    57
 * element for the same declaration created from a source file
c22877f68145 8163315: Implement an API to identify an implicitly declared annotation (or declaration)
darcy
parents: 25874
diff changeset
    58
 * including:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
 * <ul>
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
 * <li> {@code strictfp} on a class or interface
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
 * <li> {@code final} on a parameter
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
 * <li> {@code protected}, {@code private}, and {@code static} on classes and interfaces
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
 * </ul>
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
 *
42825
c22877f68145 8163315: Implement an API to identify an implicitly declared annotation (or declaration)
darcy
parents: 25874
diff changeset
    66
 * Some elements which are {@linkplain
c22877f68145 8163315: Implement an API to identify an implicitly declared annotation (or declaration)
darcy
parents: 25874
diff changeset
    67
 * javax.lang.model.util.Elements.Origin#MANDATED mandated} may not be
c22877f68145 8163315: Implement an API to identify an implicitly declared annotation (or declaration)
darcy
parents: 25874
diff changeset
    68
 * marked as such when created from class files.
c22877f68145 8163315: Implement an API to identify an implicitly declared annotation (or declaration)
darcy
parents: 25874
diff changeset
    69
 *
c22877f68145 8163315: Implement an API to identify an implicitly declared annotation (or declaration)
darcy
parents: 25874
diff changeset
    70
 * Additionally, {@linkplain
c22877f68145 8163315: Implement an API to identify an implicitly declared annotation (or declaration)
darcy
parents: 25874
diff changeset
    71
 * javax.lang.model.util.Elements.Origin#SYNTHETIC synthetic}
c22877f68145 8163315: Implement an API to identify an implicitly declared annotation (or declaration)
darcy
parents: 25874
diff changeset
    72
 * constructs in a class file, such as accessor methods used in
c22877f68145 8163315: Implement an API to identify an implicitly declared annotation (or declaration)
darcy
parents: 25874
diff changeset
    73
 * implementing nested classes and {@linkplain
c22877f68145 8163315: Implement an API to identify an implicitly declared annotation (or declaration)
darcy
parents: 25874
diff changeset
    74
 * javax.lang.model.util.Elements.Origin#isBridge(ExecutableElement)
c22877f68145 8163315: Implement an API to identify an implicitly declared annotation (or declaration)
darcy
parents: 25874
diff changeset
    75
 * bridge methods} used in implementing covariant returns, are
c22877f68145 8163315: Implement an API to identify an implicitly declared annotation (or declaration)
darcy
parents: 25874
diff changeset
    76
 * translation artifacts strictly outside of this model. However, when
c22877f68145 8163315: Implement an API to identify an implicitly declared annotation (or declaration)
darcy
parents: 25874
diff changeset
    77
 * operating on class files, it is helpful be able to operate on such
c22877f68145 8163315: Implement an API to identify an implicitly declared annotation (or declaration)
darcy
parents: 25874
diff changeset
    78
 * elements, screening them out when appropriate.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
 * <p>During annotation processing, operating on incomplete or
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
 * erroneous programs is necessary; however, there are fewer
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
 * guarantees about the nature of the resulting model.  If the source
7626
6133f51d8f7d 7003550: Loosen modeling requirements for annotation processing erroneous code
darcy
parents: 5520
diff changeset
    83
 * code is not syntactically well-formed or has some other
6133f51d8f7d 7003550: Loosen modeling requirements for annotation processing erroneous code
darcy
parents: 5520
diff changeset
    84
 * irrecoverable error that could not be removed by the generation of
6133f51d8f7d 7003550: Loosen modeling requirements for annotation processing erroneous code
darcy
parents: 5520
diff changeset
    85
 * new types, a model may or may not be provided as a quality of
6133f51d8f7d 7003550: Loosen modeling requirements for annotation processing erroneous code
darcy
parents: 5520
diff changeset
    86
 * implementation issue.
6133f51d8f7d 7003550: Loosen modeling requirements for annotation processing erroneous code
darcy
parents: 5520
diff changeset
    87
 * If a program is syntactically valid but erroneous in some other
6133f51d8f7d 7003550: Loosen modeling requirements for annotation processing erroneous code
darcy
parents: 5520
diff changeset
    88
 * fashion, any returned model must have no less information than if
6133f51d8f7d 7003550: Loosen modeling requirements for annotation processing erroneous code
darcy
parents: 5520
diff changeset
    89
 * all the method bodies in the program were replaced by {@code "throw
43567
d0d89c3da7be 8173676: Improvements to javax.annotation.processing and javax.lang.model doc
darcy
parents: 42825
diff changeset
    90
 * new RuntimeException();"}.  If a program refers to a missing type Xyz,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
 * the returned model must contain no less information than if the
43567
d0d89c3da7be 8173676: Improvements to javax.annotation.processing and javax.lang.model doc
darcy
parents: 42825
diff changeset
    92
 * declaration of type Xyz were assumed to be {@code "class Xyz {}"},
d0d89c3da7be 8173676: Improvements to javax.annotation.processing and javax.lang.model doc
darcy
parents: 42825
diff changeset
    93
 * {@code "interface Xyz {}"}, {@code "enum Xyz {}"}, or {@code
d0d89c3da7be 8173676: Improvements to javax.annotation.processing and javax.lang.model doc
darcy
parents: 42825
diff changeset
    94
 * "@interface Xyz {}"}. If a program refers to a missing type {@code
d0d89c3da7be 8173676: Improvements to javax.annotation.processing and javax.lang.model doc
darcy
parents: 42825
diff changeset
    95
 * Xyz<K1, ... ,Kn>}, the returned model must contain no less
d0d89c3da7be 8173676: Improvements to javax.annotation.processing and javax.lang.model doc
darcy
parents: 42825
diff changeset
    96
 * information than if the declaration of Xyz were assumed to be
d0d89c3da7be 8173676: Improvements to javax.annotation.processing and javax.lang.model doc
darcy
parents: 42825
diff changeset
    97
 * {@code "class Xyz<T1, ... ,Tn> {}"} or {@code "interface Xyz<T1,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
 * ... ,Tn> {}"}
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
 * <p> Unless otherwise specified in a particular implementation, the
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
 * collections returned by methods in this package should be expected
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
 * to be unmodifiable by the caller and unsafe for concurrent access.
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
 * <p> Unless otherwise specified, methods in this package will throw
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
 * a {@code NullPointerException} if given a {@code null} argument.
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
 * @author Joseph D. Darcy
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
 * @author Scott Seligman
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
 * @author Peter von der Ah&eacute;
53944
2c50e900e8af 8219805: Cross-link javax.lang.model.{type, element} packages to utility interfaces
darcy
parents: 47216
diff changeset
   110
 * @see javax.lang.model.util.Elements
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
 * @since 1.6
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
package javax.lang.model.element;