1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package test.java_uno.anytest;
25 
26 import com.sun.star.uno.Any;
27 import com.sun.star.uno.Enum;
28 import com.sun.star.uno.Type;
29 import com.sun.star.uno.TypeClass;
30 import com.sun.star.uno.XInterface;
31 import java.lang.reflect.Array;
32 
33 final class TestAny {
test(XTransport transport, boolean createTypes)34     public static boolean test(XTransport transport, boolean createTypes) {
35         boolean success = true;
36 
37         // Sanity check for com.sun.star.uno.Type:
38         success &= testType(void.class, TypeClass.VOID, "void");
39         success &= testType(boolean.class, TypeClass.BOOLEAN, "boolean");
40         success &= testType(byte.class, TypeClass.BYTE, "byte");
41         success &= testType(short.class, TypeClass.SHORT, "short");
42         success &= testType(int.class, TypeClass.LONG, "long");
43         success &= testType(long.class, TypeClass.HYPER, "hyper");
44         success &= testType(float.class, TypeClass.FLOAT, "float");
45         success &= testType(double.class, TypeClass.DOUBLE, "double");
46         success &= testType(char.class, TypeClass.CHAR, "char");
47         success &= testType(String.class, TypeClass.STRING, "string");
48         success &= testType(Type.class, TypeClass.TYPE, "type");
49         success &= testType(Any.class, TypeClass.ANY, "any");
50         success &= testType(boolean[].class, TypeClass.SEQUENCE, "[]boolean");
51         success &= testType(byte[].class, TypeClass.SEQUENCE, "[]byte");
52         success &= testType(short[].class, TypeClass.SEQUENCE, "[]short");
53         success &= testType(int[].class, TypeClass.SEQUENCE, "[]long");
54         success &= testType(long[].class, TypeClass.SEQUENCE, "[]hyper");
55         success &= testType(float[].class, TypeClass.SEQUENCE, "[]float");
56         success &= testType(double[].class, TypeClass.SEQUENCE, "[]double");
57         success &= testType(char[].class, TypeClass.SEQUENCE, "[]char");
58         success &= testType(String[].class, TypeClass.SEQUENCE, "[]string");
59         success &= testType(Type[].class, TypeClass.SEQUENCE, "[]type");
60         success &= testType(Any[].class, TypeClass.SEQUENCE, "[]any");
61         success &= testType(Enum1[].class, TypeClass.SEQUENCE,
62                             "[]" + Enum1.class.getName());
63         success &= testType(BaseStruct[].class, TypeClass.SEQUENCE,
64                             "[]" + BaseStruct.class.getName());
65         success &= testType(DerivedStruct[].class, TypeClass.SEQUENCE,
66                             "[]" + DerivedStruct.class.getName());
67         success &= testType(XInterface[].class, TypeClass.SEQUENCE,
68                             "[]" + XInterface.class.getName());
69         success &= testType(BaseInterface[].class, TypeClass.SEQUENCE,
70                             "[]" + BaseInterface.class.getName());
71         success &= testType(DerivedInterface[].class, TypeClass.SEQUENCE,
72                             "[]" + DerivedInterface.class.getName());
73         success &= testType(boolean[][].class, TypeClass.SEQUENCE,
74                             "[][]boolean");
75         success &= testType(byte[][].class, TypeClass.SEQUENCE, "[][]byte");
76         success &= testType(short[][].class, TypeClass.SEQUENCE, "[][]short");
77         success &= testType(int[][].class, TypeClass.SEQUENCE, "[][]long");
78         success &= testType(long[][].class, TypeClass.SEQUENCE, "[][]hyper");
79         success &= testType(float[][].class, TypeClass.SEQUENCE, "[][]float");
80         success &= testType(double[][].class, TypeClass.SEQUENCE, "[][]double");
81         success &= testType(char[][].class, TypeClass.SEQUENCE, "[][]char");
82         success &= testType(String[][].class, TypeClass.SEQUENCE, "[][]string");
83         success &= testType(Type[][].class, TypeClass.SEQUENCE, "[][]type");
84         success &= testType(Any[][].class, TypeClass.SEQUENCE, "[][]any");
85         success &= testType(Enum1[][].class, TypeClass.SEQUENCE,
86                             "[][]" + Enum1.class.getName());
87         success &= testType(BaseStruct[][].class, TypeClass.SEQUENCE,
88                             "[][]" + BaseStruct.class.getName());
89         success &= testType(DerivedStruct[][].class, TypeClass.SEQUENCE,
90                             "[][]" + DerivedStruct.class.getName());
91         success &= testType(XInterface[][].class, TypeClass.SEQUENCE,
92                             "[][]" + XInterface.class.getName());
93         success &= testType(BaseInterface[][].class, TypeClass.SEQUENCE,
94                             "[][]" + BaseInterface.class.getName());
95         success &= testType(DerivedInterface[][].class, TypeClass.SEQUENCE,
96                             "[][]" + DerivedInterface.class.getName());
97         success &= testType(Enum1.class, TypeClass.ENUM, Enum1.class.getName());
98         success &= testType(BaseStruct.class, TypeClass.STRUCT,
99                             BaseStruct.class.getName());
100         success &= testType(DerivedStruct.class, TypeClass.STRUCT,
101                             DerivedStruct.class.getName());
102         success &= testType(com.sun.star.uno.Exception.class,
103                             TypeClass.EXCEPTION,
104                             com.sun.star.uno.Exception.class.getName());
105         success &= testType(com.sun.star.uno.RuntimeException.class,
106                             TypeClass.EXCEPTION,
107                             com.sun.star.uno.RuntimeException.class.getName());
108         success &= testType(XInterface.class, TypeClass.INTERFACE,
109                             XInterface.class.getName());
110         success &= testType(BaseInterface.class, TypeClass.INTERFACE,
111                             BaseInterface.class.getName());
112         success &= testType(DerivedInterface.class, TypeClass.INTERFACE,
113                             DerivedInterface.class.getName());
114 
115         // VOID:
116         success &= testMapAny(transport, Any.VOID, new CompareBoxed());
117 
118         // BOOLEAN:
119         success &= testMapAny(transport, Boolean.FALSE, new CompareBoxed());
120         success &= testMapAny(transport, Boolean.TRUE, new CompareBoxed());
121         success &= testMapAny(transport,
122                               new Any(Type.BOOLEAN, Boolean.FALSE),
123                               new CompareUnboxed());
124         success &= testMapAny(transport,
125                               new Any(Type.BOOLEAN, Boolean.TRUE),
126                               new CompareUnboxed());
127 
128         // BYTE:
129         success &= testMapAny(transport, new Byte((byte) -128),
130                               new CompareBoxed());
131         success &= testMapAny(transport, new Byte((byte) 0),
132                               new CompareBoxed());
133         success &= testMapAny(transport, new Byte((byte) 127),
134                               new CompareBoxed());
135         success &= testMapAny(transport,
136                               new Any(Type.BYTE, new Byte((byte) -128)),
137                               new CompareUnboxed());
138         success &= testMapAny(transport,
139                               new Any(Type.BYTE, new Byte((byte) 0)),
140                               new CompareUnboxed());
141         success &= testMapAny(transport,
142                               new Any(Type.BYTE, new Byte((byte) 127)),
143                               new CompareUnboxed());
144 
145         // SHORT:
146         success &= testMapAny(transport, new Short((short) -32768),
147                               new CompareBoxed());
148         success &= testMapAny(transport, new Short((short) 0),
149                               new CompareBoxed());
150         success &= testMapAny(transport, new Short((short) 32767),
151                               new CompareBoxed());
152         success &= testMapAny(transport,
153                               new Any(Type.SHORT,
154                                       new Short((short) -32768)),
155                               new CompareUnboxed());
156         success &= testMapAny(transport,
157                               new Any(Type.SHORT, new Short((short) 0)),
158                               new CompareUnboxed());
159         success &= testMapAny(transport,
160                               new Any(Type.SHORT, new Short((short) 32767)),
161                               new CompareUnboxed());
162 
163         // UNSIGNED SHORT:
164         success &= testMapAny(transport,
165                               new Any(Type.UNSIGNED_SHORT,
166                                       new Short((short) 0)),
167                               new CompareBoxed());
168         success &= testMapAny(transport,
169                               new Any(Type.UNSIGNED_SHORT,
170                                       new Short((short) -32768)),
171                               new CompareBoxed());
172 
173         // LONG:
174         success &= testMapAny(transport, new Integer(-2147483648),
175                               new CompareBoxed());
176         success &= testMapAny(transport, new Integer(0),
177                               new CompareBoxed());
178         success &= testMapAny(transport, new Integer(2147483647),
179                               new CompareBoxed());
180         success &= testMapAny(transport,
181                               new Any(Type.LONG, new Integer(-2147483648)),
182                               new CompareUnboxed());
183         success &= testMapAny(transport,
184                               new Any(Type.LONG, new Integer(0)),
185                               new CompareUnboxed());
186         success &= testMapAny(transport,
187                               new Any(Type.LONG, new Integer(2147483647)),
188                               new CompareUnboxed());
189 
190         // UNSIGNED LONG:
191         success &= testMapAny(transport,
192                               new Any(Type.UNSIGNED_LONG, new Integer(0)),
193                               new CompareBoxed());
194         success &= testMapAny(transport,
195                               new Any(Type.UNSIGNED_LONG,
196                                       new Integer(-2147483648)),
197                               new CompareBoxed());
198 
199         // HYPER:
200         success &= testMapAny(transport, new Long(-9223372036854775808L),
201                               new CompareBoxed());
202         success &= testMapAny(transport, new Long(0L), new CompareBoxed());
203         success &= testMapAny(transport, new Long(9223372036854775807L),
204                               new CompareBoxed());
205         success &= testMapAny(transport,
206                               new Any(Type.HYPER,
207                                       new Long(-9223372036854775808L)),
208                               new CompareUnboxed());
209         success &= testMapAny(transport, new Any(Type.HYPER, new Long(0L)),
210                               new CompareUnboxed());
211         success &= testMapAny(transport,
212                               new Any(Type.HYPER,
213                                       new Long(9223372036854775807L)),
214                               new CompareUnboxed());
215 
216         // UNSIGNED HYPER:
217         success &= testMapAny(transport,
218                               new Any(Type.UNSIGNED_HYPER, new Long(0L)),
219                               new CompareBoxed());
220         success &= testMapAny(transport,
221                               new Any(Type.UNSIGNED_HYPER,
222                                       new Long(-9223372036854775808L)),
223                               new CompareBoxed());
224 
225         // FLOAT:
226         success &= testMapAny(transport, new Float(Float.NEGATIVE_INFINITY),
227                               new CompareBoxed());
228         success &= testMapAny(transport, new Float(Float.MIN_VALUE),
229                               new CompareBoxed());
230         success &= testMapAny(transport, new Float(-0.0f),
231                               new CompareBoxed());
232         success &= testMapAny(transport, new Float(0.0f),
233                               new CompareBoxed());
234         success &= testMapAny(transport, new Float(Float.MAX_VALUE),
235                               new CompareBoxed());
236         success &= testMapAny(transport, new Float(Float.POSITIVE_INFINITY),
237                               new CompareBoxed());
238         success &= testMapAny(transport, new Float(Float.NaN),
239                               new CompareBoxed());
240         success &= testMapAny(transport,
241                               new Any(Type.FLOAT,
242                                       new Float(Float.NEGATIVE_INFINITY)),
243                               new CompareUnboxed());
244         success &= testMapAny(transport,
245                               new Any(Type.FLOAT,
246                                       new Float(Float.MIN_VALUE)),
247                               new CompareUnboxed());
248         success &= testMapAny(transport,
249                               new Any(Type.FLOAT, new Float(-0.0f)),
250                               new CompareUnboxed());
251         success &= testMapAny(transport,
252                               new Any(Type.FLOAT, new Float(0.0f)),
253                               new CompareUnboxed());
254         success &= testMapAny(transport,
255                               new Any(Type.FLOAT,
256                                       new Float(Float.MAX_VALUE)),
257                               new CompareUnboxed());
258         success &= testMapAny(transport,
259                               new Any(Type.FLOAT,
260                                       new Float(Float.POSITIVE_INFINITY)),
261                               new CompareUnboxed());
262         success &= testMapAny(transport,
263                               new Any(Type.FLOAT, new Float(Float.NaN)),
264                               new CompareUnboxed());
265 
266         // DOUBLE:
267         success &= testMapAny(transport,
268                               new Double(Double.NEGATIVE_INFINITY),
269                               new CompareBoxed());
270         success &= testMapAny(transport, new Double(Double.MIN_VALUE),
271                               new CompareBoxed());
272         success &= testMapAny(transport, new Double(-0.0f),
273                               new CompareBoxed());
274         success &= testMapAny(transport, new Double(0.0f),
275                               new CompareBoxed());
276         success &= testMapAny(transport, new Double(Double.MAX_VALUE),
277                               new CompareBoxed());
278         success &= testMapAny(transport,
279                               new Double(Double.POSITIVE_INFINITY),
280                               new CompareBoxed());
281         success &= testMapAny(transport, new Double(Double.NaN),
282                               new CompareBoxed());
283         success &= testMapAny(transport,
284                               new Any(Type.DOUBLE,
285                                       new Double(Double.NEGATIVE_INFINITY)),
286                               new CompareUnboxed());
287         success &= testMapAny(transport,
288                               new Any(Type.DOUBLE,
289                                       new Double(Double.MIN_VALUE)),
290                               new CompareUnboxed());
291         success &= testMapAny(transport,
292                               new Any(Type.DOUBLE, new Double(-0.0)),
293                               new CompareUnboxed());
294         success &= testMapAny(transport,
295                               new Any(Type.DOUBLE, new Double(0.0)),
296                               new CompareUnboxed());
297         success &= testMapAny(transport,
298                               new Any(Type.DOUBLE,
299                                       new Double(Double.MAX_VALUE)),
300                               new CompareUnboxed());
301         success &= testMapAny(transport,
302                               new Any(Type.DOUBLE,
303                                       new Double(Double.POSITIVE_INFINITY)),
304                               new CompareUnboxed());
305         success &= testMapAny(transport,
306                               new Any(Type.DOUBLE, new Double(Double.NaN)),
307                               new CompareUnboxed());
308 
309         // CHAR:
310         success &= testMapAny(transport, new Character('\u0000'),
311                               new CompareBoxed());
312         success &= testMapAny(transport, new Character('\uDBFF'),
313                               new CompareBoxed());
314         success &= testMapAny(transport, new Character('\uFFFD'),
315                               new CompareBoxed());
316         success &= testMapAny(transport,
317                               new Any(Type.CHAR, new Character('\u0000')),
318                               new CompareUnboxed());
319         success &= testMapAny(transport,
320                               new Any(Type.CHAR, new Character('\uDBFF')),
321                               new CompareUnboxed());
322         success &= testMapAny(transport,
323                               new Any(Type.CHAR, new Character('\uFFFD')),
324                               new CompareUnboxed());
325 
326         // STRING:
327         success &= testMapAny(transport, "", new CompareBoxed());
328         success &= testMapAny(transport, "\uD800\uDC00",
329                               new CompareBoxed());
330         success &= testMapAny(transport, "Test", new CompareBoxed());
331         success &= testMapAny(transport, new Any(Type.STRING, ""),
332                               new CompareUnboxed());
333         success &= testMapAny(transport,
334                               new Any(Type.STRING, "\uD800\uDC00"),
335                               new CompareUnboxed());
336         success &= testMapAny(transport, new Any(Type.STRING, "Test"),
337                               new CompareUnboxed());
338 
339         // TYPE:
340         success &= testMapAny(transport, Type.VOID, new CompareBoxed());
341         success &= testMapAny(transport, Type.BOOLEAN, new CompareBoxed());
342         success &= testMapAny(transport, Type.BYTE, new CompareBoxed());
343         success &= testMapAny(transport, Type.SHORT, new CompareBoxed());
344         success &= testMapAny(transport, Type.UNSIGNED_SHORT,
345                               new CompareBoxed());
346         success &= testMapAny(transport, Type.LONG, new CompareBoxed());
347         success &= testMapAny(transport, Type.UNSIGNED_LONG,
348                               new CompareBoxed());
349         success &= testMapAny(transport, Type.HYPER, new CompareBoxed());
350         success &= testMapAny(transport, Type.UNSIGNED_HYPER,
351                               new CompareBoxed());
352         success &= testMapAny(transport, Type.FLOAT, new CompareBoxed());
353         success &= testMapAny(transport, Type.DOUBLE, new CompareBoxed());
354         success &= testMapAny(transport, Type.CHAR, new CompareBoxed());
355         success &= testMapAny(transport, Type.STRING, new CompareBoxed());
356         success &= testMapAny(transport, Type.TYPE, new CompareBoxed());
357         success &= testMapAny(transport, Type.ANY, new CompareBoxed());
358         success &= testMapAny(transport,
359                               new Type("[]boolean", TypeClass.SEQUENCE),
360                               new CompareBoxed());
361         success &= testMapAny(transport,
362                               new Type("[]byte", TypeClass.SEQUENCE),
363                               new CompareBoxed());
364         success &= testMapAny(transport,
365                               new Type("[]short", TypeClass.SEQUENCE),
366                               new CompareBoxed());
367         success &= testMapAny(transport,
368                               new Type("[]unsigned short",
369                                        TypeClass.SEQUENCE),
370                               new CompareBoxed());
371         success &= testMapAny(transport,
372                               new Type("[]long", TypeClass.SEQUENCE),
373                               new CompareBoxed());
374         success &= testMapAny(transport,
375                               new Type("[]unsigned long",
376                                        TypeClass.SEQUENCE),
377                               new CompareBoxed());
378         success &= testMapAny(transport,
379                               new Type("[]hyper", TypeClass.SEQUENCE),
380                               new CompareBoxed());
381         success &= testMapAny(transport,
382                               new Type("[]unsigned hyper",
383                                        TypeClass.SEQUENCE),
384                               new CompareBoxed());
385         success &= testMapAny(transport,
386                               new Type("[]float", TypeClass.SEQUENCE),
387                               new CompareBoxed());
388         success &= testMapAny(transport,
389                               new Type("[]double", TypeClass.SEQUENCE),
390                               new CompareBoxed());
391         success &= testMapAny(transport,
392                               new Type("[]char", TypeClass.SEQUENCE),
393                               new CompareBoxed());
394         success &= testMapAny(transport,
395                               new Type("[]string", TypeClass.SEQUENCE),
396                               new CompareBoxed());
397         success &= testMapAny(transport,
398                               new Type("[]type", TypeClass.SEQUENCE),
399                               new CompareBoxed());
400         success &= testMapAny(transport,
401                               new Type("[]any", TypeClass.SEQUENCE),
402                               new CompareBoxed());
403         if (createTypes) {
404             success &= testMapAny(transport,
405                                   new Type("[]" + Enum1.class.getName(),
406                                            TypeClass.SEQUENCE),
407                                   new CompareBoxed());
408             success &= testMapAny(transport,
409                                   new Type("[]" + BaseStruct.class.getName(),
410                                            TypeClass.SEQUENCE),
411                                   new CompareBoxed());
412             success &= testMapAny(transport,
413                                   new Type("[]" + DerivedStruct.class.getName(),
414                                            TypeClass.SEQUENCE),
415                                   new CompareBoxed());
416         }
417         success &= testMapAny(transport,
418                               new Type("[]" + XInterface.class.getName(),
419                                        TypeClass.SEQUENCE),
420                               new CompareBoxed());
421         success &= testMapAny(transport,
422                               new Type("[]" + BaseInterface.class.getName(),
423                                        TypeClass.SEQUENCE),
424                               new CompareBoxed());
425         success &= testMapAny(transport,
426                               new Type("[]"
427                                        + DerivedInterface.class.getName(),
428                                        TypeClass.SEQUENCE),
429                               new CompareBoxed());
430         success &= testMapAny(transport,
431                               new Type("[][]boolean", TypeClass.SEQUENCE),
432                               new CompareBoxed());
433         success &= testMapAny(transport,
434                               new Type("[][]byte", TypeClass.SEQUENCE),
435                               new CompareBoxed());
436         success &= testMapAny(transport,
437                               new Type("[][]short", TypeClass.SEQUENCE),
438                               new CompareBoxed());
439         success &= testMapAny(transport,
440                               new Type("[][]unsigned short",
441                                        TypeClass.SEQUENCE),
442                               new CompareBoxed());
443         success &= testMapAny(transport,
444                               new Type("[][]long", TypeClass.SEQUENCE),
445                               new CompareBoxed());
446         success &= testMapAny(transport,
447                               new Type("[][]unsigned long",
448                                        TypeClass.SEQUENCE),
449                               new CompareBoxed());
450         success &= testMapAny(transport,
451                               new Type("[][]hyper", TypeClass.SEQUENCE),
452                               new CompareBoxed());
453         success &= testMapAny(transport,
454                               new Type("[][]unsigned hyper",
455                                        TypeClass.SEQUENCE),
456                               new CompareBoxed());
457         success &= testMapAny(transport,
458                               new Type("[][]float", TypeClass.SEQUENCE),
459                               new CompareBoxed());
460         success &= testMapAny(transport,
461                               new Type("[][]double", TypeClass.SEQUENCE),
462                               new CompareBoxed());
463         success &= testMapAny(transport,
464                               new Type("[][]char", TypeClass.SEQUENCE),
465                               new CompareBoxed());
466         success &= testMapAny(transport,
467                               new Type("[][]string", TypeClass.SEQUENCE),
468                               new CompareBoxed());
469         success &= testMapAny(transport,
470                               new Type("[][]type", TypeClass.SEQUENCE),
471                               new CompareBoxed());
472         success &= testMapAny(transport,
473                               new Type("[][]any", TypeClass.SEQUENCE),
474                               new CompareBoxed());
475         if (createTypes) {
476             success &= testMapAny(transport,
477                                   new Type("[][]" + Enum1.class.getName(),
478                                            TypeClass.SEQUENCE),
479                                   new CompareBoxed());
480             success &= testMapAny(transport,
481                                   new Type("[][]" + BaseStruct.class.getName(),
482                                            TypeClass.SEQUENCE),
483                                   new CompareBoxed());
484             success &= testMapAny(transport,
485                                   new Type("[][]"
486                                            + DerivedStruct.class.getName(),
487                                            TypeClass.SEQUENCE),
488                                   new CompareBoxed());
489         }
490         success &= testMapAny(transport,
491                               new Type("[][]" + XInterface.class.getName(),
492                                        TypeClass.SEQUENCE),
493                               new CompareBoxed());
494         success &= testMapAny(transport,
495                               new Type("[][]"
496                                        + BaseInterface.class.getName(),
497                                        TypeClass.SEQUENCE),
498                               new CompareBoxed());
499         success &= testMapAny(transport,
500                               new Type("[][]"
501                                        + DerivedInterface.class.getName(),
502                                        TypeClass.SEQUENCE),
503                               new CompareBoxed());
504         if (createTypes) {
505             success &= testMapAny(transport, new Type(Enum1.class.getName(),
506                                                       TypeClass.ENUM),
507                                   new CompareBoxed());
508             success &= testMapAny(transport,
509                                   new Type(BaseStruct.class.getName(),
510                                            TypeClass.STRUCT),
511                                   new CompareBoxed());
512             success &= testMapAny(transport,
513                                   new Type(DerivedStruct.class.getName(),
514                                            TypeClass.STRUCT),
515                                   new CompareBoxed());
516         }
517         success &= testMapAny(transport,
518                               new Type(
519                                   com.sun.star.uno.Exception.class.
520                                   getName(),
521                                   TypeClass.EXCEPTION),
522                               new CompareBoxed());
523         if (createTypes) {
524             success &= testMapAny(transport,
525                                   new Type(BaseException.class.getName(),
526                                            TypeClass.EXCEPTION),
527                                   new CompareBoxed());
528             success &= testMapAny(transport,
529                                   new Type(DerivedException.class.getName(),
530                                            TypeClass.EXCEPTION),
531                                   new CompareBoxed());
532         }
533         success &= testMapAny(transport,
534                               new Type(
535                                   com.sun.star.uno.RuntimeException.class.
536                                   getName(),
537                                   TypeClass.EXCEPTION),
538                               new CompareBoxed());
539         if (createTypes) {
540             success &= testMapAny(transport,
541                                   new Type(
542                                       BaseRuntimeException.class.getName(),
543                                       TypeClass.EXCEPTION),
544                                   new CompareBoxed());
545             success &= testMapAny(transport,
546                                   new Type(
547                                       DerivedRuntimeException.class.
548                                       getName(),
549                                       TypeClass.EXCEPTION),
550                                   new CompareBoxed());
551         }
552         success &= testMapAny(transport,
553                               new Type(XInterface.class.getName(),
554                                        TypeClass.INTERFACE),
555                               new CompareBoxed());
556         success &= testMapAny(transport,
557                               new Type(BaseInterface.class.getName(),
558                                        TypeClass.INTERFACE),
559                               new CompareBoxed());
560         success &= testMapAny(transport,
561                               new Type(DerivedInterface.class.getName(),
562                                        TypeClass.INTERFACE),
563                               new CompareBoxed());
564         success &= testMapAny(transport, new Any(Type.TYPE, Type.VOID),
565                               new CompareUnboxed());
566         success &= testMapAny(transport, new Any(Type.TYPE, Type.BOOLEAN),
567                               new CompareUnboxed());
568         success &= testMapAny(transport, new Any(Type.TYPE, Type.BYTE),
569                               new CompareUnboxed());
570         success &= testMapAny(transport, new Any(Type.TYPE, Type.SHORT),
571                               new CompareUnboxed());
572         success &= testMapAny(transport,
573                               new Any(Type.TYPE, Type.UNSIGNED_SHORT),
574                               new CompareUnboxed());
575         success &= testMapAny(transport, new Any(Type.TYPE, Type.LONG),
576                               new CompareUnboxed());
577         success &= testMapAny(transport,
578                               new Any(Type.TYPE, Type.UNSIGNED_LONG),
579                               new CompareUnboxed());
580         success &= testMapAny(transport, new Any(Type.TYPE, Type.HYPER),
581                               new CompareUnboxed());
582         success &= testMapAny(transport,
583                               new Any(Type.TYPE, Type.UNSIGNED_HYPER),
584                               new CompareUnboxed());
585         success &= testMapAny(transport, new Any(Type.TYPE, Type.FLOAT),
586                               new CompareUnboxed());
587         success &= testMapAny(transport, new Any(Type.TYPE, Type.DOUBLE),
588                               new CompareUnboxed());
589         success &= testMapAny(transport, new Any(Type.TYPE, Type.CHAR),
590                               new CompareUnboxed());
591         success &= testMapAny(transport, new Any(Type.TYPE, Type.STRING),
592                               new CompareUnboxed());
593         success &= testMapAny(transport, new Any(Type.TYPE, Type.TYPE),
594                               new CompareUnboxed());
595         success &= testMapAny(transport, new Any(Type.TYPE, Type.ANY),
596                               new CompareUnboxed());
597         success &= testMapAny(transport,
598                               new Any(Type.TYPE,
599                                       new Type("[]boolean",
600                                                TypeClass.SEQUENCE)),
601                               new CompareUnboxed());
602         success &= testMapAny(transport,
603                               new Any(Type.TYPE,
604                                       new Type("[]byte",
605                                                TypeClass.SEQUENCE)),
606                               new CompareUnboxed());
607         success &= testMapAny(transport,
608                               new Any(Type.TYPE,
609                                       new Type("[]short",
610                                                TypeClass.SEQUENCE)),
611                               new CompareUnboxed());
612         success &= testMapAny(transport,
613                               new Any(Type.TYPE,
614                                       new Type("[]unsigned short",
615                                                TypeClass.SEQUENCE)),
616                               new CompareUnboxed());
617         success &= testMapAny(transport,
618                               new Any(Type.TYPE,
619                                       new Type("[]long",
620                                                TypeClass.SEQUENCE)),
621                               new CompareUnboxed());
622         success &= testMapAny(transport,
623                               new Any(Type.TYPE,
624                                       new Type("[]unsigned long",
625                                                TypeClass.SEQUENCE)),
626                               new CompareUnboxed());
627         success &= testMapAny(transport,
628                               new Any(Type.TYPE,
629                                       new Type("[]hyper",
630                                                TypeClass.SEQUENCE)),
631                               new CompareUnboxed());
632         success &= testMapAny(transport,
633                               new Any(Type.TYPE,
634                                       new Type("[]unsigned hyper",
635                                                TypeClass.SEQUENCE)),
636                               new CompareUnboxed());
637         success &= testMapAny(transport,
638                               new Any(Type.TYPE,
639                                       new Type("[]float",
640                                                TypeClass.SEQUENCE)),
641                               new CompareUnboxed());
642         success &= testMapAny(transport,
643                               new Any(Type.TYPE,
644                                       new Type("[]double",
645                                                TypeClass.SEQUENCE)),
646                               new CompareUnboxed());
647         success &= testMapAny(transport,
648                               new Any(Type.TYPE,
649                                       new Type("[]char",
650                                                TypeClass.SEQUENCE)),
651                               new CompareUnboxed());
652         success &= testMapAny(transport,
653                               new Any(Type.TYPE,
654                                       new Type("[]string",
655                                                TypeClass.SEQUENCE)),
656                               new CompareUnboxed());
657         success &= testMapAny(transport,
658                               new Any(Type.TYPE,
659                                       new Type("[]type",
660                                                TypeClass.SEQUENCE)),
661                               new CompareUnboxed());
662         success &= testMapAny(transport,
663                               new Any(Type.TYPE,
664                                       new Type("[]any",
665                                                TypeClass.SEQUENCE)),
666                               new CompareUnboxed());
667         if (createTypes) {
668             success &= testMapAny(transport,
669                                   new Any(Type.TYPE,
670                                           new Type("[]" + Enum1.class.getName(),
671                                                    TypeClass.SEQUENCE)),
672                                   new CompareUnboxed());
673             success &= testMapAny(transport,
674                                   new Any(Type.TYPE,
675                                           new Type("[]"
676                                                    + BaseStruct.class.getName(),
677                                                    TypeClass.SEQUENCE)),
678                                   new CompareUnboxed());
679             success &= testMapAny(transport,
680                                   new Any(Type.TYPE,
681                                           new Type(
682                                               "[]"
683                                               + DerivedStruct.class.getName(),
684                                               TypeClass.SEQUENCE)),
685                                   new CompareUnboxed());
686         }
687         success &= testMapAny(transport,
688                               new Any(Type.TYPE,
689                                       new Type("[]"
690                                                + XInterface.class.getName(),
691                                                TypeClass.SEQUENCE)),
692                               new CompareUnboxed());
693         success &= testMapAny(transport,
694                               new Any(Type.TYPE,
695                                       new Type(
696                                           "[]"
697                                           + BaseInterface.class.getName(),
698                                           TypeClass.SEQUENCE)),
699                               new CompareUnboxed());
700         success &= testMapAny(transport,
701                               new Any(
702                                   Type.TYPE,
703                                   new Type(
704                                       "[]"
705                                       + DerivedInterface.class.getName(),
706                                       TypeClass.SEQUENCE)),
707                               new CompareUnboxed());
708         success &= testMapAny(transport,
709                               new Any(Type.TYPE,
710                                       new Type("[][]boolean",
711                                                TypeClass.SEQUENCE)),
712                               new CompareUnboxed());
713         success &= testMapAny(transport,
714                               new Any(Type.TYPE,
715                                       new Type("[][]byte",
716                                                TypeClass.SEQUENCE)),
717                               new CompareUnboxed());
718         success &= testMapAny(transport,
719                               new Any(Type.TYPE,
720                                       new Type("[][]short",
721                                                TypeClass.SEQUENCE)),
722                               new CompareUnboxed());
723         success &= testMapAny(transport,
724                               new Any(Type.TYPE,
725                                       new Type("[][]unsigned short",
726                                                TypeClass.SEQUENCE)),
727                               new CompareUnboxed());
728         success &= testMapAny(transport,
729                               new Any(Type.TYPE,
730                                       new Type("[][]long",
731                                                TypeClass.SEQUENCE)),
732                               new CompareUnboxed());
733         success &= testMapAny(transport,
734                               new Any(Type.TYPE,
735                                       new Type("[][]unsigned long",
736                                                TypeClass.SEQUENCE)),
737                               new CompareUnboxed());
738         success &= testMapAny(transport,
739                               new Any(Type.TYPE,
740                                       new Type("[][]hyper",
741                                                TypeClass.SEQUENCE)),
742                               new CompareUnboxed());
743         success &= testMapAny(transport,
744                               new Any(Type.TYPE,
745                                       new Type("[][]unsigned hyper",
746                                                TypeClass.SEQUENCE)),
747                               new CompareUnboxed());
748         success &= testMapAny(transport,
749                               new Any(Type.TYPE,
750                                       new Type("[][]float",
751                                                TypeClass.SEQUENCE)),
752                               new CompareUnboxed());
753         success &= testMapAny(transport,
754                               new Any(Type.TYPE,
755                                       new Type("[][]double",
756                                                TypeClass.SEQUENCE)),
757                               new CompareUnboxed());
758         success &= testMapAny(transport,
759                               new Any(Type.TYPE,
760                                       new Type("[][]char",
761                                                TypeClass.SEQUENCE)),
762                               new CompareUnboxed());
763         success &= testMapAny(transport,
764                               new Any(Type.TYPE,
765                                       new Type("[][]string",
766                                                TypeClass.SEQUENCE)),
767                               new CompareUnboxed());
768         success &= testMapAny(transport,
769                               new Any(Type.TYPE,
770                                       new Type("[][]type",
771                                                TypeClass.SEQUENCE)),
772                               new CompareUnboxed());
773         success &= testMapAny(transport,
774                               new Any(Type.TYPE,
775                                       new Type("[][]any",
776                                                TypeClass.SEQUENCE)),
777                               new CompareUnboxed());
778         if (createTypes) {
779             success &= testMapAny(transport,
780                                   new Any(Type.TYPE,
781                                           new Type("[][]"
782                                                    + Enum1.class.getName(),
783                                                    TypeClass.SEQUENCE)),
784                                   new CompareUnboxed());
785             success &= testMapAny(transport,
786                                   new Any(Type.TYPE,
787                                           new Type("[][]"
788                                                    + BaseStruct.class.getName(),
789                                                    TypeClass.SEQUENCE)),
790                                   new CompareUnboxed());
791             success &= testMapAny(transport,
792                                   new Any(Type.TYPE,
793                                           new Type(
794                                               "[][]"
795                                               + DerivedStruct.class.getName(),
796                                               TypeClass.SEQUENCE)),
797                                   new CompareUnboxed());
798         }
799         success &= testMapAny(transport,
800                               new Any(Type.TYPE,
801                                       new Type("[][]"
802                                                + XInterface.class.getName(),
803                                                TypeClass.SEQUENCE)),
804                               new CompareUnboxed());
805         success &= testMapAny(transport,
806                               new Any(Type.TYPE,
807                                       new Type(
808                                           "[][]"
809                                           + BaseInterface.class.getName(),
810                                           TypeClass.SEQUENCE)),
811                               new CompareUnboxed());
812         success &= testMapAny(transport,
813                               new Any(
814                                   Type.TYPE,
815                                   new Type(
816                                       "[][]"
817                                       + DerivedInterface.class.getName(),
818                                       TypeClass.SEQUENCE)),
819                               new CompareUnboxed());
820         if (createTypes) {
821             success &= testMapAny(transport,
822                                   new Any(Type.TYPE,
823                                           new Type(Enum1.class.getName(),
824                                                    TypeClass.ENUM)),
825                                   new CompareUnboxed());
826             success &= testMapAny(transport,
827                                   new Any(Type.TYPE,
828                                           new Type(BaseStruct.class.getName(),
829                                                    TypeClass.STRUCT)),
830                                   new CompareUnboxed());
831             success &= testMapAny(transport,
832                                   new Any(Type.TYPE,
833                                           new Type(
834                                               DerivedStruct.class.getName(),
835                                               TypeClass.STRUCT)),
836                                   new CompareUnboxed());
837         }
838         success &= testMapAny(transport,
839                               new Any(
840                                   Type.TYPE,
841                                   new Type(
842                                       com.sun.star.uno.Exception.class.
843                                       getName(),
844                                       TypeClass.EXCEPTION)),
845                               new CompareUnboxed());
846         if (createTypes) {
847             success &= testMapAny(transport,
848                                   new Any(Type.TYPE,
849                                           new Type(
850                                               BaseException.class.getName(),
851                                               TypeClass.EXCEPTION)),
852                                   new CompareUnboxed());
853             success &= testMapAny(transport,
854                                   new Any(
855                                       Type.TYPE,
856                                       new Type(
857                                           DerivedException.class.getName(),
858                                           TypeClass.EXCEPTION)),
859                                   new CompareUnboxed());
860         }
861         success &= testMapAny(transport,
862                               new Any(
863                                   Type.TYPE,
864                                   new Type(
865                                       com.sun.star.uno.RuntimeException.
866                                       class.getName(),
867                                       TypeClass.EXCEPTION)),
868                               new CompareUnboxed());
869         if (createTypes) {
870             success &= testMapAny(transport,
871                                   new Any(
872                                       Type.TYPE,
873                                       new Type(
874                                           BaseRuntimeException.class.
875                                           getName(),
876                                           TypeClass.EXCEPTION)),
877                                   new CompareUnboxed());
878             success &= testMapAny(transport,
879                                   new Any(
880                                       Type.TYPE,
881                                       new Type(
882                                           DerivedRuntimeException.class.
883                                           getName(),
884                                           TypeClass.EXCEPTION)),
885                                   new CompareUnboxed());
886         }
887         success &= testMapAny(transport,
888                               new Any(Type.TYPE,
889                                       new Type(XInterface.class.getName(),
890                                                TypeClass.INTERFACE)),
891                               new CompareUnboxed());
892         success &= testMapAny(transport,
893                               new Any(Type.TYPE,
894                                       new Type(
895                                           BaseInterface.class.getName(),
896                                           TypeClass.INTERFACE)),
897                               new CompareUnboxed());
898         success &= testMapAny(transport,
899                               new Any(Type.TYPE,
900                                       new Type(
901                                           DerivedInterface.class.getName(),
902                                           TypeClass.INTERFACE)),
903                               new CompareUnboxed());
904 
905         // Sequence Types:
906         success &= testMapAny(transport, new boolean[] {},
907                               new CompareBoxed());
908         success &= testMapAny(transport, new boolean[] { false, true },
909                               new CompareBoxed());
910         success &= testMapAny(transport,
911                               new Any(new Type(boolean[].class),
912                                       new boolean[] {}),
913                               new CompareUnboxed());
914         success &= testMapAny(transport,
915                               new Any(new Type(boolean[].class),
916                                       new boolean[] { false, true }),
917                               new CompareUnboxed());
918         success &= testMapAny(transport, new byte[] {},
919                               new CompareBoxed());
920         success &= testMapAny(transport, new byte[] { -128, 0, 127 },
921                               new CompareBoxed());
922         success &= testMapAny(transport,
923                               new Any(new Type(byte[].class),
924                                       new byte[] {}),
925                               new CompareUnboxed());
926         success &= testMapAny(transport,
927                               new Any(new Type(byte[].class),
928                                       new byte[] { -128, 0, 127 }),
929                               new CompareUnboxed());
930         success &= testMapAny(transport, new short[] {},
931                               new CompareBoxed());
932         success &= testMapAny(transport, new short[] { -32768, 0, 32767 },
933                               new CompareBoxed());
934         success &= testMapAny(transport,
935                               new Any(new Type(short[].class),
936                                       new short[] {}),
937                               new CompareUnboxed());
938         success &= testMapAny(transport,
939                               new Any(new Type(short[].class),
940                                       new short[] { -32768, 0, 32767 }),
941                               new CompareUnboxed());
942         success &= testMapAny(transport,
943                               new Any(new Type("[]unsigned short",
944                                                TypeClass.SEQUENCE),
945                                       new short[] {}),
946                               new CompareBoxed());
947         success &= testMapAny(transport,
948                               new Any(new Type("[]unsigned short",
949                                                TypeClass.SEQUENCE),
950                                       new short[] { 0, -32768 }),
951                               new CompareBoxed());
952         success &= testMapAny(transport, new int[] {},
953                               new CompareBoxed());
954         success &= testMapAny(transport,
955                               new int[] { -2147483648, 0, 2147483647 },
956                               new CompareBoxed());
957         success &= testMapAny(transport,
958                               new Any(new Type(int[].class),
959                                       new int[] {}),
960                               new CompareUnboxed());
961         success &= testMapAny(transport,
962                               new Any(new Type(int[].class),
963                                       new int[] { -2147483648, 0,
964                                                   2147483647 }),
965                               new CompareUnboxed());
966         success &= testMapAny(transport,
967                               new Any(new Type("[]unsigned long",
968                                                TypeClass.SEQUENCE),
969                                       new int[] {}),
970                               new CompareBoxed());
971         success &= testMapAny(transport,
972                               new Any(new Type("[]unsigned long",
973                                                TypeClass.SEQUENCE),
974                                       new int[] { 0, -2147483648 }),
975                               new CompareBoxed());
976         success &= testMapAny(transport, new long[] {},
977                               new CompareBoxed());
978         success &= testMapAny(transport,
979                               new long[] { -9223372036854775808L, 0L,
980                                            9223372036854775807L },
981                               new CompareBoxed());
982         success &= testMapAny(transport,
983                               new Any(new Type(long[].class),
984                                       new long[] {}),
985                               new CompareUnboxed());
986         success &= testMapAny(transport,
987                               new Any(new Type(long[].class),
988                                       new long[] { -9223372036854775808L,
989                                                    0L,
990                                                    9223372036854775807L }),
991                               new CompareUnboxed());
992         success &= testMapAny(transport,
993                               new Any(new Type("[]unsigned hyper",
994                                                TypeClass.SEQUENCE),
995                                       new long[] {}),
996                               new CompareBoxed());
997         success &= testMapAny(transport,
998                               new Any(new Type("[]unsigned hyper",
999                                                TypeClass.SEQUENCE),
1000                                       new long[] { 0L,
1001                                                    -9223372036854775808L }),
1002                               new CompareBoxed());
1003         success &= testMapAny(transport, new float[] {},
1004                               new CompareBoxed());
1005         success &= testMapAny(transport,
1006                               new float[] { Float.NEGATIVE_INFINITY,
1007                                             Float.MIN_VALUE, -0.0f, 0.0f,
1008                                             Float.MAX_VALUE,
1009                                             Float.POSITIVE_INFINITY,
1010                                             Float.NaN },
1011                               new CompareBoxed());
1012         success &= testMapAny(transport,
1013                               new Any(new Type(float[].class),
1014                                       new float[] {}),
1015                               new CompareUnboxed());
1016         success &= testMapAny(transport,
1017                               new Any(new Type(float[].class),
1018                                       new float[] { Float.NEGATIVE_INFINITY,
1019                                                     Float.MIN_VALUE, -0.0f,
1020                                                     0.0f, Float.MAX_VALUE,
1021                                                     Float.POSITIVE_INFINITY,
1022                                                     Float.NaN }),
1023                               new CompareUnboxed());
1024         success &= testMapAny(transport, new double[] {},
1025                               new CompareBoxed());
1026         success &= testMapAny(transport,
1027                               new double[] { Double.NEGATIVE_INFINITY,
1028                                              Double.MIN_VALUE, -0.0, 0.0,
1029                                              Double.MAX_VALUE,
1030                                              Double.POSITIVE_INFINITY,
1031                                              Double.NaN },
1032                               new CompareBoxed());
1033         success &= testMapAny(transport,
1034                               new Any(new Type(double[].class),
1035                                       new double[] {}),
1036                               new CompareUnboxed());
1037         success &= testMapAny(transport,
1038                               new Any(new Type(double[].class),
1039                                       new double[] {
1040                                           Double.NEGATIVE_INFINITY,
1041                                           Double.MIN_VALUE, -0.0, 0.0,
1042                                           Double.MAX_VALUE,
1043                                           Double.POSITIVE_INFINITY,
1044                                           Double.NaN }),
1045                               new CompareUnboxed());
1046         success &= testMapAny(transport, new char[] {},
1047                               new CompareBoxed());
1048         success &= testMapAny(transport,
1049                               new char[] { '\u0000', '\uDBFF', '\uFFFD' },
1050                               new CompareBoxed());
1051         success &= testMapAny(transport,
1052                               new Any(new Type(char[].class),
1053                                       new char[] {}),
1054                               new CompareUnboxed());
1055         success &= testMapAny(transport,
1056                               new Any(
1057                                   new Type(char[].class),
1058                                   new char[] { '\u0000', '\uDBFF',
1059                                                '\uFFFD' }),
1060                               new CompareUnboxed());
1061         success &= testMapAny(transport, new String[] {},
1062                               new CompareBoxed());
1063         success &= testMapAny(transport,
1064                               new String[] { "", "\uD800\uDC00", "Test" },
1065                               new CompareBoxed());
1066         success &= testMapAny(transport,
1067                               new Any(new Type(String[].class),
1068                                       new String[] {}),
1069                               new CompareUnboxed());
1070         success &= testMapAny(transport,
1071                               new Any(new Type(String[].class),
1072                                       new String[] { "", "\uD800\uDC00",
1073                                                      "Test" }),
1074                               new CompareUnboxed());
1075         success &= testMapAny(transport, new Type[] {}, new CompareBoxed());
1076         success &= testMapAny(transport,
1077                               new Type[] {
1078                                   Type.VOID,
1079                                   new Type(DerivedInterface.class.getName(),
1080                                            TypeClass.INTERFACE) },
1081                               new CompareBoxed());
1082         success &= testMapAny(transport,
1083                               new Any(new Type(Type[].class),
1084                                       new Type[] {}),
1085                               new CompareUnboxed());
1086         success &= testMapAny(transport,
1087                               new Any(
1088                                   new Type(Type[].class),
1089                                   new Type[] {
1090                                       Type.VOID,
1091                                       new Type(
1092                                           DerivedInterface.class.getName(),
1093                                           TypeClass.INTERFACE) }),
1094                               new CompareUnboxed());
1095         success &= testMapAny(transport, new Object[] {},
1096                               new CompareBoxed());
1097         success &= testMapAny(transport,
1098                               new Object[] { Any.VOID, Boolean.FALSE },
1099                               new CompareBoxed());
1100         success &= testMapAny(transport,
1101                               new Object[] {
1102                                   Boolean.FALSE,
1103                                   new Any(Type.BOOLEAN, Boolean.TRUE) },
1104                               new CompareBoxed(true));
1105         success &= testMapAny(transport,
1106                               new Any(new Type(Any[].class),
1107                                       new Object[] {}),
1108                               new CompareUnboxed());
1109         success &= testMapAny(transport,
1110                               new Any(new Type(Any[].class),
1111                                       new Object[] { Any.VOID,
1112                                                      Boolean.FALSE }),
1113                               new CompareUnboxed());
1114         success &= testMapAny(transport,
1115                               new Any(new Type(Any[].class),
1116                                       new Object[] {
1117                                           Boolean.FALSE,
1118                                           new Any(Type.BOOLEAN,
1119                                                   Boolean.TRUE) }),
1120                               new CompareUnboxed(true));
1121         success &= testMapAny(transport, new Any[] {},
1122                               new CompareSpecific(new Object[] {}));
1123         success &= testMapAny(transport,
1124                               new Any[] { Any.VOID,
1125                                           new Any(Type.BOOLEAN,
1126                                                   Boolean.TRUE) },
1127                               new CompareSpecific(
1128                                   new Object[] { Any.VOID, Boolean.TRUE }));
1129         success &= testMapAny(transport,
1130                               new Any(new Type(Any[].class), new Any[] {}),
1131                               new CompareSpecific(new Object[] {}));
1132         success &= testMapAny(transport,
1133                               new Any(new Type(Any[].class),
1134                                       new Any[] { Any.VOID,
1135                                                   new Any(Type.BOOLEAN,
1136                                                           Boolean.TRUE) }),
1137                               new CompareSpecific(
1138                                   new Object[] { Any.VOID, Boolean.TRUE }));
1139         success &= testMapAny(transport,
1140                               new Any(new Type(Any[].class),
1141                                       new Boolean[] {}),
1142                               new CompareSpecific(new Object[] {}));
1143         success &= testMapAny(transport,
1144                               new Any(new Type(Any[].class),
1145                                       new Boolean[] { Boolean.FALSE }),
1146                               new CompareSpecific(
1147                                   new Object[] { Boolean.FALSE }));
1148         if (createTypes) {
1149             success &= testMapAny(transport, new Enum1[] {},
1150                                   new CompareBoxed());
1151             success &= testMapAny(transport, new Enum1[] { new Enum1(),
1152                                                            new Enum2() },
1153                                   new CompareSpecific(
1154                                       new Enum1[] { new Enum1(),
1155                                                     new Enum1() }));
1156             success &= testMapAny(transport,
1157                                   new Any(new Type(Enum1[].class),
1158                                           new Enum1[] {}),
1159                                   new CompareUnboxed());
1160             success &= testMapAny(transport,
1161                                   new Any(new Type(Enum1[].class),
1162                                           new Enum1[] { new Enum1(),
1163                                                         new Enum2() }),
1164                                   new CompareSpecific(
1165                                       new Enum1[] { new Enum1(),
1166                                                     new Enum1() }));
1167             success &= testMapAny(transport,
1168                                   new Any(new Type(Enum1[].class),
1169                                           new Enum2[] {}),
1170                                   new CompareSpecific(new Enum1[] {}));
1171             success &= testMapAny(transport,
1172                                   new Any(new Type(Enum1[].class),
1173                                           new Enum2[] { new Enum2() }),
1174                                   new CompareSpecific(
1175                                       new Enum1[] { new Enum1() }));
1176             success &= testMapAny(transport, new BaseStruct[] {},
1177                                   new CompareBoxed());
1178             success &= testMapAny(transport,
1179                                   new BaseStruct[] { new BaseStruct(),
1180                                                      new DerivedStruct() },
1181                                   new CompareSpecific(
1182                                       new BaseStruct[] { new BaseStruct(),
1183                                                          new BaseStruct() }));
1184             success &= testMapAny(transport,
1185                                   new Any(new Type(BaseStruct[].class),
1186                                           new BaseStruct[] {}),
1187                                   new CompareUnboxed());
1188             success &= testMapAny(transport,
1189                                   new Any(new Type(BaseStruct[].class),
1190                                           new BaseStruct[] {
1191                                               new BaseStruct(),
1192                                               new DerivedStruct() }),
1193                                   new CompareSpecific(
1194                                       new BaseStruct[] { new BaseStruct(),
1195                                                          new BaseStruct() }));
1196             success &= testMapAny(transport,
1197                                   new Any(new Type(BaseStruct[].class),
1198                                           new DerivedStruct[] {}),
1199                                   new CompareSpecific(new BaseStruct[] {}));
1200             success &= testMapAny(transport,
1201                                   new Any(new Type(BaseStruct[].class),
1202                                           new DerivedStruct[] {
1203                                               new DerivedStruct() }),
1204                                   new CompareSpecific(
1205                                       new BaseStruct[] { new BaseStruct() }));
1206             success &= testMapAny(transport, new DerivedStruct[] {},
1207                                   new CompareBoxed());
1208             success &= testMapAny(transport,
1209                                   new DerivedStruct[] { new DerivedStruct() },
1210                                   new CompareBoxed());
1211             success &= testMapAny(transport,
1212                                   new Any(new Type(DerivedStruct[].class),
1213                                           new DerivedStruct[] {}),
1214                                   new CompareUnboxed());
1215             success &= testMapAny(transport,
1216                                   new Any(new Type(DerivedStruct[].class),
1217                                           new DerivedStruct[] {
1218                                               new DerivedStruct() }),
1219                                   new CompareUnboxed());
1220         }
1221         success &= testMapAny(transport, new XInterface[] {},
1222                               new CompareBoxed());
1223         success &= testMapAny(transport,
1224                               new XInterface[] {
1225                                   null, new XInterface() {},
1226                                   new BaseInterface() {},
1227                                   new DerivedInterface() {} },
1228                               new CompareBoxed());
1229         success &= testMapAny(transport,
1230                               new Any(new Type(XInterface[].class),
1231                                       new XInterface[] {}),
1232                               new CompareUnboxed());
1233         success &= testMapAny(transport,
1234                               new Any(new Type(XInterface[].class),
1235                                       new XInterface[] {
1236                                           null, new XInterface() {},
1237                                           new BaseInterface() {},
1238                                           new DerivedInterface() {} }),
1239                               new CompareUnboxed());
1240         success &= testMapAny(transport,
1241                               new Any(new Type(XInterface[].class),
1242                                       new Object[] {}),
1243                               new CompareSpecific(new XInterface[] {}));
1244         {
1245             XInterface if1 = new XInterface() {};
1246             XInterface if2 = new BaseInterface() {};
1247             XInterface if3 = new DerivedInterface() {};
1248             success &= testMapAny(transport,
1249                                   new Any(new Type(XInterface[].class),
1250                                           new Object[] { null, if1, if2,
1251                                                          if3 }),
1252                                   new CompareSpecific(
1253                                       new XInterface[] { null, if1, if2,
1254                                                          if3 }));
1255         }
1256         success &= testMapAny(transport,
1257                               new Any(new Type(XInterface[].class),
1258                                       new BaseInterface[] {}),
1259                               new CompareSpecific(new XInterface[] {}));
1260         {
1261             BaseInterface if1 = new BaseInterface() {};
1262             BaseInterface if2 = new DerivedInterface() {};
1263             success &= testMapAny(transport,
1264                                   new Any(new Type(XInterface[].class),
1265                                           new BaseInterface[] { null, if1,
1266                                                                 if2 }),
1267                                   new CompareSpecific(
1268                                       new XInterface[] { null, if1, if2 }));
1269         }
1270         success &= testMapAny(transport,
1271                               new Any(new Type(XInterface[].class),
1272                                       new DerivedInterface[] {}),
1273                               new CompareSpecific(new XInterface[] {}));
1274         {
1275             DerivedInterface if1 = new DerivedInterface() {};
1276             success &= testMapAny(transport,
1277                                   new Any(new Type(XInterface[].class),
1278                                           new DerivedInterface[] { null,
1279                                                                    if1 }),
1280                                   new CompareSpecific(
1281                                       new XInterface[] { null, if1 }));
1282         }
1283         success &= testMapAny(transport, new BaseInterface[] {},
1284                               new CompareBoxed());
1285         success &= testMapAny(transport,
1286                               new BaseInterface[] {
1287                                   null, new BaseInterface() {},
1288                                   new DerivedInterface() {} },
1289                               new CompareBoxed());
1290         success &= testMapAny(transport,
1291                               new Any(new Type(BaseInterface[].class),
1292                                       new BaseInterface[] {}),
1293                               new CompareUnboxed());
1294         success &= testMapAny(transport,
1295                               new Any(new Type(BaseInterface[].class),
1296                                       new BaseInterface[] {
1297                                           null, new BaseInterface() {},
1298                                           new DerivedInterface() {} }),
1299                               new CompareUnboxed());
1300         success &= testMapAny(transport,
1301                               new Any(new Type(BaseInterface[].class),
1302                                       new DerivedInterface[] {}),
1303                               new CompareSpecific(new BaseInterface[] {}));
1304         {
1305             DerivedInterface if1 = new DerivedInterface() {};
1306             success &= testMapAny(transport,
1307                                   new Any(new Type(BaseInterface[].class),
1308                                           new DerivedInterface[] { null,
1309                                                                    if1 }),
1310                                   new CompareSpecific(
1311                                       new BaseInterface[] { null, if1 }));
1312         }
1313         success &= testMapAny(transport, new DerivedInterface[] {},
1314                               new CompareBoxed());
1315         success &= testMapAny(transport,
1316                               new DerivedInterface[] {
1317                                   null, new DerivedInterface() {} },
1318                               new CompareBoxed());
1319         success &= testMapAny(transport,
1320                               new Any(new Type(DerivedInterface[].class),
1321                                       new DerivedInterface[] {}),
1322                               new CompareUnboxed());
1323         success &= testMapAny(transport,
1324                               new Any(new Type(DerivedInterface[].class),
1325                                       new DerivedInterface[] {
1326                                           null,
1327                                           new DerivedInterface() {} }),
1328                               new CompareUnboxed());
1329         success &= testMapAny(transport,
1330                               new boolean[][] { new boolean[] {} },
1331                               new CompareBoxed());
1332         success &= testMapAny(transport,
1333                               new boolean[][] {
1334                                   new boolean[] { false, true } },
1335                               new CompareBoxed());
1336         success &= testMapAny(transport,
1337                               new Any(new Type(boolean[][].class),
1338                                       new boolean[][] { new boolean[] {} }),
1339                               new CompareUnboxed());
1340         success &= testMapAny(transport,
1341                               new Any(new Type(boolean[][].class),
1342                                       new boolean[][] {
1343                                           new boolean[] { false, true } }),
1344                               new CompareUnboxed());
1345         success &= testMapAny(transport, new byte[][] { new byte[] {} },
1346                               new CompareBoxed());
1347         success &= testMapAny(transport,
1348                               new byte[][] { new byte[] { -128, 0, 127 } },
1349                               new CompareBoxed());
1350         success &= testMapAny(transport,
1351                               new Any(new Type(byte[][].class),
1352                                       new byte[][] { new byte[] {} }),
1353                               new CompareUnboxed());
1354         success &= testMapAny(transport,
1355                               new Any(new Type(byte[][].class),
1356                                       new byte[][] {
1357                                           new byte[] { -128, 0, 127 } }),
1358                               new CompareUnboxed());
1359         success &= testMapAny(transport, new short[][] { new short[] {} },
1360                               new CompareBoxed());
1361         success &= testMapAny(transport,
1362                               new short[][] {
1363                                   new short[] { -32768, 0, 32767 } },
1364                               new CompareBoxed());
1365         success &= testMapAny(transport,
1366                               new Any(new Type(short[][].class),
1367                                       new short[][] { new short[] {} }),
1368                               new CompareUnboxed());
1369         success &= testMapAny(transport,
1370                               new Any(new Type(short[][].class),
1371                                       new short[][] {
1372                                           new short[] { -32768, 0,
1373                                                         32767 } }),
1374                               new CompareUnboxed());
1375         success &= testMapAny(transport,
1376                               new Any(new Type("[][]unsigned short",
1377                                                TypeClass.SEQUENCE),
1378                                       new short[][] { new short[] {} }),
1379                               new CompareBoxed());
1380         success &= testMapAny(transport,
1381                               new Any(new Type("[][]unsigned short",
1382                                                TypeClass.SEQUENCE),
1383                                       new short[][] {
1384                                           new short[] { 0, -32768 } }),
1385                               new CompareBoxed());
1386         success &= testMapAny(transport, new int[][] { new int[] {} },
1387                               new CompareBoxed());
1388         success &= testMapAny(transport,
1389                               new int[][] { new int[] { -2147483648, 0,
1390                                                         2147483647 } },
1391                               new CompareBoxed());
1392         success &= testMapAny(transport,
1393                               new Any(new Type(int[][].class),
1394                                       new int[][] { new int[] {} }),
1395                               new CompareUnboxed());
1396         success &= testMapAny(transport,
1397                               new Any(new Type(int[][].class),
1398                                       new int[][] {
1399                                           new int[] { -2147483648, 0,
1400                                                       2147483647 } }),
1401                               new CompareUnboxed());
1402         success &= testMapAny(transport,
1403                               new Any(new Type("[][]unsigned long",
1404                                                TypeClass.SEQUENCE),
1405                                       new int[][] { new int[] {} }),
1406                               new CompareBoxed());
1407         success &= testMapAny(transport,
1408                               new Any(new Type("[][]unsigned long",
1409                                                TypeClass.SEQUENCE),
1410                                       new int[][] {
1411                                           new int[] { 0, -2147483648 } }),
1412                               new CompareBoxed());
1413         success &= testMapAny(transport, new long[][] { new long[] {} },
1414                               new CompareBoxed());
1415         success &= testMapAny(transport,
1416                               new long[][] {
1417                                   new long[] { -9223372036854775808L, 0L,
1418                                                9223372036854775807L } },
1419                               new CompareBoxed());
1420         success &= testMapAny(transport,
1421                               new Any(new Type(long[][].class),
1422                                       new long[][] { new long[] {} }),
1423                               new CompareUnboxed());
1424         success &= testMapAny(transport,
1425                               new Any(new Type(long[][].class),
1426                                       new long[][] {
1427                                           new long[] {
1428                                               -9223372036854775808L, 0L,
1429                                               9223372036854775807L } }),
1430                               new CompareUnboxed());
1431         success &= testMapAny(transport,
1432                               new Any(new Type("[][]unsigned hyper",
1433                                                TypeClass.SEQUENCE),
1434                                       new long[][] { new long[] {} }),
1435                               new CompareBoxed());
1436         success &= testMapAny(transport,
1437                               new Any(new Type("[][]unsigned hyper",
1438                                                TypeClass.SEQUENCE),
1439                                       new long[][] {
1440                                           new long[] {
1441                                               0L,
1442                                               -9223372036854775808L } }),
1443                               new CompareBoxed());
1444         success &= testMapAny(transport, new float[][] { new float[] {} },
1445                               new CompareBoxed());
1446         success &= testMapAny(transport,
1447                               new float[][] {
1448                                   new float[] { Float.NEGATIVE_INFINITY,
1449                                                 Float.MIN_VALUE, -0.0f,
1450                                                 0.0f, Float.MAX_VALUE,
1451                                                 Float.POSITIVE_INFINITY,
1452                                                 Float.NaN } },
1453                               new CompareBoxed());
1454         success &= testMapAny(transport,
1455                               new Any(new Type(float[][].class),
1456                                       new float[][] { new float[] {} }),
1457                               new CompareUnboxed());
1458         success &= testMapAny(transport,
1459                               new Any(new Type(float[][].class),
1460                                       new float[][] {
1461                                           new float[] {
1462                                               Float.NEGATIVE_INFINITY,
1463                                               Float.MIN_VALUE, -0.0f, 0.0f,
1464                                               Float.MAX_VALUE,
1465                                               Float.POSITIVE_INFINITY,
1466                                               Float.NaN } }),
1467                               new CompareUnboxed());
1468         success &= testMapAny(transport, new double[][] { new double[] {} },
1469                               new CompareBoxed());
1470         success &= testMapAny(transport,
1471                               new double[][] {
1472                                   new double[] { Double.NEGATIVE_INFINITY,
1473                                                  Double.MIN_VALUE, -0.0,
1474                                                  0.0, Double.MAX_VALUE,
1475                                                  Double.POSITIVE_INFINITY,
1476                                                  Double.NaN } },
1477                               new CompareBoxed());
1478         success &= testMapAny(transport,
1479                               new Any(new Type(double[][].class),
1480                                       new double[][] { new double[] {} }),
1481                               new CompareUnboxed());
1482         success &= testMapAny(transport,
1483                               new Any(new Type(double[][].class),
1484                                       new double[][] {
1485                                           new double[] {
1486                                               Double.NEGATIVE_INFINITY,
1487                                               Double.MIN_VALUE, -0.0, 0.0,
1488                                               Double.MAX_VALUE,
1489                                               Double.POSITIVE_INFINITY,
1490                                               Double.NaN } }),
1491                               new CompareUnboxed());
1492         success &= testMapAny(transport, new char[][] { new char[] {} },
1493                               new CompareBoxed());
1494         success &= testMapAny(transport,
1495                               new char[][] {
1496                                   new char[] { '\u0000', '\uDBFF',
1497                                                '\uFFFD' } },
1498                               new CompareBoxed());
1499         success &= testMapAny(transport,
1500                               new Any(new Type(char[][].class),
1501                                       new char[][] { new char[] {} }),
1502                               new CompareUnboxed());
1503         success &= testMapAny(transport,
1504                               new Any(
1505                                   new Type(char[][].class),
1506                                   new char[][] {
1507                                       new char[] { '\u0000', '\uDBFF',
1508                                                    '\uFFFD' } }),
1509                               new CompareUnboxed());
1510         success &= testMapAny(transport, new String[][] { new String[] {} },
1511                               new CompareBoxed());
1512         success &= testMapAny(transport,
1513                               new String[][] {
1514                                   new String[] { "", "\uD800\uDC00",
1515                                                  "Test" } },
1516                               new CompareBoxed());
1517         success &= testMapAny(transport,
1518                               new Any(new Type(String[][].class),
1519                                       new String[][] { new String[] {} }),
1520                               new CompareUnboxed());
1521         success &= testMapAny(transport,
1522                               new Any(new Type(String[][].class),
1523                                       new String[][] {
1524                                           new String[] { "", "\uD800\uDC00",
1525                                                          "Test" } }),
1526                               new CompareUnboxed());
1527         success &= testMapAny(transport, new Type[][] { new Type[] {} },
1528                               new CompareBoxed());
1529         success &= testMapAny(transport,
1530                               new Type[][] {
1531                                   new Type[] {
1532                                       Type.VOID,
1533                                       new Type(
1534                                           DerivedInterface.class.getName(),
1535                                           TypeClass.INTERFACE) } },
1536                               new CompareBoxed());
1537         success &= testMapAny(transport,
1538                               new Any(new Type(Type[][].class),
1539                                       new Type[][] { new Type[] {} }),
1540                               new CompareUnboxed());
1541         success &= testMapAny(transport,
1542                               new Any(
1543                                   new Type(Type[][].class),
1544                                   new Type[][] {
1545                                       new Type[] {
1546                                           Type.VOID,
1547                                           new Type(
1548                                               DerivedInterface.class.
1549                                               getName(),
1550                                               TypeClass.INTERFACE) } }),
1551                               new CompareUnboxed());
1552         success &= testMapAny(transport, new Object[][] { new Object[] {} },
1553                               new CompareBoxed());
1554         success &= testMapAny(transport,
1555                               new Object[][] {
1556                                   new Object[] { Any.VOID,
1557                                                  Boolean.FALSE } },
1558                               new CompareBoxed());
1559         success &= testMapAny(transport,
1560                               new Object[][] {
1561                                   new Object[] {
1562                                       Boolean.FALSE,
1563                                       new Any(Type.BOOLEAN,
1564                                               Boolean.TRUE) } },
1565                               new CompareBoxed(true));
1566         success &= testMapAny(transport,
1567                               new Any(new Type(Any[][].class),
1568                                       new Object[][] { new Object[] {} }),
1569                               new CompareUnboxed());
1570         success &= testMapAny(transport,
1571                               new Any(new Type(Any[][].class),
1572                                       new Object[][] {
1573                                           new Object[] { Any.VOID,
1574                                                          Boolean.FALSE } }),
1575                               new CompareUnboxed());
1576         success &= testMapAny(transport,
1577                               new Any(new Type(Any[][].class),
1578                                       new Object[][] {
1579                                           new Object[] {
1580                                               Boolean.FALSE,
1581                                               new Any(Type.BOOLEAN,
1582                                                       Boolean.TRUE) } }),
1583                               new CompareUnboxed(true));
1584         success &= testMapAny(transport, new Any[][] { new Any[] {} },
1585                               new CompareSpecific(
1586                                   new Object[][] { new Object[] {} }));
1587         success &= testMapAny(transport,
1588                               new Any[][] {
1589                                   new Any[] { Any.VOID,
1590                                               new Any(Type.BOOLEAN,
1591                                                       Boolean.TRUE) } },
1592                               new CompareSpecific(
1593                                   new Object[][] {
1594                                       new Object[] { Any.VOID,
1595                                                      Boolean.TRUE } }));
1596         success &= testMapAny(transport,
1597                               new Any(new Type(Any[][].class),
1598                                       new Any[][] { new Any[] {} }),
1599                               new CompareSpecific(
1600                                   new Object[][] { new Object[] {} }));
1601         success &= testMapAny(transport,
1602                               new Any(new Type(Any[][].class),
1603                                       new Any[][] {
1604                                           new Any[] {
1605                                               Any.VOID,
1606                                               new Any(Type.BOOLEAN,
1607                                                       Boolean.TRUE) } }),
1608                               new CompareSpecific(
1609                                   new Object[][] {
1610                                       new Object[] { Any.VOID,
1611                                                      Boolean.TRUE } }));
1612         success &= testMapAny(transport,
1613                               new Any(new Type(Any[][].class),
1614                                       new Boolean[][] { new Boolean[] {} }),
1615                               new CompareSpecific(
1616                                   new Object[][] { new Object[] {} }));
1617         success &= testMapAny(transport,
1618                               new Any(new Type(Any[][].class),
1619                                       new Boolean[][] {
1620                                           new Boolean[] {
1621                                               Boolean.FALSE } }),
1622                               new CompareSpecific(
1623                                   new Object[][] {
1624                                       new Object[] { Boolean.FALSE } }));
1625         if (createTypes) {
1626             success &= testMapAny(transport, new Enum1[][] { new Enum1[] {} },
1627                                   new CompareBoxed());
1628             success &= testMapAny(transport,
1629                                   new Enum1[][] {
1630                                       new Enum1[] { new Enum1(),
1631                                                     new Enum2() } },
1632                                   new CompareSpecific(
1633                                       new Enum1[][] {
1634                                           new Enum1[] { new Enum1(),
1635                                                         new Enum1() } }));
1636             success &= testMapAny(transport,
1637                                   new Any(new Type(Enum1[][].class),
1638                                           new Enum1[][] { new Enum1[] {} }),
1639                                   new CompareUnboxed());
1640             success &= testMapAny(transport,
1641                                   new Any(new Type(Enum1[][].class),
1642                                           new Enum1[][] {
1643                                               new Enum1[] { new Enum1(),
1644                                                             new Enum2() } }),
1645                                   new CompareSpecific(
1646                                       new Enum1[][] {
1647                                           new Enum1[] { new Enum1(),
1648                                                         new Enum1() } }));
1649             success &= testMapAny(transport,
1650                                   new Any(new Type(Enum1[][].class),
1651                                           new Enum2[][] { new Enum2[] {} }),
1652                                   new CompareSpecific(
1653                                       new Enum1[][] { new Enum1[] {} }));
1654             success &= testMapAny(transport,
1655                                   new Any(new Type(Enum1[][].class),
1656                                           new Enum2[][] {
1657                                               new Enum2[] { new Enum2() } }),
1658                                   new CompareSpecific(
1659                                       new Enum1[][] {
1660                                           new Enum1[] { new Enum1() } }));
1661             success &= testMapAny(transport,
1662                                   new BaseStruct[][] { new BaseStruct[] {} },
1663                                   new CompareBoxed());
1664             success &= testMapAny(transport,
1665                                   new BaseStruct[][] {
1666                                       new BaseStruct[] {
1667                                           new BaseStruct(),
1668                                           new DerivedStruct() } },
1669                                   new CompareSpecific(
1670                                       new BaseStruct[][] {
1671                                           new BaseStruct[] {
1672                                               new BaseStruct(),
1673                                               new BaseStruct() } }));
1674             success &= testMapAny(transport,
1675                                   new Any(new Type(BaseStruct[][].class),
1676                                           new BaseStruct[][] {
1677                                               new BaseStruct[] {} }),
1678                                   new CompareUnboxed());
1679             success &= testMapAny(transport,
1680                                   new Any(new Type(BaseStruct[][].class),
1681                                           new BaseStruct[][] {
1682                                               new BaseStruct[] {
1683                                                   new BaseStruct(),
1684                                                   new DerivedStruct() } }),
1685                                   new CompareSpecific(
1686                                       new BaseStruct[][] {
1687                                           new BaseStruct[] {
1688                                               new BaseStruct(),
1689                                               new BaseStruct() } }));
1690             success &= testMapAny(transport,
1691                                   new Any(new Type(BaseStruct[][].class),
1692                                           new DerivedStruct[][] {
1693                                               new DerivedStruct[] {} }),
1694                                   new CompareSpecific(
1695                                       new BaseStruct[][] {
1696                                           new BaseStruct[] {} }));
1697             success &= testMapAny(transport,
1698                                   new Any(new Type(BaseStruct[][].class),
1699                                           new DerivedStruct[][] {
1700                                               new DerivedStruct[] {
1701                                                   new DerivedStruct() } }),
1702                                   new CompareSpecific(
1703                                       new BaseStruct[][] {
1704                                           new BaseStruct[] {
1705                                               new BaseStruct() } }));
1706             success &= testMapAny(transport,
1707                                   new DerivedStruct[][] {
1708                                       new DerivedStruct[] {} },
1709                                   new CompareBoxed());
1710             success &= testMapAny(transport,
1711                                   new DerivedStruct[][] {
1712                                       new DerivedStruct[] {
1713                                           new DerivedStruct() } },
1714                                   new CompareBoxed());
1715             success &= testMapAny(transport,
1716                                   new Any(new Type(DerivedStruct[][].class),
1717                                           new DerivedStruct[][] {
1718                                               new DerivedStruct[] {} }),
1719                                   new CompareUnboxed());
1720             success &= testMapAny(transport,
1721                                   new Any(new Type(DerivedStruct[][].class),
1722                                           new DerivedStruct[][] {
1723                                               new DerivedStruct[] {
1724                                                   new DerivedStruct() } }),
1725                                   new CompareUnboxed());
1726         }
1727         success &= testMapAny(transport,
1728                               new XInterface[][] { new XInterface[] {} },
1729                               new CompareBoxed());
1730         success &= testMapAny(transport,
1731                               new XInterface[][] {
1732                                   new XInterface[] {
1733                                       null, new XInterface() {},
1734                                       new BaseInterface() {},
1735                                       new DerivedInterface() {} } },
1736                               new CompareBoxed());
1737         success &= testMapAny(transport,
1738                               new Any(new Type(XInterface[][].class),
1739                                       new XInterface[][] {
1740                                           new XInterface[] {} }),
1741                               new CompareUnboxed());
1742         success &= testMapAny(transport,
1743                               new Any(
1744                                   new Type(XInterface[][].class),
1745                                   new XInterface[][] {
1746                                       new XInterface[] {
1747                                           null, new XInterface() {},
1748                                           new BaseInterface() {},
1749                                           new DerivedInterface() {} } }),
1750                               new CompareUnboxed());
1751         success &= testMapAny(transport,
1752                               new Any(new Type(XInterface[][].class),
1753                                       new Object[][] { new Object[] {} }),
1754                               new CompareSpecific(
1755                                   new XInterface[][] {
1756                                       new XInterface[] {} }));
1757         {
1758             XInterface if1 = new XInterface() {};
1759             XInterface if2 = new BaseInterface() {};
1760             XInterface if3 = new DerivedInterface() {};
1761             success &= testMapAny(transport,
1762                                   new Any(new Type(XInterface[][].class),
1763                                           new Object[][] {
1764                                               new Object[] { null, if1, if2,
1765                                                              if3 } }),
1766                                   new CompareSpecific(
1767                                       new XInterface[][] {
1768                                           new XInterface[] { null, if1, if2,
1769                                                              if3 } }));
1770         }
1771         success &= testMapAny(transport,
1772                               new Any(new Type(XInterface[][].class),
1773                                       new BaseInterface[][] {
1774                                           new BaseInterface[] {} }),
1775                               new CompareSpecific(
1776                                   new XInterface[][] {
1777                                       new XInterface[] {} }));
1778         {
1779             BaseInterface if1 = new BaseInterface() {};
1780             BaseInterface if2 = new DerivedInterface() {};
1781             success &= testMapAny(transport,
1782                                   new Any(new Type(XInterface[][].class),
1783                                           new BaseInterface[][] {
1784                                               new BaseInterface[] {
1785                                                   null, if1, if2 } }),
1786                                   new CompareSpecific(
1787                                       new XInterface[][] {
1788                                           new XInterface[] {
1789                                               null, if1, if2 } }));
1790         }
1791         success &= testMapAny(transport,
1792                               new Any(new Type(XInterface[][].class),
1793                                       new DerivedInterface[][] {
1794                                           new DerivedInterface[] {} }),
1795                               new CompareSpecific(
1796                                   new XInterface[][] {
1797                                       new XInterface[] {} }));
1798         {
1799             DerivedInterface if1 = new DerivedInterface() {};
1800             success &= testMapAny(transport,
1801                                   new Any(new Type(XInterface[][].class),
1802                                           new DerivedInterface[][] {
1803                                               new DerivedInterface[] {
1804                                                   null, if1 } }),
1805                                   new CompareSpecific(
1806                                       new XInterface[][] {
1807                                           new XInterface[] {
1808                                               null, if1 } }));
1809         }
1810         success &= testMapAny(transport,
1811                               new BaseInterface[][] {
1812                                   new BaseInterface[] {} },
1813                               new CompareBoxed());
1814         success &= testMapAny(transport,
1815                               new BaseInterface[][] {
1816                                   new BaseInterface[] {
1817                                       null, new BaseInterface() {},
1818                                       new DerivedInterface() {} } },
1819                               new CompareBoxed());
1820         success &= testMapAny(transport,
1821                               new Any(new Type(BaseInterface[][].class),
1822                                       new BaseInterface[][] {
1823                                           new BaseInterface[] {} }),
1824                               new CompareUnboxed());
1825         success &= testMapAny(transport,
1826                               new Any(
1827                                   new Type(BaseInterface[][].class),
1828                                   new BaseInterface[][] {
1829                                       new BaseInterface[] {
1830                                           null, new BaseInterface() {},
1831                                           new DerivedInterface() {} } }),
1832                               new CompareUnboxed());
1833         success &= testMapAny(transport,
1834                               new Any(new Type(BaseInterface[][].class),
1835                                       new DerivedInterface[][] {
1836                                           new DerivedInterface[] {} }),
1837                               new CompareSpecific(
1838                                   new BaseInterface[][] {
1839                                       new BaseInterface[] {} }));
1840         {
1841             DerivedInterface if1 = new DerivedInterface() {};
1842             success &= testMapAny(transport,
1843                                   new Any(new Type(BaseInterface[][].class),
1844                                           new DerivedInterface[][] {
1845                                               new DerivedInterface[] {
1846                                                   null, if1 } }),
1847                                   new CompareSpecific(
1848                                       new BaseInterface[][] {
1849                                           new BaseInterface[] {
1850                                               null, if1 } }));
1851         }
1852         success &= testMapAny(transport,
1853                               new DerivedInterface[][] {
1854                                   new DerivedInterface[] {} },
1855                               new CompareBoxed());
1856         success &= testMapAny(transport,
1857                               new DerivedInterface[][] {
1858                                   new DerivedInterface[] {
1859                                       null, new DerivedInterface() {} } },
1860                               new CompareBoxed());
1861         success &= testMapAny(transport,
1862                               new Any(new Type(DerivedInterface[][].class),
1863                                       new DerivedInterface[][] {
1864                                           new DerivedInterface[] {} }),
1865                               new CompareUnboxed());
1866         success &= testMapAny(transport,
1867                               new Any(
1868                                   new Type(DerivedInterface[][].class),
1869                                   new DerivedInterface[][] {
1870                                       new DerivedInterface[] {
1871                                           null,
1872                                           new DerivedInterface() {} } }),
1873                               new CompareUnboxed());
1874 
1875         // Enum Types:
1876         if (createTypes) {
1877             success &= testMapAny(transport, new Enum1(), new CompareBoxed());
1878             success &= testMapAny(transport, new Any(new Type(Enum1.class),
1879                                                      new Enum1()),
1880                                   new CompareUnboxed());
1881             success &= testMapAny(transport, new Any(new Type(Enum1.class),
1882                                                      new Enum2()),
1883                                   new CompareSpecific(new Enum1()));
1884         }
1885 
1886         // Struct Types:
1887         if (createTypes) {
1888             success &= testMapAny(transport, new BaseStruct(),
1889                                   new CompareBoxed());
1890             success &= testMapAny(transport,
1891                                   new Any(new Type(BaseStruct.class),
1892                                           new BaseStruct()),
1893                                   new CompareUnboxed());
1894             success &= testMapAny(transport,
1895                                   new Any(new Type(BaseStruct.class),
1896                                           new DerivedStruct()),
1897                                   new CompareSpecific(new BaseStruct()));
1898             success &= testMapAny(transport, new DerivedStruct(),
1899                                   new CompareBoxed());
1900             success &= testMapAny(transport,
1901                                   new Any(new Type(DerivedStruct.class),
1902                                           new DerivedStruct()),
1903                                   new CompareUnboxed());
1904         }
1905 
1906         // Exception Types:
1907         success &= testMapAny(transport, new com.sun.star.uno.Exception(),
1908                               new CompareClass(
1909                                   com.sun.star.uno.Exception.class));
1910         success &= testMapAny(transport,
1911                               new Any(new Type(
1912                                           com.sun.star.uno.Exception.class),
1913                                       new com.sun.star.uno.Exception()),
1914                               new CompareClass(
1915                                   com.sun.star.uno.Exception.class));
1916         success &= testMapAny(transport,
1917                               new Any(new Type(
1918                                           com.sun.star.uno.Exception.class),
1919                                       new BaseException()),
1920                               new CompareClass(
1921                                   com.sun.star.uno.Exception.class));
1922         success &= testMapAny(transport,
1923                               new Any(new Type(
1924                                           com.sun.star.uno.Exception.class),
1925                                       new DerivedException()),
1926                               new CompareClass(
1927                                   com.sun.star.uno.Exception.class));
1928         if (createTypes) {
1929             success &= testMapAny(transport, new BaseException(),
1930                                   new CompareBoxed());
1931             success &= testMapAny(transport,
1932                                   new Any(new Type(BaseException.class),
1933                                           new BaseException()),
1934                                   new CompareUnboxed());
1935             success &= testMapAny(transport,
1936                                   new Any(new Type(BaseException.class),
1937                                           new DerivedException()),
1938                                   new CompareSpecific(new BaseException()));
1939             success &= testMapAny(transport, new DerivedException(),
1940                                   new CompareBoxed());
1941             success &= testMapAny(transport,
1942                                   new Any(new Type(DerivedException.class),
1943                                           new DerivedException()),
1944                                   new CompareUnboxed());
1945         }
1946         success &= testMapAny(transport,
1947                               new com.sun.star.uno.RuntimeException(),
1948                               new CompareClass(
1949                                   com.sun.star.uno.RuntimeException.class));
1950         success &= testMapAny(transport,
1951                               new Any(
1952                                   new Type(
1953                                       com.sun.star.uno.RuntimeException.
1954                                       class),
1955                                   new com.sun.star.uno.RuntimeException()),
1956                               new CompareClass(
1957                                   com.sun.star.uno.RuntimeException.class));
1958         success &= testMapAny(transport,
1959                               new Any(
1960                                   new Type(
1961                                       com.sun.star.uno.RuntimeException.
1962                                       class),
1963                                   new BaseRuntimeException()),
1964                               new CompareClass(
1965                                   com.sun.star.uno.RuntimeException.class));
1966         success &= testMapAny(transport,
1967                               new Any(
1968                                   new Type(
1969                                       com.sun.star.uno.RuntimeException.
1970                                       class),
1971                                   new DerivedRuntimeException()),
1972                               new CompareClass(
1973                                   com.sun.star.uno.RuntimeException.class));
1974         if (createTypes) {
1975             success &= testMapAny(transport, new BaseRuntimeException(),
1976                                   new CompareBoxed());
1977             success &= testMapAny(transport,
1978                                   new Any(new Type(
1979                                               BaseRuntimeException.class),
1980                                           new BaseRuntimeException()),
1981                                   new CompareUnboxed());
1982             success &= testMapAny(transport,
1983                                   new Any(new Type(
1984                                               BaseRuntimeException.class),
1985                                           new DerivedRuntimeException()),
1986                                   new CompareSpecific(
1987                                       new BaseRuntimeException()));
1988             success &= testMapAny(transport, new DerivedRuntimeException(),
1989                                   new CompareBoxed());
1990             success &= testMapAny(transport,
1991                                   new Any(new Type(
1992                                               DerivedRuntimeException.class),
1993                                           new DerivedRuntimeException()),
1994                                   new CompareUnboxed());
1995         }
1996 
1997         // Interface Types:
1998         success &= testMapAny(transport, null, new CompareBoxed());
1999         success &= testMapAny(transport, new XInterface() {},
2000                               new CompareBoxed());
2001         success &= testMapAny(transport, new BaseInterface() {},
2002                               new CompareBoxed());
2003         success &= testMapAny(transport, new DerivedInterface() {},
2004                               new CompareBoxed());
2005         success &= testMapAny(transport,
2006                               new Any(new Type(XInterface.class), null),
2007                               new CompareUnboxed());
2008         success &= testMapAny(transport,
2009                               new Any(new Type(XInterface.class),
2010                                       new XInterface() {}),
2011                               new CompareUnboxed());
2012         success &= testMapAny(transport,
2013                               new Any(new Type(XInterface.class),
2014                                       new BaseInterface() {}),
2015                               new CompareUnboxed());
2016         success &= testMapAny(transport,
2017                               new Any(new Type(XInterface.class),
2018                                       new DerivedInterface() {}),
2019                               new CompareUnboxed());
2020         success &= testMapAny(transport,
2021                               new Any(new Type(BaseInterface.class), null),
2022                               new CompareBoxed());
2023         success &= testMapAny(transport,
2024                               new Any(new Type(BaseInterface.class),
2025                                       new BaseInterface() {}),
2026                               new CompareBoxed());
2027         success &= testMapAny(transport,
2028                               new Any(new Type(BaseInterface.class),
2029                                       new DerivedInterface() {}),
2030                               new CompareBoxed());
2031         success &= testMapAny(transport,
2032                               new Any(new Type(DerivedInterface.class),
2033                                       null),
2034                               new CompareBoxed());
2035         success &= testMapAny(transport,
2036                               new Any(new Type(DerivedInterface.class),
2037                                       new DerivedInterface() {}),
2038                               new CompareBoxed());
2039 
2040         // Misc:
2041         try {
2042             transport.mapAny(new Object());
2043             System.out.println("BAD mapAny(Object), no exception");
2044             success = false;
2045         } catch (StackOverflowError e) {
2046             System.out.println("BAD mapAny(Object): " + e);
2047             success = false;
2048         } catch (RuntimeException e) {}
2049 
2050         return success;
2051     }
2052 
TestAny()2053     private TestAny() {} // do not instantiate
2054 
testType(Class zclass, TypeClass tclass, String tname)2055     private static boolean testType(Class zclass, TypeClass tclass,
2056                                     String tname) {
2057         Type t1 = new Type(zclass);
2058         Type t2 = new Type(tname, tclass);
2059         boolean ok = true;
2060         if (t1.getTypeClass() != tclass) {
2061             ok = false;
2062             System.out.println("BAD Type(" + zclass + ").getTypeClass() = "
2063                                + t1.getTypeClass() + " != " + tclass);
2064         }
2065         if (!t1.getTypeName().equals(tname)) {
2066             ok = false;
2067             System.out.println("BAD Type(" + zclass + ").getTypeName() = "
2068                                + t1.getTypeName() + " != " + tname);
2069         }
2070         if (!t1.equals(t2)) {
2071             ok = false;
2072             System.out.println("BAD Type(" + zclass + ") != Type(" + tname
2073                                + ", " + tclass + ")");
2074         }
2075         return ok;
2076     }
2077 
testMapAny(XTransport transport, Object any, Compare compare)2078     private static boolean testMapAny(XTransport transport, Object any,
2079                                       Compare compare) {
2080         Object any2 = transport.mapAny(any);
2081         boolean eq = compare.equal(any, any2);
2082         if (!eq) {
2083             System.out.println("BAD mapAny(" + any + ") -> " + any2);
2084         }
2085         return eq;
2086     }
2087 
2088     private static abstract class Compare {
equal(Object o1, Object o2)2089         public abstract boolean equal(Object o1, Object o2);
2090     }
2091 
2092     private static final class CompareBoxed extends Compare {
CompareBoxed()2093         public CompareBoxed() {
2094             this(false);
2095         }
2096 
CompareBoxed(boolean unboxInner)2097         public CompareBoxed(boolean unboxInner) {
2098             this.unboxInner = unboxInner;
2099         }
2100 
equal(Object o1, Object o2)2101         public boolean equal(Object o1, Object o2) {
2102             if (o1 instanceof Any) {
2103                 return o2 instanceof Any
2104                     && ((Any) o1).getType().equals(((Any) o2).getType())
2105                     && equalValues(((Any) o1).getObject(),
2106                                    ((Any) o2).getObject());
2107             } else {
2108                 return equalValues(o1, o2);
2109             }
2110         }
2111 
equalValues(Object o1, Object o2)2112         private boolean equalValues(Object o1, Object o2) {
2113             if (o1 == null) {
2114                 return o2 == null;
2115             } else if (o1.getClass().isArray()) {
2116                 if (!(o2 != null && o1.getClass() == o2.getClass()
2117                       && Array.getLength(o1) == Array.getLength(o2))) {
2118                     return false;
2119                 }
2120                 for (int i = 0; i < Array.getLength(o1); ++i) {
2121                     Object oo1 = Array.get(o1, i);
2122                     if (unboxInner && oo1 instanceof Any) {
2123                         oo1 = ((Any) oo1).getObject();
2124                     }
2125                     if (!equal(oo1, Array.get(o2, i))) {
2126                         return false;
2127                     }
2128                 }
2129                 return true;
2130             } else {
2131                 return o1.equals(o2);
2132             }
2133         }
2134 
2135         private final boolean unboxInner;
2136     }
2137 
2138     private static final class CompareUnboxed extends Compare {
CompareUnboxed()2139         public CompareUnboxed() {
2140             this(false);
2141         }
2142 
CompareUnboxed(boolean unboxInner)2143         public CompareUnboxed(boolean unboxInner) {
2144             this.unboxInner = unboxInner;
2145         }
2146 
equal(Object o1, Object o2)2147         public boolean equal(Object o1, Object o2) {
2148             return new CompareBoxed(unboxInner).equal(((Any) o1).getObject(),
2149                                                       o2);
2150         }
2151 
2152         private final boolean unboxInner;
2153     }
2154 
2155     private static final class CompareSpecific extends Compare {
CompareSpecific(Object specific)2156         public CompareSpecific(Object specific) {
2157             this.specific = specific;
2158         }
2159 
equal(Object o1, Object o2)2160         public boolean equal(Object o1, Object o2) {
2161             return new CompareBoxed().equal(specific, o2);
2162         }
2163 
2164         private final Object specific;
2165     }
2166 
2167     private static final class CompareClass extends Compare {
CompareClass(Class clazz)2168         public CompareClass(Class clazz) {
2169             this.clazz = clazz;
2170         }
2171 
equal(Object o1, Object o2)2172         public boolean equal(Object o1, Object o2) {
2173             return o2 != null && o2.getClass() == clazz;
2174         }
2175 
2176         private final Class clazz;
2177     }
2178 
2179     public static class Enum1 extends Enum {
Enum1()2180         public Enum1() {
2181             super(0);
2182         }
2183 
fromInt(int value)2184         public static Enum1 fromInt(int value) {
2185             return new Enum1();
2186         }
2187 
equals(Object obj)2188         public boolean equals(Object obj) {
2189             return obj != null && obj.getClass() == Enum1.class;
2190         }
2191     }
2192 
2193     public static class Enum2 extends Enum1 {
equals(Object obj)2194         public boolean equals(Object obj) {
2195             return obj != null && obj.getClass() == Enum2.class;
2196         }
2197     }
2198 
2199     public static class BaseStruct {
equals(Object obj)2200         public boolean equals(Object obj) {
2201             return obj != null && obj.getClass() == BaseStruct.class;
2202         }
2203     }
2204 
2205     public static class DerivedStruct extends BaseStruct {
equals(Object obj)2206         public boolean equals(Object obj) {
2207             return obj != null && obj.getClass() == DerivedStruct.class;
2208         }
2209     }
2210 
2211     public static class BaseException extends com.sun.star.uno.Exception {
BaseException()2212         public BaseException() {}
2213 
BaseException(String message)2214         public BaseException(String message) {
2215             super(message);
2216         }
2217 
equals(Object obj)2218         public boolean equals(Object obj) {
2219             return obj != null && obj.getClass() == BaseException.class;
2220         }
2221     }
2222 
2223     public static class DerivedException extends BaseException {
DerivedException()2224         public DerivedException() {}
2225 
DerivedException(String message)2226         public DerivedException(String message) {
2227             super(message);
2228         }
2229 
equals(Object obj)2230         public boolean equals(Object obj) {
2231             return obj != null && obj.getClass() == DerivedException.class;
2232         }
2233     }
2234 
2235     public static class BaseRuntimeException
2236         extends com.sun.star.uno.RuntimeException
2237     {
BaseRuntimeException()2238         public BaseRuntimeException() {}
2239 
BaseRuntimeException(String message)2240         public BaseRuntimeException(String message) {
2241             super(message);
2242         }
2243 
equals(Object obj)2244         public boolean equals(Object obj) {
2245             return obj != null
2246                 && obj.getClass() == BaseRuntimeException.class;
2247         }
2248     }
2249 
2250     public static class DerivedRuntimeException extends BaseRuntimeException
2251     {
DerivedRuntimeException()2252         public DerivedRuntimeException() {}
2253 
DerivedRuntimeException(String message)2254         public DerivedRuntimeException(String message) {
2255             super(message);
2256         }
2257 
equals(Object obj)2258         public boolean equals(Object obj) {
2259             return obj != null
2260                 && obj.getClass() == DerivedRuntimeException.class;
2261         }
2262     }
2263 }
2264