langtools/src/share/classes/javax/lang/model/util/Elements.java
author jjg
Thu, 13 Sep 2012 14:29:36 -0700
changeset 13844 56339cf983a3
parent 9303 eae35c201e19
child 15714 d9a83ab62853
permissions -rw-r--r--
7177970: fix issues in langtools doc comments Reviewed-by: mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9303
diff changeset
     2
 * Copyright (c) 2005, 2012, 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: 4074
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: 4074
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: 4074
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 4074
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 4074
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
package javax.lang.model.util;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
import java.util.List;
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import java.util.Map;
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
import javax.lang.model.element.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
import javax.lang.model.type.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * Utility methods for operating on program elements.
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * <p><b>Compatibility Note:</b> Methods may be added to this interface
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 * in future releases of the platform.
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 * @author Joseph D. Darcy
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 * @author Scott Seligman
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 * @author Peter von der Ah&eacute;
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 * @see javax.annotation.processing.ProcessingEnvironment#getElementUtils
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 * @since 1.6
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
public interface Elements {
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
     * Returns a package given its fully qualified name.
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
     * @param name  fully qualified package name, or "" for an unnamed package
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
     * @return the named package, or {@code null} if it cannot be found
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
    PackageElement getPackageElement(CharSequence name);
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
     * Returns a type element given its canonical name.
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
     * @param name  the canonical name
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
     * @return the named type element, or {@code null} if it cannot be found
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    TypeElement getTypeElement(CharSequence name);
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
     * Returns the values of an annotation's elements, including defaults.
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
     * @see AnnotationMirror#getElementValues()
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
     * @param a  annotation to examine
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
     * @return the values of the annotation's elements, including defaults
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
    Map<? extends ExecutableElement, ? extends AnnotationValue>
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
            getElementValuesWithDefaults(AnnotationMirror a);
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
     * Returns the text of the documentation (&quot;Javadoc&quot;)
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
     * comment of an element.
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
     *
4074
2b391dcb03ff 6558804: Specification for Elements.getDocComment(Element e) should be clarified
darcy
parents: 10
diff changeset
    80
     * <p> A documentation comment of an element is a comment that
2b391dcb03ff 6558804: Specification for Elements.getDocComment(Element e) should be clarified
darcy
parents: 10
diff changeset
    81
     * begins with "{@code /**}" , ends with a separate
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9303
diff changeset
    82
     * "<code>*&#47;</code>", and immediately precedes the element,
4074
2b391dcb03ff 6558804: Specification for Elements.getDocComment(Element e) should be clarified
darcy
parents: 10
diff changeset
    83
     * ignoring white space.  Therefore, a documentation comment
2b391dcb03ff 6558804: Specification for Elements.getDocComment(Element e) should be clarified
darcy
parents: 10
diff changeset
    84
     * contains at least three"{@code *}" characters.  The text
2b391dcb03ff 6558804: Specification for Elements.getDocComment(Element e) should be clarified
darcy
parents: 10
diff changeset
    85
     * returned for the documentation comment is a processed form of
2b391dcb03ff 6558804: Specification for Elements.getDocComment(Element e) should be clarified
darcy
parents: 10
diff changeset
    86
     * the comment as it appears in source code.  The leading "{@code
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9303
diff changeset
    87
     * /**}" and trailing "<code>*&#47;</code>" are removed.  For lines
4074
2b391dcb03ff 6558804: Specification for Elements.getDocComment(Element e) should be clarified
darcy
parents: 10
diff changeset
    88
     * of the comment starting after the initial "{@code /**}",
2b391dcb03ff 6558804: Specification for Elements.getDocComment(Element e) should be clarified
darcy
parents: 10
diff changeset
    89
     * leading white space characters are discarded as are any
2b391dcb03ff 6558804: Specification for Elements.getDocComment(Element e) should be clarified
darcy
parents: 10
diff changeset
    90
     * consecutive "{@code *}" characters appearing after the white
2b391dcb03ff 6558804: Specification for Elements.getDocComment(Element e) should be clarified
darcy
parents: 10
diff changeset
    91
     * space or starting the line.  The processed lines are then
2b391dcb03ff 6558804: Specification for Elements.getDocComment(Element e) should be clarified
darcy
parents: 10
diff changeset
    92
     * concatenated together (including line terminators) and
2b391dcb03ff 6558804: Specification for Elements.getDocComment(Element e) should be clarified
darcy
parents: 10
diff changeset
    93
     * returned.
2b391dcb03ff 6558804: Specification for Elements.getDocComment(Element e) should be clarified
darcy
parents: 10
diff changeset
    94
     *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
     * @param e  the element being examined
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
     * @return the documentation comment of the element, or {@code null}
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
     *          if there is none
9303
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 5520
diff changeset
    98
     * @jls 3.6 White Space
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
    String getDocComment(Element e);
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
     * Returns {@code true} if the element is deprecated, {@code false} otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
     * @param e  the element being examined
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
     * @return {@code true} if the element is deprecated, {@code false} otherwise
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
    boolean isDeprecated(Element e);
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     * Returns the <i>binary name</i> of a type element.
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
     * @param type  the type element being examined
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
     * @return the binary name
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
     * @see TypeElement#getQualifiedName
9303
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 5520
diff changeset
   117
     * @jls 13.1 The Form of a Binary
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
    Name getBinaryName(TypeElement type);
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
     * Returns the package of an element.  The package of a package is
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
     * itself.
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
     * @param type the element being examined
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
     * @return the package of an element
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
    PackageElement getPackageOf(Element type);
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
     * Returns all members of a type element, whether inherited or
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     * declared directly.  For a class the result also includes its
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
     * constructors, but not local or anonymous classes.
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     * <p>Note that elements of certain kinds can be isolated using
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
     * methods in {@link ElementFilter}.
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
     * @param type  the type being examined
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     * @return all members of the type
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
     * @see Element#getEnclosedElements
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
    List<? extends Element> getAllMembers(TypeElement type);
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
     * Returns all annotations of an element, whether
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
     * inherited or directly present.
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
     * @param e  the element being examined
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
     * @return all annotations of the element
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
     * @see Element#getAnnotationMirrors
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
    List<? extends AnnotationMirror> getAllAnnotationMirrors(Element e);
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
     * Tests whether one type, method, or field hides another.
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
     * @param hider   the first element
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
     * @param hidden  the second element
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
     * @return {@code true} if and only if the first element hides
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
     *          the second
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
    boolean hides(Element hider, Element hidden);
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
     * Tests whether one method, as a member of a given type,
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
     * overrides another method.
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
     * When a non-abstract method overrides an abstract one, the
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
     * former is also said to <i>implement</i> the latter.
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
     * <p> In the simplest and most typical usage, the value of the
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
     * {@code type} parameter will simply be the class or interface
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
     * directly enclosing {@code overrider} (the possibly-overriding
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
     * method).  For example, suppose {@code m1} represents the method
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
     * {@code String.hashCode} and {@code m2} represents {@code
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
     * Object.hashCode}.  We can then ask whether {@code m1} overrides
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
     * {@code m2} within the class {@code String} (it does):
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
     * <blockquote>
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
     * {@code assert elements.overrides(m1, m2,
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
     *          elements.getTypeElement("java.lang.String")); }
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
     * </blockquote>
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
     * A more interesting case can be illustrated by the following example
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
     * in which a method in type {@code A} does not override a
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
     * like-named method in type {@code B}:
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
     * <blockquote>
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
     * {@code class A { public void m() {} } }<br>
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
     * {@code interface B { void m(); } }<br>
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
     * ...<br>
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
     * {@code m1 = ...;  // A.m }<br>
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
     * {@code m2 = ...;  // B.m }<br>
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
     * {@code assert ! elements.overrides(m1, m2,
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
     *          elements.getTypeElement("A")); }
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
     * </blockquote>
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
     * When viewed as a member of a third type {@code C}, however,
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
     * the method in {@code A} does override the one in {@code B}:
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
     * <blockquote>
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
     * {@code class C extends A implements B {} }<br>
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
     * ...<br>
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
     * {@code assert elements.overrides(m1, m2,
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
     *          elements.getTypeElement("C")); }
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
     * </blockquote>
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
     * @param overrider  the first method, possible overrider
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
     * @param overridden  the second method, possibly being overridden
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
     * @param type   the type of which the first method is a member
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
     * @return {@code true} if and only if the first method overrides
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
     *          the second
9303
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 5520
diff changeset
   213
     * @jls 8.4.8 Inheritance, Overriding, and Hiding
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 5520
diff changeset
   214
     * @jls 9.4.1 Inheritance and Overriding
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
    boolean overrides(ExecutableElement overrider, ExecutableElement overridden,
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
                      TypeElement type);
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
     * Returns the text of a <i>constant expression</i> representing a
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
     * primitive value or a string.
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
     * The text returned is in a form suitable for representing the value
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
     * in source code.
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
     * @param value  a primitive value or string
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
     * @return the text of a constant expression
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
     * @throws IllegalArgumentException if the argument is not a primitive
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
     *          value or string
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
     * @see VariableElement#getConstantValue()
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
    String getConstantExpression(Object value);
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
     * Prints a representation of the elements to the given writer in
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
     * the specified order.  The main purpose of this method is for
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
     * diagnostics.  The exact format of the output is <em>not</em>
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
     * specified and is subject to change.
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
     * @param w the writer to print the output to
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
     * @param elements the elements to print
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
    void printElements(java.io.Writer w, Element... elements);
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
     * Return a name with the same sequence of characters as the
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
     * argument.
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
     * @param cs the character sequence to return as a name
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
    Name getName(CharSequence cs);
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
}