jdk/src/java.base/share/classes/java/lang/reflect/WildcardType.java
author thartmann
Tue, 03 Nov 2015 09:42:11 +0100
changeset 33663 2cd62a4bd471
parent 31177 c8ceef082391
permissions -rw-r--r--
8141132: JEP 254: Compact Strings Summary: Adopt a more space-efficient internal representation for strings. Reviewed-by: alanb, bdelsart, coleenp, iklam, jiangli, jrose, kevinw, naoto, pliden, roland, smarks, twisti Contributed-by: Brent Christian <brent.christian@oracle.com>, Vivek Deshpande <vivek.r.deshpande@intel.com>, Tobias Hartmann <tobias.hartmann@oracle.com>, Charlie Hunt <charlie.hunt@oracle.com>, Vladimir Kozlov <vladimir.kozlov@oracle.com>, Roger Riggs <roger.riggs@oracle.com>, Xueming Shen <xueming.shen@oracle.com>, Aleksey Shipilev <aleksey.shipilev@oracle.com>, Sandhya Viswanathan <sandhya.viswanathan@intel.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
31177
c8ceef082391 8098790: Improve cross references and wording in java.lang.reflect.AnnotatedFoo type
darcy
parents: 25859
diff changeset
     2
 * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.lang.reflect;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * WildcardType represents a wildcard type expression, such as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * {@code ?}, {@code ? extends Number}, or {@code ? super Integer}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
public interface WildcardType extends Type {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
     * Returns an array of {@code Type} objects representing the  upper
31177
c8ceef082391 8098790: Improve cross references and wording in java.lang.reflect.AnnotatedFoo type
darcy
parents: 25859
diff changeset
    37
     * bound(s) of this type variable.  If no upper bound is
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
     * explicitly declared, the upper bound is {@code Object}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
     * <p>For each upper bound B :
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
     *  <li>if B is a parameterized type or a type variable, it is created,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
     *  (see {@link java.lang.reflect.ParameterizedType ParameterizedType}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
     *  for the details of the creation process for parameterized types).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
     *  <li>Otherwise, B is resolved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     * @return an array of Types representing the upper bound(s) of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     *     type variable
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     * @throws TypeNotPresentException if any of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     *     bounds refers to a non-existent type declaration
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * @throws MalformedParameterizedTypeException if any of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     *     bounds refer to a parameterized type that cannot be instantiated
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     *     for any reason
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    Type[] getUpperBounds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * Returns an array of {@code Type} objects representing the
31177
c8ceef082391 8098790: Improve cross references and wording in java.lang.reflect.AnnotatedFoo type
darcy
parents: 25859
diff changeset
    60
     * lower bound(s) of this type variable.  If no lower bound is
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * explicitly declared, the lower bound is the type of {@code null}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * In this case, a zero length array is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * <p>For each lower bound B :
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     *   <li>if B is a parameterized type or a type variable, it is created,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     *  (see {@link java.lang.reflect.ParameterizedType ParameterizedType}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     *  for the details of the creation process for parameterized types).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     *   <li>Otherwise, B is resolved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * @return an array of Types representing the lower bound(s) of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     *     type variable
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * @throws TypeNotPresentException if any of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     *     bounds refers to a non-existent type declaration
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * @throws MalformedParameterizedTypeException if any of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     *     bounds refer to a parameterized type that cannot be instantiated
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     *     for any reason
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    Type[] getLowerBounds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    // one or many? Up to language spec; currently only one, but this API
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    // allows for generalization.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
}