Bug Summary

File:codemaker/source/javamaker/javatype.cxx
Location:line 1627, column 25
Description:Called C++ object pointer is null

Annotated Source Code

1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20
21#include "javatype.hxx"
22
23#include "classfile.hxx"
24#include "javaoptions.hxx"
25
26#include "codemaker/exceptiontree.hxx"
27#include "codemaker/generatedtypeset.hxx"
28#include "codemaker/global.hxx"
29#include "codemaker/options.hxx"
30#include "codemaker/typemanager.hxx"
31#include "codemaker/unotype.hxx"
32#include "codemaker/commonjava.hxx"
33
34#include "osl/diagnose.h"
35#include "registry/reader.hxx"
36#include "registry/refltype.hxx"
37#include "registry/types.h"
38#include "rtl/strbuf.hxx"
39#include "rtl/string.h"
40#include "rtl/string.hxx"
41#include "rtl/textcvt.h"
42#include "rtl/textenc.h"
43#include "rtl/ustring.h"
44#include "rtl/ustring.hxx"
45#include "sal/types.h"
46
47#include <algorithm>
48#include <list>
49#include <map>
50#include <memory>
51#include <set>
52#include <utility>
53#include <vector>
54
55using codemaker::javamaker::ClassFile;
56
57namespace {
58
59// helper function for createUnoName
60void appendUnoName(
61 TypeManager const & manager, rtl::OString const & nucleus, sal_Int32 rank,
62 std::vector< rtl::OString > const & arguments, rtl::OStringBuffer * buffer)
63{
64 OSL_ASSERT(rank >= 0 && buffer != 0)do { if (true && (!(rank >= 0 && buffer !=
0))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"
), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "64" ": "), "OSL_ASSERT: %s", "rank >= 0 && buffer != 0"
); } } while (false)
;
65 for (sal_Int32 i = 0; i < rank; ++i) {
66 buffer->append(RTL_CONSTASCII_STRINGPARAM("[]")(&("[]")[0]), ((sal_Int32)(sizeof ("[]") / sizeof (("[]")
[0]))-1)
);
67 }
68 buffer->append(nucleus.replace('/', '.'));
69 if (!arguments.empty()) {
70 buffer->append('<');
71 for (std::vector< rtl::OString >::const_iterator i(arguments.begin());
72 i != arguments.end(); ++i)
73 {
74 if (i != arguments.begin()) {
75 buffer->append(',');
76 }
77 RTTypeClass argTypeClass;
78 rtl::OString argNucleus;
79 sal_Int32 argRank;
80 std::vector< rtl::OString > argArgs;
81 codemaker::decomposeAndResolve(
82 manager, *i, true, false, false, &argTypeClass, &argNucleus,
83 &argRank, &argArgs);
84 appendUnoName(manager, argNucleus, argRank, argArgs, buffer);
85 }
86 buffer->append('>');
87 }
88}
89
90// Translate the name of a UNO type registry entity (enum type, plain struct
91// type, polymorphic struct type template, or interface type, decomposed into
92// nucleus, rank, and arguments) into a core UNO type name:
93rtl::OString createUnoName(
94 TypeManager const & manager, rtl::OString const & nucleus, sal_Int32 rank,
95 std::vector< rtl::OString > const & arguments)
96{
97 rtl::OStringBuffer buf;
98 appendUnoName(manager, nucleus, rank, arguments, &buf);
99 return buf.makeStringAndClear();
100}
101
102/**
103 Set of UTF-8--encoded names of UNO type registry entities a given UNO type
104 registry entity depends on.
105
106 UNO type registry entities are enum types, plain struct types, polymorphic
107 struct type templates, exception types, interface types, typedefs, modules,
108 constant groupds, single-interface--based services, accumulation-based
109 services, interface-based singletons, and service-based singletons.
110 */
111typedef std::set< rtl::OString > Dependencies;
112
113enum SpecialType {
114 SPECIAL_TYPE_NONE,
115 SPECIAL_TYPE_ANY,
116 SPECIAL_TYPE_UNSIGNED,
117 SPECIAL_TYPE_INTERFACE
118};
119
120bool isSpecialType(SpecialType special) {
121 return special >= SPECIAL_TYPE_UNSIGNED;
122}
123
124rtl::OString translateUnoTypeToJavaFullyQualifiedName(
125 rtl::OString const & type, rtl::OString const & prefix)
126{
127 sal_Int32 i = type.lastIndexOf('/') + 1;
128 return type.copy(0, i) +
129 codemaker::java::translateUnoToJavaIdentifier(type.copy(i), prefix);
130}
131
132struct PolymorphicUnoType {
133 PolymorphicUnoType(): kind(KIND_NONE) {}
134
135 enum Kind { KIND_NONE, KIND_STRUCT, KIND_SEQUENCE };
136 Kind kind;
137 rtl::OString name;
138};
139
140SpecialType translateUnoTypeToDescriptor(
141 TypeManager const & manager, rtl::OString const & type, bool array,
142 bool classType, Dependencies * dependencies,
143 rtl::OStringBuffer * descriptor, rtl::OStringBuffer * signature,
144 bool * needsSignature, PolymorphicUnoType * polymorphicUnoType);
145
146SpecialType translateUnoTypeToDescriptor(
147 TypeManager const & manager, codemaker::UnoType::Sort sort,
148 RTTypeClass typeClass, rtl::OString const & nucleus, sal_Int32 rank,
149 std::vector< rtl::OString > const & arguments, bool array, bool classType,
150 Dependencies * dependencies, rtl::OStringBuffer * descriptor,
151 rtl::OStringBuffer * signature, bool * needsSignature,
152 PolymorphicUnoType * polymorphicUnoType)
153{
154 OSL_ASSERT(rank >= 0 && (signature == 0) == (needsSignature == 0))do { if (true && (!(rank >= 0 && (signature
== 0) == (needsSignature == 0)))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN
), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "154" ": "), "OSL_ASSERT: %s", "rank >= 0 && (signature == 0) == (needsSignature == 0)"
); } } while (false)
;
155 if (rank > 0xFF - (array ? 1 : 0)) {
156 throw CannotDumpException(
157 rtl::OString(
158 RTL_CONSTASCII_STRINGPARAM((&("Too many array dimensions for Java class file format"
)[0]), ((sal_Int32)(sizeof ("Too many array dimensions for Java class file format"
) / sizeof (("Too many array dimensions for Java class file format"
)[0]))-1)
159 "Too many array dimensions for Java class file format")(&("Too many array dimensions for Java class file format"
)[0]), ((sal_Int32)(sizeof ("Too many array dimensions for Java class file format"
) / sizeof (("Too many array dimensions for Java class file format"
)[0]))-1)
));
160 }
161 if (array) {
162 ++rank;
163 }
164 for (sal_Int32 i = 0; i < rank; ++i) {
165 if (descriptor != 0) {
166 descriptor->append('[');
167 }
168 if (signature != 0) {
169 signature->append('[');
170 }
171 }
172 if (sort == codemaker::UnoType::SORT_COMPLEX) {
173 //TODO: check that nucleus is a valid (Java-modified UTF-8) identifier
174 rtl::OString superClass;
175 if (typeClass == RT_TYPE_INTERFACE
176 && (nucleus
177 == rtl::OString(
178 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/XInterface")(&("com/sun/star/uno/XInterface")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/XInterface") / sizeof (("com/sun/star/uno/XInterface"
)[0]))-1)
)))
179 {
180 if (descriptor != 0) {
181 descriptor->append(
182 rtl::OString(
183 RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Object;")(&("Ljava/lang/Object;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Object;"
) / sizeof (("Ljava/lang/Object;")[0]))-1)
));
184 }
185 if (signature != 0) {
186 signature->append(
187 rtl::OString(
188 RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Object;")(&("Ljava/lang/Object;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Object;"
) / sizeof (("Ljava/lang/Object;")[0]))-1)
));
189 }
190 if (polymorphicUnoType != 0) {
191 polymorphicUnoType->kind = PolymorphicUnoType::KIND_NONE;
192 }
193 return SPECIAL_TYPE_INTERFACE;
194 } else {
195 if (dependencies != 0) {
196 dependencies->insert(nucleus);
197 }
198 if (descriptor != 0) {
199 descriptor->append('L');
200 descriptor->append(nucleus);
201 descriptor->append(';');
202 }
203 if (signature != 0) {
204 signature->append('L');
205 signature->append(nucleus);
206 if (!arguments.empty()) {
207 signature->append('<');
208 for (std::vector< rtl::OString >::const_iterator i(
209 arguments.begin());
210 i != arguments.end(); ++i)
211 {
212 translateUnoTypeToDescriptor(
213 manager, *i, false, true, dependencies, 0,
214 signature, needsSignature, 0);
215 }
216 signature->append('>');
217 *needsSignature = true;
218 }
219 signature->append(';');
220 }
221 if (polymorphicUnoType != 0) {
222 if (arguments.empty()) {
223 polymorphicUnoType->kind = PolymorphicUnoType::KIND_NONE;
224 } else {
225 polymorphicUnoType->kind = rank == 0
226 ? PolymorphicUnoType::KIND_STRUCT
227 : PolymorphicUnoType::KIND_SEQUENCE;
228 polymorphicUnoType->name = createUnoName(
229 manager, nucleus, rank, arguments);
230 }
231 }
232 return SPECIAL_TYPE_NONE;
233 }
234 } else {
235 static rtl::OString const
236 simpleTypeDescriptors[codemaker::UnoType::SORT_ANY + 1][2] = {
237 { rtl::OString(RTL_CONSTASCII_STRINGPARAM("V")(&("V")[0]), ((sal_Int32)(sizeof ("V") / sizeof (("V")[0]
))-1)
),
238 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Void;")(&("Ljava/lang/Void;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Void;"
) / sizeof (("Ljava/lang/Void;")[0]))-1)
)
239 },
240 { rtl::OString(RTL_CONSTASCII_STRINGPARAM("Z")(&("Z")[0]), ((sal_Int32)(sizeof ("Z") / sizeof (("Z")[0]
))-1)
),
241 rtl::OString(
242 RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Boolean;")(&("Ljava/lang/Boolean;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Boolean;"
) / sizeof (("Ljava/lang/Boolean;")[0]))-1)
)
243 },
244 { rtl::OString(RTL_CONSTASCII_STRINGPARAM("B")(&("B")[0]), ((sal_Int32)(sizeof ("B") / sizeof (("B")[0]
))-1)
),
245 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Byte;")(&("Ljava/lang/Byte;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Byte;"
) / sizeof (("Ljava/lang/Byte;")[0]))-1)
)
246 },
247 { rtl::OString(RTL_CONSTASCII_STRINGPARAM("S")(&("S")[0]), ((sal_Int32)(sizeof ("S") / sizeof (("S")[0]
))-1)
),
248 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Short;")(&("Ljava/lang/Short;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Short;"
) / sizeof (("Ljava/lang/Short;")[0]))-1)
)
249 },
250 { rtl::OString(RTL_CONSTASCII_STRINGPARAM("S")(&("S")[0]), ((sal_Int32)(sizeof ("S") / sizeof (("S")[0]
))-1)
),
251 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Short;")(&("Ljava/lang/Short;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Short;"
) / sizeof (("Ljava/lang/Short;")[0]))-1)
)
252 },
253 { rtl::OString(RTL_CONSTASCII_STRINGPARAM("I")(&("I")[0]), ((sal_Int32)(sizeof ("I") / sizeof (("I")[0]
))-1)
),
254 rtl::OString(
255 RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Integer;")(&("Ljava/lang/Integer;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Integer;"
) / sizeof (("Ljava/lang/Integer;")[0]))-1)
)
256 },
257 { rtl::OString(RTL_CONSTASCII_STRINGPARAM("I")(&("I")[0]), ((sal_Int32)(sizeof ("I") / sizeof (("I")[0]
))-1)
),
258 rtl::OString(
259 RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Integer;")(&("Ljava/lang/Integer;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Integer;"
) / sizeof (("Ljava/lang/Integer;")[0]))-1)
)
260 },
261 { rtl::OString(RTL_CONSTASCII_STRINGPARAM("J")(&("J")[0]), ((sal_Int32)(sizeof ("J") / sizeof (("J")[0]
))-1)
),
262 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Long;")(&("Ljava/lang/Long;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Long;"
) / sizeof (("Ljava/lang/Long;")[0]))-1)
)
263 },
264 { rtl::OString(RTL_CONSTASCII_STRINGPARAM("J")(&("J")[0]), ((sal_Int32)(sizeof ("J") / sizeof (("J")[0]
))-1)
),
265 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Long;")(&("Ljava/lang/Long;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Long;"
) / sizeof (("Ljava/lang/Long;")[0]))-1)
)
266 },
267 { rtl::OString(RTL_CONSTASCII_STRINGPARAM("F")(&("F")[0]), ((sal_Int32)(sizeof ("F") / sizeof (("F")[0]
))-1)
),
268 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Float;")(&("Ljava/lang/Float;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Float;"
) / sizeof (("Ljava/lang/Float;")[0]))-1)
)
269 },
270 { rtl::OString(RTL_CONSTASCII_STRINGPARAM("D")(&("D")[0]), ((sal_Int32)(sizeof ("D") / sizeof (("D")[0]
))-1)
),
271 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Double;")(&("Ljava/lang/Double;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Double;"
) / sizeof (("Ljava/lang/Double;")[0]))-1)
)
272 },
273 { rtl::OString(RTL_CONSTASCII_STRINGPARAM("C")(&("C")[0]), ((sal_Int32)(sizeof ("C") / sizeof (("C")[0]
))-1)
),
274 rtl::OString(
275 RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Character;")(&("Ljava/lang/Character;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Character;"
) / sizeof (("Ljava/lang/Character;")[0]))-1)
)
276 },
277 { rtl::OString(
278 RTL_CONSTASCII_STRINGPARAM("Ljava/lang/String;")(&("Ljava/lang/String;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/String;"
) / sizeof (("Ljava/lang/String;")[0]))-1)
),
279 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Ljava/lang/String;")(&("Ljava/lang/String;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/String;"
) / sizeof (("Ljava/lang/String;")[0]))-1)
)
280 },
281 { rtl::OString(
282 RTL_CONSTASCII_STRINGPARAM("Lcom/sun/star/uno/Type;")(&("Lcom/sun/star/uno/Type;")[0]), ((sal_Int32)(sizeof ("Lcom/sun/star/uno/Type;"
) / sizeof (("Lcom/sun/star/uno/Type;")[0]))-1)
),
283 rtl::OString(
284 RTL_CONSTASCII_STRINGPARAM("Lcom/sun/star/uno/Type;")(&("Lcom/sun/star/uno/Type;")[0]), ((sal_Int32)(sizeof ("Lcom/sun/star/uno/Type;"
) / sizeof (("Lcom/sun/star/uno/Type;")[0]))-1)
)
285 },
286 { rtl::OString(
287 RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Object;")(&("Ljava/lang/Object;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Object;"
) / sizeof (("Ljava/lang/Object;")[0]))-1)
),
288 rtl::OString(
289 RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Object;")(&("Ljava/lang/Object;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Object;"
) / sizeof (("Ljava/lang/Object;")[0]))-1)
)
290 } };
291 rtl::OString const & s
292 = simpleTypeDescriptors[sort][rank == 0 && classType];
293 if (descriptor != 0) {
294 descriptor->append(s);
295 }
296 if (signature != 0) {
297 signature->append(s);
298 }
299 if (polymorphicUnoType != 0) {
300 polymorphicUnoType->kind = PolymorphicUnoType::KIND_NONE;
301 }
302 static SpecialType const
303 simpleTypeSpecials[codemaker::UnoType::SORT_ANY + 1] = {
304 SPECIAL_TYPE_NONE, SPECIAL_TYPE_NONE, SPECIAL_TYPE_NONE,
305 SPECIAL_TYPE_NONE, SPECIAL_TYPE_UNSIGNED, SPECIAL_TYPE_NONE,
306 SPECIAL_TYPE_UNSIGNED, SPECIAL_TYPE_NONE, SPECIAL_TYPE_UNSIGNED,
307 SPECIAL_TYPE_NONE, SPECIAL_TYPE_NONE, SPECIAL_TYPE_NONE,
308 SPECIAL_TYPE_NONE, SPECIAL_TYPE_NONE, SPECIAL_TYPE_ANY };
309 return simpleTypeSpecials[sort];
310 }
311}
312
313SpecialType translateUnoTypeToDescriptor(
314 TypeManager const & manager, rtl::OString const & type, bool array,
315 bool classType, Dependencies * dependencies,
316 rtl::OStringBuffer * descriptor, rtl::OStringBuffer * signature,
317 bool * needsSignature, PolymorphicUnoType * polymorphicUnoType)
318{
319 RTTypeClass typeClass;
320 rtl::OString nucleus;
321 sal_Int32 rank;
322 std::vector< rtl::OString > args;
323 codemaker::UnoType::Sort sort = codemaker::decomposeAndResolve(
324 manager, type, true, true, false, &typeClass, &nucleus, &rank, &args);
325 OSL_ASSERT(rank < SAL_MAX_INT32)do { if (true && (!(rank < ((sal_Int32) 0x7FFFFFFF
)))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"
), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "325" ": "), "OSL_ASSERT: %s", "rank < SAL_MAX_INT32"
); } } while (false)
;
326 return translateUnoTypeToDescriptor(
327 manager, sort, typeClass, nucleus, rank, args, array, classType,
328 dependencies, descriptor, signature, needsSignature,
329 polymorphicUnoType);
330}
331
332SpecialType getFieldDescriptor(
333 TypeManager const & manager, Dependencies * dependencies,
334 rtl::OString const & type, rtl::OString * descriptor,
335 rtl::OString * signature, PolymorphicUnoType * polymorphicUnoType)
336{
337 OSL_ASSERT(dependencies != 0 && descriptor != 0)do { if (true && (!(dependencies != 0 && descriptor
!= 0))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), (
"legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "337" ": "), "OSL_ASSERT: %s", "dependencies != 0 && descriptor != 0"
); } } while (false)
;
338 rtl::OStringBuffer desc;
339 rtl::OStringBuffer sig;
340 bool needsSig = false;
341 SpecialType specialType = translateUnoTypeToDescriptor(
342 manager, type, false, false, dependencies, &desc, &sig, &needsSig,
343 polymorphicUnoType);
344 *descriptor = desc.makeStringAndClear();
345 if (signature != 0) {
346 if (needsSig) {
347 *signature = sig.makeStringAndClear();
348 } else {
349 *signature = rtl::OString();
350 }
351 }
352 return specialType;
353}
354
355class MethodDescriptor {
356public:
357 MethodDescriptor(
358 TypeManager const & manager, Dependencies * dependencies,
359 rtl::OString const & returnType, SpecialType * specialReturnType,
360 PolymorphicUnoType * polymorphicUnoType);
361
362 SpecialType addParameter(
363 rtl::OString const & type, bool array, bool dependency,
364 PolymorphicUnoType * polymorphicUnoType);
365
366 void addTypeParameter(rtl::OString const & name);
367
368 rtl::OString getDescriptor() const;
369
370 rtl::OString getSignature() const;
371
372private:
373 TypeManager const & m_manager;
374 Dependencies * m_dependencies;
375 rtl::OStringBuffer m_descriptorStart;
376 rtl::OString m_descriptorEnd;
377 rtl::OStringBuffer m_signatureStart;
378 rtl::OString m_signatureEnd;
379 bool m_needsSignature;
380};
381
382MethodDescriptor::MethodDescriptor(
383 TypeManager const & manager, Dependencies * dependencies,
384 rtl::OString const & returnType, SpecialType * specialReturnType,
385 PolymorphicUnoType * polymorphicUnoType):
386 m_manager(manager), m_dependencies(dependencies), m_needsSignature(false)
387{
388 OSL_ASSERT(dependencies != 0)do { if (true && (!(dependencies != 0))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "388" ": "), "OSL_ASSERT: %s", "dependencies != 0"); } }
while (false)
;
389 m_descriptorStart.append('(');
390 m_signatureStart.append('(');
391 rtl::OStringBuffer descEnd;
392 descEnd.append(')');
393 rtl::OStringBuffer sigEnd;
394 sigEnd.append(')');
395 SpecialType special = translateUnoTypeToDescriptor(
396 m_manager, returnType, false, false, m_dependencies, &descEnd, &sigEnd,
397 &m_needsSignature, polymorphicUnoType);
398 m_descriptorEnd = descEnd.makeStringAndClear();
399 m_signatureEnd = sigEnd.makeStringAndClear();
400 if (specialReturnType != 0) {
401 *specialReturnType = special;
402 }
403}
404
405SpecialType MethodDescriptor::addParameter(
406 rtl::OString const & type, bool array, bool dependency,
407 PolymorphicUnoType * polymorphicUnoType)
408{
409 return translateUnoTypeToDescriptor(
410 m_manager, type, array, false, dependency ? m_dependencies : 0,
411 &m_descriptorStart, &m_signatureStart, &m_needsSignature,
412 polymorphicUnoType);
413}
414
415void MethodDescriptor::addTypeParameter(rtl::OString const & name) {
416 m_descriptorStart.append(RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Object;")(&("Ljava/lang/Object;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Object;"
) / sizeof (("Ljava/lang/Object;")[0]))-1)
);
417 m_signatureStart.append('T');
418 m_signatureStart.append(name);
419 m_signatureStart.append(';');
420 m_needsSignature = true;
421}
422
423rtl::OString MethodDescriptor::getDescriptor() const {
424 rtl::OStringBuffer buf(m_descriptorStart);
425 buf.append(m_descriptorEnd);
426 return buf.makeStringAndClear();
427}
428
429rtl::OString MethodDescriptor::getSignature() const {
430 if (m_needsSignature) {
431 rtl::OStringBuffer buf(m_signatureStart);
432 buf.append(m_signatureEnd);
433 return buf.makeStringAndClear();
434 } else {
435 return rtl::OString();
436 }
437}
438
439class TypeInfo {
440public:
441 enum Kind { KIND_MEMBER, KIND_ATTRIBUTE, KIND_METHOD, KIND_PARAMETER };
442
443 // Same values as in com/sun/star/lib/uno/typeinfo/TypeInfo.java:
444 enum Flags {
445 FLAG_READONLY = 0x008, FLAG_BOUND = 0x100, FLAG_ONEWAY = 0x010
446 };
447
448 // KIND_MEMBER:
449 TypeInfo(
450 rtl::OString const & name, SpecialType specialType, sal_Int32 index,
451 PolymorphicUnoType const & polymorphicUnoType,
452 sal_Int32 typeParameterIndex);
453
454 // KIND_ATTRIBUTE/METHOD:
455 TypeInfo(
456 Kind kind, rtl::OString const & name, SpecialType specialType,
457 Flags flags, sal_Int32 index,
458 PolymorphicUnoType const & polymorphicUnoType);
459
460 // KIND_PARAMETER:
461 TypeInfo(
462 rtl::OString const & parameterName, SpecialType specialType,
463 bool inParameter, bool outParameter, rtl::OString const & methodName,
464 sal_Int32 index, PolymorphicUnoType const & polymorphicUnoType);
465
466 sal_uInt16 generateCode(ClassFile::Code & code, Dependencies * dependencies)
467 const;
468
469 void generatePolymorphicUnoTypeCode(
470 ClassFile::Code & code, Dependencies * dependencies) const;
471
472private:
473 Kind m_kind;
474 rtl::OString m_name;
475 sal_Int32 m_flags;
476 sal_Int32 m_index;
477 rtl::OString m_methodName;
478 PolymorphicUnoType m_polymorphicUnoType;
479 sal_Int32 m_typeParameterIndex;
480};
481
482sal_Int32 translateSpecialTypeFlags(
483 SpecialType specialType, bool inParameter, bool outParameter)
484{
485 static sal_Int32 const specialTypeFlags[SPECIAL_TYPE_INTERFACE + 1] = {
486 0, 0x0040 /* ANY */, 0x0004 /* UNSIGNED */, 0x0080 /* INTERFACE */ };
487 sal_Int32 flags = specialTypeFlags[specialType];
488 if (inParameter) {
489 flags |= 0x0001; /* IN */
490 }
491 if (outParameter) {
492 flags |= 0x0002; /* OUT */
493 }
494 return flags;
495}
496
497TypeInfo::TypeInfo(
498 rtl::OString const & name, SpecialType specialType, sal_Int32 index,
499 PolymorphicUnoType const & polymorphicUnoType,
500 sal_Int32 typeParameterIndex):
501 m_kind(KIND_MEMBER), m_name(name),
502 m_flags(translateSpecialTypeFlags(specialType, false, false)),
503 m_index(index), m_polymorphicUnoType(polymorphicUnoType),
504 m_typeParameterIndex(typeParameterIndex)
505{
506 OSL_ASSERT(do { if (true && (!(polymorphicUnoType.kind == PolymorphicUnoType
::KIND_NONE ? typeParameterIndex >= -1 : typeParameterIndex
== -1))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN),
("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "508" ": "), "OSL_ASSERT: %s", "polymorphicUnoType.kind == PolymorphicUnoType::KIND_NONE ? typeParameterIndex >= -1 : typeParameterIndex == -1"
); } } while (false)
507 polymorphicUnoType.kind == PolymorphicUnoType::KIND_NONEdo { if (true && (!(polymorphicUnoType.kind == PolymorphicUnoType
::KIND_NONE ? typeParameterIndex >= -1 : typeParameterIndex
== -1))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN),
("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "508" ": "), "OSL_ASSERT: %s", "polymorphicUnoType.kind == PolymorphicUnoType::KIND_NONE ? typeParameterIndex >= -1 : typeParameterIndex == -1"
); } } while (false)
508 ? typeParameterIndex >= -1 : typeParameterIndex == -1)do { if (true && (!(polymorphicUnoType.kind == PolymorphicUnoType
::KIND_NONE ? typeParameterIndex >= -1 : typeParameterIndex
== -1))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN),
("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "508" ": "), "OSL_ASSERT: %s", "polymorphicUnoType.kind == PolymorphicUnoType::KIND_NONE ? typeParameterIndex >= -1 : typeParameterIndex == -1"
); } } while (false)
;
509}
510
511TypeInfo::TypeInfo(
512 Kind kind, rtl::OString const & name, SpecialType specialType,
513 Flags flags, sal_Int32 index,
514 PolymorphicUnoType const & polymorphicUnoType):
515 m_kind(kind), m_name(name),
516 m_flags(flags | translateSpecialTypeFlags(specialType, false, false)),
517 m_index(index), m_polymorphicUnoType(polymorphicUnoType)
518{
519 OSL_ASSERT(kind == KIND_ATTRIBUTE || kind == KIND_METHOD)do { if (true && (!(kind == KIND_ATTRIBUTE || kind ==
KIND_METHOD))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN
), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "519" ": "), "OSL_ASSERT: %s", "kind == KIND_ATTRIBUTE || kind == KIND_METHOD"
); } } while (false)
;
520}
521
522TypeInfo::TypeInfo(
523 rtl::OString const & parameterName, SpecialType specialType,
524 bool inParameter, bool outParameter, rtl::OString const & methodName,
525 sal_Int32 index, PolymorphicUnoType const & polymorphicUnoType):
526 m_kind(KIND_PARAMETER), m_name(parameterName),
527 m_flags(translateSpecialTypeFlags(specialType, inParameter, outParameter)),
528 m_index(index), m_methodName(methodName),
529 m_polymorphicUnoType(polymorphicUnoType)
530{}
531
532sal_uInt16 TypeInfo::generateCode(
533 ClassFile::Code & code, Dependencies * dependencies) const
534{
535 OSL_ASSERT(dependencies != 0)do { if (true && (!(dependencies != 0))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "535" ": "), "OSL_ASSERT: %s", "dependencies != 0"); } }
while (false)
;
536 switch (m_kind) {
537 case KIND_MEMBER:
538 code.instrNew(
539 rtl::OString(
540 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/lib/uno/typeinfo/MemberTypeInfo")[0]), (
(sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/MemberTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/MemberTypeInfo")[
0]))-1)
541 "com/sun/star/lib/uno/typeinfo/MemberTypeInfo")(&("com/sun/star/lib/uno/typeinfo/MemberTypeInfo")[0]), (
(sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/MemberTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/MemberTypeInfo")[
0]))-1)
));
542 code.instrDup();
543 code.loadStringConstant(m_name);
544 code.loadIntegerConstant(m_index);
545 code.loadIntegerConstant(m_flags);
546 if (m_polymorphicUnoType.kind != PolymorphicUnoType::KIND_NONE) {
547 generatePolymorphicUnoTypeCode(code, dependencies);
548 code.loadIntegerConstant(m_typeParameterIndex);
549 code.instrInvokespecial(
550 rtl::OString(
551 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/lib/uno/typeinfo/MemberTypeInfo")[0]), (
(sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/MemberTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/MemberTypeInfo")[
0]))-1)
552 "com/sun/star/lib/uno/typeinfo/MemberTypeInfo")(&("com/sun/star/lib/uno/typeinfo/MemberTypeInfo")[0]), (
(sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/MemberTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/MemberTypeInfo")[
0]))-1)
),
553 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
554 rtl::OString(
555 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V")[0])
, ((sal_Int32)(sizeof ("(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V"
) / sizeof (("(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V"
)[0]))-1)
556 "(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V")(&("(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V")[0])
, ((sal_Int32)(sizeof ("(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V"
) / sizeof (("(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V"
)[0]))-1)
));
557 return 8;
558 } else if (m_typeParameterIndex >= 0) {
559 code.instrAconstNull();
560 code.loadIntegerConstant(m_typeParameterIndex);
561 code.instrInvokespecial(
562 rtl::OString(
563 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/lib/uno/typeinfo/MemberTypeInfo")[0]), (
(sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/MemberTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/MemberTypeInfo")[
0]))-1)
564 "com/sun/star/lib/uno/typeinfo/MemberTypeInfo")(&("com/sun/star/lib/uno/typeinfo/MemberTypeInfo")[0]), (
(sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/MemberTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/MemberTypeInfo")[
0]))-1)
),
565 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
566 rtl::OString(
567 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V")[0])
, ((sal_Int32)(sizeof ("(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V"
) / sizeof (("(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V"
)[0]))-1)
568 "(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V")(&("(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V")[0])
, ((sal_Int32)(sizeof ("(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V"
) / sizeof (("(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V"
)[0]))-1)
));
569 return 6;
570 } else {
571 code.instrInvokespecial(
572 rtl::OString(
573 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/lib/uno/typeinfo/MemberTypeInfo")[0]), (
(sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/MemberTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/MemberTypeInfo")[
0]))-1)
574 "com/sun/star/lib/uno/typeinfo/MemberTypeInfo")(&("com/sun/star/lib/uno/typeinfo/MemberTypeInfo")[0]), (
(sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/MemberTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/MemberTypeInfo")[
0]))-1)
),
575 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
576 rtl::OString(
577 RTL_CONSTASCII_STRINGPARAM("(Ljava/lang/String;II)V")(&("(Ljava/lang/String;II)V")[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;II)V"
) / sizeof (("(Ljava/lang/String;II)V")[0]))-1)
));
578 return 4;
579 }
580
581 case KIND_ATTRIBUTE:
582 code.instrNew(
583 rtl::OString(
584 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo")[0])
, ((sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo"
)[0]))-1)
585 "com/sun/star/lib/uno/typeinfo/AttributeTypeInfo")(&("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo")[0])
, ((sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo"
)[0]))-1)
));
586 code.instrDup();
587 code.loadStringConstant(m_name);
588 code.loadIntegerConstant(m_index);
589 code.loadIntegerConstant(m_flags);
590 if (m_polymorphicUnoType.kind != PolymorphicUnoType::KIND_NONE) {
591 generatePolymorphicUnoTypeCode(code, dependencies);
592 code.instrInvokespecial(
593 rtl::OString(
594 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo")[0])
, ((sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo"
)[0]))-1)
595 "com/sun/star/lib/uno/typeinfo/AttributeTypeInfo")(&("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo")[0])
, ((sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo"
)[0]))-1)
),
596 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
597 rtl::OString(
598 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;IILcom/sun/star/uno/Type;)V")[0]),
((sal_Int32)(sizeof ("(Ljava/lang/String;IILcom/sun/star/uno/Type;)V"
) / sizeof (("(Ljava/lang/String;IILcom/sun/star/uno/Type;)V"
)[0]))-1)
599 "(Ljava/lang/String;IILcom/sun/star/uno/Type;)V")(&("(Ljava/lang/String;IILcom/sun/star/uno/Type;)V")[0]),
((sal_Int32)(sizeof ("(Ljava/lang/String;IILcom/sun/star/uno/Type;)V"
) / sizeof (("(Ljava/lang/String;IILcom/sun/star/uno/Type;)V"
)[0]))-1)
));
600 return 8;
601 } else {
602 code.instrInvokespecial(
603 rtl::OString(
604 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo")[0])
, ((sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo"
)[0]))-1)
605 "com/sun/star/lib/uno/typeinfo/AttributeTypeInfo")(&("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo")[0])
, ((sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo"
)[0]))-1)
),
606 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
607 rtl::OString(
608 RTL_CONSTASCII_STRINGPARAM("(Ljava/lang/String;II)V")(&("(Ljava/lang/String;II)V")[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;II)V"
) / sizeof (("(Ljava/lang/String;II)V")[0]))-1)
));
609 return 4;
610 }
611
612 case KIND_METHOD:
613 code.instrNew(
614 rtl::OString(
615 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/lib/uno/typeinfo/MethodTypeInfo")[0]), (
(sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/MethodTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/MethodTypeInfo")[
0]))-1)
616 "com/sun/star/lib/uno/typeinfo/MethodTypeInfo")(&("com/sun/star/lib/uno/typeinfo/MethodTypeInfo")[0]), (
(sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/MethodTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/MethodTypeInfo")[
0]))-1)
));
617 code.instrDup();
618 code.loadStringConstant(m_name);
619 code.loadIntegerConstant(m_index);
620 code.loadIntegerConstant(m_flags);
621 if (m_polymorphicUnoType.kind != PolymorphicUnoType::KIND_NONE) {
622 generatePolymorphicUnoTypeCode(code, dependencies);
623 code.instrInvokespecial(
624 rtl::OString(
625 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/lib/uno/typeinfo/MethodTypeInfo")[0]), (
(sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/MethodTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/MethodTypeInfo")[
0]))-1)
626 "com/sun/star/lib/uno/typeinfo/MethodTypeInfo")(&("com/sun/star/lib/uno/typeinfo/MethodTypeInfo")[0]), (
(sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/MethodTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/MethodTypeInfo")[
0]))-1)
),
627 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
628 rtl::OString(
629 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;IILcom/sun/star/uno/Type;)V")[0]),
((sal_Int32)(sizeof ("(Ljava/lang/String;IILcom/sun/star/uno/Type;)V"
) / sizeof (("(Ljava/lang/String;IILcom/sun/star/uno/Type;)V"
)[0]))-1)
630 "(Ljava/lang/String;IILcom/sun/star/uno/Type;)V")(&("(Ljava/lang/String;IILcom/sun/star/uno/Type;)V")[0]),
((sal_Int32)(sizeof ("(Ljava/lang/String;IILcom/sun/star/uno/Type;)V"
) / sizeof (("(Ljava/lang/String;IILcom/sun/star/uno/Type;)V"
)[0]))-1)
));
631 return 8;
632 } else {
633 code.instrInvokespecial(
634 rtl::OString(
635 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/lib/uno/typeinfo/MethodTypeInfo")[0]), (
(sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/MethodTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/MethodTypeInfo")[
0]))-1)
636 "com/sun/star/lib/uno/typeinfo/MethodTypeInfo")(&("com/sun/star/lib/uno/typeinfo/MethodTypeInfo")[0]), (
(sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/MethodTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/MethodTypeInfo")[
0]))-1)
),
637 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
638 rtl::OString(
639 RTL_CONSTASCII_STRINGPARAM("(Ljava/lang/String;II)V")(&("(Ljava/lang/String;II)V")[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;II)V"
) / sizeof (("(Ljava/lang/String;II)V")[0]))-1)
));
640 return 4;
641 }
642
643 case KIND_PARAMETER:
644 code.instrNew(
645 rtl::OString(
646 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo")[0])
, ((sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo"
)[0]))-1)
647 "com/sun/star/lib/uno/typeinfo/ParameterTypeInfo")(&("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo")[0])
, ((sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo"
)[0]))-1)
));
648 code.instrDup();
649 code.loadStringConstant(m_name);
650 code.loadStringConstant(m_methodName);
651 code.loadIntegerConstant(m_index);
652 code.loadIntegerConstant(m_flags);
653 if (m_polymorphicUnoType.kind != PolymorphicUnoType::KIND_NONE) {
654 generatePolymorphicUnoTypeCode(code, dependencies);
655 code.instrInvokespecial(
656 rtl::OString(
657 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo")[0])
, ((sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo"
)[0]))-1)
658 "com/sun/star/lib/uno/typeinfo/ParameterTypeInfo")(&("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo")[0])
, ((sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo"
)[0]))-1)
),
659 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
660 rtl::OString(
661 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;Ljava/lang/String;II" "Lcom/sun/star/uno/Type;)V"
)[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;Ljava/lang/String;II"
"Lcom/sun/star/uno/Type;)V") / sizeof (("(Ljava/lang/String;Ljava/lang/String;II"
"Lcom/sun/star/uno/Type;)V")[0]))-1)
662 "(Ljava/lang/String;Ljava/lang/String;II"(&("(Ljava/lang/String;Ljava/lang/String;II" "Lcom/sun/star/uno/Type;)V"
)[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;Ljava/lang/String;II"
"Lcom/sun/star/uno/Type;)V") / sizeof (("(Ljava/lang/String;Ljava/lang/String;II"
"Lcom/sun/star/uno/Type;)V")[0]))-1)
663 "Lcom/sun/star/uno/Type;)V")(&("(Ljava/lang/String;Ljava/lang/String;II" "Lcom/sun/star/uno/Type;)V"
)[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;Ljava/lang/String;II"
"Lcom/sun/star/uno/Type;)V") / sizeof (("(Ljava/lang/String;Ljava/lang/String;II"
"Lcom/sun/star/uno/Type;)V")[0]))-1)
));
664 return 9;
665 } else {
666 code.instrInvokespecial(
667 rtl::OString(
668 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo")[0])
, ((sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo"
)[0]))-1)
669 "com/sun/star/lib/uno/typeinfo/ParameterTypeInfo")(&("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo")[0])
, ((sal_Int32)(sizeof ("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo"
) / sizeof (("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo"
)[0]))-1)
),
670 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
671 rtl::OString(
672 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;Ljava/lang/String;II)V")[0]), ((sal_Int32
)(sizeof ("(Ljava/lang/String;Ljava/lang/String;II)V") / sizeof
(("(Ljava/lang/String;Ljava/lang/String;II)V")[0]))-1)
673 "(Ljava/lang/String;Ljava/lang/String;II)V")(&("(Ljava/lang/String;Ljava/lang/String;II)V")[0]), ((sal_Int32
)(sizeof ("(Ljava/lang/String;Ljava/lang/String;II)V") / sizeof
(("(Ljava/lang/String;Ljava/lang/String;II)V")[0]))-1)
));
674 return 5;
675 }
676
677 default:
678 OSL_ASSERT(false)do { if (true && (!(false))) { sal_detail_logFormat((
SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "678" ": "), "OSL_ASSERT: %s", "false"); } } while (false
)
;
679 return 0;
680 }
681}
682
683void TypeInfo::generatePolymorphicUnoTypeCode(
684 ClassFile::Code & code, Dependencies * dependencies) const
685{
686 OSL_ASSERT(do { if (true && (!(dependencies != 0 && m_polymorphicUnoType
.kind != PolymorphicUnoType::KIND_NONE))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "688" ": "), "OSL_ASSERT: %s", "dependencies != 0 && m_polymorphicUnoType.kind != PolymorphicUnoType::KIND_NONE"
); } } while (false)
687 dependencies != 0do { if (true && (!(dependencies != 0 && m_polymorphicUnoType
.kind != PolymorphicUnoType::KIND_NONE))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "688" ": "), "OSL_ASSERT: %s", "dependencies != 0 && m_polymorphicUnoType.kind != PolymorphicUnoType::KIND_NONE"
); } } while (false)
688 && m_polymorphicUnoType.kind != PolymorphicUnoType::KIND_NONE)do { if (true && (!(dependencies != 0 && m_polymorphicUnoType
.kind != PolymorphicUnoType::KIND_NONE))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "688" ": "), "OSL_ASSERT: %s", "dependencies != 0 && m_polymorphicUnoType.kind != PolymorphicUnoType::KIND_NONE"
); } } while (false)
;
689 code.instrNew(
690 rtl::OString(RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Type")(&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
));
691 code.instrDup();
692 code.loadStringConstant(m_polymorphicUnoType.name);
693 if (m_polymorphicUnoType.kind == PolymorphicUnoType::KIND_STRUCT) {
694 code.instrGetstatic(
695 rtl::OString(
696 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/TypeClass")(&("com/sun/star/uno/TypeClass")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/TypeClass") / sizeof (("com/sun/star/uno/TypeClass"
)[0]))-1)
),
697 rtl::OString(RTL_CONSTASCII_STRINGPARAM("STRUCT")(&("STRUCT")[0]), ((sal_Int32)(sizeof ("STRUCT") / sizeof
(("STRUCT")[0]))-1)
),
698 rtl::OString(
699 RTL_CONSTASCII_STRINGPARAM("Lcom/sun/star/uno/TypeClass;")(&("Lcom/sun/star/uno/TypeClass;")[0]), ((sal_Int32)(sizeof
("Lcom/sun/star/uno/TypeClass;") / sizeof (("Lcom/sun/star/uno/TypeClass;"
)[0]))-1)
));
700 } else {
701 code.instrGetstatic(
702 rtl::OString(
703 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/TypeClass")(&("com/sun/star/uno/TypeClass")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/TypeClass") / sizeof (("com/sun/star/uno/TypeClass"
)[0]))-1)
),
704 rtl::OString(RTL_CONSTASCII_STRINGPARAM("SEQUENCE")(&("SEQUENCE")[0]), ((sal_Int32)(sizeof ("SEQUENCE") / sizeof
(("SEQUENCE")[0]))-1)
),
705 rtl::OString(
706 RTL_CONSTASCII_STRINGPARAM("Lcom/sun/star/uno/TypeClass;")(&("Lcom/sun/star/uno/TypeClass;")[0]), ((sal_Int32)(sizeof
("Lcom/sun/star/uno/TypeClass;") / sizeof (("Lcom/sun/star/uno/TypeClass;"
)[0]))-1)
));
707 }
708 dependencies->insert(
709 rtl::OString(RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/TypeClass")(&("com/sun/star/uno/TypeClass")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/TypeClass") / sizeof (("com/sun/star/uno/TypeClass"
)[0]))-1)
));
710 code.instrInvokespecial(
711 rtl::OString(RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Type")(&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
),
712 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
713 rtl::OString(
714 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V")[0
]), ((sal_Int32)(sizeof ("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"
) / sizeof (("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"
)[0]))-1)
715 "(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V")(&("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V")[0
]), ((sal_Int32)(sizeof ("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"
) / sizeof (("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"
)[0]))-1)
));
716}
717
718void writeClassFile(
719 JavaOptions /*TODO const*/ & options, rtl::OString const & type,
720 ClassFile const & classFile)
721{
722 rtl::OString path;
723 if (options.isValid(rtl::OString(RTL_CONSTASCII_STRINGPARAM("-O")(&("-O")[0]), ((sal_Int32)(sizeof ("-O") / sizeof (("-O")
[0]))-1)
))) {
724 path = options.getOption(
725 rtl::OString(RTL_CONSTASCII_STRINGPARAM("-O")(&("-O")[0]), ((sal_Int32)(sizeof ("-O") / sizeof (("-O")
[0]))-1)
));
726 }
727 rtl::OString filename(
728 createFileNameFromType(
729 path, type, rtl::OString(RTL_CONSTASCII_STRINGPARAM(".class")(&(".class")[0]), ((sal_Int32)(sizeof (".class") / sizeof
((".class")[0]))-1)
)));
730 bool check = false;
731 if (fileExists(filename)) {
732 if (options.isValid(rtl::OString(RTL_CONSTASCII_STRINGPARAM("-G")(&("-G")[0]), ((sal_Int32)(sizeof ("-G") / sizeof (("-G")
[0]))-1)
))) {
733 return;
734 }
735 check = options.isValid(
736 rtl::OString(RTL_CONSTASCII_STRINGPARAM("-Gc")(&("-Gc")[0]), ((sal_Int32)(sizeof ("-Gc") / sizeof (("-Gc"
)[0]))-1)
));
737 }
738 FileStream tempfile;
739 tempfile.createTempFile(getTempDir(filename));
740 if (!tempfile.isValid()) {
741 throw CannotDumpException(
742 rtl::OString(
743 RTL_CONSTASCII_STRINGPARAM("Cannot create temporary file for ")(&("Cannot create temporary file for ")[0]), ((sal_Int32)
(sizeof ("Cannot create temporary file for ") / sizeof (("Cannot create temporary file for "
)[0]))-1)
)
744 + filename);
745 }
746 rtl::OString tempname(tempfile.getName());
747 try {
748 classFile.write(tempfile);
749 } catch (...) {
750 // Remove existing file for consistency:
751 if (fileExists(filename)) {
752 removeTypeFile(filename);
753 }
754 tempfile.close();
755 removeTypeFile(tempname);
756 throw;
757 }
758 tempfile.close();
759 if (!makeValidTypeFile(filename, tempname, check)) {
760 rtl::OStringBuffer msg;
761 msg.append(RTL_CONSTASCII_STRINGPARAM("Cannot create ")(&("Cannot create ")[0]), ((sal_Int32)(sizeof ("Cannot create "
) / sizeof (("Cannot create ")[0]))-1)
);
762 msg.append(filename);
763 msg.append(RTL_CONSTASCII_STRINGPARAM(" from temporary file ")(&(" from temporary file ")[0]), ((sal_Int32)(sizeof (" from temporary file "
) / sizeof ((" from temporary file ")[0]))-1)
);
764 msg.append(tempname);
765 throw CannotDumpException(msg.makeStringAndClear());
766 }
767}
768
769void addTypeInfo(
770 rtl::OString const & className, std::vector< TypeInfo > const & typeInfo,
771 Dependencies * dependencies, ClassFile * classFile)
772{
773 OSL_ASSERT(dependencies != 0 && classFile != 0)do { if (true && (!(dependencies != 0 && classFile
!= 0))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), (
"legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "773" ": "), "OSL_ASSERT: %s", "dependencies != 0 && classFile != 0"
); } } while (false)
;
774 std::vector< TypeInfo >::size_type typeInfos = typeInfo.size();
775 if (typeInfos > SAL_MAX_INT32((sal_Int32) 0x7FFFFFFF)) {
776 throw CannotDumpException(
777 rtl::OString(
778 RTL_CONSTASCII_STRINGPARAM((&("UNOTYPEINFO array too big for Java class file format"
)[0]), ((sal_Int32)(sizeof ("UNOTYPEINFO array too big for Java class file format"
) / sizeof (("UNOTYPEINFO array too big for Java class file format"
)[0]))-1)
779 "UNOTYPEINFO array too big for Java class file format")(&("UNOTYPEINFO array too big for Java class file format"
)[0]), ((sal_Int32)(sizeof ("UNOTYPEINFO array too big for Java class file format"
) / sizeof (("UNOTYPEINFO array too big for Java class file format"
)[0]))-1)
));
780 }
781 if (typeInfos != 0) {
782 classFile->addField(
783 static_cast< ClassFile::AccessFlags >(
784 ClassFile::ACC_PUBLIC | ClassFile::ACC_STATIC
785 | ClassFile::ACC_FINAL),
786 rtl::OString(RTL_CONSTASCII_STRINGPARAM("UNOTYPEINFO")(&("UNOTYPEINFO")[0]), ((sal_Int32)(sizeof ("UNOTYPEINFO"
) / sizeof (("UNOTYPEINFO")[0]))-1)
),
787 rtl::OString(
788 RTL_CONSTASCII_STRINGPARAM((&("[Lcom/sun/star/lib/uno/typeinfo/TypeInfo;")[0]), ((sal_Int32
)(sizeof ("[Lcom/sun/star/lib/uno/typeinfo/TypeInfo;") / sizeof
(("[Lcom/sun/star/lib/uno/typeinfo/TypeInfo;")[0]))-1)
789 "[Lcom/sun/star/lib/uno/typeinfo/TypeInfo;")(&("[Lcom/sun/star/lib/uno/typeinfo/TypeInfo;")[0]), ((sal_Int32
)(sizeof ("[Lcom/sun/star/lib/uno/typeinfo/TypeInfo;") / sizeof
(("[Lcom/sun/star/lib/uno/typeinfo/TypeInfo;")[0]))-1)
),
790 0, rtl::OString());
791 SAL_WNODEPRECATED_DECLARATIONS_PUSH
792 std::auto_ptr< ClassFile::Code > code(classFile->newCode());
793 SAL_WNODEPRECATED_DECLARATIONS_POP
794 code->loadIntegerConstant(static_cast< sal_Int32 >(typeInfos));
795 code->instrAnewarray(
796 rtl::OString(
797 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/lib/uno/typeinfo/TypeInfo")[0]), ((sal_Int32
)(sizeof ("com/sun/star/lib/uno/typeinfo/TypeInfo") / sizeof (
("com/sun/star/lib/uno/typeinfo/TypeInfo")[0]))-1)
798 "com/sun/star/lib/uno/typeinfo/TypeInfo")(&("com/sun/star/lib/uno/typeinfo/TypeInfo")[0]), ((sal_Int32
)(sizeof ("com/sun/star/lib/uno/typeinfo/TypeInfo") / sizeof (
("com/sun/star/lib/uno/typeinfo/TypeInfo")[0]))-1)
));
799 sal_Int32 index = 0;
800 sal_uInt16 stack = 0;
801 for (std::vector< TypeInfo >::const_iterator i(typeInfo.begin());
802 i != typeInfo.end(); ++i)
803 {
804 code->instrDup();
805 code->loadIntegerConstant(index++);
806 stack = std::max(stack, i->generateCode(*code, dependencies));
807 code->instrAastore();
808 }
809 code->instrPutstatic(
810 className, rtl::OString(RTL_CONSTASCII_STRINGPARAM("UNOTYPEINFO")(&("UNOTYPEINFO")[0]), ((sal_Int32)(sizeof ("UNOTYPEINFO"
) / sizeof (("UNOTYPEINFO")[0]))-1)
),
811 rtl::OString(
812 RTL_CONSTASCII_STRINGPARAM((&("[Lcom/sun/star/lib/uno/typeinfo/TypeInfo;")[0]), ((sal_Int32
)(sizeof ("[Lcom/sun/star/lib/uno/typeinfo/TypeInfo;") / sizeof
(("[Lcom/sun/star/lib/uno/typeinfo/TypeInfo;")[0]))-1)
813 "[Lcom/sun/star/lib/uno/typeinfo/TypeInfo;")(&("[Lcom/sun/star/lib/uno/typeinfo/TypeInfo;")[0]), ((sal_Int32
)(sizeof ("[Lcom/sun/star/lib/uno/typeinfo/TypeInfo;") / sizeof
(("[Lcom/sun/star/lib/uno/typeinfo/TypeInfo;")[0]))-1)
));
814 code->instrReturn();
815 if (stack > SAL_MAX_UINT16((sal_uInt16) 0xFFFF) - 4) {
816 throw CannotDumpException(
817 rtl::OString(
818 RTL_CONSTASCII_STRINGPARAM((&("Stack too big for Java class file format")[0]), ((sal_Int32
)(sizeof ("Stack too big for Java class file format") / sizeof
(("Stack too big for Java class file format")[0]))-1)
819 "Stack too big for Java class file format")(&("Stack too big for Java class file format")[0]), ((sal_Int32
)(sizeof ("Stack too big for Java class file format") / sizeof
(("Stack too big for Java class file format")[0]))-1)
));
820 }
821 code->setMaxStackAndLocals(static_cast< sal_uInt16 >(stack + 4), 0);
822 classFile->addMethod(
823 static_cast< ClassFile::AccessFlags >(
824 ClassFile::ACC_PRIVATE | ClassFile::ACC_STATIC),
825 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<clinit>")(&("<clinit>")[0]), ((sal_Int32)(sizeof ("<clinit>"
) / sizeof (("<clinit>")[0]))-1)
),
826 rtl::OString(RTL_CONSTASCII_STRINGPARAM("()V")(&("()V")[0]), ((sal_Int32)(sizeof ("()V") / sizeof (("()V"
)[0]))-1)
), code.get(),
827 std::vector< rtl::OString >(), rtl::OString());
828 }
829}
830
831typedef void (* handleUnoTypeRegistryEntityFunction)(
832 TypeManager const & manager, JavaOptions /*TODO const*/ & options,
833 typereg::Reader const & reader, Dependencies * dependencies);
834
835void handleEnumType(
836 SAL_UNUSED_PARAMETER__attribute__ ((unused)) TypeManager const &,
837 JavaOptions /*TODO const*/ & options, typereg::Reader const & reader,
838 SAL_UNUSED_PARAMETER__attribute__ ((unused)) Dependencies *)
839{
840 sal_uInt16 fields = reader.getFieldCount();
841 if (fields == 0 || reader.getSuperTypeCount() != 0
842 || reader.getMethodCount() != 0 || reader.getReferenceCount() != 0)
843 {
844 throw CannotDumpException(
845 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
));
846 //TODO
847 }
848 rtl::OString className(codemaker::convertString(reader.getTypeName()));
849 SAL_WNODEPRECATED_DECLARATIONS_PUSH
850 std::auto_ptr< ClassFile > cf(
851 new ClassFile(
852 static_cast< ClassFile::AccessFlags >(
853 ClassFile::ACC_PUBLIC | ClassFile::ACC_FINAL
854 | ClassFile::ACC_SUPER),
855 className,
856 rtl::OString(RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Enum")(&("com/sun/star/uno/Enum")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Enum"
) / sizeof (("com/sun/star/uno/Enum")[0]))-1)
),
857 rtl::OString()));
858 SAL_WNODEPRECATED_DECLARATIONS_POP
859 rtl::OStringBuffer buf;
860 buf.append('L');
861 buf.append(className);
862 buf.append(';');
863 rtl::OString classDescriptor(buf.makeStringAndClear());
864 {for (sal_uInt16 i = 0; i < fields; ++i) {
865 RTConstValue fieldValue(reader.getFieldValue(i));
866 if (fieldValue.m_type != RT_TYPE_INT32
867 || reader.getFieldFlags(i) != RT_ACCESS_CONST0x0800
868 || reader.getFieldTypeName(i).getLength() != 0)
869 {
870 throw CannotDumpException(
871 rtl::OString(
872 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
873 }
874 rtl::OString fieldName(
875 codemaker::convertString(reader.getFieldName(i)));
876 cf->addField(
877 static_cast< ClassFile::AccessFlags >(
878 ClassFile::ACC_PUBLIC | ClassFile::ACC_STATIC
879 | ClassFile::ACC_FINAL),
880 fieldName, classDescriptor, 0, rtl::OString());
881 cf->addField(
882 static_cast< ClassFile::AccessFlags >(
883 ClassFile::ACC_PUBLIC | ClassFile::ACC_STATIC
884 | ClassFile::ACC_FINAL),
885 fieldName + rtl::OString(RTL_CONSTASCII_STRINGPARAM("_value")(&("_value")[0]), ((sal_Int32)(sizeof ("_value") / sizeof
(("_value")[0]))-1)
),
886 rtl::OString(RTL_CONSTASCII_STRINGPARAM("I")(&("I")[0]), ((sal_Int32)(sizeof ("I") / sizeof (("I")[0]
))-1)
),
887 cf->addIntegerInfo(fieldValue.m_value.aLong), rtl::OString());
888 }}
889 SAL_WNODEPRECATED_DECLARATIONS_PUSH
890 std::auto_ptr< ClassFile::Code > code(cf->newCode());
891 SAL_WNODEPRECATED_DECLARATIONS_POP
892 code->loadLocalReference(0);
893 code->loadLocalInteger(1);
894 code->instrInvokespecial(
895 rtl::OString(RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Enum")(&("com/sun/star/uno/Enum")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Enum"
) / sizeof (("com/sun/star/uno/Enum")[0]))-1)
),
896 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
897 rtl::OString(RTL_CONSTASCII_STRINGPARAM("(I)V")(&("(I)V")[0]), ((sal_Int32)(sizeof ("(I)V") / sizeof (("(I)V"
)[0]))-1)
));
898 code->instrReturn();
899 code->setMaxStackAndLocals(2, 2);
900 cf->addMethod(
901 ClassFile::ACC_PRIVATE,
902 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
903 rtl::OString(RTL_CONSTASCII_STRINGPARAM("(I)V")(&("(I)V")[0]), ((sal_Int32)(sizeof ("(I)V") / sizeof (("(I)V"
)[0]))-1)
), code.get(),
904 std::vector< rtl::OString >(), rtl::OString());
905 code.reset(cf->newCode());
906 code->instrGetstatic(
907 className,
908 codemaker::convertString(reader.getFieldName(0)), classDescriptor);
909 code->instrAreturn();
910 code->setMaxStackAndLocals(1, 0);
911 cf->addMethod(
912 static_cast< ClassFile::AccessFlags >(
913 ClassFile::ACC_PUBLIC | ClassFile::ACC_STATIC),
914 rtl::OString(RTL_CONSTASCII_STRINGPARAM("getDefault")(&("getDefault")[0]), ((sal_Int32)(sizeof ("getDefault") /
sizeof (("getDefault")[0]))-1)
),
915 rtl::OString(RTL_CONSTASCII_STRINGPARAM("()")(&("()")[0]), ((sal_Int32)(sizeof ("()") / sizeof (("()")
[0]))-1)
) + classDescriptor,
916 code.get(), std::vector< rtl::OString >(), rtl::OString());
917 code.reset(cf->newCode());
918 code->loadLocalInteger(0);
919 std::map< sal_Int32, rtl::OString > map;
920 sal_Int32 min = SAL_MAX_INT32((sal_Int32) 0x7FFFFFFF);
921 sal_Int32 max = SAL_MIN_INT32((sal_Int32) (-0x7FFFFFFF - 1));
922 {for (sal_uInt16 i = 0; i < fields; ++i) {
923 sal_Int32 value = reader.getFieldValue(i).m_value.aLong;
924 min = std::min(min, value);
925 max = std::max(max, value);
926 map.insert(
927 std::map< sal_Int32, rtl::OString >::value_type(
928 value, codemaker::convertString(reader.getFieldName(i))));
929 }}
930 sal_uInt64 size = static_cast< sal_uInt64 >(map.size());
931 if ((static_cast< sal_uInt64 >(max) - static_cast< sal_uInt64 >(min)
932 <= 2 * size)
933 || size > SAL_MAX_INT32((sal_Int32) 0x7FFFFFFF))
934 {
935 SAL_WNODEPRECATED_DECLARATIONS_PUSH
936 std::auto_ptr< ClassFile::Code > defCode(cf->newCode());
937 SAL_WNODEPRECATED_DECLARATIONS_POP
938 defCode->instrAconstNull();
939 defCode->instrAreturn();
940 std::list< ClassFile::Code * > blocks;
941 //FIXME: pointers contained in blocks may leak
942 sal_Int32 last = SAL_MAX_INT32((sal_Int32) 0x7FFFFFFF);
943 for (std::map< sal_Int32, rtl::OString >::iterator i(map.begin());
944 i != map.end(); ++i)
945 {
946 sal_Int32 value = i->first;
947 if (last != SAL_MAX_INT32((sal_Int32) 0x7FFFFFFF)) {
948 for (sal_Int32 j = last + 1; j < value; ++j) {
949 blocks.push_back(0);
950 }
951 }
952 last = value;
953 SAL_WNODEPRECATED_DECLARATIONS_PUSH
954 std::auto_ptr< ClassFile::Code > blockCode(cf->newCode());
955 SAL_WNODEPRECATED_DECLARATIONS_POP
956 blockCode->instrGetstatic(className, i->second, classDescriptor);
957 blockCode->instrAreturn();
958 blocks.push_back(blockCode.get());
959 blockCode.release();
960 }
961 code->instrTableswitch(defCode.get(), min, blocks);
962 {for (std::list< ClassFile::Code * >::iterator i(blocks.begin());
963 i != blocks.end(); ++i)
964 {
965 delete *i;
966 }}
967 } else{
968 SAL_WNODEPRECATED_DECLARATIONS_PUSH
969 std::auto_ptr< ClassFile::Code > defCode(cf->newCode());
970 SAL_WNODEPRECATED_DECLARATIONS_POP
971 defCode->instrAconstNull();
972 defCode->instrAreturn();
973 std::list< std::pair< sal_Int32, ClassFile::Code * > > blocks;
974 //FIXME: pointers contained in blocks may leak
975 for (std::map< sal_Int32, rtl::OString >::iterator i(map.begin());
976 i != map.end(); ++i)
977 {
978 SAL_WNODEPRECATED_DECLARATIONS_PUSH
979 std::auto_ptr< ClassFile::Code > blockCode(cf->newCode());
980 SAL_WNODEPRECATED_DECLARATIONS_POP
981 blockCode->instrGetstatic(className, i->second, classDescriptor);
982 blockCode->instrAreturn();
983 blocks.push_back(std::make_pair(i->first, blockCode.get()));
984 blockCode.release();
985 }
986 code->instrLookupswitch(defCode.get(), blocks);
987 {for (std::list< std::pair< sal_Int32, ClassFile::Code * > >::iterator
988 i(blocks.begin());
989 i != blocks.end(); ++i)
990 {
991 delete i->second;
992 }}
993 }
994 code->setMaxStackAndLocals(1, 1);
995 cf->addMethod(
996 static_cast< ClassFile::AccessFlags >(
997 ClassFile::ACC_PUBLIC | ClassFile::ACC_STATIC),
998 rtl::OString(RTL_CONSTASCII_STRINGPARAM("fromInt")(&("fromInt")[0]), ((sal_Int32)(sizeof ("fromInt") / sizeof
(("fromInt")[0]))-1)
),
999 rtl::OString(RTL_CONSTASCII_STRINGPARAM("(I)")(&("(I)")[0]), ((sal_Int32)(sizeof ("(I)") / sizeof (("(I)"
)[0]))-1)
) + classDescriptor,
1000 code.get(), std::vector< rtl::OString >(), rtl::OString());
1001 code.reset(cf->newCode());
1002 {for (sal_uInt16 i = 0; i < fields; ++i) {
1003 code->instrNew(className);
1004 code->instrDup();
1005 code->loadIntegerConstant(reader.getFieldValue(i).m_value.aLong);
1006 code->instrInvokespecial(
1007 className, rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1008 rtl::OString(RTL_CONSTASCII_STRINGPARAM("(I)V")(&("(I)V")[0]), ((sal_Int32)(sizeof ("(I)V") / sizeof (("(I)V"
)[0]))-1)
));
1009 code->instrPutstatic(
1010 className,
1011 codemaker::convertString(reader.getFieldName(i)),
1012 classDescriptor);
1013 }}
1014 code->instrReturn();
1015 code->setMaxStackAndLocals(3, 0);
1016 cf->addMethod(
1017 static_cast< ClassFile::AccessFlags >(
1018 ClassFile::ACC_PRIVATE | ClassFile::ACC_STATIC),
1019 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<clinit>")(&("<clinit>")[0]), ((sal_Int32)(sizeof ("<clinit>"
) / sizeof (("<clinit>")[0]))-1)
),
1020 rtl::OString(RTL_CONSTASCII_STRINGPARAM("()V")(&("()V")[0]), ((sal_Int32)(sizeof ("()V") / sizeof (("()V"
)[0]))-1)
), code.get(),
1021 std::vector< rtl::OString >(), rtl::OString());
1022 writeClassFile(options, className, *cf.get());
1023}
1024
1025void addField(
1026 TypeManager const & manager, Dependencies * dependencies,
1027 ClassFile * classFile, std::vector< TypeInfo > * typeInfo,
1028 sal_Int32 typeParameterIndex, rtl::OString const & type,
1029 rtl::OString const & name, sal_Int32 index)
1030{
1031 OSL_ASSERT(dependencies != 0 && classFile != 0 && typeInfo != 0)do { if (true && (!(dependencies != 0 && classFile
!= 0 && typeInfo != 0))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN
), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "1031" ": "), "OSL_ASSERT: %s", "dependencies != 0 && classFile != 0 && typeInfo != 0"
); } } while (false)
;
1032 rtl::OString descriptor;
1033 rtl::OString signature;
1034 SpecialType specialType;
1035 PolymorphicUnoType polymorphicUnoType;
1036 if (typeParameterIndex >= 0) {
1037 descriptor = rtl::OString(
1038 RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Object;")(&("Ljava/lang/Object;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Object;"
) / sizeof (("Ljava/lang/Object;")[0]))-1)
);
1039 rtl::OStringBuffer buf;
1040 buf.append('T');
1041 buf.append(type);
1042 buf.append(';');
1043 signature = buf.makeStringAndClear();
1044 specialType = SPECIAL_TYPE_NONE; //TODO: SPECIAL_TYPE_TYPE_PARAMETER?
1045 } else {
1046 specialType = getFieldDescriptor(
1047 manager, dependencies, type, &descriptor, &signature,
1048 &polymorphicUnoType);
1049 }
1050 classFile->addField(ClassFile::ACC_PUBLIC, name, descriptor, 0, signature);
1051 typeInfo->push_back(
1052 TypeInfo(
1053 name, specialType, index, polymorphicUnoType, typeParameterIndex));
1054}
1055
1056sal_uInt16 addFieldInit(
1057 TypeManager const & manager, rtl::OString const & className,
1058 rtl::OString const & fieldName, bool typeParameter,
1059 rtl::OString const & fieldType, Dependencies * dependencies,
1060 ClassFile::Code * code)
1061{
1062 OSL_ASSERT(dependencies != 0 && code != 0)do { if (true && (!(dependencies != 0 && code
!= 0))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), (
"legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "1062" ": "), "OSL_ASSERT: %s", "dependencies != 0 && code != 0"
); } } while (false)
;
1063 if (typeParameter) {
1064 return 0;
1065 } else {
1066 RTTypeClass typeClass;
1067 rtl::OString nucleus;
1068 sal_Int32 rank;
1069 std::vector< rtl::OString > args;
1070 codemaker::UnoType::Sort sort = codemaker::decomposeAndResolve(
1071 manager, fieldType, true, false, false, &typeClass, &nucleus, &rank,
1072 &args);
1073 if (rank == 0) {
1074 switch (sort) {
1075 case codemaker::UnoType::SORT_STRING:
1076 code->loadLocalReference(0);
1077 code->loadStringConstant(rtl::OString());
1078 code->instrPutfield(
1079 className, fieldName,
1080 rtl::OString(
1081 RTL_CONSTASCII_STRINGPARAM("Ljava/lang/String;")(&("Ljava/lang/String;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/String;"
) / sizeof (("Ljava/lang/String;")[0]))-1)
));
1082 return 2;
1083
1084 case codemaker::UnoType::SORT_TYPE:
1085 code->loadLocalReference(0);
1086 code->instrGetstatic(
1087 rtl::OString(
1088 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Type")(&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
),
1089 rtl::OString(RTL_CONSTASCII_STRINGPARAM("VOID")(&("VOID")[0]), ((sal_Int32)(sizeof ("VOID") / sizeof (("VOID"
)[0]))-1)
),
1090 rtl::OString(
1091 RTL_CONSTASCII_STRINGPARAM("Lcom/sun/star/uno/Type;")(&("Lcom/sun/star/uno/Type;")[0]), ((sal_Int32)(sizeof ("Lcom/sun/star/uno/Type;"
) / sizeof (("Lcom/sun/star/uno/Type;")[0]))-1)
));
1092 code->instrPutfield(
1093 className, fieldName,
1094 rtl::OString(
1095 RTL_CONSTASCII_STRINGPARAM("Lcom/sun/star/uno/Type;")(&("Lcom/sun/star/uno/Type;")[0]), ((sal_Int32)(sizeof ("Lcom/sun/star/uno/Type;"
) / sizeof (("Lcom/sun/star/uno/Type;")[0]))-1)
));
1096 return 2;
1097
1098 case codemaker::UnoType::SORT_ANY:
1099 code->loadLocalReference(0);
1100 code->instrGetstatic(
1101 rtl::OString(
1102 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Any")(&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
),
1103 rtl::OString(RTL_CONSTASCII_STRINGPARAM("VOID")(&("VOID")[0]), ((sal_Int32)(sizeof ("VOID") / sizeof (("VOID"
)[0]))-1)
),
1104 rtl::OString(
1105 RTL_CONSTASCII_STRINGPARAM("Lcom/sun/star/uno/Any;")(&("Lcom/sun/star/uno/Any;")[0]), ((sal_Int32)(sizeof ("Lcom/sun/star/uno/Any;"
) / sizeof (("Lcom/sun/star/uno/Any;")[0]))-1)
));
1106 code->instrPutfield(
1107 className, fieldName,
1108 rtl::OString(
1109 RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Object;")(&("Ljava/lang/Object;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Object;"
) / sizeof (("Ljava/lang/Object;")[0]))-1)
));
1110 return 2;
1111
1112 case codemaker::UnoType::SORT_COMPLEX:
1113 switch (typeClass) {
1114 case RT_TYPE_ENUM:
1115 {
1116 code->loadLocalReference(0);
1117 typereg::Reader reader(manager.getTypeReader(nucleus));
1118 if (reader.getFieldCount() == 0) {
1119 throw CannotDumpException(
1120 rtl::OString(
1121 RTL_CONSTASCII_STRINGPARAM((&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
1122 "Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
1123 }
1124 rtl::OStringBuffer descBuf;
1125 translateUnoTypeToDescriptor(
1126 manager, sort, typeClass, nucleus, 0,
1127 std::vector< rtl::OString >(), false, false,
1128 dependencies, &descBuf, 0, 0, 0);
1129 rtl::OString desc(descBuf.makeStringAndClear());
1130 code->instrGetstatic(
1131 nucleus,
1132 codemaker::convertString(reader.getFieldName(0)),
1133 desc);
1134 code->instrPutfield(className, fieldName, desc);
1135 return 2;
1136 }
1137
1138 case RT_TYPE_STRUCT:
1139 {
1140 code->loadLocalReference(0);
1141 code->instrNew(nucleus);
1142 code->instrDup();
1143 code->instrInvokespecial(
1144 nucleus,
1145 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1146 rtl::OString(RTL_CONSTASCII_STRINGPARAM("()V")(&("()V")[0]), ((sal_Int32)(sizeof ("()V") / sizeof (("()V"
)[0]))-1)
));
1147 rtl::OStringBuffer desc;
1148 translateUnoTypeToDescriptor(
1149 manager, sort, typeClass, nucleus, 0,
1150 std::vector< rtl::OString >(), false, false,
1151 dependencies, &desc, 0, 0, 0);
1152 code->instrPutfield(
1153 className, fieldName, desc.makeStringAndClear());
1154 return 3;
1155 }
1156
1157 default:
1158 OSL_ASSERT(typeClass == RT_TYPE_INTERFACE)do { if (true && (!(typeClass == RT_TYPE_INTERFACE)))
{ sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"
), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "1158" ": "), "OSL_ASSERT: %s", "typeClass == RT_TYPE_INTERFACE"
); } } while (false)
;
1159 return 0;
1160 }
1161
1162 default:
1163 return 0;
1164 }
1165 } else {
1166 code->loadLocalReference(0);
1167 code->loadIntegerConstant(0);
1168 if (rank == 1) {
1169 if (sort >= codemaker::UnoType::SORT_BOOLEAN
1170 && sort <= codemaker::UnoType::SORT_CHAR)
1171 {
1172 code->instrNewarray(sort);
1173 } else {
1174 code->instrAnewarray(
1175 codemaker::java::translateUnoToJavaType(sort, typeClass,
1176 nucleus, 0));
1177 }
1178 } else {
1179 rtl::OStringBuffer desc;
1180 translateUnoTypeToDescriptor(
1181 manager, sort, typeClass, nucleus, rank - 1,
1182 std::vector< rtl::OString >(), false, false, dependencies,
1183 &desc, 0, 0, 0);
1184 code->instrAnewarray(desc.makeStringAndClear());
1185 }
1186 rtl::OStringBuffer desc;
1187 translateUnoTypeToDescriptor(
1188 manager, sort, typeClass, nucleus, rank,
1189 std::vector< rtl::OString >(), false, false, dependencies,
1190 &desc, 0, 0, 0);
1191 code->instrPutfield(
1192 className, fieldName, desc.makeStringAndClear());
1193 return 2;
1194 }
1195 }
1196}
1197
1198sal_uInt16 addLoadLocal(
1199 TypeManager const & manager, ClassFile::Code * code, sal_uInt16 * index,
1200 bool typeParameter, rtl::OString const & type, bool any,
1201 Dependencies * dependencies)
1202{
1203 OSL_ASSERT(do { if (true && (!(code != 0 && index != 0 &&
!(typeParameter && any) && dependencies != 0
))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"
), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "1205" ": "), "OSL_ASSERT: %s", "code != 0 && index != 0 && !(typeParameter && any) && dependencies != 0"
); } } while (false)
7
Within the expansion of the macro 'OSL_ASSERT':
a
Assuming 'code' is equal to null
b
Assuming pointer value is null
1204 code != 0 && index != 0 && !(typeParameter && any)do { if (true && (!(code != 0 && index != 0 &&
!(typeParameter && any) && dependencies != 0
))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"
), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "1205" ": "), "OSL_ASSERT: %s", "code != 0 && index != 0 && !(typeParameter && any) && dependencies != 0"
); } } while (false)
1205 && dependencies != 0)do { if (true && (!(code != 0 && index != 0 &&
!(typeParameter && any) && dependencies != 0
))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"
), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "1205" ": "), "OSL_ASSERT: %s", "code != 0 && index != 0 && !(typeParameter && any) && dependencies != 0"
); } } while (false)
;
1206 sal_uInt16 stack = 1;
1207 sal_uInt16 size = 1;
1208 if (typeParameter) {
8
Taking false branch
1209 code->loadLocalReference(*index);
1210 stack = size = 1;
1211 } else {
1212 RTTypeClass typeClass;
1213 rtl::OString nucleus;
1214 sal_Int32 rank;
1215 std::vector< rtl::OString > args;
1216 codemaker::UnoType::Sort sort = codemaker::decomposeAndResolve(
1217 manager, type, true, false, false, &typeClass, &nucleus, &rank, &args);
1218 if (rank == 0) {
9
Taking true branch
1219 switch (sort) {
10
Control jumps to 'case SORT_COMPLEX:' at line 1513
1220 case codemaker::UnoType::SORT_BOOLEAN:
1221 if (any) {
1222 code->instrNew(
1223 rtl::OString(
1224 RTL_CONSTASCII_STRINGPARAM("java/lang/Boolean")(&("java/lang/Boolean")[0]), ((sal_Int32)(sizeof ("java/lang/Boolean"
) / sizeof (("java/lang/Boolean")[0]))-1)
));
1225 code->instrDup();
1226 code->loadLocalInteger(*index);
1227 code->instrInvokespecial(
1228 rtl::OString(
1229 RTL_CONSTASCII_STRINGPARAM("java/lang/Boolean")(&("java/lang/Boolean")[0]), ((sal_Int32)(sizeof ("java/lang/Boolean"
) / sizeof (("java/lang/Boolean")[0]))-1)
),
1230 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1231 rtl::OString(RTL_CONSTASCII_STRINGPARAM("(Z)V")(&("(Z)V")[0]), ((sal_Int32)(sizeof ("(Z)V") / sizeof (("(Z)V"
)[0]))-1)
));
1232 stack = 3;
1233 } else {
1234 code->loadLocalInteger(*index);
1235 stack = 1;
1236 }
1237 size = 1;
1238 break;
1239
1240 case codemaker::UnoType::SORT_BYTE:
1241 if (any) {
1242 code->instrNew(
1243 rtl::OString(
1244 RTL_CONSTASCII_STRINGPARAM("java/lang/Byte")(&("java/lang/Byte")[0]), ((sal_Int32)(sizeof ("java/lang/Byte"
) / sizeof (("java/lang/Byte")[0]))-1)
));
1245 code->instrDup();
1246 code->loadLocalInteger(*index);
1247 code->instrInvokespecial(
1248 rtl::OString(
1249 RTL_CONSTASCII_STRINGPARAM("java/lang/Byte")(&("java/lang/Byte")[0]), ((sal_Int32)(sizeof ("java/lang/Byte"
) / sizeof (("java/lang/Byte")[0]))-1)
),
1250 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1251 rtl::OString(RTL_CONSTASCII_STRINGPARAM("(B)V")(&("(B)V")[0]), ((sal_Int32)(sizeof ("(B)V") / sizeof (("(B)V"
)[0]))-1)
));
1252 stack = 3;
1253 } else {
1254 code->loadLocalInteger(*index);
1255 stack = 1;
1256 }
1257 size = 1;
1258 break;
1259
1260 case codemaker::UnoType::SORT_SHORT:
1261 if (any) {
1262 code->instrNew(
1263 rtl::OString(
1264 RTL_CONSTASCII_STRINGPARAM("java/lang/Short")(&("java/lang/Short")[0]), ((sal_Int32)(sizeof ("java/lang/Short"
) / sizeof (("java/lang/Short")[0]))-1)
));
1265 code->instrDup();
1266 code->loadLocalInteger(*index);
1267 code->instrInvokespecial(
1268 rtl::OString(
1269 RTL_CONSTASCII_STRINGPARAM("java/lang/Short")(&("java/lang/Short")[0]), ((sal_Int32)(sizeof ("java/lang/Short"
) / sizeof (("java/lang/Short")[0]))-1)
),
1270 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1271 rtl::OString(RTL_CONSTASCII_STRINGPARAM("(S)V")(&("(S)V")[0]), ((sal_Int32)(sizeof ("(S)V") / sizeof (("(S)V"
)[0]))-1)
));
1272 stack = 3;
1273 } else {
1274 code->loadLocalInteger(*index);
1275 stack = 1;
1276 }
1277 size = 1;
1278 break;
1279
1280 case codemaker::UnoType::SORT_UNSIGNED_SHORT:
1281 if (any) {
1282 code->instrNew(
1283 rtl::OString(
1284 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
1285 "com/sun/star/uno/Any")(&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
));
1286 code->instrDup();
1287 code->instrGetstatic(
1288 rtl::OString(
1289 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
1290 "com/sun/star/uno/Type")(&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
),
1291 rtl::OString(
1292 RTL_CONSTASCII_STRINGPARAM("UNSIGNED_SHORT")(&("UNSIGNED_SHORT")[0]), ((sal_Int32)(sizeof ("UNSIGNED_SHORT"
) / sizeof (("UNSIGNED_SHORT")[0]))-1)
),
1293 rtl::OString(
1294 RTL_CONSTASCII_STRINGPARAM((&("Lcom/sun/star/uno/Type;")[0]), ((sal_Int32)(sizeof ("Lcom/sun/star/uno/Type;"
) / sizeof (("Lcom/sun/star/uno/Type;")[0]))-1)
1295 "Lcom/sun/star/uno/Type;")(&("Lcom/sun/star/uno/Type;")[0]), ((sal_Int32)(sizeof ("Lcom/sun/star/uno/Type;"
) / sizeof (("Lcom/sun/star/uno/Type;")[0]))-1)
));
1296 code->instrNew(
1297 rtl::OString(
1298 RTL_CONSTASCII_STRINGPARAM("java/lang/Short")(&("java/lang/Short")[0]), ((sal_Int32)(sizeof ("java/lang/Short"
) / sizeof (("java/lang/Short")[0]))-1)
));
1299 code->instrDup();
1300 code->loadLocalInteger(*index);
1301 code->instrInvokespecial(
1302 rtl::OString(
1303 RTL_CONSTASCII_STRINGPARAM("java/lang/Short")(&("java/lang/Short")[0]), ((sal_Int32)(sizeof ("java/lang/Short"
) / sizeof (("java/lang/Short")[0]))-1)
),
1304 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1305 rtl::OString(RTL_CONSTASCII_STRINGPARAM("(S)V")(&("(S)V")[0]), ((sal_Int32)(sizeof ("(S)V") / sizeof (("(S)V"
)[0]))-1)
));
1306 code->instrInvokespecial(
1307 rtl::OString(
1308 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Any")(&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
),
1309 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1310 rtl::OString(
1311 RTL_CONSTASCII_STRINGPARAM((&("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)" "V")[0])
, ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V") / sizeof (("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V")[0]))-1)
1312 "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"(&("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)" "V")[0])
, ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V") / sizeof (("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V")[0]))-1)
1313 "V")(&("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)" "V")[0])
, ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V") / sizeof (("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V")[0]))-1)
));
1314 stack = 6;
1315 } else {
1316 code->loadLocalInteger(*index);
1317 stack = 1;
1318 }
1319 size = 1;
1320 break;
1321
1322 case codemaker::UnoType::SORT_LONG:
1323 if (any) {
1324 code->instrNew(
1325 rtl::OString(
1326 RTL_CONSTASCII_STRINGPARAM("java/lang/Integer")(&("java/lang/Integer")[0]), ((sal_Int32)(sizeof ("java/lang/Integer"
) / sizeof (("java/lang/Integer")[0]))-1)
));
1327 code->instrDup();
1328 code->loadLocalInteger(*index);
1329 code->instrInvokespecial(
1330 rtl::OString(
1331 RTL_CONSTASCII_STRINGPARAM("java/lang/Integer")(&("java/lang/Integer")[0]), ((sal_Int32)(sizeof ("java/lang/Integer"
) / sizeof (("java/lang/Integer")[0]))-1)
),
1332 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1333 rtl::OString(RTL_CONSTASCII_STRINGPARAM("(I)V")(&("(I)V")[0]), ((sal_Int32)(sizeof ("(I)V") / sizeof (("(I)V"
)[0]))-1)
));
1334 stack = 3;
1335 } else {
1336 code->loadLocalInteger(*index);
1337 stack = 1;
1338 }
1339 size = 1;
1340 break;
1341
1342 case codemaker::UnoType::SORT_UNSIGNED_LONG:
1343 if (any) {
1344 code->instrNew(
1345 rtl::OString(
1346 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
1347 "com/sun/star/uno/Any")(&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
));
1348 code->instrDup();
1349 code->instrGetstatic(
1350 rtl::OString(
1351 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
1352 "com/sun/star/uno/Type")(&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
),
1353 rtl::OString(
1354 RTL_CONSTASCII_STRINGPARAM("UNSIGNED_LONG")(&("UNSIGNED_LONG")[0]), ((sal_Int32)(sizeof ("UNSIGNED_LONG"
) / sizeof (("UNSIGNED_LONG")[0]))-1)
),
1355 rtl::OString(
1356 RTL_CONSTASCII_STRINGPARAM((&("Lcom/sun/star/uno/Type;")[0]), ((sal_Int32)(sizeof ("Lcom/sun/star/uno/Type;"
) / sizeof (("Lcom/sun/star/uno/Type;")[0]))-1)
1357 "Lcom/sun/star/uno/Type;")(&("Lcom/sun/star/uno/Type;")[0]), ((sal_Int32)(sizeof ("Lcom/sun/star/uno/Type;"
) / sizeof (("Lcom/sun/star/uno/Type;")[0]))-1)
));
1358 code->instrNew(
1359 rtl::OString(
1360 RTL_CONSTASCII_STRINGPARAM("java/lang/Integer")(&("java/lang/Integer")[0]), ((sal_Int32)(sizeof ("java/lang/Integer"
) / sizeof (("java/lang/Integer")[0]))-1)
));
1361 code->instrDup();
1362 code->loadLocalInteger(*index);
1363 code->instrInvokespecial(
1364 rtl::OString(
1365 RTL_CONSTASCII_STRINGPARAM("java/lang/Integer")(&("java/lang/Integer")[0]), ((sal_Int32)(sizeof ("java/lang/Integer"
) / sizeof (("java/lang/Integer")[0]))-1)
),
1366 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1367 rtl::OString(RTL_CONSTASCII_STRINGPARAM("(I)V")(&("(I)V")[0]), ((sal_Int32)(sizeof ("(I)V") / sizeof (("(I)V"
)[0]))-1)
));
1368 code->instrInvokespecial(
1369 rtl::OString(
1370 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Any")(&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
),
1371 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1372 rtl::OString(
1373 RTL_CONSTASCII_STRINGPARAM((&("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)" "V")[0])
, ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V") / sizeof (("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V")[0]))-1)
1374 "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"(&("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)" "V")[0])
, ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V") / sizeof (("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V")[0]))-1)
1375 "V")(&("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)" "V")[0])
, ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V") / sizeof (("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V")[0]))-1)
));
1376 stack = 6;
1377 } else {
1378 code->loadLocalInteger(*index);
1379 stack = 1;
1380 }
1381 size = 1;
1382 break;
1383
1384 case codemaker::UnoType::SORT_HYPER:
1385 if (any) {
1386 code->instrNew(
1387 rtl::OString(
1388 RTL_CONSTASCII_STRINGPARAM("java/lang/Long")(&("java/lang/Long")[0]), ((sal_Int32)(sizeof ("java/lang/Long"
) / sizeof (("java/lang/Long")[0]))-1)
));
1389 code->instrDup();
1390 code->loadLocalLong(*index);
1391 code->instrInvokespecial(
1392 rtl::OString(
1393 RTL_CONSTASCII_STRINGPARAM("java/lang/Long")(&("java/lang/Long")[0]), ((sal_Int32)(sizeof ("java/lang/Long"
) / sizeof (("java/lang/Long")[0]))-1)
),
1394 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1395 rtl::OString(RTL_CONSTASCII_STRINGPARAM("(J)V")(&("(J)V")[0]), ((sal_Int32)(sizeof ("(J)V") / sizeof (("(J)V"
)[0]))-1)
));
1396 stack = 4;
1397 } else {
1398 code->loadLocalLong(*index);
1399 stack = 2;
1400 }
1401 size = 2;
1402 break;
1403
1404 case codemaker::UnoType::SORT_UNSIGNED_HYPER:
1405 if (any) {
1406 code->instrNew(
1407 rtl::OString(
1408 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
1409 "com/sun/star/uno/Any")(&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
));
1410 code->instrDup();
1411 code->instrGetstatic(
1412 rtl::OString(
1413 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
1414 "com/sun/star/uno/Type")(&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
),
1415 rtl::OString(
1416 RTL_CONSTASCII_STRINGPARAM("UNSIGNED_HYPER")(&("UNSIGNED_HYPER")[0]), ((sal_Int32)(sizeof ("UNSIGNED_HYPER"
) / sizeof (("UNSIGNED_HYPER")[0]))-1)
),
1417 rtl::OString(
1418 RTL_CONSTASCII_STRINGPARAM((&("Lcom/sun/star/uno/Type;")[0]), ((sal_Int32)(sizeof ("Lcom/sun/star/uno/Type;"
) / sizeof (("Lcom/sun/star/uno/Type;")[0]))-1)
1419 "Lcom/sun/star/uno/Type;")(&("Lcom/sun/star/uno/Type;")[0]), ((sal_Int32)(sizeof ("Lcom/sun/star/uno/Type;"
) / sizeof (("Lcom/sun/star/uno/Type;")[0]))-1)
));
1420 code->instrNew(
1421 rtl::OString(
1422 RTL_CONSTASCII_STRINGPARAM("java/lang/Long")(&("java/lang/Long")[0]), ((sal_Int32)(sizeof ("java/lang/Long"
) / sizeof (("java/lang/Long")[0]))-1)
));
1423 code->instrDup();
1424 code->loadLocalLong(*index);
1425 code->instrInvokespecial(
1426 rtl::OString(
1427 RTL_CONSTASCII_STRINGPARAM("java/lang/Long")(&("java/lang/Long")[0]), ((sal_Int32)(sizeof ("java/lang/Long"
) / sizeof (("java/lang/Long")[0]))-1)
),
1428 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1429 rtl::OString(RTL_CONSTASCII_STRINGPARAM("(J)V")(&("(J)V")[0]), ((sal_Int32)(sizeof ("(J)V") / sizeof (("(J)V"
)[0]))-1)
));
1430 code->instrInvokespecial(
1431 rtl::OString(
1432 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Any")(&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
),
1433 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1434 rtl::OString(
1435 RTL_CONSTASCII_STRINGPARAM((&("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)" "V")[0])
, ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V") / sizeof (("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V")[0]))-1)
1436 "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"(&("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)" "V")[0])
, ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V") / sizeof (("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V")[0]))-1)
1437 "V")(&("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)" "V")[0])
, ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V") / sizeof (("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"V")[0]))-1)
));
1438 stack = 7;
1439 } else {
1440 code->loadLocalLong(*index);
1441 stack = 2;
1442 }
1443 size = 2;
1444 break;
1445
1446 case codemaker::UnoType::SORT_FLOAT:
1447 if (any) {
1448 code->instrNew(
1449 rtl::OString(
1450 RTL_CONSTASCII_STRINGPARAM("java/lang/Float")(&("java/lang/Float")[0]), ((sal_Int32)(sizeof ("java/lang/Float"
) / sizeof (("java/lang/Float")[0]))-1)
));
1451 code->instrDup();
1452 code->loadLocalFloat(*index);
1453 code->instrInvokespecial(
1454 rtl::OString(
1455 RTL_CONSTASCII_STRINGPARAM("java/lang/Float")(&("java/lang/Float")[0]), ((sal_Int32)(sizeof ("java/lang/Float"
) / sizeof (("java/lang/Float")[0]))-1)
),
1456 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1457 rtl::OString(RTL_CONSTASCII_STRINGPARAM("(F)V")(&("(F)V")[0]), ((sal_Int32)(sizeof ("(F)V") / sizeof (("(F)V"
)[0]))-1)
));
1458 stack = 3;
1459 } else {
1460 code->loadLocalFloat(*index);
1461 stack = 1;
1462 }
1463 size = 1;
1464 break;
1465
1466 case codemaker::UnoType::SORT_DOUBLE:
1467 if (any) {
1468 code->instrNew(
1469 rtl::OString(
1470 RTL_CONSTASCII_STRINGPARAM("java/lang/Double")(&("java/lang/Double")[0]), ((sal_Int32)(sizeof ("java/lang/Double"
) / sizeof (("java/lang/Double")[0]))-1)
));
1471 code->instrDup();
1472 code->loadLocalDouble(*index);
1473 code->instrInvokespecial(
1474 rtl::OString(
1475 RTL_CONSTASCII_STRINGPARAM("java/lang/Double")(&("java/lang/Double")[0]), ((sal_Int32)(sizeof ("java/lang/Double"
) / sizeof (("java/lang/Double")[0]))-1)
),
1476 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1477 rtl::OString(RTL_CONSTASCII_STRINGPARAM("(D)V")(&("(D)V")[0]), ((sal_Int32)(sizeof ("(D)V") / sizeof (("(D)V"
)[0]))-1)
));
1478 stack = 4;
1479 } else {
1480 code->loadLocalDouble(*index);
1481 stack = 2;
1482 }
1483 size = 2;
1484 break;
1485
1486 case codemaker::UnoType::SORT_CHAR:
1487 if (any) {
1488 code->instrNew(
1489 rtl::OString(
1490 RTL_CONSTASCII_STRINGPARAM("java/lang/Character")(&("java/lang/Character")[0]), ((sal_Int32)(sizeof ("java/lang/Character"
) / sizeof (("java/lang/Character")[0]))-1)
));
1491 code->instrDup();
1492 code->loadLocalInteger(*index);
1493 code->instrInvokespecial(
1494 rtl::OString(
1495 RTL_CONSTASCII_STRINGPARAM("java/lang/Character")(&("java/lang/Character")[0]), ((sal_Int32)(sizeof ("java/lang/Character"
) / sizeof (("java/lang/Character")[0]))-1)
),
1496 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1497 rtl::OString(RTL_CONSTASCII_STRINGPARAM("(C)V")(&("(C)V")[0]), ((sal_Int32)(sizeof ("(C)V") / sizeof (("(C)V"
)[0]))-1)
));
1498 stack = 3;
1499 } else {
1500 code->loadLocalInteger(*index);
1501 stack = 1;
1502 }
1503 size = 1;
1504 break;
1505
1506 case codemaker::UnoType::SORT_STRING:
1507 case codemaker::UnoType::SORT_TYPE:
1508 case codemaker::UnoType::SORT_ANY:
1509 code->loadLocalReference(*index);
1510 stack = size = 1;
1511 break;
1512
1513 case codemaker::UnoType::SORT_COMPLEX:
1514 switch (typeClass) {
11
Control jumps to 'case RT_TYPE_INTERFACE:' at line 1575
1515 case RT_TYPE_ENUM:
1516 // Assuming that no Java types are derived from Java types
1517 // that are directly derived from com.sun.star.uno.Enum:
1518 code->loadLocalReference(*index);
1519 stack = size = 1;
1520 break;
1521
1522 case RT_TYPE_STRUCT:
1523 if (any) {
1524 code->instrNew(
1525 rtl::OString(
1526 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
1527 "com/sun/star/uno/Any")(&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
));
1528 code->instrDup();
1529 code->instrNew(
1530 rtl::OString(
1531 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
1532 "com/sun/star/uno/Type")(&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
));
1533 code->instrDup();
1534 code->loadStringConstant(
1535 createUnoName(manager, nucleus, rank, args));
1536 code->instrGetstatic(
1537 rtl::OString(
1538 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/TypeClass")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/TypeClass") / sizeof (("com/sun/star/uno/TypeClass"
)[0]))-1)
1539 "com/sun/star/uno/TypeClass")(&("com/sun/star/uno/TypeClass")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/TypeClass") / sizeof (("com/sun/star/uno/TypeClass"
)[0]))-1)
),
1540 rtl::OString(RTL_CONSTASCII_STRINGPARAM("STRUCT")(&("STRUCT")[0]), ((sal_Int32)(sizeof ("STRUCT") / sizeof
(("STRUCT")[0]))-1)
),
1541 rtl::OString(
1542 RTL_CONSTASCII_STRINGPARAM((&("Lcom/sun/star/uno/TypeClass;")[0]), ((sal_Int32)(sizeof
("Lcom/sun/star/uno/TypeClass;") / sizeof (("Lcom/sun/star/uno/TypeClass;"
)[0]))-1)
1543 "Lcom/sun/star/uno/TypeClass;")(&("Lcom/sun/star/uno/TypeClass;")[0]), ((sal_Int32)(sizeof
("Lcom/sun/star/uno/TypeClass;") / sizeof (("Lcom/sun/star/uno/TypeClass;"
)[0]))-1)
));
1544 dependencies->insert(
1545 rtl::OString(
1546 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/TypeClass")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/TypeClass") / sizeof (("com/sun/star/uno/TypeClass"
)[0]))-1)
1547 "com/sun/star/uno/TypeClass")(&("com/sun/star/uno/TypeClass")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/TypeClass") / sizeof (("com/sun/star/uno/TypeClass"
)[0]))-1)
));
1548 code->instrInvokespecial(
1549 rtl::OString(
1550 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
1551 "com/sun/star/uno/Type")(&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
),
1552 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1553 rtl::OString(
1554 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
)[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
) / sizeof (("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
)[0]))-1)
1555 "(Ljava/lang/String;"(&("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
)[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
) / sizeof (("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
)[0]))-1)
1556 "Lcom/sun/star/uno/TypeClass;)V")(&("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
)[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
) / sizeof (("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
)[0]))-1)
));
1557 code->loadLocalReference(*index);
1558 code->instrInvokespecial(
1559 rtl::OString(
1560 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
1561 "com/sun/star/uno/Any")(&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
),
1562 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1563 rtl::OString(
1564 RTL_CONSTASCII_STRINGPARAM((&("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V")[0])
, ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V"
) / sizeof (("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V"
)[0]))-1)
1565 "(Lcom/sun/star/uno/Type;"(&("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V")[0])
, ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V"
) / sizeof (("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V"
)[0]))-1)
1566 "Ljava/lang/Object;)V")(&("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V")[0])
, ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V"
) / sizeof (("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V"
)[0]))-1)
));
1567 stack = 6;
1568 } else {
1569 code->loadLocalReference(*index);
1570 stack = 1;
1571 }
1572 size = 1;
1573 break;
1574
1575 case RT_TYPE_INTERFACE:
1576 if (any
12
Taking false branch
1577 && (nucleus
1578 != rtl::OString(
1579 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/XInterface")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/XInterface") / sizeof (("com/sun/star/uno/XInterface"
)[0]))-1)
1580 "com/sun/star/uno/XInterface")(&("com/sun/star/uno/XInterface")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/XInterface") / sizeof (("com/sun/star/uno/XInterface"
)[0]))-1)
)))
1581 {
1582 code->instrNew(
1583 rtl::OString(
1584 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
1585 "com/sun/star/uno/Any")(&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
));
1586 code->instrDup();
1587 code->instrNew(
1588 rtl::OString(
1589 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
1590 "com/sun/star/uno/Type")(&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
));
1591 code->instrDup();
1592 code->loadStringConstant(nucleus.replace('/', '.'));
1593 code->instrGetstatic(
1594 rtl::OString(
1595 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/TypeClass")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/TypeClass") / sizeof (("com/sun/star/uno/TypeClass"
)[0]))-1)
1596 "com/sun/star/uno/TypeClass")(&("com/sun/star/uno/TypeClass")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/TypeClass") / sizeof (("com/sun/star/uno/TypeClass"
)[0]))-1)
),
1597 rtl::OString(
1598 RTL_CONSTASCII_STRINGPARAM("INTERFACE")(&("INTERFACE")[0]), ((sal_Int32)(sizeof ("INTERFACE") / sizeof
(("INTERFACE")[0]))-1)
),
1599 rtl::OString(
1600 RTL_CONSTASCII_STRINGPARAM((&("Lcom/sun/star/uno/TypeClass;")[0]), ((sal_Int32)(sizeof
("Lcom/sun/star/uno/TypeClass;") / sizeof (("Lcom/sun/star/uno/TypeClass;"
)[0]))-1)
1601 "Lcom/sun/star/uno/TypeClass;")(&("Lcom/sun/star/uno/TypeClass;")[0]), ((sal_Int32)(sizeof
("Lcom/sun/star/uno/TypeClass;") / sizeof (("Lcom/sun/star/uno/TypeClass;"
)[0]))-1)
));
1602 dependencies->insert(
1603 rtl::OString(
1604 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/TypeClass")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/TypeClass") / sizeof (("com/sun/star/uno/TypeClass"
)[0]))-1)
1605 "com/sun/star/uno/TypeClass")(&("com/sun/star/uno/TypeClass")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/TypeClass") / sizeof (("com/sun/star/uno/TypeClass"
)[0]))-1)
));
1606 code->instrInvokespecial(
1607 rtl::OString(
1608 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
1609 "com/sun/star/uno/Type")(&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
),
1610 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1611 rtl::OString(
1612 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
)[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
) / sizeof (("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
)[0]))-1)
1613 "(Ljava/lang/String;"(&("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
)[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
) / sizeof (("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
)[0]))-1)
1614 "Lcom/sun/star/uno/TypeClass;)V")(&("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
)[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
) / sizeof (("(Ljava/lang/String;" "Lcom/sun/star/uno/TypeClass;)V"
)[0]))-1)
));
1615 code->loadLocalReference(*index);
1616 code->instrInvokespecial(
1617 rtl::OString(
1618 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
1619 "com/sun/star/uno/Any")(&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
),
1620 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1621 rtl::OString(
1622 RTL_CONSTASCII_STRINGPARAM((&("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V")[0])
, ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V"
) / sizeof (("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V"
)[0]))-1)
1623 "(Lcom/sun/star/uno/Type;"(&("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V")[0])
, ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V"
) / sizeof (("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V"
)[0]))-1)
1624 "Ljava/lang/Object;)V")(&("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V")[0])
, ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V"
) / sizeof (("(Lcom/sun/star/uno/Type;" "Ljava/lang/Object;)V"
)[0]))-1)
));
1625 stack = 6;
1626 } else {
1627 code->loadLocalReference(*index);
13
Called C++ object pointer is null
1628 stack = 1;
1629 }
1630 size = 1;
1631 break;
1632
1633 default:
1634 OSL_ASSERT(false)do { if (true && (!(false))) { sal_detail_logFormat((
SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "1634" ": "), "OSL_ASSERT: %s", "false"); } } while (false
)
;
1635 break;
1636 }
1637 break;
1638
1639 default:
1640 OSL_ASSERT(false)do { if (true && (!(false))) { sal_detail_logFormat((
SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "1640" ": "), "OSL_ASSERT: %s", "false"); } } while (false
)
;
1641 break;
1642 }
1643 } else {
1644 bool wrap = false;
1645 if (any) {
1646 switch (sort) {
1647 case codemaker::UnoType::SORT_BOOLEAN:
1648 case codemaker::UnoType::SORT_BYTE:
1649 case codemaker::UnoType::SORT_SHORT:
1650 case codemaker::UnoType::SORT_LONG:
1651 case codemaker::UnoType::SORT_HYPER:
1652 case codemaker::UnoType::SORT_FLOAT:
1653 case codemaker::UnoType::SORT_DOUBLE:
1654 case codemaker::UnoType::SORT_CHAR:
1655 case codemaker::UnoType::SORT_STRING:
1656 case codemaker::UnoType::SORT_TYPE:
1657 // assuming that no Java types are derived from
1658 // com.sun.star.uno.Type
1659 break;
1660
1661 case codemaker::UnoType::SORT_UNSIGNED_SHORT:
1662 case codemaker::UnoType::SORT_UNSIGNED_LONG:
1663 case codemaker::UnoType::SORT_UNSIGNED_HYPER:
1664 case codemaker::UnoType::SORT_ANY:
1665 wrap = true;
1666 break;
1667
1668 case codemaker::UnoType::SORT_COMPLEX:
1669 switch (typeClass) {
1670 case RT_TYPE_ENUM:
1671 // assuming that no Java types are derived from Java
1672 // types that are directly derived from
1673 // com.sun.star.uno.Enum
1674 break;
1675
1676 case RT_TYPE_STRUCT:
1677 case RT_TYPE_INTERFACE:
1678 wrap = true;
1679 break;
1680
1681 default:
1682 OSL_ASSERT(false)do { if (true && (!(false))) { sal_detail_logFormat((
SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "1682" ": "), "OSL_ASSERT: %s", "false"); } } while (false
)
;
1683 break;
1684 }
1685 break;
1686
1687 default:
1688 OSL_ASSERT(false)do { if (true && (!(false))) { sal_detail_logFormat((
SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "1688" ": "), "OSL_ASSERT: %s", "false"); } } while (false
)
;
1689 break;
1690 }
1691 }
1692 if (wrap) {
1693 code->instrNew(
1694 rtl::OString(
1695 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Any")(&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
));
1696 code->instrDup();
1697 code->instrNew(
1698 rtl::OString(
1699 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Type")(&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
));
1700 code->instrDup();
1701 code->loadStringConstant(
1702 createUnoName(manager, nucleus, rank, args));
1703 code->instrInvokespecial(
1704 rtl::OString(
1705 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Type")(&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
),
1706 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1707 rtl::OString(
1708 RTL_CONSTASCII_STRINGPARAM("(Ljava/lang/String;)V")(&("(Ljava/lang/String;)V")[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;)V"
) / sizeof (("(Ljava/lang/String;)V")[0]))-1)
));
1709 code->loadLocalReference(*index);
1710 code->instrInvokespecial(
1711 rtl::OString(
1712 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Any")(&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
),
1713 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1714 rtl::OString(
1715 RTL_CONSTASCII_STRINGPARAM((&("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V")[0]), (
(sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V"
) / sizeof (("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V")[
0]))-1)
1716 "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V")(&("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V")[0]), (
(sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V"
) / sizeof (("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V")[
0]))-1)
));
1717 stack = 5;
1718 } else {
1719 code->loadLocalReference(*index);
1720 stack = 1;
1721 }
1722 size = 1;
1723 }
1724 }
1725 if (*index > SAL_MAX_UINT16((sal_uInt16) 0xFFFF) - size) {
1726 throw CannotDumpException(
1727 rtl::OString(
1728 RTL_CONSTASCII_STRINGPARAM((&("Too many local variables for Java class file format")
[0]), ((sal_Int32)(sizeof ("Too many local variables for Java class file format"
) / sizeof (("Too many local variables for Java class file format"
)[0]))-1)
1729 "Too many local variables for Java class file format")(&("Too many local variables for Java class file format")
[0]), ((sal_Int32)(sizeof ("Too many local variables for Java class file format"
) / sizeof (("Too many local variables for Java class file format"
)[0]))-1)
));
1730 }
1731 *index = *index + size;
1732 return stack;
1733}
1734
1735void addBaseArguments(
1736 TypeManager const & manager, Dependencies * dependencies,
1737 MethodDescriptor * methodDescriptor, ClassFile::Code * code,
1738 RTTypeClass typeClass, rtl::OString const & type, sal_uInt16 * index)
1739{
1740 OSL_ASSERT(do { if (true && (!(dependencies != 0 && methodDescriptor
!= 0 && code != 0 && index != 0))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "1741" ": "), "OSL_ASSERT: %s", "dependencies != 0 && methodDescriptor != 0 && code != 0 && index != 0"
); } } while (false)
1741 dependencies != 0 && methodDescriptor != 0 && code != 0 && index != 0)do { if (true && (!(dependencies != 0 && methodDescriptor
!= 0 && code != 0 && index != 0))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "1741" ": "), "OSL_ASSERT: %s", "dependencies != 0 && methodDescriptor != 0 && code != 0 && index != 0"
); } } while (false)
;
1742 typereg::Reader reader(manager.getTypeReader(type));
1743 if (!reader.isValid() || reader.getTypeClass() != typeClass
1
Taking false branch
1744 || codemaker::convertString(reader.getTypeName()) != type
1745 || reader.getMethodCount() != 0 || reader.getReferenceCount() != 0)
1746 {
1747 throw CannotDumpException(
1748 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
));
1749 //TODO
1750 }
1751 sal_uInt16 superTypes = reader.getSuperTypeCount();
1752 sal_uInt16 fields = reader.getFieldCount();
1753 sal_uInt16 firstField = 0;
1754 if (type
2
Taking false branch
1755 == rtl::OString(
1756 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Exception")(&("com/sun/star/uno/Exception")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/Exception") / sizeof (("com/sun/star/uno/Exception"
)[0]))-1)
))
1757 {
1758 if (typeClass != RT_TYPE_EXCEPTION || superTypes != 0 || fields != 2) {
1759 throw CannotDumpException(
1760 rtl::OString(
1761 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
1762 }
1763 firstField = 1;
1764 } else {
1765 if (
1766 (typeClass == RT_TYPE_STRUCT && (superTypes > 1 || fields == 0)) ||
1767 (typeClass == RT_TYPE_EXCEPTION && superTypes != 1)
1768 )
1769 {
1770 throw CannotDumpException(
1771 rtl::OString(
1772 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
1773 }
1774 if (superTypes == 1) {
3
Taking false branch
1775 addBaseArguments(
1776 manager, dependencies, methodDescriptor, code, typeClass,
1777 codemaker::convertString(reader.getSuperTypeName(0)), index);
1778 }
1779 }
1780 for (sal_uInt16 i = firstField; i < fields; ++i) {
4
Loop condition is true. Entering loop body
1781 if (reader.getFieldFlags(i) != RT_ACCESS_READWRITE0x1000
5
Taking false branch
1782 || reader.getFieldValue(i).m_type != RT_TYPE_NONE)
1783 {
1784 throw CannotDumpException(
1785 rtl::OString(
1786 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
1787 }
1788 rtl::OString fieldType(
1789 codemaker::convertString(reader.getFieldTypeName(i)));
1790 methodDescriptor->addParameter(fieldType, false, true, 0);
1791 addLoadLocal(
6
Calling 'addLoadLocal'
1792 manager, code, index, false, fieldType, false, dependencies);
1793 }
1794}
1795
1796sal_uInt16 addDirectArgument(
1797 TypeManager const & manager, Dependencies * dependencies,
1798 MethodDescriptor * methodDescriptor, ClassFile::Code * code,
1799 sal_uInt16 * index, rtl::OString const & className,
1800 rtl::OString const & fieldName, bool typeParameter,
1801 rtl::OString const & fieldType)
1802{
1803 OSL_ASSERT(do { if (true && (!(dependencies != 0 && methodDescriptor
!= 0 && code != 0 && index != 0))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "1804" ": "), "OSL_ASSERT: %s", "dependencies != 0 && methodDescriptor != 0 && code != 0 && index != 0"
); } } while (false)
1804 dependencies != 0 && methodDescriptor != 0 && code != 0 && index != 0)do { if (true && (!(dependencies != 0 && methodDescriptor
!= 0 && code != 0 && index != 0))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "1804" ": "), "OSL_ASSERT: %s", "dependencies != 0 && methodDescriptor != 0 && code != 0 && index != 0"
); } } while (false)
;
1805 rtl::OString desc;
1806 if (typeParameter) {
1807 methodDescriptor->addTypeParameter(fieldType);
1808 desc = rtl::OString(RTL_CONSTASCII_STRINGPARAM("Ljava/lang/Object;")(&("Ljava/lang/Object;")[0]), ((sal_Int32)(sizeof ("Ljava/lang/Object;"
) / sizeof (("Ljava/lang/Object;")[0]))-1)
);
1809 } else {
1810 methodDescriptor->addParameter(fieldType, false, true, 0);
1811 getFieldDescriptor(manager, dependencies, fieldType, &desc, 0, 0);
1812 }
1813 code->loadLocalReference(0);
1814 sal_uInt16 stack = addLoadLocal(
1815 manager, code, index, typeParameter, fieldType, false, dependencies);
1816 code->instrPutfield(className, fieldName, desc);
1817 return stack + 1;
1818}
1819
1820void handleAggregatingType(
1821 TypeManager const & manager, JavaOptions /*TODO const*/ & options,
1822 typereg::Reader const & reader, Dependencies * dependencies)
1823{
1824 OSL_ASSERT(dependencies != 0)do { if (true && (!(dependencies != 0))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "1824" ": "), "OSL_ASSERT: %s", "dependencies != 0"); } }
while (false)
;
1825 if (reader.getMethodCount() != 0)
1826 {
1827 throw CannotDumpException(
1828 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
));
1829 //TODO
1830 }
1831 RTTypeClass typeClass = reader.getTypeClass();
1832 rtl::OString className(codemaker::convertString(reader.getTypeName()));
1833 sal_uInt16 superTypes = reader.getSuperTypeCount();
1834 sal_uInt16 fields = reader.getFieldCount();
1835 sal_uInt16 firstField = 0;
1836 sal_uInt16 references = reader.getReferenceCount();
1837 bool runtimeException = false;
1838 rtl::OString superClass;
1839 if (className
1840 == rtl::OString(
1841 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Exception")(&("com/sun/star/uno/Exception")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/Exception") / sizeof (("com/sun/star/uno/Exception"
)[0]))-1)
))
1842 {
1843 if (typeClass != RT_TYPE_EXCEPTION || superTypes != 0 || fields != 2
1844 || references != 0)
1845 {
1846 throw CannotDumpException(
1847 rtl::OString(
1848 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
1849 }
1850 firstField = 1;
1851 superClass = rtl::OString(
1852 RTL_CONSTASCII_STRINGPARAM("java/lang/Exception")(&("java/lang/Exception")[0]), ((sal_Int32)(sizeof ("java/lang/Exception"
) / sizeof (("java/lang/Exception")[0]))-1)
);
1853 } else if (className
1854 == rtl::OString(
1855 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/RuntimeException")[0]), ((sal_Int32)
(sizeof ("com/sun/star/uno/RuntimeException") / sizeof (("com/sun/star/uno/RuntimeException"
)[0]))-1)
1856 "com/sun/star/uno/RuntimeException")(&("com/sun/star/uno/RuntimeException")[0]), ((sal_Int32)
(sizeof ("com/sun/star/uno/RuntimeException") / sizeof (("com/sun/star/uno/RuntimeException"
)[0]))-1)
))
1857 {
1858 if (typeClass != RT_TYPE_EXCEPTION || superTypes != 1 || fields != 0
1859 || references != 0)
1860 {
1861 throw CannotDumpException(
1862 rtl::OString(
1863 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
1864 }
1865 superTypes = 0;
1866 superClass = rtl::OString(
1867 RTL_CONSTASCII_STRINGPARAM("java/lang/RuntimeException")(&("java/lang/RuntimeException")[0]), ((sal_Int32)(sizeof
("java/lang/RuntimeException") / sizeof (("java/lang/RuntimeException"
)[0]))-1)
);
1868 runtimeException = true;
1869 } else {
1870 if (
1871 (
1872 typeClass == RT_TYPE_STRUCT &&
1873 (
1874 fields == 0 ||
1875 (references == 0 ? superTypes > 1 : superTypes != 0)
1876 )
1877 ) ||
1878 (typeClass == RT_TYPE_EXCEPTION && superTypes != 1)
1879 )
1880 {
1881 throw CannotDumpException(
1882 rtl::OString(
1883 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
1884 }
1885 if (superTypes == 0) {
1886 superClass = rtl::OString(
1887 RTL_CONSTASCII_STRINGPARAM("java/lang/Object")(&("java/lang/Object")[0]), ((sal_Int32)(sizeof ("java/lang/Object"
) / sizeof (("java/lang/Object")[0]))-1)
);
1888 } else {
1889 superClass = codemaker::convertString(reader.getSuperTypeName(0));
1890 dependencies->insert(superClass);
1891 }
1892 }
1893 rtl::OString sig;
1894 std::map< rtl::OString, sal_Int32 > typeParameters;
1895 if (references != 0) {
1896 rtl::OStringBuffer buf;
1897 buf.append('<');
1898 for (sal_uInt16 i = 0; i < references; ++i) {
1899 if (reader.getReferenceFlags(i) != RT_ACCESS_INVALID0x0000
1900 || reader.getReferenceSort(i) != RT_REF_TYPE_PARAMETER)
1901 {
1902 throw CannotDumpException(
1903 rtl::OString(
1904 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
));
1905 //TODO
1906 }
1907 rtl::OString name(
1908 codemaker::convertString(reader.getReferenceTypeName(i)));
1909 buf.append(name);
1910 buf.append(RTL_CONSTASCII_STRINGPARAM(":Ljava/lang/Object;")(&(":Ljava/lang/Object;")[0]), ((sal_Int32)(sizeof (":Ljava/lang/Object;"
) / sizeof ((":Ljava/lang/Object;")[0]))-1)
);
1911 if (!typeParameters.insert(
1912 std::map< rtl::OString, sal_Int32 >::value_type(name, i)).
1913 second)
1914 {
1915 throw CannotDumpException(
1916 rtl::OString(
1917 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
));
1918 //TODO
1919 }
1920 }
1921 buf.append(RTL_CONSTASCII_STRINGPARAM(">Ljava/lang/Object;")(&(">Ljava/lang/Object;")[0]), ((sal_Int32)(sizeof (">Ljava/lang/Object;"
) / sizeof ((">Ljava/lang/Object;")[0]))-1)
);
1922 sig = buf.makeStringAndClear();
1923 }
1924 SAL_WNODEPRECATED_DECLARATIONS_PUSH
1925 std::auto_ptr< ClassFile > cf(
1926 new ClassFile(
1927 static_cast< ClassFile::AccessFlags >(
1928 ClassFile::ACC_PUBLIC | ClassFile::ACC_SUPER),
1929 className, superClass, sig));
1930 SAL_WNODEPRECATED_DECLARATIONS_POP
1931 std::vector< TypeInfo > typeInfo;
1932 {for (sal_uInt16 i = firstField; i < fields; ++i) {
1933 RTFieldAccess flags = reader.getFieldFlags(i);
1934 if ((flags != RT_ACCESS_READWRITE0x1000
1935 && flags != (RT_ACCESS_READWRITE0x1000 | RT_ACCESS_PARAMETERIZED_TYPE0x4000))
1936 || ((flags & RT_ACCESS_PARAMETERIZED_TYPE0x4000) != 0 && references == 0)
1937 || reader.getFieldValue(i).m_type != RT_TYPE_NONE)
1938 {
1939 throw CannotDumpException(
1940 rtl::OString(
1941 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
1942 }
1943 rtl::OString type(
1944 codemaker::convertString(reader.getFieldTypeName(i)));
1945 sal_Int32 typeParameterIndex;
1946 if ((flags & RT_ACCESS_PARAMETERIZED_TYPE0x4000) == 0) {
1947 typeParameterIndex = -1;
1948 } else {
1949 std::map< rtl::OString, sal_Int32 >::iterator it(
1950 typeParameters.find(type));
1951 if (it == typeParameters.end()) {
1952 throw CannotDumpException(
1953 rtl::OString(
1954 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
));
1955 //TODO
1956 }
1957 typeParameterIndex = it->second;
1958 }
1959 addField(
1960 manager, dependencies, cf.get(), &typeInfo, typeParameterIndex,
1961 type, codemaker::convertString(reader.getFieldName(i)), i - firstField);
1962 }}
1963 if (runtimeException) {
1964 addField(
1965 manager, dependencies, cf.get(), &typeInfo, -1,
1966 rtl::OString(
1967 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/XInterface")(&("com/sun/star/uno/XInterface")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/XInterface") / sizeof (("com/sun/star/uno/XInterface"
)[0]))-1)
),
1968 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Context")(&("Context")[0]), ((sal_Int32)(sizeof ("Context") / sizeof
(("Context")[0]))-1)
), 0);
1969 }
1970 SAL_WNODEPRECATED_DECLARATIONS_PUSH
1971 std::auto_ptr< ClassFile::Code > code(cf->newCode());
1972 SAL_WNODEPRECATED_DECLARATIONS_POP
1973 code->loadLocalReference(0);
1974 code->instrInvokespecial(
1975 superClass, rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
1976 rtl::OString(RTL_CONSTASCII_STRINGPARAM("()V")(&("()V")[0]), ((sal_Int32)(sizeof ("()V") / sizeof (("()V"
)[0]))-1)
));
1977 sal_uInt16 stack = 0;
1978 {for (sal_uInt16 i = firstField; i < fields; ++i) {
1979 stack = std::max(
1980 stack,
1981 addFieldInit(
1982 manager, className,
1983 codemaker::convertString(reader.getFieldName(i)),
1984 (reader.getFieldFlags(i) & RT_ACCESS_PARAMETERIZED_TYPE0x4000) != 0,
1985 codemaker::convertString(reader.getFieldTypeName(i)),
1986 dependencies, code.get()));
1987 }}
1988 if (runtimeException) {
1989 stack = std::max(
1990 stack,
1991 addFieldInit(
1992 manager, className,
1993 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Context")(&("Context")[0]), ((sal_Int32)(sizeof ("Context") / sizeof
(("Context")[0]))-1)
), false,
1994 rtl::OString(
1995 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/XInterface")(&("com/sun/star/uno/XInterface")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/XInterface") / sizeof (("com/sun/star/uno/XInterface"
)[0]))-1)
),
1996 dependencies, code.get()));
1997 }
1998 code->instrReturn();
1999 code->setMaxStackAndLocals(stack + 1, 1);
2000 cf->addMethod(
2001 ClassFile::ACC_PUBLIC,
2002 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
2003 rtl::OString(RTL_CONSTASCII_STRINGPARAM("()V")(&("()V")[0]), ((sal_Int32)(sizeof ("()V") / sizeof (("()V"
)[0]))-1)
), code.get(),
2004 std::vector< rtl::OString >(), rtl::OString());
2005 if (typeClass == RT_TYPE_EXCEPTION) {
2006 code.reset(cf->newCode());
2007 code->loadLocalReference(0);
2008 code->loadLocalReference(1);
2009 code->instrInvokespecial(
2010 superClass, rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
2011 rtl::OString(RTL_CONSTASCII_STRINGPARAM("(Ljava/lang/String;)V")(&("(Ljava/lang/String;)V")[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;)V"
) / sizeof (("(Ljava/lang/String;)V")[0]))-1)
));
2012 stack = 0;
2013 for (sal_uInt16 i = firstField; i < fields; ++i) {
2014 stack = std::max(
2015 stack,
2016 addFieldInit(
2017 manager, className,
2018 codemaker::convertString(reader.getFieldName(i)),
2019 ((reader.getFieldFlags(i) & RT_ACCESS_PARAMETERIZED_TYPE0x4000)
2020 != 0),
2021 codemaker::convertString(reader.getFieldTypeName(i)),
2022 dependencies, code.get()));
2023 }
2024 if (runtimeException) {
2025 stack = std::max(
2026 stack,
2027 addFieldInit(
2028 manager, className,
2029 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Context")(&("Context")[0]), ((sal_Int32)(sizeof ("Context") / sizeof
(("Context")[0]))-1)
), false,
2030 rtl::OString(
2031 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/XInterface")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/XInterface") / sizeof (("com/sun/star/uno/XInterface"
)[0]))-1)
2032 "com/sun/star/uno/XInterface")(&("com/sun/star/uno/XInterface")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/XInterface") / sizeof (("com/sun/star/uno/XInterface"
)[0]))-1)
),
2033 dependencies, code.get()));
2034 }
2035 code->instrReturn();
2036 code->setMaxStackAndLocals(stack + 2, 2);
2037 cf->addMethod(
2038 ClassFile::ACC_PUBLIC,
2039 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
2040 rtl::OString(RTL_CONSTASCII_STRINGPARAM("(Ljava/lang/String;)V")(&("(Ljava/lang/String;)V")[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;)V"
) / sizeof (("(Ljava/lang/String;)V")[0]))-1)
),
2041 code.get(), std::vector< rtl::OString >(), rtl::OString());
2042 }
2043 MethodDescriptor desc(
2044 manager, dependencies, rtl::OString(RTL_CONSTASCII_STRINGPARAM("void")(&("void")[0]), ((sal_Int32)(sizeof ("void") / sizeof (("void"
)[0]))-1)
),
2045 0, 0);
2046 code.reset(cf->newCode());
2047 code->loadLocalReference(0);
2048 sal_uInt16 index = 1;
2049 if (typeClass == RT_TYPE_EXCEPTION) {
2050 desc.addParameter(
2051 rtl::OString(RTL_CONSTASCII_STRINGPARAM("string")(&("string")[0]), ((sal_Int32)(sizeof ("string") / sizeof
(("string")[0]))-1)
), false, true, 0);
2052 code->loadLocalReference(index++);
2053 }
2054 if (superTypes != 0) {
2055 addBaseArguments(
2056 manager, dependencies, &desc, code.get(), typeClass, superClass,
2057 &index);
2058 }
2059 code->instrInvokespecial(
2060 superClass, rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
2061 desc.getDescriptor());
2062 sal_uInt16 maxSize = index;
2063 {for (sal_uInt16 i = firstField; i < fields; ++i) {
2064 maxSize = std::max(
2065 maxSize,
2066 addDirectArgument(
2067 manager, dependencies, &desc, code.get(), &index, className,
2068 codemaker::convertString(reader.getFieldName(i)),
2069 (reader.getFieldFlags(i) & RT_ACCESS_PARAMETERIZED_TYPE0x4000) != 0,
2070 codemaker::convertString(reader.getFieldTypeName(i))));
2071 }}
2072 if (runtimeException) {
2073 maxSize = std::max(
2074 maxSize,
2075 addDirectArgument(
2076 manager, dependencies, &desc, code.get(), &index, className,
2077 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Context")(&("Context")[0]), ((sal_Int32)(sizeof ("Context") / sizeof
(("Context")[0]))-1)
), false,
2078 rtl::OString(
2079 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/XInterface")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/XInterface") / sizeof (("com/sun/star/uno/XInterface"
)[0]))-1)
2080 "com/sun/star/uno/XInterface")(&("com/sun/star/uno/XInterface")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/XInterface") / sizeof (("com/sun/star/uno/XInterface"
)[0]))-1)
)));
2081 }
2082 code->instrReturn();
2083 code->setMaxStackAndLocals(maxSize, index);
2084 cf->addMethod(
2085 ClassFile::ACC_PUBLIC,
2086 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
2087 desc.getDescriptor(), code.get(), std::vector< rtl::OString >(),
2088 desc.getSignature());
2089 addTypeInfo(className, typeInfo, dependencies, cf.get());
2090 writeClassFile(options, className, *cf.get());
2091}
2092
2093void createExceptionsAttribute(
2094 TypeManager const & manager, typereg::Reader const & reader,
2095 sal_uInt16 methodIndex, Dependencies * dependencies,
2096 std::vector< rtl::OString > * exceptions, codemaker::ExceptionTree * tree)
2097{
2098 OSL_ASSERT(dependencies != 0 && exceptions != 0)do { if (true && (!(dependencies != 0 && exceptions
!= 0))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), (
"legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "2098" ": "), "OSL_ASSERT: %s", "dependencies != 0 && exceptions != 0"
); } } while (false)
;
2099 sal_uInt16 n = reader.getMethodExceptionCount(methodIndex);
2100 for (sal_uInt16 i = 0; i < n; ++i) {
2101 rtl::OString type(
2102 codemaker::convertString(
2103 reader.getMethodExceptionTypeName(methodIndex, i)));
2104 dependencies->insert(type);
2105 exceptions->push_back(type);
2106 if (tree != 0) {
2107 tree->add(type, manager);
2108 }
2109 }
2110}
2111
2112void handleInterfaceType(
2113 TypeManager const & manager, JavaOptions /*TODO const*/ & options,
2114 typereg::Reader const & reader, Dependencies * dependencies)
2115{
2116 OSL_ASSERT(dependencies != 0)do { if (true && (!(dependencies != 0))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "2116" ": "), "OSL_ASSERT: %s", "dependencies != 0"); } }
while (false)
;
2117
2118 rtl::OString className(codemaker::convertString(reader.getTypeName()));
2119 sal_uInt16 superTypes = reader.getSuperTypeCount();
2120 sal_uInt16 fields = reader.getFieldCount();
2121 sal_uInt16 methods = reader.getMethodCount();
2122 if (className
2123 == rtl::OString(
2124 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/XInterface")(&("com/sun/star/uno/XInterface")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/XInterface") / sizeof (("com/sun/star/uno/XInterface"
)[0]))-1)
))
2125 {
2126 if (superTypes != 0 || fields != 0 || methods != 3) {
2127 throw CannotDumpException(
2128 rtl::OString(
2129 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
2130 }
2131 methods = 0;
2132 } else if (superTypes == 0) {
2133 throw CannotDumpException(
2134 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
));
2135 //TODO
2136 }
2137 SAL_WNODEPRECATED_DECLARATIONS_PUSH
2138 std::auto_ptr< ClassFile > cf(
2139 new ClassFile(
2140 static_cast< ClassFile::AccessFlags >(
2141 ClassFile::ACC_PUBLIC | ClassFile::ACC_INTERFACE
2142 | ClassFile::ACC_ABSTRACT),
2143 className,
2144 rtl::OString(RTL_CONSTASCII_STRINGPARAM("java/lang/Object")(&("java/lang/Object")[0]), ((sal_Int32)(sizeof ("java/lang/Object"
) / sizeof (("java/lang/Object")[0]))-1)
),
2145 rtl::OString()));
2146 SAL_WNODEPRECATED_DECLARATIONS_POP
2147 {for (sal_uInt16 i = 0; i < superTypes; ++i) {
2148 rtl::OString t(codemaker::convertString(reader.getSuperTypeName(i)));
2149 dependencies->insert(t);
2150 cf->addInterface(t);
2151 }}
2152 // As a special case, let com.sun.star.lang.XEventListener extend
2153 // java.util.EventListener ("A tagging interface that all event listener
2154 // interfaces must extend"):
2155 if (className ==
2156 rtl::OString(
2157 RTL_CONSTASCII_STRINGPARAM("com/sun/star/lang/XEventListener")(&("com/sun/star/lang/XEventListener")[0]), ((sal_Int32)(
sizeof ("com/sun/star/lang/XEventListener") / sizeof (("com/sun/star/lang/XEventListener"
)[0]))-1)
))
2158 {
2159 cf->addInterface(
2160 rtl::OString(
2161 RTL_CONSTASCII_STRINGPARAM("java/util/EventListener")(&("java/util/EventListener")[0]), ((sal_Int32)(sizeof ("java/util/EventListener"
) / sizeof (("java/util/EventListener")[0]))-1)
));
2162 }
2163 std::vector< TypeInfo > typeInfo;
2164 sal_Int32 index = 0;
2165 {for (sal_uInt16 i = 0; i < fields; ++i) {
2166 RTFieldAccess flags = reader.getFieldFlags(i);
2167 //TODO: ok if both READONLY and BOUND?
2168 if (((((flags & RT_ACCESS_READWRITE0x1000) != 0)
2169 ^ ((flags & RT_ACCESS_READONLY0x0001) != 0))
2170 == 0)
2171 || ((flags
2172 & ~(RT_ACCESS_READWRITE0x1000 | RT_ACCESS_READONLY0x0001
2173 | RT_ACCESS_BOUND0x0008))
2174 != 0)
2175 || reader.getFieldValue(i).m_type != RT_TYPE_NONE)
2176 {
2177 throw CannotDumpException(
2178 rtl::OString(
2179 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
2180 }
2181 //TODO: exploit the fact that attribute getter/setter methods preceed
2182 // real methods
2183 rtl::OUString attrNameUtf16(reader.getFieldName(i));
2184 sal_uInt16 getter = SAL_MAX_UINT16((sal_uInt16) 0xFFFF);
2185 sal_uInt16 setter = SAL_MAX_UINT16((sal_uInt16) 0xFFFF);
2186 for (sal_uInt16 j = 0; j < methods; ++j) {
2187 RTMethodMode mflags = reader.getMethodFlags(j);
2188 if ((mflags == RT_MODE_ATTRIBUTE_GET
2189 || mflags == RT_MODE_ATTRIBUTE_SET)
2190 && reader.getMethodName(j) == attrNameUtf16)
2191 {
2192 if (reader.getMethodReturnTypeName(j) != "void"
2193 || reader.getMethodParameterCount(j) != 0
2194 || (mflags == RT_MODE_ATTRIBUTE_GET
2195 ? getter != SAL_MAX_UINT16((sal_uInt16) 0xFFFF)
2196 : (setter != SAL_MAX_UINT16((sal_uInt16) 0xFFFF)
2197 || (flags & RT_ACCESS_READONLY0x0001) != 0)))
2198 {
2199 throw CannotDumpException(
2200 rtl::OString(
2201 RTL_CONSTASCII_STRINGPARAM((&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
2202 "Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
2203 }
2204 OSL_ASSERT(j != SAL_MAX_UINT16)do { if (true && (!(j != ((sal_uInt16) 0xFFFF)))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "2204" ": "), "OSL_ASSERT: %s", "j != SAL_MAX_UINT16"); }
} while (false)
;
2205 (mflags == RT_MODE_ATTRIBUTE_GET ? getter : setter) = j;
2206 }
2207 }
2208 rtl::OString fieldType(
2209 codemaker::convertString(reader.getFieldTypeName(i)));
2210 SpecialType specialType;
2211 PolymorphicUnoType polymorphicUnoType;
2212 MethodDescriptor gdesc(
2213 manager, dependencies, fieldType, &specialType,
2214 &polymorphicUnoType);
2215 std::vector< rtl::OString > exc;
2216 if (getter != SAL_MAX_UINT16((sal_uInt16) 0xFFFF)) {
2217 createExceptionsAttribute(
2218 manager, reader, getter, dependencies, &exc, 0);
2219 }
2220 rtl::OString attrName(codemaker::convertString(attrNameUtf16));
2221 cf->addMethod(
2222 static_cast< ClassFile::AccessFlags >(
2223 ClassFile::ACC_PUBLIC | ClassFile::ACC_ABSTRACT),
2224 rtl::OString(RTL_CONSTASCII_STRINGPARAM("get")(&("get")[0]), ((sal_Int32)(sizeof ("get") / sizeof (("get"
)[0]))-1)
) + attrName,
2225 gdesc.getDescriptor(), 0, exc, gdesc.getSignature());
2226 if ((flags & RT_ACCESS_READONLY0x0001) == 0) {
2227 MethodDescriptor sdesc(
2228 manager, dependencies,
2229 rtl::OString(RTL_CONSTASCII_STRINGPARAM("void")(&("void")[0]), ((sal_Int32)(sizeof ("void") / sizeof (("void"
)[0]))-1)
), 0, 0);
2230 sdesc.addParameter(fieldType, false, true, 0);
2231 std::vector< rtl::OString > exc2;
2232 if (setter != SAL_MAX_UINT16((sal_uInt16) 0xFFFF)) {
2233 createExceptionsAttribute(
2234 manager, reader, setter, dependencies, &exc2, 0);
2235 }
2236 cf->addMethod(
2237 static_cast< ClassFile::AccessFlags >(
2238 ClassFile::ACC_PUBLIC | ClassFile::ACC_ABSTRACT),
2239 rtl::OString(RTL_CONSTASCII_STRINGPARAM("set")(&("set")[0]), ((sal_Int32)(sizeof ("set") / sizeof (("set"
)[0]))-1)
) + attrName,
2240 sdesc.getDescriptor(), 0, exc2, sdesc.getSignature());
2241 }
2242 typeInfo.push_back(
2243 TypeInfo(
2244 TypeInfo::KIND_ATTRIBUTE, attrName, specialType,
2245 static_cast< TypeInfo::Flags >(
2246 ((flags & RT_ACCESS_READONLY0x0001) == 0
2247 ? 0 : TypeInfo::FLAG_READONLY)
2248 | ((flags & RT_ACCESS_BOUND0x0008) == 0
2249 ? 0 : TypeInfo::FLAG_BOUND)),
2250 index, polymorphicUnoType));
2251 index += ((flags & RT_ACCESS_READONLY0x0001) == 0 ? 2 : 1);
2252 }}
2253 {for (sal_uInt16 i = 0; i < methods; ++i) {
2254 RTMethodMode flags = reader.getMethodFlags(i);
2255 switch (flags) {
2256 case RT_MODE_ONEWAY:
2257 case RT_MODE_TWOWAY:
2258 {
2259 rtl::OString methodName(
2260 codemaker::convertString(reader.getMethodName(i)));
2261 SpecialType specialReturnType;
2262 PolymorphicUnoType polymorphicUnoReturnType;
2263 MethodDescriptor desc(
2264 manager, dependencies,
2265 codemaker::convertString(
2266 reader.getMethodReturnTypeName(i)),
2267 &specialReturnType, &polymorphicUnoReturnType);
2268 typeInfo.push_back(
2269 TypeInfo(
2270 TypeInfo::KIND_METHOD, methodName, specialReturnType,
2271 static_cast< TypeInfo::Flags >(
2272 flags == RT_MODE_ONEWAY
2273 ? TypeInfo::FLAG_ONEWAY : 0),
2274 index++, polymorphicUnoReturnType));
2275 for (sal_uInt16 j = 0; j < reader.getMethodParameterCount(i);
2276 ++j)
2277 {
2278 bool in;
2279 bool out;
2280 switch (reader.getMethodParameterFlags(i, j)) {
2281 case RT_PARAM_IN:
2282 in = true;
2283 out = false;
2284 break;
2285
2286 case RT_PARAM_OUT:
2287 in = false;
2288 out = true;
2289 break;
2290
2291 case RT_PARAM_INOUT:
2292 in = true;
2293 out = true;
2294 break;
2295
2296 default:
2297 throw CannotDumpException(
2298 rtl::OString(
2299 RTL_CONSTASCII_STRINGPARAM((&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
2300 "Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
2301 }
2302 PolymorphicUnoType polymorphicUnoType;
2303 SpecialType specialType = desc.addParameter(
2304 codemaker::convertString(
2305 reader.getMethodParameterTypeName(i, j)),
2306 out, true, &polymorphicUnoType);
2307 if (out || isSpecialType(specialType)
2308 || (polymorphicUnoType.kind
2309 != PolymorphicUnoType::KIND_NONE))
2310 {
2311 typeInfo.push_back(
2312 TypeInfo(
2313 codemaker::convertString(
2314 reader.getMethodParameterName(i, j)),
2315 specialType, in, out, methodName, j,
2316 polymorphicUnoType));
2317 }
2318 }
2319 std::vector< rtl::OString > exc2;
2320 createExceptionsAttribute(
2321 manager, reader, i, dependencies, &exc2, 0);
2322 cf->addMethod(
2323 static_cast< ClassFile::AccessFlags >(
2324 ClassFile::ACC_PUBLIC | ClassFile::ACC_ABSTRACT),
2325 methodName, desc.getDescriptor(), 0, exc2,
2326 desc.getSignature());
2327 break;
2328 }
2329
2330 case RT_MODE_ATTRIBUTE_GET:
2331 case RT_MODE_ATTRIBUTE_SET:
2332 {
2333 //TODO: exploit the fact that attribute getter/setter methods
2334 // are ordered the same way as the attribute fields themselves
2335 rtl::OUString methodNameUtf16(reader.getMethodName(i));
2336 bool found = false;
2337 for (sal_uInt16 j = 0; j < fields; ++j) {
2338 if (reader.getFieldName(j) == methodNameUtf16) {
2339 found = true;
2340 break;
2341 }
2342 }
2343 if (found) {
2344 break;
2345 }
2346 }
2347 default:
2348 throw CannotDumpException(
2349 rtl::OString(
2350 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
2351 }
2352 }}
2353 addTypeInfo(className, typeInfo, dependencies, cf.get());
2354 writeClassFile(options, className, *cf.get());
2355}
2356
2357void handleTypedef(
2358 TypeManager const & manager,
2359 SAL_UNUSED_PARAMETER__attribute__ ((unused)) JavaOptions /*TODO const*/ &,
2360 typereg::Reader const & reader, Dependencies * dependencies)
2361{
2362 OSL_ASSERT(dependencies != 0)do { if (true && (!(dependencies != 0))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "2362" ": "), "OSL_ASSERT: %s", "dependencies != 0"); } }
while (false)
;
2363 if (reader.getSuperTypeCount() != 1 || reader.getFieldCount() != 0
2364 || reader.getMethodCount() != 0 || reader.getReferenceCount() != 0)
2365 {
2366 throw CannotDumpException(
2367 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
));
2368 //TODO
2369 }
2370 RTTypeClass typeClass;
2371 rtl::OString nucleus;
2372 sal_Int32 rank;
2373 std::vector< rtl::OString > args;
2374 if (codemaker::decomposeAndResolve(
2375 manager, codemaker::convertString(reader.getSuperTypeName(0)),
2376 false, false, false, &typeClass, &nucleus, &rank, &args)
2377 == codemaker::UnoType::SORT_COMPLEX)
2378 {
2379 switch (typeClass) {
2380 case RT_TYPE_STRUCT:
2381 if (!args.empty()) {
2382 throw CannotDumpException(
2383 rtl::OString(
2384 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
));
2385 //TODO
2386 }
2387 case RT_TYPE_ENUM:
2388 case RT_TYPE_INTERFACE:
2389 case RT_TYPE_TYPEDEF:
2390 dependencies->insert(nucleus);
2391 break;
2392
2393 default:
2394 OSL_ASSERT(false)do { if (true && (!(false))) { sal_detail_logFormat((
SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "2394" ": "), "OSL_ASSERT: %s", "false"); } } while (false
)
;
2395 break;
2396 }
2397 }
2398}
2399
2400void addConstant(
2401 TypeManager const & manager, typereg::Reader const & reader,
2402 bool publishable, sal_uInt16 index, Dependencies * dependencies,
2403 ClassFile * classFile)
2404{
2405 OSL_ASSERT(dependencies != 0 && classFile != 0)do { if (true && (!(dependencies != 0 && classFile
!= 0))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), (
"legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "2405" ": "), "OSL_ASSERT: %s", "dependencies != 0 && classFile != 0"
); } } while (false)
;
2406 RTFieldAccess flags = reader.getFieldFlags(index);
2407 if (flags != RT_ACCESS_CONST0x0800
2408 && (!publishable || flags != (RT_ACCESS_CONST0x0800 | RT_ACCESS_PUBLISHED0x8000)))
2409 {
2410 throw CannotDumpException(
2411 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
));
2412 //TODO
2413 }
2414 RTConstValue fieldValue(reader.getFieldValue(index));
2415 sal_uInt16 valueIndex;
2416 RTTypeClass typeClass;
2417 rtl::OString nucleus;
2418 sal_Int32 rank;
2419 std::vector< rtl::OString > args;
2420 switch (codemaker::decomposeAndResolve(
2421 manager,
2422 codemaker::convertString(reader.getFieldTypeName(index)),
2423 true, false, false, &typeClass, &nucleus, &rank, &args))
2424 {
2425 case codemaker::UnoType::SORT_BOOLEAN:
2426 if (fieldValue.m_type != RT_TYPE_BOOL) {
2427 throw CannotDumpException(
2428 rtl::OString(
2429 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
2430 }
2431 valueIndex = classFile->addIntegerInfo(fieldValue.m_value.aBool);
2432 break;
2433
2434 case codemaker::UnoType::SORT_BYTE:
2435 if (fieldValue.m_type != RT_TYPE_BYTE) {
2436 throw CannotDumpException(
2437 rtl::OString(
2438 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
2439 }
2440 valueIndex = classFile->addIntegerInfo(fieldValue.m_value.aByte);
2441 break;
2442
2443 case codemaker::UnoType::SORT_SHORT:
2444 if (fieldValue.m_type != RT_TYPE_INT16) {
2445 throw CannotDumpException(
2446 rtl::OString(
2447 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
2448 }
2449 valueIndex = classFile->addIntegerInfo(fieldValue.m_value.aShort);
2450 break;
2451
2452 case codemaker::UnoType::SORT_UNSIGNED_SHORT:
2453 case codemaker::UnoType::SORT_CHAR:
2454 if (fieldValue.m_type != RT_TYPE_UINT16) {
2455 throw CannotDumpException(
2456 rtl::OString(
2457 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
2458 }
2459 valueIndex = classFile->addIntegerInfo(fieldValue.m_value.aUShort);
2460 break;
2461
2462 case codemaker::UnoType::SORT_LONG:
2463 if (fieldValue.m_type != RT_TYPE_INT32) {
2464 throw CannotDumpException(
2465 rtl::OString(
2466 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
2467 }
2468 valueIndex = classFile->addIntegerInfo(fieldValue.m_value.aLong);
2469 break;
2470
2471 case codemaker::UnoType::SORT_UNSIGNED_LONG:
2472 if (fieldValue.m_type != RT_TYPE_UINT32) {
2473 throw CannotDumpException(
2474 rtl::OString(
2475 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
2476 }
2477 valueIndex = classFile->addIntegerInfo(
2478 static_cast< sal_Int32 >(fieldValue.m_value.aULong));
2479 break;
2480
2481 case codemaker::UnoType::SORT_HYPER:
2482 if (fieldValue.m_type != RT_TYPE_INT64) {
2483 throw CannotDumpException(
2484 rtl::OString(
2485 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
2486 }
2487 valueIndex = classFile->addLongInfo(fieldValue.m_value.aHyper);
2488 break;
2489
2490 case codemaker::UnoType::SORT_UNSIGNED_HYPER:
2491 if (fieldValue.m_type != RT_TYPE_UINT64) {
2492 throw CannotDumpException(
2493 rtl::OString(
2494 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
2495 }
2496 valueIndex = classFile->addLongInfo(
2497 static_cast< sal_Int64 >(fieldValue.m_value.aUHyper));
2498 break;
2499
2500 case codemaker::UnoType::SORT_FLOAT:
2501 if (fieldValue.m_type != RT_TYPE_FLOAT) {
2502 throw CannotDumpException(
2503 rtl::OString(
2504 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
2505 }
2506 valueIndex = classFile->addFloatInfo(fieldValue.m_value.aFloat);
2507 break;
2508
2509 case codemaker::UnoType::SORT_DOUBLE:
2510 if (fieldValue.m_type != RT_TYPE_DOUBLE) {
2511 throw CannotDumpException(
2512 rtl::OString(
2513 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
2514 }
2515 valueIndex = classFile->addDoubleInfo(fieldValue.m_value.aDouble);
2516 break;
2517
2518 default:
2519 throw CannotDumpException(
2520 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
));
2521 //TODO
2522 }
2523 rtl::OString desc;
2524 rtl::OString sig;
2525 getFieldDescriptor(
2526 manager, dependencies,
2527 codemaker::convertString(reader.getFieldTypeName(index)),
2528 &desc, &sig, 0);
2529 classFile->addField(
2530 static_cast< ClassFile::AccessFlags >(
2531 ClassFile::ACC_PUBLIC | ClassFile::ACC_STATIC
2532 | ClassFile::ACC_FINAL),
2533 codemaker::convertString(reader.getFieldName(index)),
2534 desc, valueIndex, sig);
2535}
2536
2537void handleConstantGroup(
2538 TypeManager const & manager, JavaOptions /*TODO const*/ & options,
2539 typereg::Reader const & reader, Dependencies * dependencies)
2540{
2541 OSL_ASSERT(dependencies != 0)do { if (true && (!(dependencies != 0))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "2541" ": "), "OSL_ASSERT: %s", "dependencies != 0"); } }
while (false)
;
2542 if (reader.getSuperTypeCount() != 0 || reader.getMethodCount() != 0
2543 || reader.getReferenceCount() != 0)
2544 {
2545 throw CannotDumpException(
2546 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
));
2547 //TODO
2548 }
2549 rtl::OString className(codemaker::convertString(reader.getTypeName()));
2550 SAL_WNODEPRECATED_DECLARATIONS_PUSH
2551 std::auto_ptr< ClassFile > cf(
2552 new ClassFile(
2553 static_cast< ClassFile::AccessFlags >(
2554 ClassFile::ACC_PUBLIC | ClassFile::ACC_INTERFACE
2555 | ClassFile::ACC_ABSTRACT),
2556 className,
2557 rtl::OString(RTL_CONSTASCII_STRINGPARAM("java/lang/Object")(&("java/lang/Object")[0]), ((sal_Int32)(sizeof ("java/lang/Object"
) / sizeof (("java/lang/Object")[0]))-1)
),
2558 rtl::OString()));
2559 SAL_WNODEPRECATED_DECLARATIONS_POP
2560 sal_uInt16 fields = reader.getFieldCount();
2561 for (sal_uInt16 i = 0; i < fields; ++i) {
2562 addConstant(manager, reader, false, i, dependencies, cf.get());
2563 }
2564 writeClassFile(options, className, *cf.get());
2565}
2566
2567void handleModule(
2568 TypeManager const & manager, JavaOptions /*TODO const*/ & options,
2569 typereg::Reader const & reader, Dependencies * dependencies)
2570{
2571 OSL_ASSERT(dependencies != 0)do { if (true && (!(dependencies != 0))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "2571" ": "), "OSL_ASSERT: %s", "dependencies != 0"); } }
while (false)
;
2572 if (reader.getSuperTypeCount() != 0 || reader.getMethodCount() != 0
2573 || reader.getReferenceCount() != 0)
2574 {
2575 throw CannotDumpException(
2576 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
));
2577 //TODO
2578 }
2579 rtl::OStringBuffer buf(codemaker::convertString(reader.getTypeName()));
2580 buf.append('/');
2581 rtl::OString prefix(buf.makeStringAndClear());
2582 sal_uInt16 fields = reader.getFieldCount();
2583 for (sal_uInt16 i = 0; i < fields; ++i) {
2584 rtl::OString className(
2585 prefix + codemaker::convertString(reader.getFieldName(i)));
2586 SAL_WNODEPRECATED_DECLARATIONS_PUSH
2587 std::auto_ptr< ClassFile > cf(
2588 new ClassFile(
2589 static_cast< ClassFile::AccessFlags >(
2590 ClassFile::ACC_PUBLIC | ClassFile::ACC_INTERFACE
2591 | ClassFile::ACC_ABSTRACT),
2592 className,
2593 rtl::OString(RTL_CONSTASCII_STRINGPARAM("java/lang/Object")(&("java/lang/Object")[0]), ((sal_Int32)(sizeof ("java/lang/Object"
) / sizeof (("java/lang/Object")[0]))-1)
),
2594 rtl::OString()));
2595 SAL_WNODEPRECATED_DECLARATIONS_POP
2596 addConstant(manager, reader, true, i, dependencies, cf.get());
2597 writeClassFile(options, className, *cf.get());
2598 }
2599}
2600
2601void addExceptionHandlers(
2602 codemaker::ExceptionTreeNode const * node,
2603 ClassFile::Code::Position start, ClassFile::Code::Position end,
2604 ClassFile::Code::Position handler, ClassFile::Code * code)
2605{
2606 OSL_ASSERT(node != 0 && code != 0)do { if (true && (!(node != 0 && code != 0)))
{ sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"
), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "2606" ": "), "OSL_ASSERT: %s", "node != 0 && code != 0"
); } } while (false)
;
2607 if (node->present) {
2608 code->addException(start, end, handler, node->name);
2609 } else {
2610 for (codemaker::ExceptionTreeNode::Children::const_iterator i(
2611 node->children.begin());
2612 i != node->children.end(); ++i)
2613 {
2614 addExceptionHandlers(*i, start, end, handler, code);
2615 }
2616 }
2617}
2618
2619void addConstructor(
2620 TypeManager const & manager, rtl::OString const & realJavaBaseName,
2621 rtl::OString const & unoName, rtl::OString const & className,
2622 typereg::Reader const & reader, sal_uInt16 methodIndex,
2623 rtl::OString const & methodName, rtl::OString const & returnType,
2624 bool defaultConstructor, Dependencies * dependencies, ClassFile * classFile)
2625{
2626 OSL_ASSERT(dependencies != 0 && classFile != 0)do { if (true && (!(dependencies != 0 && classFile
!= 0))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), (
"legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "2626" ": "), "OSL_ASSERT: %s", "dependencies != 0 && classFile != 0"
); } } while (false)
;
2627 MethodDescriptor desc(manager, dependencies, returnType, 0, 0);
2628 desc.addParameter(
2629 rtl::OString(
2630 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/XComponentContext")(&("com/sun/star/uno/XComponentContext")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/XComponentContext") / sizeof (("com/sun/star/uno/XComponentContext"
)[0]))-1)
),
2631 false, false, 0);
2632 SAL_WNODEPRECATED_DECLARATIONS_PUSH
2633 std::auto_ptr< ClassFile::Code > code(classFile->newCode());
2634 SAL_WNODEPRECATED_DECLARATIONS_POP
2635 code->loadLocalReference(0);
2636 // stack: context
2637 code->instrInvokestatic(
2638 className, rtl::OString(RTL_CONSTASCII_STRINGPARAM("$getFactory")(&("$getFactory")[0]), ((sal_Int32)(sizeof ("$getFactory"
) / sizeof (("$getFactory")[0]))-1)
),
2639 rtl::OString(
2640 RTL_CONSTASCII_STRINGPARAM((&("(Lcom/sun/star/uno/XComponentContext;)" "Lcom/sun/star/lang/XMultiComponentFactory;"
)[0]), ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/XComponentContext;)"
"Lcom/sun/star/lang/XMultiComponentFactory;") / sizeof (("(Lcom/sun/star/uno/XComponentContext;)"
"Lcom/sun/star/lang/XMultiComponentFactory;")[0]))-1)
2641 "(Lcom/sun/star/uno/XComponentContext;)"(&("(Lcom/sun/star/uno/XComponentContext;)" "Lcom/sun/star/lang/XMultiComponentFactory;"
)[0]), ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/XComponentContext;)"
"Lcom/sun/star/lang/XMultiComponentFactory;") / sizeof (("(Lcom/sun/star/uno/XComponentContext;)"
"Lcom/sun/star/lang/XMultiComponentFactory;")[0]))-1)
2642 "Lcom/sun/star/lang/XMultiComponentFactory;")(&("(Lcom/sun/star/uno/XComponentContext;)" "Lcom/sun/star/lang/XMultiComponentFactory;"
)[0]), ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/XComponentContext;)"
"Lcom/sun/star/lang/XMultiComponentFactory;") / sizeof (("(Lcom/sun/star/uno/XComponentContext;)"
"Lcom/sun/star/lang/XMultiComponentFactory;")[0]))-1)
));
2643 // stack: factory
2644 code->loadStringConstant(unoName);
2645 // stack: factory serviceName
2646 codemaker::ExceptionTree tree;
2647 ClassFile::Code::Position tryStart;
2648 ClassFile::Code::Position tryEnd;
2649 std::vector< rtl::OString > exc;
2650 sal_uInt16 stack;
2651 sal_uInt16 localIndex = 1;
2652 ClassFile::AccessFlags access = static_cast< ClassFile::AccessFlags >(
2653 ClassFile::ACC_PUBLIC | ClassFile::ACC_STATIC);
2654 if (defaultConstructor) {
2655 code->loadLocalReference(0);
2656 // stack: factory serviceName context
2657 tryStart = code->getPosition();
2658 code->instrInvokeinterface(
2659 rtl::OString(
2660 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/lang/XMultiComponentFactory")[0]), ((sal_Int32
)(sizeof ("com/sun/star/lang/XMultiComponentFactory") / sizeof
(("com/sun/star/lang/XMultiComponentFactory")[0]))-1)
2661 "com/sun/star/lang/XMultiComponentFactory")(&("com/sun/star/lang/XMultiComponentFactory")[0]), ((sal_Int32
)(sizeof ("com/sun/star/lang/XMultiComponentFactory") / sizeof
(("com/sun/star/lang/XMultiComponentFactory")[0]))-1)
),
2662 rtl::OString(
2663 RTL_CONSTASCII_STRINGPARAM((&("createInstanceWithContext")[0]), ((sal_Int32)(sizeof (
"createInstanceWithContext") / sizeof (("createInstanceWithContext"
)[0]))-1)
2664 "createInstanceWithContext")(&("createInstanceWithContext")[0]), ((sal_Int32)(sizeof (
"createInstanceWithContext") / sizeof (("createInstanceWithContext"
)[0]))-1)
),
2665 rtl::OString(
2666 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;")[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;") / sizeof (("(Ljava/lang/String;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;")[0]))-1)
2667 "(Ljava/lang/String;Lcom/sun/star/uno/XComponentContext;)"(&("(Ljava/lang/String;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;")[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;") / sizeof (("(Ljava/lang/String;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;")[0]))-1)
2668 "Ljava/lang/Object;")(&("(Ljava/lang/String;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;")[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;") / sizeof (("(Ljava/lang/String;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;")[0]))-1)
),
2669 3);
2670 tryEnd = code->getPosition();
2671 // stack: instance
2672 stack = 3;
2673 } else {
2674 sal_uInt16 parameters = reader.getMethodParameterCount(methodIndex);
2675 if (parameters == 1
2676 && (reader.getMethodParameterFlags(methodIndex, 0)
2677 == (RT_PARAM_IN | RT_PARAM_REST))
2678 && (reader.getMethodParameterTypeName(methodIndex, 0)
2679 == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any")(&("any")[0]), ((sal_Int32)((sizeof ("any") / sizeof (("any"
)[0]))-1)), (((rtl_TextEncoding) 11))
)))
2680 {
2681 desc.addParameter(
2682 rtl::OString(RTL_CONSTASCII_STRINGPARAM("any")(&("any")[0]), ((sal_Int32)(sizeof ("any") / sizeof (("any"
)[0]))-1)
), true, true, 0);
2683 code->loadLocalReference(localIndex++);
2684 // stack: factory serviceName args
2685 stack = 4;
2686 access = static_cast< ClassFile::AccessFlags >(
2687 access | ClassFile::ACC_VARARGS);
2688 } else {
2689 code->loadIntegerConstant(parameters);
2690 // stack: factory serviceName N
2691 code->instrAnewarray(
2692 rtl::OString(RTL_CONSTASCII_STRINGPARAM("java/lang/Object")(&("java/lang/Object")[0]), ((sal_Int32)(sizeof ("java/lang/Object"
) / sizeof (("java/lang/Object")[0]))-1)
));
2693 // stack: factory serviceName args
2694 stack = 0;
2695 for (sal_uInt16 i = 0; i < parameters; ++i) {
2696 RTParamMode flags = reader.getMethodParameterFlags(
2697 methodIndex, i);
2698 rtl::OString paramType(
2699 codemaker::convertString(
2700 reader.getMethodParameterTypeName(methodIndex, i)));
2701 if ((flags != RT_PARAM_IN
2702 && flags != (RT_PARAM_IN | RT_PARAM_REST))
2703 || ((flags & RT_PARAM_REST) != 0
2704 && (parameters != 1
2705 || (paramType
2706 != rtl::OString(
2707 RTL_CONSTASCII_STRINGPARAM("any")(&("any")[0]), ((sal_Int32)(sizeof ("any") / sizeof (("any"
)[0]))-1)
)))))
2708 {
2709 throw CannotDumpException(
2710 rtl::OString(
2711 RTL_CONSTASCII_STRINGPARAM((&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
2712 "Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
)); //TODO
2713 }
2714 desc.addParameter(paramType, false, true, 0);
2715 code->instrDup();
2716 // stack: factory serviceName args args
2717 code->loadIntegerConstant(i);
2718 // stack: factory serviceName args args i
2719 stack = std::max(
2720 stack,
2721 addLoadLocal(
2722 manager, code.get(), &localIndex, false, paramType,
2723 true, dependencies));
2724 // stack: factory serviceName args args i any
2725 code->instrAastore();
2726 // stack: factory serviceName args
2727 }
2728 stack += 5;
2729 }
2730 code->loadLocalReference(0);
2731 // stack: factory serviceName args context
2732 tryStart = code->getPosition();
2733 code->instrInvokeinterface(
2734 rtl::OString(
2735 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/lang/XMultiComponentFactory")[0]), ((sal_Int32
)(sizeof ("com/sun/star/lang/XMultiComponentFactory") / sizeof
(("com/sun/star/lang/XMultiComponentFactory")[0]))-1)
2736 "com/sun/star/lang/XMultiComponentFactory")(&("com/sun/star/lang/XMultiComponentFactory")[0]), ((sal_Int32
)(sizeof ("com/sun/star/lang/XMultiComponentFactory") / sizeof
(("com/sun/star/lang/XMultiComponentFactory")[0]))-1)
),
2737 rtl::OString(
2738 RTL_CONSTASCII_STRINGPARAM((&("createInstanceWithArgumentsAndContext")[0]), ((sal_Int32
)(sizeof ("createInstanceWithArgumentsAndContext") / sizeof (
("createInstanceWithArgumentsAndContext")[0]))-1)
2739 "createInstanceWithArgumentsAndContext")(&("createInstanceWithArgumentsAndContext")[0]), ((sal_Int32
)(sizeof ("createInstanceWithArgumentsAndContext") / sizeof (
("createInstanceWithArgumentsAndContext")[0]))-1)
),
2740 rtl::OString(
2741 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;[Ljava/lang/Object;" "Lcom/sun/star/uno/XComponentContext;)Ljava/lang/Object;"
)[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;[Ljava/lang/Object;"
"Lcom/sun/star/uno/XComponentContext;)Ljava/lang/Object;") /
sizeof (("(Ljava/lang/String;[Ljava/lang/Object;" "Lcom/sun/star/uno/XComponentContext;)Ljava/lang/Object;"
)[0]))-1)
2742 "(Ljava/lang/String;[Ljava/lang/Object;"(&("(Ljava/lang/String;[Ljava/lang/Object;" "Lcom/sun/star/uno/XComponentContext;)Ljava/lang/Object;"
)[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;[Ljava/lang/Object;"
"Lcom/sun/star/uno/XComponentContext;)Ljava/lang/Object;") /
sizeof (("(Ljava/lang/String;[Ljava/lang/Object;" "Lcom/sun/star/uno/XComponentContext;)Ljava/lang/Object;"
)[0]))-1)
2743 "Lcom/sun/star/uno/XComponentContext;)Ljava/lang/Object;")(&("(Ljava/lang/String;[Ljava/lang/Object;" "Lcom/sun/star/uno/XComponentContext;)Ljava/lang/Object;"
)[0]), ((sal_Int32)(sizeof ("(Ljava/lang/String;[Ljava/lang/Object;"
"Lcom/sun/star/uno/XComponentContext;)Ljava/lang/Object;") /
sizeof (("(Ljava/lang/String;[Ljava/lang/Object;" "Lcom/sun/star/uno/XComponentContext;)Ljava/lang/Object;"
)[0]))-1)
),
2744 4);
2745 tryEnd = code->getPosition();
2746 // stack: instance
2747 createExceptionsAttribute(
2748 manager, reader, methodIndex, dependencies, &exc, &tree);
2749 }
2750 code->loadLocalReference(0);
2751 // stack: instance context
2752 code->instrInvokestatic(
2753 className, rtl::OString(RTL_CONSTASCII_STRINGPARAM("$castInstance")(&("$castInstance")[0]), ((sal_Int32)(sizeof ("$castInstance"
) / sizeof (("$castInstance")[0]))-1)
),
2754 rtl::OString(
2755 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/Object;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;")[0]), ((sal_Int32)(sizeof ("(Ljava/lang/Object;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;") / sizeof (("(Ljava/lang/Object;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;")[0]))-1)
2756 "(Ljava/lang/Object;Lcom/sun/star/uno/XComponentContext;)"(&("(Ljava/lang/Object;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;")[0]), ((sal_Int32)(sizeof ("(Ljava/lang/Object;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;") / sizeof (("(Ljava/lang/Object;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;")[0]))-1)
2757 "Ljava/lang/Object;")(&("(Ljava/lang/Object;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;")[0]), ((sal_Int32)(sizeof ("(Ljava/lang/Object;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;") / sizeof (("(Ljava/lang/Object;Lcom/sun/star/uno/XComponentContext;)"
"Ljava/lang/Object;")[0]))-1)
));
2758 // stack: instance
2759 code->instrCheckcast(returnType);
2760 // stack: instance
2761 code->instrAreturn();
2762 if (!tree.getRoot()->present) {
2763 ClassFile::Code::Position pos1 = code->getPosition();
2764 // stack: e
2765 code->instrInvokevirtual(
2766 rtl::OString(RTL_CONSTASCII_STRINGPARAM("java/lang/Throwable")(&("java/lang/Throwable")[0]), ((sal_Int32)(sizeof ("java/lang/Throwable"
) / sizeof (("java/lang/Throwable")[0]))-1)
),
2767 rtl::OString(RTL_CONSTASCII_STRINGPARAM("toString")(&("toString")[0]), ((sal_Int32)(sizeof ("toString") / sizeof
(("toString")[0]))-1)
),
2768 rtl::OString(RTL_CONSTASCII_STRINGPARAM("()Ljava/lang/String;")(&("()Ljava/lang/String;")[0]), ((sal_Int32)(sizeof ("()Ljava/lang/String;"
) / sizeof (("()Ljava/lang/String;")[0]))-1)
));
2769 // stack: str
2770 localIndex = std::max< sal_uInt16 >(localIndex, 2);
2771 code->storeLocalReference(1);
2772 // stack: -
2773 code->instrNew(
2774 rtl::OString(
2775 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
2776 "com/sun/star/uno/DeploymentException")(&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
));
2777 // stack: ex
2778 code->instrDup();
2779 // stack: ex ex
2780 rtl::OStringBuffer msg;
2781 msg.append(
2782 RTL_CONSTASCII_STRINGPARAM((&("component context fails to supply service ")[0]), ((sal_Int32
)(sizeof ("component context fails to supply service ") / sizeof
(("component context fails to supply service ")[0]))-1)
2783 "component context fails to supply service ")(&("component context fails to supply service ")[0]), ((sal_Int32
)(sizeof ("component context fails to supply service ") / sizeof
(("component context fails to supply service ")[0]))-1)
);
2784 msg.append(unoName);
2785 msg.append(RTL_CONSTASCII_STRINGPARAM(" of type ")(&(" of type ")[0]), ((sal_Int32)(sizeof (" of type ") / sizeof
((" of type ")[0]))-1)
);
2786 msg.append(realJavaBaseName);
2787 msg.append(RTL_CONSTASCII_STRINGPARAM(": ")(&(": ")[0]), ((sal_Int32)(sizeof (": ") / sizeof ((": ")
[0]))-1)
);
2788 code->loadStringConstant(msg.makeStringAndClear());
2789 // stack: ex ex "..."
2790 code->loadLocalReference(1);
2791 // stack: ex ex "..." str
2792 code->instrInvokevirtual(
2793 rtl::OString(RTL_CONSTASCII_STRINGPARAM("java/lang/String")(&("java/lang/String")[0]), ((sal_Int32)(sizeof ("java/lang/String"
) / sizeof (("java/lang/String")[0]))-1)
),
2794 rtl::OString(RTL_CONSTASCII_STRINGPARAM("concat")(&("concat")[0]), ((sal_Int32)(sizeof ("concat") / sizeof
(("concat")[0]))-1)
),
2795 rtl::OString(
2796 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;)Ljava/lang/String;")[0]), ((sal_Int32
)(sizeof ("(Ljava/lang/String;)Ljava/lang/String;") / sizeof (
("(Ljava/lang/String;)Ljava/lang/String;")[0]))-1)
2797 "(Ljava/lang/String;)Ljava/lang/String;")(&("(Ljava/lang/String;)Ljava/lang/String;")[0]), ((sal_Int32
)(sizeof ("(Ljava/lang/String;)Ljava/lang/String;") / sizeof (
("(Ljava/lang/String;)Ljava/lang/String;")[0]))-1)
));
2798 // stack: ex ex "..."
2799 code->loadLocalReference(0);
2800 // stack: ex ex "..." context
2801 code->instrInvokespecial(
2802 rtl::OString(
2803 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
2804 "com/sun/star/uno/DeploymentException")(&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
),
2805 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
2806 rtl::OString(
2807 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;Ljava/lang/Object;)V")[0]), ((sal_Int32
)(sizeof ("(Ljava/lang/String;Ljava/lang/Object;)V") / sizeof
(("(Ljava/lang/String;Ljava/lang/Object;)V")[0]))-1)
2808 "(Ljava/lang/String;Ljava/lang/Object;)V")(&("(Ljava/lang/String;Ljava/lang/Object;)V")[0]), ((sal_Int32
)(sizeof ("(Ljava/lang/String;Ljava/lang/Object;)V") / sizeof
(("(Ljava/lang/String;Ljava/lang/Object;)V")[0]))-1)
));
2809 // stack: ex
2810 ClassFile::Code::Position pos2 = code->getPosition();
2811 code->instrAthrow();
2812 addExceptionHandlers(
2813 tree.getRoot(), tryStart, tryEnd, pos2, code.get());
2814 code->addException(
2815 tryStart, tryEnd, pos1,
2816 rtl::OString(
2817 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Exception")(&("com/sun/star/uno/Exception")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/Exception") / sizeof (("com/sun/star/uno/Exception"
)[0]))-1)
));
2818 dependencies->insert(
2819 rtl::OString(
2820 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Exception")(&("com/sun/star/uno/Exception")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/Exception") / sizeof (("com/sun/star/uno/Exception"
)[0]))-1)
));
2821 stack = std::max< sal_uInt16 >(stack, 4);
2822 }
2823 code->setMaxStackAndLocals(stack, localIndex);
2824 classFile->addMethod(
2825 access, methodName, desc.getDescriptor(), code.get(), exc,
2826 desc.getSignature());
2827}
2828
2829void handleService(
2830 TypeManager const & manager, JavaOptions /*TODO const*/ & options,
2831 typereg::Reader const & reader, Dependencies * dependencies)
2832{
2833 OSL_ASSERT(dependencies != 0)do { if (true && (!(dependencies != 0))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "2833" ": "), "OSL_ASSERT: %s", "dependencies != 0"); } }
while (false)
;
2834 sal_uInt16 superTypes = reader.getSuperTypeCount();
2835 sal_uInt16 methods = reader.getMethodCount();
2836 if (superTypes == 0
2837 ? methods != 0
2838 : (superTypes != 1 || reader.getFieldCount() != 0
2839 || reader.getReferenceCount() != 0))
2840 {
2841 throw CannotDumpException(
2842 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
));
2843 //TODO
2844 }
2845 if (superTypes == 0) {
2846 return;
2847 }
2848 rtl::OString unoName(codemaker::convertString(reader.getTypeName()));
2849 rtl::OString className(
2850 translateUnoTypeToJavaFullyQualifiedName(
2851 unoName, rtl::OString(RTL_CONSTASCII_STRINGPARAM("service")(&("service")[0]), ((sal_Int32)(sizeof ("service") / sizeof
(("service")[0]))-1)
)));
2852 unoName = unoName.replace('/', '.');
2853 SAL_WNODEPRECATED_DECLARATIONS_PUSH
2854 std::auto_ptr< ClassFile > cf(
2855 new ClassFile(
2856 static_cast< ClassFile::AccessFlags >(
2857 ClassFile::ACC_PUBLIC | ClassFile::ACC_FINAL
2858 | ClassFile::ACC_SUPER),
2859 className,
2860 rtl::OString(RTL_CONSTASCII_STRINGPARAM("java/lang/Object")(&("java/lang/Object")[0]), ((sal_Int32)(sizeof ("java/lang/Object"
) / sizeof (("java/lang/Object")[0]))-1)
),
2861 rtl::OString()));
2862 SAL_WNODEPRECATED_DECLARATIONS_POP
2863 if (methods > 0) {
2864 rtl::OString base(codemaker::convertString(
2865 reader.getSuperTypeName(0)));
2866 rtl::OString realJavaBaseName(base.replace('/', '.'));
2867 dependencies->insert(base);
2868 dependencies->insert(
2869 rtl::OString(
2870 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/lang/XMultiComponentFactory")[0]), ((sal_Int32
)(sizeof ("com/sun/star/lang/XMultiComponentFactory") / sizeof
(("com/sun/star/lang/XMultiComponentFactory")[0]))-1)
2871 "com/sun/star/lang/XMultiComponentFactory")(&("com/sun/star/lang/XMultiComponentFactory")[0]), ((sal_Int32
)(sizeof ("com/sun/star/lang/XMultiComponentFactory") / sizeof
(("com/sun/star/lang/XMultiComponentFactory")[0]))-1)
));
2872 dependencies->insert(
2873 rtl::OString(
2874 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
2875 "com/sun/star/uno/DeploymentException")(&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
));
2876 dependencies->insert(
2877 rtl::OString(
2878 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/TypeClass")(&("com/sun/star/uno/TypeClass")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/TypeClass") / sizeof (("com/sun/star/uno/TypeClass"
)[0]))-1)
));
2879 dependencies->insert(
2880 rtl::OString(
2881 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/XComponentContext")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/XComponentContext") / sizeof (("com/sun/star/uno/XComponentContext"
)[0]))-1)
2882 "com/sun/star/uno/XComponentContext")(&("com/sun/star/uno/XComponentContext")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/XComponentContext") / sizeof (("com/sun/star/uno/XComponentContext"
)[0]))-1)
));
2883 for (sal_uInt16 i = 0; i < methods; ++i) {
2884 rtl::OString name(codemaker::convertString(
2885 reader.getMethodName(i)));
2886 bool defaultCtor = name.getLength() == 0;
2887 if (reader.getMethodFlags(i) != RT_MODE_TWOWAY
2888 || (reader.getMethodReturnTypeName(i) != "void")
2889 || (defaultCtor
2890 && (methods != 1 || reader.getMethodParameterCount(i) != 0
2891 || reader.getMethodExceptionCount(i) != 0)))
2892 {
2893 throw CannotDumpException(
2894 rtl::OString(
2895 RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
));
2896 //TODO
2897 }
2898 if (defaultCtor) {
2899 name = rtl::OString(RTL_CONSTASCII_STRINGPARAM("create")(&("create")[0]), ((sal_Int32)(sizeof ("create") / sizeof
(("create")[0]))-1)
);
2900 } else {
2901 name = codemaker::java::translateUnoToJavaIdentifier(
2902 name, rtl::OString(RTL_CONSTASCII_STRINGPARAM("method")(&("method")[0]), ((sal_Int32)(sizeof ("method") / sizeof
(("method")[0]))-1)
));
2903 }
2904 addConstructor(
2905 manager, realJavaBaseName, unoName, className, reader, i, name,
2906 base, defaultCtor, dependencies, cf.get());
2907 }
2908 // Synthetic getFactory method:
2909 {
2910 SAL_WNODEPRECATED_DECLARATIONS_PUSH
2911 std::auto_ptr< ClassFile::Code > code(cf->newCode());
2912 SAL_WNODEPRECATED_DECLARATIONS_POP
2913 code->loadLocalReference(0);
2914 // stack: context
2915 code->instrInvokeinterface(
2916 rtl::OString(
2917 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/XComponentContext")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/XComponentContext") / sizeof (("com/sun/star/uno/XComponentContext"
)[0]))-1)
2918 "com/sun/star/uno/XComponentContext")(&("com/sun/star/uno/XComponentContext")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/XComponentContext") / sizeof (("com/sun/star/uno/XComponentContext"
)[0]))-1)
),
2919 rtl::OString(RTL_CONSTASCII_STRINGPARAM("getServiceManager")(&("getServiceManager")[0]), ((sal_Int32)(sizeof ("getServiceManager"
) / sizeof (("getServiceManager")[0]))-1)
),
2920 rtl::OString(
2921 RTL_CONSTASCII_STRINGPARAM((&("()Lcom/sun/star/lang/XMultiComponentFactory;")[0]), (
(sal_Int32)(sizeof ("()Lcom/sun/star/lang/XMultiComponentFactory;"
) / sizeof (("()Lcom/sun/star/lang/XMultiComponentFactory;")[
0]))-1)
2922 "()Lcom/sun/star/lang/XMultiComponentFactory;")(&("()Lcom/sun/star/lang/XMultiComponentFactory;")[0]), (
(sal_Int32)(sizeof ("()Lcom/sun/star/lang/XMultiComponentFactory;"
) / sizeof (("()Lcom/sun/star/lang/XMultiComponentFactory;")[
0]))-1)
),
2923 1);
2924 // stack: factory
2925 code->instrDup();
2926 // stack: factory factory
2927 ClassFile::Code::Branch branch = code->instrIfnull();
2928 // stack: factory
2929 code->instrAreturn();
2930 code->branchHere(branch);
2931 code->instrPop();
2932 // stack: -
2933 code->instrNew(
2934 rtl::OString(
2935 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
2936 "com/sun/star/uno/DeploymentException")(&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
));
2937 // stack: ex
2938 code->instrDup();
2939 // stack: ex ex
2940 code->loadStringConstant(
2941 rtl::OString(
2942 RTL_CONSTASCII_STRINGPARAM((&("component context fails to supply service manager")[0
]), ((sal_Int32)(sizeof ("component context fails to supply service manager"
) / sizeof (("component context fails to supply service manager"
)[0]))-1)
2943 "component context fails to supply service manager")(&("component context fails to supply service manager")[0
]), ((sal_Int32)(sizeof ("component context fails to supply service manager"
) / sizeof (("component context fails to supply service manager"
)[0]))-1)
));
2944 // stack: ex ex "..."
2945 code->loadLocalReference(0);
2946 // stack: ex ex "..." context
2947 code->instrInvokespecial(
2948 rtl::OString(
2949 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
2950 "com/sun/star/uno/DeploymentException")(&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
),
2951 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
2952 rtl::OString(
2953 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;Ljava/lang/Object;)V")[0]), ((sal_Int32
)(sizeof ("(Ljava/lang/String;Ljava/lang/Object;)V") / sizeof
(("(Ljava/lang/String;Ljava/lang/Object;)V")[0]))-1)
2954 "(Ljava/lang/String;Ljava/lang/Object;)V")(&("(Ljava/lang/String;Ljava/lang/Object;)V")[0]), ((sal_Int32
)(sizeof ("(Ljava/lang/String;Ljava/lang/Object;)V") / sizeof
(("(Ljava/lang/String;Ljava/lang/Object;)V")[0]))-1)
));
2955 // stack: ex
2956 code->instrAthrow();
2957 code->setMaxStackAndLocals(4, 1);
2958 cf->addMethod(
2959 static_cast< ClassFile::AccessFlags >(
2960 ClassFile::ACC_PRIVATE | ClassFile::ACC_STATIC
2961 | ClassFile::ACC_SYNTHETIC),
2962 rtl::OString(RTL_CONSTASCII_STRINGPARAM("$getFactory")(&("$getFactory")[0]), ((sal_Int32)(sizeof ("$getFactory"
) / sizeof (("$getFactory")[0]))-1)
),
2963 rtl::OString(
2964 RTL_CONSTASCII_STRINGPARAM((&("(Lcom/sun/star/uno/XComponentContext;)" "Lcom/sun/star/lang/XMultiComponentFactory;"
)[0]), ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/XComponentContext;)"
"Lcom/sun/star/lang/XMultiComponentFactory;") / sizeof (("(Lcom/sun/star/uno/XComponentContext;)"
"Lcom/sun/star/lang/XMultiComponentFactory;")[0]))-1)
2965 "(Lcom/sun/star/uno/XComponentContext;)"(&("(Lcom/sun/star/uno/XComponentContext;)" "Lcom/sun/star/lang/XMultiComponentFactory;"
)[0]), ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/XComponentContext;)"
"Lcom/sun/star/lang/XMultiComponentFactory;") / sizeof (("(Lcom/sun/star/uno/XComponentContext;)"
"Lcom/sun/star/lang/XMultiComponentFactory;")[0]))-1)
2966 "Lcom/sun/star/lang/XMultiComponentFactory;")(&("(Lcom/sun/star/uno/XComponentContext;)" "Lcom/sun/star/lang/XMultiComponentFactory;"
)[0]), ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/XComponentContext;)"
"Lcom/sun/star/lang/XMultiComponentFactory;") / sizeof (("(Lcom/sun/star/uno/XComponentContext;)"
"Lcom/sun/star/lang/XMultiComponentFactory;")[0]))-1)
),
2967 code.get(), std::vector< rtl::OString >(), rtl::OString());
2968 }
2969 // Synthetic castInstance method:
2970 {
2971 SAL_WNODEPRECATED_DECLARATIONS_PUSH
2972 std::auto_ptr< ClassFile::Code > code(cf->newCode());
2973 SAL_WNODEPRECATED_DECLARATIONS_POP
2974 code->instrNew(
2975 rtl::OString(
2976 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Type")(&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
));
2977 // stack: type
2978 code->instrDup();
2979 // stack: type type
2980 code->loadStringConstant(realJavaBaseName);
2981 // stack: type type "..."
2982 code->instrGetstatic(
2983 rtl::OString(
2984 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/TypeClass")(&("com/sun/star/uno/TypeClass")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/TypeClass") / sizeof (("com/sun/star/uno/TypeClass"
)[0]))-1)
),
2985 rtl::OString(RTL_CONSTASCII_STRINGPARAM("INTERFACE")(&("INTERFACE")[0]), ((sal_Int32)(sizeof ("INTERFACE") / sizeof
(("INTERFACE")[0]))-1)
),
2986 rtl::OString(
2987 RTL_CONSTASCII_STRINGPARAM((&("Lcom/sun/star/uno/TypeClass;")[0]), ((sal_Int32)(sizeof
("Lcom/sun/star/uno/TypeClass;") / sizeof (("Lcom/sun/star/uno/TypeClass;"
)[0]))-1)
2988 "Lcom/sun/star/uno/TypeClass;")(&("Lcom/sun/star/uno/TypeClass;")[0]), ((sal_Int32)(sizeof
("Lcom/sun/star/uno/TypeClass;") / sizeof (("Lcom/sun/star/uno/TypeClass;"
)[0]))-1)
));
2989 // stack: type type "..." INTERFACE
2990 code->instrInvokespecial(
2991 rtl::OString(
2992 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Type")(&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
),
2993 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
2994 rtl::OString(
2995 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V")[0
]), ((sal_Int32)(sizeof ("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"
) / sizeof (("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"
)[0]))-1)
2996 "(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V")(&("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V")[0
]), ((sal_Int32)(sizeof ("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"
) / sizeof (("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"
)[0]))-1)
));
2997 // stack: type
2998 code->loadLocalReference(0);
2999 // stack: type instance
3000 code->instrInvokestatic(
3001 rtl::OString(
3002 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/UnoRuntime")(&("com/sun/star/uno/UnoRuntime")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/UnoRuntime") / sizeof (("com/sun/star/uno/UnoRuntime"
)[0]))-1)
),
3003 rtl::OString(RTL_CONSTASCII_STRINGPARAM("queryInterface")(&("queryInterface")[0]), ((sal_Int32)(sizeof ("queryInterface"
) / sizeof (("queryInterface")[0]))-1)
),
3004 rtl::OString(
3005 RTL_CONSTASCII_STRINGPARAM((&("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)" "Ljava/lang/Object;"
)[0]), ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"Ljava/lang/Object;") / sizeof (("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"Ljava/lang/Object;")[0]))-1)
3006 "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"(&("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)" "Ljava/lang/Object;"
)[0]), ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"Ljava/lang/Object;") / sizeof (("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"Ljava/lang/Object;")[0]))-1)
3007 "Ljava/lang/Object;")(&("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)" "Ljava/lang/Object;"
)[0]), ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"Ljava/lang/Object;") / sizeof (("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"Ljava/lang/Object;")[0]))-1)
));
3008 // stack: instance
3009 code->instrDup();
3010 // stack: instance instance
3011 ClassFile::Code::Branch branch = code->instrIfnull();
3012 // stack: instance
3013 code->instrAreturn();
3014 code->branchHere(branch);
3015 code->instrPop();
3016 // stack: -
3017 code->instrNew(
3018 rtl::OString(
3019 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
3020 "com/sun/star/uno/DeploymentException")(&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
));
3021 // stack: ex
3022 code->instrDup();
3023 // stack: ex ex
3024 rtl::OStringBuffer msg;
3025 msg.append(
3026 RTL_CONSTASCII_STRINGPARAM((&("component context fails to supply service ")[0]), ((sal_Int32
)(sizeof ("component context fails to supply service ") / sizeof
(("component context fails to supply service ")[0]))-1)
3027 "component context fails to supply service ")(&("component context fails to supply service ")[0]), ((sal_Int32
)(sizeof ("component context fails to supply service ") / sizeof
(("component context fails to supply service ")[0]))-1)
);
3028 msg.append(unoName);
3029 msg.append(RTL_CONSTASCII_STRINGPARAM(" of type ")(&(" of type ")[0]), ((sal_Int32)(sizeof (" of type ") / sizeof
((" of type ")[0]))-1)
);
3030 msg.append(realJavaBaseName);
3031 code->loadStringConstant(msg.makeStringAndClear());
3032 // stack: ex ex "..."
3033 code->loadLocalReference(1);
3034 // stack: ex ex "..." context
3035 code->instrInvokespecial(
3036 rtl::OString(
3037 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
3038 "com/sun/star/uno/DeploymentException")(&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
),
3039 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
3040 rtl::OString(
3041 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;Ljava/lang/Object;)V")[0]), ((sal_Int32
)(sizeof ("(Ljava/lang/String;Ljava/lang/Object;)V") / sizeof
(("(Ljava/lang/String;Ljava/lang/Object;)V")[0]))-1)
3042 "(Ljava/lang/String;Ljava/lang/Object;)V")(&("(Ljava/lang/String;Ljava/lang/Object;)V")[0]), ((sal_Int32
)(sizeof ("(Ljava/lang/String;Ljava/lang/Object;)V") / sizeof
(("(Ljava/lang/String;Ljava/lang/Object;)V")[0]))-1)
));
3043 // stack: ex
3044 code->instrAthrow();
3045 code->setMaxStackAndLocals(4, 2);
3046 cf->addMethod(
3047 static_cast< ClassFile::AccessFlags >(
3048 ClassFile::ACC_PRIVATE | ClassFile::ACC_STATIC
3049 | ClassFile::ACC_SYNTHETIC),
3050 rtl::OString(RTL_CONSTASCII_STRINGPARAM("$castInstance")(&("$castInstance")[0]), ((sal_Int32)(sizeof ("$castInstance"
) / sizeof (("$castInstance")[0]))-1)
),
3051 rtl::OString(
3052 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/Object;Lcom/sun/star/uno/" "XComponentContext;)Ljava/lang/Object;"
)[0]), ((sal_Int32)(sizeof ("(Ljava/lang/Object;Lcom/sun/star/uno/"
"XComponentContext;)Ljava/lang/Object;") / sizeof (("(Ljava/lang/Object;Lcom/sun/star/uno/"
"XComponentContext;)Ljava/lang/Object;")[0]))-1)
3053 "(Ljava/lang/Object;Lcom/sun/star/uno/"(&("(Ljava/lang/Object;Lcom/sun/star/uno/" "XComponentContext;)Ljava/lang/Object;"
)[0]), ((sal_Int32)(sizeof ("(Ljava/lang/Object;Lcom/sun/star/uno/"
"XComponentContext;)Ljava/lang/Object;") / sizeof (("(Ljava/lang/Object;Lcom/sun/star/uno/"
"XComponentContext;)Ljava/lang/Object;")[0]))-1)
3054 "XComponentContext;)Ljava/lang/Object;")(&("(Ljava/lang/Object;Lcom/sun/star/uno/" "XComponentContext;)Ljava/lang/Object;"
)[0]), ((sal_Int32)(sizeof ("(Ljava/lang/Object;Lcom/sun/star/uno/"
"XComponentContext;)Ljava/lang/Object;") / sizeof (("(Ljava/lang/Object;Lcom/sun/star/uno/"
"XComponentContext;)Ljava/lang/Object;")[0]))-1)
),
3055 code.get(), std::vector< rtl::OString >(), rtl::OString());
3056 }
3057 }
3058 writeClassFile(options, className, *cf.get());
3059}
3060
3061void handleSingleton(
3062 TypeManager const & manager, JavaOptions /*TODO const*/ & options,
3063 typereg::Reader const & reader, Dependencies * dependencies)
3064{
3065 OSL_ASSERT(dependencies != 0)do { if (true && (!(dependencies != 0))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "3065" ": "), "OSL_ASSERT: %s", "dependencies != 0"); } }
while (false)
;
3066 if (reader.getSuperTypeCount() != 1 || reader.getFieldCount() != 0
3067 || reader.getMethodCount() != 0 || reader.getReferenceCount() != 0)
3068 {
3069 throw CannotDumpException(
3070 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
));
3071 //TODO
3072 }
3073 rtl::OString base(codemaker::convertString(reader.getSuperTypeName(0)));
3074 rtl::OString realJavaBaseName(base.replace('/', '.'));
3075 switch (manager.getTypeReader(base).getTypeClass()) {
3076 case RT_TYPE_INTERFACE:
3077 break;
3078
3079 case RT_TYPE_SERVICE:
3080 return;
3081
3082 default:
3083 throw CannotDumpException(
3084 rtl::OString(RTL_CONSTASCII_STRINGPARAM("Bad type information")(&("Bad type information")[0]), ((sal_Int32)(sizeof ("Bad type information"
) / sizeof (("Bad type information")[0]))-1)
));
3085 //TODO
3086 }
3087 dependencies->insert(base);
3088 rtl::OString unoName(codemaker::convertString(reader.getTypeName()));
3089 rtl::OString className(
3090 translateUnoTypeToJavaFullyQualifiedName(
3091 unoName, rtl::OString(RTL_CONSTASCII_STRINGPARAM("singleton")(&("singleton")[0]), ((sal_Int32)(sizeof ("singleton") / sizeof
(("singleton")[0]))-1)
)));
3092 unoName = unoName.replace('/', '.');
3093 dependencies->insert(
3094 rtl::OString(
3095 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
3096 "com/sun/star/uno/DeploymentException")(&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
));
3097 dependencies->insert(
3098 rtl::OString(RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/TypeClass")(&("com/sun/star/uno/TypeClass")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/TypeClass") / sizeof (("com/sun/star/uno/TypeClass"
)[0]))-1)
));
3099 dependencies->insert(
3100 rtl::OString(
3101 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/XComponentContext")(&("com/sun/star/uno/XComponentContext")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/XComponentContext") / sizeof (("com/sun/star/uno/XComponentContext"
)[0]))-1)
));
3102 SAL_WNODEPRECATED_DECLARATIONS_PUSH
3103 std::auto_ptr< ClassFile > cf(
3104 new ClassFile(
3105 static_cast< ClassFile::AccessFlags >(
3106 ClassFile::ACC_PUBLIC | ClassFile::ACC_FINAL
3107 | ClassFile::ACC_SUPER),
3108 className,
3109 rtl::OString(RTL_CONSTASCII_STRINGPARAM("java/lang/Object")(&("java/lang/Object")[0]), ((sal_Int32)(sizeof ("java/lang/Object"
) / sizeof (("java/lang/Object")[0]))-1)
),
3110 rtl::OString()));
3111 SAL_WNODEPRECATED_DECLARATIONS_POP
3112 MethodDescriptor desc(manager, dependencies, base, 0, 0);
3113 desc.addParameter(
3114 rtl::OString(
3115 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/XComponentContext")(&("com/sun/star/uno/XComponentContext")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/XComponentContext") / sizeof (("com/sun/star/uno/XComponentContext"
)[0]))-1)
),
3116 false, false, 0);
3117 SAL_WNODEPRECATED_DECLARATIONS_PUSH
3118 std::auto_ptr< ClassFile::Code > code(cf->newCode());
3119 SAL_WNODEPRECATED_DECLARATIONS_POP
3120 code->loadLocalReference(0);
3121 // stack: context
3122 code->loadStringConstant(
3123 rtl::OString(RTL_CONSTASCII_STRINGPARAM("/singletons/")(&("/singletons/")[0]), ((sal_Int32)(sizeof ("/singletons/"
) / sizeof (("/singletons/")[0]))-1)
) + unoName);
3124 // stack: context "..."
3125 code->instrInvokeinterface(
3126 rtl::OString(
3127 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/XComponentContext")(&("com/sun/star/uno/XComponentContext")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/XComponentContext") / sizeof (("com/sun/star/uno/XComponentContext"
)[0]))-1)
),
3128 rtl::OString(RTL_CONSTASCII_STRINGPARAM("getValueByName")(&("getValueByName")[0]), ((sal_Int32)(sizeof ("getValueByName"
) / sizeof (("getValueByName")[0]))-1)
),
3129 rtl::OString(
3130 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;)Ljava/lang/Object;")[0]), ((sal_Int32
)(sizeof ("(Ljava/lang/String;)Ljava/lang/Object;") / sizeof (
("(Ljava/lang/String;)Ljava/lang/Object;")[0]))-1)
3131 "(Ljava/lang/String;)Ljava/lang/Object;")(&("(Ljava/lang/String;)Ljava/lang/Object;")[0]), ((sal_Int32
)(sizeof ("(Ljava/lang/String;)Ljava/lang/Object;") / sizeof (
("(Ljava/lang/String;)Ljava/lang/Object;")[0]))-1)
),
3132 2);
3133 // stack: value
3134 code->instrDup();
3135 // stack: value value
3136 code->instrInstanceof(
3137 rtl::OString(RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Any")(&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
));
3138 // stack: value 0/1
3139 ClassFile::Code::Branch branch1 = code->instrIfeq();
3140 // stack: value
3141 code->instrCheckcast(
3142 rtl::OString(RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Any")(&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
));
3143 // stack: value
3144 code->instrDup();
3145 // stack: value value
3146 code->instrInvokevirtual(
3147 rtl::OString(RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Any")(&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
),
3148 rtl::OString(RTL_CONSTASCII_STRINGPARAM("getType")(&("getType")[0]), ((sal_Int32)(sizeof ("getType") / sizeof
(("getType")[0]))-1)
),
3149 rtl::OString(RTL_CONSTASCII_STRINGPARAM("()Lcom/sun/star/uno/Type;")(&("()Lcom/sun/star/uno/Type;")[0]), ((sal_Int32)(sizeof (
"()Lcom/sun/star/uno/Type;") / sizeof (("()Lcom/sun/star/uno/Type;"
)[0]))-1)
));
3150 // stack: value type
3151 code->instrInvokevirtual(
3152 rtl::OString(RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Type")(&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
),
3153 rtl::OString(RTL_CONSTASCII_STRINGPARAM("getTypeClass")(&("getTypeClass")[0]), ((sal_Int32)(sizeof ("getTypeClass"
) / sizeof (("getTypeClass")[0]))-1)
),
3154 rtl::OString(
3155 RTL_CONSTASCII_STRINGPARAM("()Lcom/sun/star/uno/TypeClass;")(&("()Lcom/sun/star/uno/TypeClass;")[0]), ((sal_Int32)(sizeof
("()Lcom/sun/star/uno/TypeClass;") / sizeof (("()Lcom/sun/star/uno/TypeClass;"
)[0]))-1)
));
3156 // stack: value typeClass
3157 code->instrGetstatic(
3158 rtl::OString(RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/TypeClass")(&("com/sun/star/uno/TypeClass")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/TypeClass") / sizeof (("com/sun/star/uno/TypeClass"
)[0]))-1)
),
3159 rtl::OString(RTL_CONSTASCII_STRINGPARAM("INTERFACE")(&("INTERFACE")[0]), ((sal_Int32)(sizeof ("INTERFACE") / sizeof
(("INTERFACE")[0]))-1)
),
3160 rtl::OString(
3161 RTL_CONSTASCII_STRINGPARAM("Lcom/sun/star/uno/TypeClass;")(&("Lcom/sun/star/uno/TypeClass;")[0]), ((sal_Int32)(sizeof
("Lcom/sun/star/uno/TypeClass;") / sizeof (("Lcom/sun/star/uno/TypeClass;"
)[0]))-1)
));
3162 // stack: value typeClass INTERFACE
3163 ClassFile::Code::Branch branch2 = code->instrIfAcmpne();
3164 // stack: value
3165 code->instrInvokevirtual(
3166 rtl::OString(RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Any")(&("com/sun/star/uno/Any")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Any"
) / sizeof (("com/sun/star/uno/Any")[0]))-1)
),
3167 rtl::OString(RTL_CONSTASCII_STRINGPARAM("getObject")(&("getObject")[0]), ((sal_Int32)(sizeof ("getObject") / sizeof
(("getObject")[0]))-1)
),
3168 rtl::OString(RTL_CONSTASCII_STRINGPARAM("()Ljava/lang/Object;")(&("()Ljava/lang/Object;")[0]), ((sal_Int32)(sizeof ("()Ljava/lang/Object;"
) / sizeof (("()Ljava/lang/Object;")[0]))-1)
));
3169 // stack: value
3170 code->branchHere(branch1);
3171 code->instrNew(
3172 rtl::OString(RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Type")(&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
));
3173 // stack: value type
3174 code->instrDup();
3175 // stack: value type type
3176 code->loadStringConstant(realJavaBaseName);
3177 // stack: value type type "..."
3178 code->instrGetstatic(
3179 rtl::OString(RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/TypeClass")(&("com/sun/star/uno/TypeClass")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/TypeClass") / sizeof (("com/sun/star/uno/TypeClass"
)[0]))-1)
),
3180 rtl::OString(RTL_CONSTASCII_STRINGPARAM("INTERFACE")(&("INTERFACE")[0]), ((sal_Int32)(sizeof ("INTERFACE") / sizeof
(("INTERFACE")[0]))-1)
),
3181 rtl::OString(
3182 RTL_CONSTASCII_STRINGPARAM("Lcom/sun/star/uno/TypeClass;")(&("Lcom/sun/star/uno/TypeClass;")[0]), ((sal_Int32)(sizeof
("Lcom/sun/star/uno/TypeClass;") / sizeof (("Lcom/sun/star/uno/TypeClass;"
)[0]))-1)
));
3183 // stack: value type type "..." INTERFACE
3184 code->instrInvokespecial(
3185 rtl::OString(RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Type")(&("com/sun/star/uno/Type")[0]), ((sal_Int32)(sizeof ("com/sun/star/uno/Type"
) / sizeof (("com/sun/star/uno/Type")[0]))-1)
),
3186 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
3187 rtl::OString(
3188 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V")[0
]), ((sal_Int32)(sizeof ("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"
) / sizeof (("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"
)[0]))-1)
3189 "(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V")(&("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V")[0
]), ((sal_Int32)(sizeof ("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"
) / sizeof (("(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V"
)[0]))-1)
));
3190 // stack: value type
3191 code->instrSwap();
3192 // stack: type value
3193 code->instrInvokestatic(
3194 rtl::OString(RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/UnoRuntime")(&("com/sun/star/uno/UnoRuntime")[0]), ((sal_Int32)(sizeof
("com/sun/star/uno/UnoRuntime") / sizeof (("com/sun/star/uno/UnoRuntime"
)[0]))-1)
),
3195 rtl::OString(RTL_CONSTASCII_STRINGPARAM("queryInterface")(&("queryInterface")[0]), ((sal_Int32)(sizeof ("queryInterface"
) / sizeof (("queryInterface")[0]))-1)
),
3196 rtl::OString(
3197 RTL_CONSTASCII_STRINGPARAM((&("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)" "Ljava/lang/Object;"
)[0]), ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"Ljava/lang/Object;") / sizeof (("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"Ljava/lang/Object;")[0]))-1)
3198 "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"(&("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)" "Ljava/lang/Object;"
)[0]), ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"Ljava/lang/Object;") / sizeof (("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"Ljava/lang/Object;")[0]))-1)
3199 "Ljava/lang/Object;")(&("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)" "Ljava/lang/Object;"
)[0]), ((sal_Int32)(sizeof ("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"Ljava/lang/Object;") / sizeof (("(Lcom/sun/star/uno/Type;Ljava/lang/Object;)"
"Ljava/lang/Object;")[0]))-1)
));
3200 // stack: instance
3201 code->instrDup();
3202 // stack: instance instance
3203 ClassFile::Code::Branch branch3 = code->instrIfnull();
3204 // stack: instance
3205 code->instrCheckcast(base);
3206 // stack: instance
3207 code->instrAreturn();
3208 code->branchHere(branch2);
3209 code->branchHere(branch3);
3210 code->instrPop();
3211 // stack: -
3212 code->instrNew(
3213 rtl::OString(
3214 RTL_CONSTASCII_STRINGPARAM((&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
3215 "com/sun/star/uno/DeploymentException")(&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
));
3216 // stack: ex
3217 code->instrDup();
3218 // stack: ex ex
3219 rtl::OStringBuffer msg;
3220 msg.append(
3221 RTL_CONSTASCII_STRINGPARAM((&("component context fails to supply singleton ")[0]), (
(sal_Int32)(sizeof ("component context fails to supply singleton "
) / sizeof (("component context fails to supply singleton ")[
0]))-1)
3222 "component context fails to supply singleton ")(&("component context fails to supply singleton ")[0]), (
(sal_Int32)(sizeof ("component context fails to supply singleton "
) / sizeof (("component context fails to supply singleton ")[
0]))-1)
);
3223 msg.append(unoName);
3224 msg.append(RTL_CONSTASCII_STRINGPARAM(" of type ")(&(" of type ")[0]), ((sal_Int32)(sizeof (" of type ") / sizeof
((" of type ")[0]))-1)
);
3225 msg.append(realJavaBaseName);
3226 code->loadStringConstant(msg.makeStringAndClear());
3227 // stack: ex ex "..."
3228 code->loadLocalReference(0);
3229 // stack: ex ex "..." context
3230 code->instrInvokespecial(
3231 rtl::OString(
3232 RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/DeploymentException")(&("com/sun/star/uno/DeploymentException")[0]), ((sal_Int32
)(sizeof ("com/sun/star/uno/DeploymentException") / sizeof ((
"com/sun/star/uno/DeploymentException")[0]))-1)
),
3233 rtl::OString(RTL_CONSTASCII_STRINGPARAM("<init>")(&("<init>")[0]), ((sal_Int32)(sizeof ("<init>"
) / sizeof (("<init>")[0]))-1)
),
3234 rtl::OString(
3235 RTL_CONSTASCII_STRINGPARAM((&("(Ljava/lang/String;Ljava/lang/Object;)V")[0]), ((sal_Int32
)(sizeof ("(Ljava/lang/String;Ljava/lang/Object;)V") / sizeof
(("(Ljava/lang/String;Ljava/lang/Object;)V")[0]))-1)
3236 "(Ljava/lang/String;Ljava/lang/Object;)V")(&("(Ljava/lang/String;Ljava/lang/Object;)V")[0]), ((sal_Int32
)(sizeof ("(Ljava/lang/String;Ljava/lang/Object;)V") / sizeof
(("(Ljava/lang/String;Ljava/lang/Object;)V")[0]))-1)
));
3237 // stack: ex
3238 code->instrAthrow();
3239 code->setMaxStackAndLocals(5, 1);
3240 cf->addMethod(
3241 static_cast< ClassFile::AccessFlags >(
3242 ClassFile::ACC_PUBLIC | ClassFile::ACC_STATIC),
3243 rtl::OString(RTL_CONSTASCII_STRINGPARAM("get")(&("get")[0]), ((sal_Int32)(sizeof ("get") / sizeof (("get"
)[0]))-1)
), desc.getDescriptor(),
3244 code.get(), std::vector< rtl::OString >(), desc.getSignature());
3245 writeClassFile(options, className, *cf.get());
3246}
3247
3248}
3249
3250bool produceType(
3251 rtl::OString const & type, TypeManager const & manager,
3252 codemaker::GeneratedTypeSet & generated, JavaOptions * options)
3253{
3254 OSL_ASSERT(options != 0)do { if (true && (!(options != 0))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "3254" ": "), "OSL_ASSERT: %s", "options != 0"); } } while
(false)
;
3255 if (type.equals("/")
3256 || type.equals(manager.getBase())
3257 || generated.contains(type))
3258 {
3259 return true;
3260 }
3261 sal_Bool extra = sal_False((sal_Bool)0);
3262 typereg::Reader reader(manager.getTypeReader(type, &extra));
3263 if (extra) {
3264 generated.add(type);
3265 return true;
3266 }
3267 if (!reader.isValid()) {
3268 return false;
3269 }
3270
3271 handleUnoTypeRegistryEntityFunction handler;
3272 switch (reader.getTypeClass()) {
3273 case RT_TYPE_ENUM:
3274 handler = handleEnumType;
3275 break;
3276
3277 case RT_TYPE_STRUCT:
3278 case RT_TYPE_EXCEPTION:
3279 handler = handleAggregatingType;
3280 break;
3281
3282 case RT_TYPE_INTERFACE:
3283 handler = handleInterfaceType;
3284 break;
3285
3286 case RT_TYPE_TYPEDEF:
3287 handler = handleTypedef;
3288 break;
3289
3290 case RT_TYPE_CONSTANTS:
3291 handler = handleConstantGroup;
3292 break;
3293
3294 case RT_TYPE_MODULE:
3295 handler = handleModule;
3296 break;
3297
3298 case RT_TYPE_SERVICE:
3299 handler = handleService;
3300 break;
3301
3302 case RT_TYPE_SINGLETON:
3303 handler = handleSingleton;
3304 break;
3305
3306 default:
3307 return false;
3308 }
3309 Dependencies deps;
3310 handler(manager, *options, reader, &deps);
3311 generated.add(type);
3312 if (!options->isValid(rtl::OString(RTL_CONSTASCII_STRINGPARAM("-nD")(&("-nD")[0]), ((sal_Int32)(sizeof ("-nD") / sizeof (("-nD"
)[0]))-1)
))) {
3313 for (Dependencies::iterator i(deps.begin()); i != deps.end(); ++i) {
3314 if (!produceType(*i, manager, generated, options)) {
3315 return false;
3316 }
3317 }
3318 }
3319 return true;
3320}
3321
3322bool produceType(
3323 RegistryKey & rTypeKey, bool bIsExtraType, TypeManager const & manager,
3324 codemaker::GeneratedTypeSet & generated, JavaOptions * options)
3325{
3326 ::rtl::OString typeName = manager.getTypeName(rTypeKey);
3327
3328 OSL_ASSERT(options != 0)do { if (true && (!(options != 0))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/usr/local/src/libreoffice/codemaker/source/javamaker/javatype.cxx"
":" "3328" ": "), "OSL_ASSERT: %s", "options != 0"); } } while
(false)
;
3329 if (typeName.equals("/")
3330 || typeName.equals(manager.getBase())
3331 || generated.contains(typeName))
3332 {
3333 return true;
3334 }
3335 typereg::Reader reader(manager.getTypeReader(rTypeKey));
3336 if (bIsExtraType) {
3337 generated.add(typeName);
3338 return true;
3339 }
3340 if (!reader.isValid()) {
3341 return false;
3342 }
3343 handleUnoTypeRegistryEntityFunction handler;
3344 switch (reader.getTypeClass()) {
3345 case RT_TYPE_ENUM:
3346 handler = handleEnumType;
3347 break;
3348
3349 case RT_TYPE_STRUCT:
3350 case RT_TYPE_EXCEPTION:
3351 handler = handleAggregatingType;
3352 break;
3353
3354 case RT_TYPE_INTERFACE:
3355 handler = handleInterfaceType;
3356 break;
3357
3358 case RT_TYPE_TYPEDEF:
3359 handler = handleTypedef;
3360 break;
3361
3362 case RT_TYPE_CONSTANTS:
3363 handler = handleConstantGroup;
3364 break;
3365
3366 case RT_TYPE_MODULE:
3367 handler = handleModule;
3368 break;
3369
3370 case RT_TYPE_SERVICE:
3371 handler = handleService;
3372 break;
3373
3374 case RT_TYPE_SINGLETON:
3375 handler = handleSingleton;
3376 break;
3377
3378 default:
3379 return false;
3380 }
3381 Dependencies deps;
3382 handler(manager, *options, reader, &deps);
3383 generated.add(typeName);
3384 if (!options->isValid(rtl::OString(RTL_CONSTASCII_STRINGPARAM("-nD")(&("-nD")[0]), ((sal_Int32)(sizeof ("-nD") / sizeof (("-nD"
)[0]))-1)
))) {
3385 for (Dependencies::iterator i(deps.begin()); i != deps.end(); ++i) {
3386 if (!produceType(*i, manager, generated, options)) {
3387 return false;
3388 }
3389 }
3390 }
3391 return true;
3392}
3393
3394/* vim:set shiftwidth=4 softtabstop=4 expandtab: */