src/java.compiler/share/classes/javax/lang/model/element/ExecutableElement.java
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 55275 0a7af38ef32a
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
55118
9ea55cb79d77 8224687: Add clarifying overrides of Element.asType to more specific subinterfaces
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: 2088
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: 2088
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: 2088
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2088
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2088
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.element;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import java.util.List;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
import javax.lang.model.type.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
 * Represents a method, constructor, or initializer (static or
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
 * instance) of a class or interface, including annotation type
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 * elements.
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 * @author Joseph D. Darcy
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * @author Scott Seligman
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * @author Peter von der Ahé
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * @see ExecutableType
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 * @since 1.6
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 */
2088
6e2c8594b2e5 6460529: Provide mixin interfaces for getQualifiedName and getTypeParameters
darcy
parents: 10
diff changeset
    42
public interface ExecutableElement extends Element, Parameterizable {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
    /**
55118
9ea55cb79d77 8224687: Add clarifying overrides of Element.asType to more specific subinterfaces
darcy
parents: 47216
diff changeset
    44
     * Returns the {@linkplain ExecutableType executable type} defined
9ea55cb79d77 8224687: Add clarifying overrides of Element.asType to more specific subinterfaces
darcy
parents: 47216
diff changeset
    45
     * by this executable element.
9ea55cb79d77 8224687: Add clarifying overrides of Element.asType to more specific subinterfaces
darcy
parents: 47216
diff changeset
    46
     *
9ea55cb79d77 8224687: Add clarifying overrides of Element.asType to more specific subinterfaces
darcy
parents: 47216
diff changeset
    47
     * @return the executable type defined by this executable element
9ea55cb79d77 8224687: Add clarifying overrides of Element.asType to more specific subinterfaces
darcy
parents: 47216
diff changeset
    48
     *
9ea55cb79d77 8224687: Add clarifying overrides of Element.asType to more specific subinterfaces
darcy
parents: 47216
diff changeset
    49
     * @see ExecutableType
9ea55cb79d77 8224687: Add clarifying overrides of Element.asType to more specific subinterfaces
darcy
parents: 47216
diff changeset
    50
     */
9ea55cb79d77 8224687: Add clarifying overrides of Element.asType to more specific subinterfaces
darcy
parents: 47216
diff changeset
    51
    @Override
9ea55cb79d77 8224687: Add clarifying overrides of Element.asType to more specific subinterfaces
darcy
parents: 47216
diff changeset
    52
    TypeMirror asType();
9ea55cb79d77 8224687: Add clarifying overrides of Element.asType to more specific subinterfaces
darcy
parents: 47216
diff changeset
    53
9ea55cb79d77 8224687: Add clarifying overrides of Element.asType to more specific subinterfaces
darcy
parents: 47216
diff changeset
    54
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
     * Returns the formal type parameters of this executable
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
     * in declaration order.
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
     * @return the formal type parameters, or an empty list
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
     * if there are none
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
    List<? extends TypeParameterElement> getTypeParameters();
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
     * Returns the return type of this executable.
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
     * Returns a {@link NoType} with kind {@link TypeKind#VOID VOID}
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
     * if this executable is not a method, or is a method that does not
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
     * return a value.
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
     * @return the return type of this executable
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
    TypeMirror getReturnType();
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
     * Returns the formal parameters of this executable.
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
     * They are returned in declaration order.
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
     * @return the formal parameters,
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
     * or an empty list if there are none
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
    List<? extends VariableElement> getParameters();
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
    /**
16557
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
    83
     * Returns the receiver type of this executable,
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
    84
     * or {@link javax.lang.model.type.NoType NoType} with
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
    85
     * kind {@link javax.lang.model.type.TypeKind#NONE NONE}
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
    86
     * if the executable has no receiver type.
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
    87
     *
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
    88
     * An executable which is an instance method, or a constructor of an
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
    89
     * inner class, has a receiver type derived from the {@linkplain
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
    90
     * #getEnclosingElement declaring type}.
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
    91
     *
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
    92
     * An executable which is a static method, or a constructor of a
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
    93
     * non-inner class, or an initializer (static or instance), has no
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
    94
     * receiver type.
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
    95
     *
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
    96
     * @return the receiver type of this executable
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
    97
     * @since 1.8
55275
0a7af38ef32a 8225465: Add @jls tags to receiver type methods
darcy
parents: 55118
diff changeset
    98
     *
0a7af38ef32a 8225465: Add @jls tags to receiver type methods
darcy
parents: 55118
diff changeset
    99
     * @jls 8.4 Method Declarations
0a7af38ef32a 8225465: Add @jls tags to receiver type methods
darcy
parents: 55118
diff changeset
   100
     * @jls 8.4.1 Formal Parameters
0a7af38ef32a 8225465: Add @jls tags to receiver type methods
darcy
parents: 55118
diff changeset
   101
     * @jls 8.8 Constructor Declarations
16557
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
   102
     */
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
   103
    TypeMirror getReceiverType();
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
   104
67a3ae363f03 8007803: Implement javax.lang.model API for Type Annotations
jjg
parents: 14956
diff changeset
   105
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
     * Returns {@code true} if this method or constructor accepts a variable
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
     * number of arguments and returns {@code false} otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
     * @return {@code true} if this method or constructor accepts a variable
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     * number of arguments and {@code false} otherwise
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
    boolean isVarArgs();
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
    /**
14956
185bd7c693d8 8005046: Provide checking for a default method in javax.lang.model
darcy
parents: 14258
diff changeset
   115
     * Returns {@code true} if this method is a default method and
185bd7c693d8 8005046: Provide checking for a default method in javax.lang.model
darcy
parents: 14258
diff changeset
   116
     * returns {@code false} otherwise.
185bd7c693d8 8005046: Provide checking for a default method in javax.lang.model
darcy
parents: 14258
diff changeset
   117
     *
185bd7c693d8 8005046: Provide checking for a default method in javax.lang.model
darcy
parents: 14258
diff changeset
   118
     * @return {@code true} if this method is a default method and
185bd7c693d8 8005046: Provide checking for a default method in javax.lang.model
darcy
parents: 14258
diff changeset
   119
     * {@code false} otherwise
185bd7c693d8 8005046: Provide checking for a default method in javax.lang.model
darcy
parents: 14258
diff changeset
   120
     * @since 1.8
185bd7c693d8 8005046: Provide checking for a default method in javax.lang.model
darcy
parents: 14258
diff changeset
   121
     */
185bd7c693d8 8005046: Provide checking for a default method in javax.lang.model
darcy
parents: 14258
diff changeset
   122
    boolean isDefault();
185bd7c693d8 8005046: Provide checking for a default method in javax.lang.model
darcy
parents: 14258
diff changeset
   123
185bd7c693d8 8005046: Provide checking for a default method in javax.lang.model
darcy
parents: 14258
diff changeset
   124
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
     * Returns the exceptions and other throwables listed in this
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
     * method or constructor's {@code throws} clause in declaration
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
     * order.
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
     * @return the exceptions and other throwables listed in the
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
     * {@code throws} clause, or an empty list if there are none
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
    List<? extends TypeMirror> getThrownTypes();
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
     * Returns the default value if this executable is an annotation
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     * type element.  Returns {@code null} if this method is not an
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
     * annotation type element, or if it is an annotation type element
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
     * with no default value.
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     * @return the default value, or {@code null} if none
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
    AnnotationValue getDefaultValue();
8233
fda68eae1504 7015530: Reiterate API specializations in javax.lang.model.elment subinterfaces
darcy
parents: 5520
diff changeset
   143
fda68eae1504 7015530: Reiterate API specializations in javax.lang.model.elment subinterfaces
darcy
parents: 5520
diff changeset
   144
    /**
fda68eae1504 7015530: Reiterate API specializations in javax.lang.model.elment subinterfaces
darcy
parents: 5520
diff changeset
   145
     * Returns the simple name of a constructor, method, or
fda68eae1504 7015530: Reiterate API specializations in javax.lang.model.elment subinterfaces
darcy
parents: 5520
diff changeset
   146
     * initializer.  For a constructor, the name {@code "<init>"} is
fda68eae1504 7015530: Reiterate API specializations in javax.lang.model.elment subinterfaces
darcy
parents: 5520
diff changeset
   147
     * returned, for a static initializer, the name {@code "<clinit>"}
fda68eae1504 7015530: Reiterate API specializations in javax.lang.model.elment subinterfaces
darcy
parents: 5520
diff changeset
   148
     * is returned, and for an anonymous class or instance
fda68eae1504 7015530: Reiterate API specializations in javax.lang.model.elment subinterfaces
darcy
parents: 5520
diff changeset
   149
     * initializer, an empty name is returned.
fda68eae1504 7015530: Reiterate API specializations in javax.lang.model.elment subinterfaces
darcy
parents: 5520
diff changeset
   150
     *
fda68eae1504 7015530: Reiterate API specializations in javax.lang.model.elment subinterfaces
darcy
parents: 5520
diff changeset
   151
     * @return the simple name of a constructor, method, or
fda68eae1504 7015530: Reiterate API specializations in javax.lang.model.elment subinterfaces
darcy
parents: 5520
diff changeset
   152
     * initializer
fda68eae1504 7015530: Reiterate API specializations in javax.lang.model.elment subinterfaces
darcy
parents: 5520
diff changeset
   153
     */
fda68eae1504 7015530: Reiterate API specializations in javax.lang.model.elment subinterfaces
darcy
parents: 5520
diff changeset
   154
    @Override
fda68eae1504 7015530: Reiterate API specializations in javax.lang.model.elment subinterfaces
darcy
parents: 5520
diff changeset
   155
    Name getSimpleName();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
}