Mon, 18 Mar 2013 18:33:13 -0700
8007803: Implement javax.lang.model API for Type Annotations
Reviewed-by: darcy
1 /*
2 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 package javax.lang.model.type;
29 import java.util.List;
31 import javax.lang.model.element.ExecutableElement;
34 /**
35 * Represents the type of an executable. An <i>executable</i>
36 * is a method, constructor, or initializer.
37 *
38 * <p> The executable is
39 * represented as when viewed as a method (or constructor or
40 * initializer) of some reference type.
41 * If that reference type is parameterized, then its actual
42 * type arguments are substituted into any types returned by the methods of
43 * this interface.
44 *
45 * @author Joseph D. Darcy
46 * @author Scott Seligman
47 * @author Peter von der Ahé
48 * @see ExecutableElement
49 * @since 1.6
50 */
51 public interface ExecutableType extends TypeMirror {
53 /**
54 * Returns the type variables declared by the formal type parameters
55 * of this executable.
56 *
57 * @return the type variables declared by the formal type parameters,
58 * or an empty list if there are none
59 */
60 List<? extends TypeVariable> getTypeVariables();
62 /**
63 * Returns the return type of this executable.
64 * Returns a {@link NoType} with kind {@link TypeKind#VOID VOID}
65 * if this executable is not a method, or is a method that does not
66 * return a value.
67 *
68 * @return the return type of this executable
69 */
70 TypeMirror getReturnType();
72 /**
73 * Returns the types of this executable's formal parameters.
74 *
75 * @return the types of this executable's formal parameters,
76 * or an empty list if there are none
77 */
78 List<? extends TypeMirror> getParameterTypes();
80 /**
81 * Returns the receiver type of this executable,
82 * or {@link javax.lang.model.type.NoType NoType} with
83 * kind {@link javax.lang.model.type.TypeKind#NONE NONE}
84 * if the executable has no receiver type.
85 *
86 * An executable which is an instance method, or a constructor of an
87 * inner class, has a receiver type derived from the {@linkplain
88 * #getEnclosingElement declaring type}.
89 *
90 * An executable which is a static method, or a constructor of a
91 * non-inner class, or an initializer (static or instance), has no
92 * receiver type.
93 *
94 * @return the receiver type of this executable
95 * @since 1.8
96 */
97 TypeMirror getReceiverType();
99 /**
100 * Returns the exceptions and other throwables listed in this
101 * executable's {@code throws} clause.
102 *
103 * @return the exceptions and other throwables listed in this
104 * executable's {@code throws} clause,
105 * or an empty list if there are none.
106 */
107 List<? extends TypeMirror> getThrownTypes();
108 }