Tue, 28 Dec 2010 15:54:52 -0800
6962318: Update copyright year
Reviewed-by: xdono
1 /*
2 * Copyright (c) 2005, 2006, 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.Element;
32 import javax.lang.model.element.TypeElement;
33 import javax.lang.model.util.Types;
36 /**
37 * Represents a declared type, either a class type or an interface type.
38 * This includes parameterized types such as {@code java.util.Set<String>}
39 * as well as raw types.
40 *
41 * <p> While a {@code TypeElement} represents a class or interface
42 * <i>element</i>, a {@code DeclaredType} represents a class
43 * or interface <i>type</i>, the latter being a use
44 * (or <i>invocation</i>) of the former.
45 * See {@link TypeElement} for more on this distinction.
46 *
47 * <p> The supertypes (both class and interface types) of a declared
48 * type may be found using the {@link
49 * Types#directSupertypes(TypeMirror)} method. This returns the
50 * supertypes with any type arguments substituted in.
51 *
52 * <p> This interface is also used to represent intersection types.
53 * An intersection type is implicit in a program rather than being
54 * explictly declared. For example, the bound of the type parameter
55 * {@code <T extends Number & Runnable>}
56 * is an intersection type. It is represented by a {@code DeclaredType}
57 * with {@code Number} as its superclass and {@code Runnable} as its
58 * lone superinterface.
59 *
60 * @author Joseph D. Darcy
61 * @author Scott Seligman
62 * @author Peter von der Ahé
63 * @see TypeElement
64 * @since 1.6
65 */
66 public interface DeclaredType extends ReferenceType {
68 /**
69 * Returns the element corresponding to this type.
70 *
71 * @return the element corresponding to this type
72 */
73 Element asElement();
75 /**
76 * Returns the type of the innermost enclosing instance or a
77 * {@code NoType} of kind {@code NONE} if there is no enclosing
78 * instance. Only types corresponding to inner classes have an
79 * enclosing instance.
80 *
81 * @return a type mirror for the enclosing type
82 * @jls3 8.1.3 Inner Classes and Enclosing Instances
83 * @jls3 15.9.2 Determining Enclosing Instances
84 */
85 TypeMirror getEnclosingType();
87 /**
88 * Returns the actual type arguments of this type.
89 * For a type nested within a parameterized type
90 * (such as {@code Outer<String>.Inner<Number>}), only the type
91 * arguments of the innermost type are included.
92 *
93 * @return the actual type arguments of this type, or an empty list
94 * if none
95 */
96 List<? extends TypeMirror> getTypeArguments();
97 }