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