jdk/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/WildcardTypeImpl.java
author martin
Thu, 06 Nov 2014 13:18:44 -0800
changeset 27489 cf53b2c02ebb
parent 25859 3317bb8137f4
child 28056 0cab6eb92852
permissions -rw-r--r--
8062771: Core reflection should use final fields whenever possible Reviewed-by: psandoz, darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
17456
0f2c187cd188 8014357: Minor refactorings to sun.reflect.generics.reflectiveObjects.*
darcy
parents: 5506
diff changeset
     2
 * Copyright (c) 2003, 2013, 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 sun.reflect.generics.reflectiveObjects;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.lang.reflect.Type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.lang.reflect.WildcardType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import sun.reflect.generics.factory.GenericsFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import sun.reflect.generics.tree.FieldTypeSignature;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import sun.reflect.generics.visitor.Reifier;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.util.Arrays;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * Implementation of WildcardType interface for core reflection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
public class WildcardTypeImpl extends LazyReflectiveObjectGenerator
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
    implements WildcardType {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    // upper bounds - evaluated lazily
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    private Type[] upperBounds;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    // lower bounds - evaluated lazily
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    private Type[] lowerBounds;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    // The ASTs for the bounds. We are required to evaluate the bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    // lazily, so we store these at least until we are first asked
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    // for the bounds. This also neatly solves the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    // problem with F-bounds - you can't reify them before the formal
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    // is defined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    private FieldTypeSignature[] upperBoundASTs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    private FieldTypeSignature[] lowerBoundASTs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    // constructor is private to enforce access through static factory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    private WildcardTypeImpl(FieldTypeSignature[] ubs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
                             FieldTypeSignature[] lbs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
                             GenericsFactory f) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
        super(f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
        upperBoundASTs = ubs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
        lowerBoundASTs = lbs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * Factory method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * @param ubs - an array of ASTs representing the upper bounds for the type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * variable to be created
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * @param lbs - an array of ASTs representing the lower bounds for the type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * variable to be created
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * @param f - a factory that can be used to manufacture reflective
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * objects that represent the bounds of this wildcard type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * @return a wild card type with the requested bounds and factory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    public static WildcardTypeImpl make(FieldTypeSignature[] ubs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
                                        FieldTypeSignature[] lbs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
                                        GenericsFactory f) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        return new WildcardTypeImpl(ubs, lbs, f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    // Accessors
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    // accessor for ASTs for upper bounds. Must not be called after upper
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    // bounds have been evaluated, because we might throw the ASTs
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    // away (but that is not thread-safe, is it?)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    private FieldTypeSignature[] getUpperBoundASTs() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        // check that upper bounds were not evaluated yet
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        assert(upperBounds == null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        return upperBoundASTs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    // accessor for ASTs for lower bounds. Must not be called after lower
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    // bounds have been evaluated, because we might throw the ASTs
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    // away (but that is not thread-safe, is it?)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    private FieldTypeSignature[] getLowerBoundASTs() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        // check that lower bounds were not evaluated yet
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        assert(lowerBounds == null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        return lowerBoundASTs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * Returns an array of <tt>Type</tt> objects representing the  upper
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * bound(s) of this type variable.  Note that if no upper bound is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * explicitly declared, the upper bound is <tt>Object</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * <p>For each upper bound B :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     *  <li>if B is a parameterized type or a type variable, it is created,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     *  (see {@link #ParameterizedType} for the details of the creation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     *  process for parameterized types).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     *  <li>Otherwise, B is resolved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * @return an array of Types representing the upper bound(s) of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     *     type variable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * @throws <tt>TypeNotPresentException</tt> if any of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     *     bounds refers to a non-existent type declaration
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * @throws <tt>MalformedParameterizedTypeException</tt> if any of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     *     bounds refer to a parameterized type that cannot be instantiated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     *     for any reason
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    public Type[] getUpperBounds() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        // lazily initialize bounds if necessary
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        if (upperBounds == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
            FieldTypeSignature[] fts = getUpperBoundASTs(); // get AST
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            // allocate result array; note that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            // keeping ts and bounds separate helps with threads
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
            Type[] ts = new Type[fts.length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
            // iterate over bound trees, reifying each in turn
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            for ( int j = 0; j  < fts.length; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                Reifier r = getReifier();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                fts[j].accept(r);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                ts[j] = r.getResult();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            // cache result
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            upperBounds = ts;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
            // could throw away upper bound ASTs here; thread safety?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        return upperBounds.clone(); // return cached bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * Returns an array of <tt>Type</tt> objects representing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * lower bound(s) of this type variable.  Note that if no lower bound is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * explicitly declared, the lower bound is the type of <tt>null</tt>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * In this case, a zero length array is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * <p>For each lower bound B :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     *   <li>if B is a parameterized type or a type variable, it is created,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     *   (see {@link #ParameterizedType} for the details of the creation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     *   process for parameterized types).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     *   <li>Otherwise, B is resolved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * @return an array of Types representing the lower bound(s) of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     *     type variable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * @throws <tt>TypeNotPresentException</tt> if any of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     *     bounds refers to a non-existent type declaration
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * @throws <tt>MalformedParameterizedTypeException</tt> if any of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     *     bounds refer to a parameterized type that cannot be instantiated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     *     for any reason
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    public Type[] getLowerBounds() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        // lazily initialize bounds if necessary
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        if (lowerBounds == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            FieldTypeSignature[] fts = getLowerBoundASTs(); // get AST
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            // allocate result array; note that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            // keeping ts and bounds separate helps with threads
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            Type[] ts = new Type[fts.length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            // iterate over bound trees, reifying each in turn
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            for ( int j = 0; j  < fts.length; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                Reifier r = getReifier();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                fts[j].accept(r);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                ts[j] = r.getResult();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            // cache result
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            lowerBounds = ts;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            // could throw away lower bound ASTs here; thread safety?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        return lowerBounds.clone(); // return cached bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        Type[] lowerBounds = getLowerBounds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        Type[] bounds = lowerBounds;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        StringBuilder sb = new StringBuilder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        if (lowerBounds.length > 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            sb.append("? super ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            Type[] upperBounds = getUpperBounds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
            if (upperBounds.length > 0 && !upperBounds[0].equals(Object.class) ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                bounds = upperBounds;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                sb.append("? extends ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            } else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
                return "?";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        assert bounds.length > 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        boolean first = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        for(Type bound: bounds) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
            if (!first)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                sb.append(" & ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
            first = false;
17456
0f2c187cd188 8014357: Minor refactorings to sun.reflect.generics.reflectiveObjects.*
darcy
parents: 5506
diff changeset
   206
            sb.append(bound.getTypeName());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        return sb.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    public boolean equals(Object o) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        if (o instanceof WildcardType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
            WildcardType that = (WildcardType) o;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                Arrays.equals(this.getLowerBounds(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                              that.getLowerBounds()) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                Arrays.equals(this.getUpperBounds(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                              that.getUpperBounds());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        } else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    public int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        Type [] lowerBounds = getLowerBounds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        Type [] upperBounds = getUpperBounds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        return Arrays.hashCode(lowerBounds) ^ Arrays.hashCode(upperBounds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
}