author | sundar |
Mon, 16 May 2016 14:50:43 +0530 | |
changeset 37951 | ce2744a0f1a7 |
parent 33260 | af1ca24593aa |
child 44423 | 306c020eb154 |
permissions | -rw-r--r-- |
33260
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
1 |
/* |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
4 |
* |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
8 |
* |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
13 |
* accompanied this code). |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
14 |
* |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
18 |
* |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
21 |
* questions. |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
22 |
*/ |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
23 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
24 |
import java.util.HashMap; |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
25 |
import java.util.Map; |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
26 |
import javax.management.openmbean.ArrayType; |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
27 |
import javax.management.openmbean.CompositeData; |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
28 |
import javax.management.openmbean.CompositeDataSupport; |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
29 |
import javax.management.openmbean.CompositeType; |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
30 |
import javax.management.openmbean.OpenDataException; |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
31 |
import javax.management.openmbean.OpenType; |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
32 |
import javax.management.openmbean.SimpleType; |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
33 |
import sun.management.LazyCompositeData; |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
34 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
35 |
/** |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
36 |
* @test |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
37 |
* @bug 8139870 |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
38 |
* @summary sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
39 |
* @modules java.management/sun.management |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
40 |
* @author Jaroslav Bachorik |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
41 |
*/ |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
42 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
43 |
public class LazyCompositeDataTest { |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
44 |
private final static CompositeData dataV1, dataV2; |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
45 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
46 |
static { |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
47 |
try { |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
48 |
// *** |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
49 |
// prepare the composite types |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
50 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
51 |
// composite type stored in an array; V1 |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
52 |
CompositeType subtypeV1 = new CompositeType( |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
53 |
"Subtype1", |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
54 |
"Version 1", |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
55 |
new String[]{"item1"}, |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
56 |
new String[]{"Item 1"}, |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
57 |
new OpenType<?>[]{ |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
58 |
SimpleType.STRING |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
59 |
} |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
60 |
); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
61 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
62 |
// composite type stored in an array; V2 |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
63 |
CompositeType subtypeV2 = new CompositeType( |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
64 |
"Subtype2", |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
65 |
"Version 2", |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
66 |
new String[]{"item1", "item2"}, |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
67 |
new String[]{"Item 1", "Item 2"}, |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
68 |
new OpenType<?>[]{ |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
69 |
SimpleType.STRING, |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
70 |
SimpleType.INTEGER |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
71 |
} |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
72 |
); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
73 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
74 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
75 |
// main composite type; V1 |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
76 |
// one of the items is array of 'subtypeV1' instances |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
77 |
CompositeType typeV1 = new CompositeType( |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
78 |
"MyDataV1", |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
79 |
"Version 1", |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
80 |
new String[]{"item1", "item2"}, |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
81 |
new String[]{"Item 1", "Item 2"}, |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
82 |
new OpenType<?>[]{ |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
83 |
SimpleType.STRING, |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
84 |
ArrayType.getArrayType(subtypeV1) |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
85 |
} |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
86 |
); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
87 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
88 |
// main composite type; V2 |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
89 |
// one of the items is array of 'subtypeV2' instances |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
90 |
CompositeType typeV2 = new CompositeType( |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
91 |
"MyDataV2", |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
92 |
"Version 2", |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
93 |
new String[]{"item1", "item2"}, |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
94 |
new String[]{"Item 1", "Item 2"}, |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
95 |
new OpenType<?>[]{ |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
96 |
SimpleType.STRING, |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
97 |
ArrayType.getArrayType(subtypeV2) |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
98 |
} |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
99 |
); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
100 |
// *** |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
101 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
102 |
// *** |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
103 |
// construct the data |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
104 |
Map<String, Object> subitemsV1 = new HashMap<>(); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
105 |
Map<String, Object> subitemsV2 = new HashMap<>(); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
106 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
107 |
Map<String, Object> itemsV1 = new HashMap<>(); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
108 |
Map<String, Object> itemsV2 = new HashMap<>(); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
109 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
110 |
subitemsV1.put("item1", "item1"); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
111 |
subitemsV2.put("item1", "item1"); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
112 |
subitemsV2.put("item2", 42); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
113 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
114 |
itemsV1.put("item1", "item1"); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
115 |
itemsV1.put("item2", new CompositeData[]{new CompositeDataSupport(subtypeV1, subitemsV1)}); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
116 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
117 |
itemsV2.put("item1", "item1"); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
118 |
itemsV2.put("item2", new CompositeData[]{new CompositeDataSupport(subtypeV2, subitemsV2)}); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
119 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
120 |
dataV1 = new CompositeDataSupport(typeV1, itemsV1); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
121 |
dataV2 = new CompositeDataSupport(typeV2, itemsV2); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
122 |
// *** |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
123 |
} catch (OpenDataException e) { |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
124 |
throw new Error(e); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
125 |
} |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
126 |
} |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
127 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
128 |
private static class MyDataV1 extends LazyCompositeData { |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
129 |
@Override |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
130 |
protected CompositeData getCompositeData() { |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
131 |
return dataV1; |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
132 |
} |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
133 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
134 |
public boolean isTypeMached(CompositeType type) { |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
135 |
return isTypeMatched(this.getCompositeType(), type); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
136 |
} |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
137 |
} |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
138 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
139 |
private static class MyDataV2 extends LazyCompositeData { |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
140 |
@Override |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
141 |
protected CompositeData getCompositeData() { |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
142 |
return dataV2; |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
143 |
} |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
144 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
145 |
} |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
146 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
147 |
public static void main(String[] args) throws Exception { |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
148 |
System.out.println("Checking LazyCompositeData.isTypeMatched()"); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
149 |
MyDataV1 v1 = new MyDataV1(); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
150 |
MyDataV2 v2 = new MyDataV2(); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
151 |
|
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
152 |
if (!v1.isTypeMached(v2.getCompositeType())) { |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
153 |
System.err.println("=== FAILED"); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
154 |
System.err.println("V1 should be matched by V2"); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
155 |
System.err.println("\n=== V1"); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
156 |
System.err.println(v1.getCompositeType()); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
157 |
System.err.println("\n=== V2"); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
158 |
System.err.println(v2.getCompositeType()); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
159 |
throw new Error(); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
160 |
} |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
161 |
System.out.println("=== PASSED"); |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
162 |
} |
af1ca24593aa
8139870: sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
jbachorik
parents:
diff
changeset
|
163 |
} |