src/java.management/share/classes/sun/management/LazyCompositeData.java
author darcy
Wed, 23 Oct 2019 13:01:40 -0700
changeset 58766 54ffb15c4839
parent 47216 71c04702a3d5
permissions -rw-r--r--
8232442: Suppress warnings on non-serializable non-transient instance fields in java.management.* Reviewed-by: rriggs, mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
58766
54ffb15c4839 8232442: Suppress warnings on non-serializable non-transient instance fields in java.management.*
darcy
parents: 47216
diff changeset
     2
 * Copyright (c) 2004, 2019, 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: 4173
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: 4173
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: 4173
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4173
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4173
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.management;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.Serializable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.*;
33260
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
    30
import javax.management.openmbean.ArrayType;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import javax.management.openmbean.CompositeData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import javax.management.openmbean.CompositeType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import javax.management.openmbean.OpenType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.management.openmbean.TabularType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * This abstract class provides the implementation of the CompositeData
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * interface.  A CompositeData object will be lazily created only when
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * the CompositeData interface is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * Classes that extends this abstract class will implement the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * getCompositeData() method. The object returned by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * getCompositeData() is an instance of CompositeData such that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * the instance serializes itself as the type CompositeDataSupport.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
public abstract class LazyCompositeData
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
        implements CompositeData, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
58766
54ffb15c4839 8232442: Suppress warnings on non-serializable non-transient instance fields in java.management.*
darcy
parents: 47216
diff changeset
    49
    @SuppressWarnings("serial") // Not statically typed as Serializable
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    private CompositeData compositeData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    // Implementation of the CompositeData interface
33260
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
    53
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    public boolean containsKey(String key) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        return compositeData().containsKey(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
33260
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
    58
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    public boolean containsValue(Object value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
        return compositeData().containsValue(value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
33260
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
    63
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    public boolean equals(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        return compositeData().equals(obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
33260
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
    68
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    public Object get(String key) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        return compositeData().get(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
33260
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
    73
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    public Object[] getAll(String[] keys) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        return compositeData().getAll(keys);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
33260
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
    78
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    public CompositeType getCompositeType() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        return compositeData().getCompositeType();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
33260
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
    83
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    public int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        return compositeData().hashCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
33260
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
    88
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        /** FIXME: What should this be?? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        return compositeData().toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
33260
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
    94
    @Override
11530
a9d059c15b80 7117570: Warnings in sun.mangement.* and its subpackages
mchung
parents: 5506
diff changeset
    95
    public Collection<?> values() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        return compositeData().values();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    /* Lazy creation of a CompositeData object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * only when the CompositeData interface is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    private synchronized CompositeData compositeData() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        if (compositeData != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            return compositeData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        compositeData = getCompositeData();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        return compositeData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * Designate to a CompositeData object when writing to an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * output stream during serialization so that the receiver
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * only requires JMX 1.2 classes but not any implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * specific class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    protected Object writeReplace() throws java.io.ObjectStreamException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        return compositeData();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * Returns the CompositeData representing this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * The returned CompositeData object must be an instance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * of javax.management.openmbean.CompositeDataSupport class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * so that no implementation specific class is required
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * for unmarshalling besides JMX 1.2 classes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    protected abstract CompositeData getCompositeData();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    // Helper methods
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 25859
diff changeset
   129
    public static String getString(CompositeData cd, String itemName) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        if (cd == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            throw new IllegalArgumentException("Null CompositeData");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        return (String) cd.get(itemName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 25859
diff changeset
   136
    public static boolean getBoolean(CompositeData cd, String itemName) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        if (cd == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            throw new IllegalArgumentException("Null CompositeData");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
33260
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   140
        return ((Boolean) cd.get(itemName));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 25859
diff changeset
   143
    public static long getLong(CompositeData cd, String itemName) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        if (cd == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            throw new IllegalArgumentException("Null CompositeData");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
33260
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   147
        return ((Long) cd.get(itemName));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 25859
diff changeset
   150
    public static int getInt(CompositeData cd, String itemName) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        if (cd == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            throw new IllegalArgumentException("Null CompositeData");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
33260
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   154
        return ((Integer) cd.get(itemName));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * Compares two CompositeTypes and returns true if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * all items in type1 exist in type2 and their item types
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * are the same.
33260
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   161
     * @param type1 the base composite type
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   162
     * @param type2 the checked composite type
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   163
     * @return {@code true} if all items in type1 exist in type2 and their item
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   164
     *         types are the same.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    protected static boolean isTypeMatched(CompositeType type1, CompositeType type2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        if (type1 == type2) return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        // We can't use CompositeType.isValue() since it returns false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        // if the type name doesn't match.
11530
a9d059c15b80 7117570: Warnings in sun.mangement.* and its subpackages
mchung
parents: 5506
diff changeset
   171
        Set<String> allItems = type1.keySet();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        // Check all items in the type1 exist in type2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        if (!type2.keySet().containsAll(allItems))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
33260
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   177
        return allItems.stream().allMatch(
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   178
            item -> isTypeMatched(type1.getType(item), type2.getType(item))
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   179
        );
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    protected static boolean isTypeMatched(TabularType type1, TabularType type2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        if (type1 == type2) return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
11530
a9d059c15b80 7117570: Warnings in sun.mangement.* and its subpackages
mchung
parents: 5506
diff changeset
   185
        List<String> list1 = type1.getIndexNames();
a9d059c15b80 7117570: Warnings in sun.mangement.* and its subpackages
mchung
parents: 5506
diff changeset
   186
        List<String> list2 = type2.getIndexNames();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        // check if the list of index names are the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        if (!list1.equals(list2))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        return isTypeMatched(type1.getRowType(), type2.getRowType());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    }
4173
d01972926813 6895875: Missing serialVersionUID in sun.management classes
mchung
parents: 2
diff changeset
   194
33260
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   195
    protected static boolean isTypeMatched(ArrayType<?> type1, ArrayType<?> type2) {
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   196
        if (type1 == type2) return true;
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   197
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   198
        int dim1 = type1.getDimension();
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   199
        int dim2 = type2.getDimension();
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   200
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   201
        // check if the array dimensions are the same
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   202
        if (dim1 != dim2)
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   203
            return false;
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   204
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   205
        return isTypeMatched(type1.getElementOpenType(), type2.getElementOpenType());
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   206
    }
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   207
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   208
    private static boolean isTypeMatched(OpenType<?> ot1, OpenType<?> ot2) {
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   209
        if (ot1 instanceof CompositeType) {
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   210
            if (! (ot2 instanceof CompositeType))
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   211
                return false;
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   212
            if (!isTypeMatched((CompositeType) ot1, (CompositeType) ot2))
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   213
                return false;
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   214
        } else if (ot1 instanceof TabularType) {
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   215
            if (! (ot2 instanceof TabularType))
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   216
                return false;
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   217
            if (!isTypeMatched((TabularType) ot1, (TabularType) ot2))
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   218
                return false;
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   219
        } else if (ot1 instanceof ArrayType) {
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   220
            if (! (ot2 instanceof ArrayType))
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   221
                return false;
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   222
            if (!isTypeMatched((ArrayType<?>) ot1, (ArrayType<?>) ot2)) {
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   223
                return false;
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   224
            }
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   225
        } else if (!ot1.equals(ot2)) {
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   226
            return false;
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   227
        }
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   228
        return true;
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   229
    }
af1ca24593aa 8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents: 30355
diff changeset
   230
4173
d01972926813 6895875: Missing serialVersionUID in sun.management classes
mchung
parents: 2
diff changeset
   231
    private static final long serialVersionUID = -2190411934472666714L;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
}