[Libreoffice-commits] core.git: 3 commits - codemaker/inc codemaker/README codemaker/source jurt/CustomTarget_test_urp.mk ridljar/CustomTarget_javamaker.mk testtools/CustomTarget_bridgetest_javamaker.mk unodevtools/source unoil/CustomTarget_javamaker.mk

Stephan Bergmann sbergman at redhat.com
Thu Apr 11 00:30:09 PDT 2013


 codemaker/README                                   |   32 
 codemaker/inc/codemaker/commonjava.hxx             |    4 
 codemaker/inc/codemaker/typemanager.hxx            |   15 
 codemaker/source/codemaker/typemanager.cxx         |  121 
 codemaker/source/commonjava/commonjava.cxx         |   22 
 codemaker/source/cppumaker/cpputype.cxx            |   10 
 codemaker/source/javamaker/javamaker.cxx           |  269 --
 codemaker/source/javamaker/javaoptions.cxx         |   26 
 codemaker/source/javamaker/javatype.cxx            | 2712 ++++++++++-----------
 codemaker/source/javamaker/javatype.hxx            |   15 
 jurt/CustomTarget_test_urp.mk                      |    2 
 ridljar/CustomTarget_javamaker.mk                  |    2 
 testtools/CustomTarget_bridgetest_javamaker.mk     |    2 
 unodevtools/source/skeletonmaker/javatypemaker.cxx |    2 
 unoil/CustomTarget_javamaker.mk                    |    2 
 15 files changed, 1542 insertions(+), 1694 deletions(-)

New commits:
commit fc02ae8f825b9325c3f3d6b690a1bffeb0520253
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Apr 11 09:27:11 2013 +0200

    [API CHANGE] WIP: Experimental new binary type.rdb format
    
    Make javamaker work on top of unoidl/ instead of registry/.
    
    API CHANGE: javamaker no longer supports the -B switch, as that is meaningless
    with the new format.  When reading from an old-format .rdb file, /UCR is hard-
    coded as the prefix now.
    
    Change-Id: I8cca39f8ebacd0476934f7bd493d206928d063a9

diff --git a/codemaker/inc/codemaker/commonjava.hxx b/codemaker/inc/codemaker/commonjava.hxx
index 26c87e1..8ff0a9a 100644
--- a/codemaker/inc/codemaker/commonjava.hxx
+++ b/codemaker/inc/codemaker/commonjava.hxx
@@ -25,8 +25,8 @@
 namespace codemaker { namespace java {
 
 rtl::OString translateUnoToJavaType(
-    codemaker::UnoType::Sort sort, RTTypeClass typeClass,
-    rtl::OString const & nucleus, bool referenceType);
+    codemaker::UnoType::Sort sort, rtl::OString const & nucleus,
+    bool referenceType);
 
 rtl::OString translateUnoToJavaIdentifier(
     rtl::OString const & identifier, rtl::OString const & prefix);
diff --git a/codemaker/inc/codemaker/typemanager.hxx b/codemaker/inc/codemaker/typemanager.hxx
index 325a510..0d37693 100644
--- a/codemaker/inc/codemaker/typemanager.hxx
+++ b/codemaker/inc/codemaker/typemanager.hxx
@@ -79,15 +79,22 @@ public:
     sal_Int32 getSize() const { return m_t2TypeClass.size(); }
 
 
-    void loadProvider(rtl::OUString const & uri, bool primary);
+    void loadProvider(OUString const & uri, bool primary);
 
-    bool foundAtPrimaryProvider(rtl::OUString const & name) const;
+    bool foundAtPrimaryProvider(OUString const & name) const;
 
     codemaker::UnoType::Sort getSort(
-        rtl::OUString const & name,
-        rtl::Reference< unoidl::Entity > * entity = 0,
+        OUString const & name, rtl::Reference< unoidl::Entity > * entity = 0,
         rtl::Reference< unoidl::MapCursor > * cursor = 0) const;
 
+    codemaker::UnoType::Sort getSortResolveOuterSequences(
+        OUString const & name, OUString * nucleus, sal_Int32 * rank) const;
+
+    codemaker::UnoType::Sort getSortResolveAllSequencesTemplatesTypedefs(
+        OUString const & name, OUString * nucleus, sal_Int32 * rank,
+        std::vector< OUString > * arguments,
+        rtl::Reference< unoidl::Entity > * entity) const;
+
 private:
     virtual ~TypeManager();
 
diff --git a/codemaker/source/codemaker/typemanager.cxx b/codemaker/source/codemaker/typemanager.cxx
index 1c9a5ca..027eae2 100644
--- a/codemaker/source/codemaker/typemanager.cxx
+++ b/codemaker/source/codemaker/typemanager.cxx
@@ -20,6 +20,7 @@
 #include "sal/config.h"
 
 #include <cstdlib>
+#include <cstring>
 
 #include "rtl/alloc.h"
 #include "codemaker/typemanager.hxx"
@@ -344,7 +345,7 @@ bool TypeManager::foundAtPrimaryProvider(rtl::OUString const & name) const {
 }
 
 codemaker::UnoType::Sort TypeManager::getSort(
-    rtl::OUString const & name, rtl::Reference< unoidl::Entity > * entity,
+    OUString const & name, rtl::Reference< unoidl::Entity > * entity,
     rtl::Reference< unoidl::MapCursor > * cursor) const
 {
     if (name.isEmpty()) {
@@ -444,4 +445,122 @@ codemaker::UnoType::Sort TypeManager::getSort(
     }
 }
 
+codemaker::UnoType::Sort TypeManager::getSortResolveOuterSequences(
+    OUString const & name, OUString * nucleus, sal_Int32 * rank) const
+{
+    assert(nucleus != 0);
+    assert(rank != 0);
+    *nucleus = name;
+    *rank = 0;
+    while (nucleus->startsWith("[]")) {
+        ++rank;
+        *nucleus = nucleus->copy(std::strlen("[]"));
+    }
+    codemaker::UnoType::Sort s = getSort(*nucleus);
+    switch (s) {
+    case codemaker::UnoType::SORT_BOOLEAN:
+    case codemaker::UnoType::SORT_BYTE:
+    case codemaker::UnoType::SORT_SHORT:
+    case codemaker::UnoType::SORT_UNSIGNED_SHORT:
+    case codemaker::UnoType::SORT_LONG:
+    case codemaker::UnoType::SORT_UNSIGNED_LONG:
+    case codemaker::UnoType::SORT_HYPER:
+    case codemaker::UnoType::SORT_UNSIGNED_HYPER:
+    case codemaker::UnoType::SORT_FLOAT:
+    case codemaker::UnoType::SORT_DOUBLE:
+    case codemaker::UnoType::SORT_CHAR:
+    case codemaker::UnoType::SORT_STRING:
+    case codemaker::UnoType::SORT_TYPE:
+    case codemaker::UnoType::SORT_ANY:
+    case codemaker::UnoType::SORT_ENUM_TYPE:
+    case codemaker::UnoType::SORT_PLAIN_STRUCT_TYPE:
+    case codemaker::UnoType::SORT_INTERFACE_TYPE:
+    case codemaker::UnoType::SORT_TYPEDEF:
+        return s;
+    case codemaker::UnoType::SORT_SEQUENCE_TYPE:
+        assert(false); // this cannot happen
+        // fall through
+    default:
+        throw CannotDumpException(
+            "unexpected \"" + *nucleus + "\" resolved from \"" + name
+            + "\"in call to TypeManager::getSortResolveOuterSequences");
+    }
+}
+
+codemaker::UnoType::Sort
+TypeManager::getSortResolveAllSequencesTemplatesTypedefs(
+    OUString const & name, OUString * nucleus, sal_Int32 * rank,
+    std::vector< OUString > * arguments,
+    rtl::Reference< unoidl::Entity > * entity) const
+{
+    assert(nucleus != 0);
+    assert(rank != 0);
+    assert(arguments != 0);
+    arguments->clear();
+    std::vector< OString > args;
+    *nucleus = b2u(codemaker::UnoType::decompose(u2b(name), rank, &args));
+    for (;;) {
+        rtl::Reference< unoidl::Entity > ent;
+        codemaker::UnoType::Sort s = getSort(*nucleus, &ent);
+        if (args.empty()
+            != (s != codemaker::UnoType::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE))
+        {
+            throw CannotDumpException(
+                "syntax error, \"" + *nucleus + "\" resolved from \""
+                + name + "\"");
+        }
+        switch (s) {
+        case codemaker::UnoType::SORT_VOID:
+        case codemaker::UnoType::SORT_BOOLEAN:
+        case codemaker::UnoType::SORT_BYTE:
+        case codemaker::UnoType::SORT_SHORT:
+        case codemaker::UnoType::SORT_UNSIGNED_SHORT:
+        case codemaker::UnoType::SORT_LONG:
+        case codemaker::UnoType::SORT_UNSIGNED_LONG:
+        case codemaker::UnoType::SORT_HYPER:
+        case codemaker::UnoType::SORT_UNSIGNED_HYPER:
+        case codemaker::UnoType::SORT_FLOAT:
+        case codemaker::UnoType::SORT_DOUBLE:
+        case codemaker::UnoType::SORT_CHAR:
+        case codemaker::UnoType::SORT_STRING:
+        case codemaker::UnoType::SORT_TYPE:
+        case codemaker::UnoType::SORT_ANY:
+        case codemaker::UnoType::SORT_ENUM_TYPE:
+        case codemaker::UnoType::SORT_PLAIN_STRUCT_TYPE:
+        case codemaker::UnoType::SORT_INTERFACE_TYPE:
+            if (entity != 0) {
+                *entity = ent;
+            }
+            return s;
+        case codemaker::UnoType::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE:
+            if (entity != 0) {
+                *entity = ent;
+            }
+            for (std::vector< OString >::iterator i(args.begin());
+                 i != args.end(); ++i)
+            {
+                arguments->push_back(b2u(*i));
+            }
+            return
+                codemaker::UnoType::SORT_INSTANTIATED_POLYMORPHIC_STRUCT_TYPE;
+        case codemaker::UnoType::SORT_TYPEDEF:
+            *nucleus = dynamic_cast< unoidl::TypedefEntity * >(ent.get())->
+                getType();
+            while (nucleus->startsWith("[]")) {
+                ++*rank; //TODO: overflow
+                *nucleus = nucleus->copy(std::strlen("[]"));
+            }
+            break;
+        case codemaker::UnoType::SORT_SEQUENCE_TYPE:
+            assert(false); // this cannot happen
+            // fall through
+        default:
+            throw CannotDumpException(
+                "unexpected \"" + *nucleus + "\" resolved from \"" + name
+                + ("\"in call to TypeManager::"
+                   "getSortResolveAllSequencesTemplatesTypedefs"));
+        }
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/codemaker/source/commonjava/commonjava.cxx b/codemaker/source/commonjava/commonjava.cxx
index 8c8a630..84722d5 100644
--- a/codemaker/source/commonjava/commonjava.cxx
+++ b/codemaker/source/commonjava/commonjava.cxx
@@ -40,20 +40,10 @@
 namespace codemaker { namespace java {
 
 OString translateUnoToJavaType(
-    codemaker::UnoType::Sort sort, RTTypeClass typeClass,
-    OString const & nucleus, bool referenceType)
+    codemaker::UnoType::Sort sort, OString const & nucleus, bool referenceType)
 {
     OStringBuffer buf;
-    if (sort == codemaker::UnoType::SORT_COMPLEX) {
-        if (typeClass == RT_TYPE_INTERFACE && nucleus == "com/sun/star/uno/XInterface")
-        {
-            buf.append("java/lang/Object");
-        } else {
-            //TODO: check that nucleus is a valid (Java-modified UTF-8)
-            // identifier
-            buf.append(nucleus);
-        }
-    } else {
+    if (sort <= codemaker::UnoType::SORT_ANY) {
         OString const javaTypes[codemaker::UnoType::SORT_ANY + 1][2] = {
             { "void", "java/lang/Void" },
             { "boolean", "java/lang/Boolean" },
@@ -71,6 +61,14 @@ OString translateUnoToJavaType(
             { "com/sun/star/uno/Type", "com/sun/star/uno/Type" },
             { "java/lang/Object", "java/lang/Object" } };
         buf.append(javaTypes[sort][referenceType]);
+    } else {
+        if (nucleus == "com/sun/star/uno/XInterface") {
+            buf.append("java/lang/Object");
+        } else {
+            //TODO: check that nucleus is a valid (Java-modified UTF-8)
+            // identifier
+            buf.append(nucleus);
+        }
     }
     return buf.makeStringAndClear();
 }
diff --git a/codemaker/source/javamaker/javamaker.cxx b/codemaker/source/javamaker/javamaker.cxx
index c10406b..9250153 100644
--- a/codemaker/source/javamaker/javamaker.cxx
+++ b/codemaker/source/javamaker/javamaker.cxx
@@ -17,234 +17,87 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include "sal/config.h"
 
-#include <stdio.h>
+#include <cstdlib>
+#include <cstring>
+#include <iostream>
+#include <vector>
 
+#include "codemaker/generatedtypeset.hxx"
+#include "codemaker/typemanager.hxx"
 #include "rtl/ref.hxx"
+#include "rtl/string.hxx"
+#include "rtl/ustring.hxx"
 #include "sal/main.h"
+#include "sal/types.h"
+#include "unoidl/unoidl.hxx"
 
-#include "codemaker/typemanager.hxx"
-#include "codemaker/generatedtypeset.hxx"
 #include "javaoptions.hxx"
 #include "javatype.hxx"
 
-using ::rtl::OUString;
-using ::rtl::OString;
-sal_Bool produceAllTypes(RegistryKey& rTypeKey, sal_Bool bIsExtraType,
-                         rtl::Reference< TypeManager > const & typeMgr,
-                         codemaker::GeneratedTypeSet & generated,
-                         JavaOptions* pOptions,
-                         sal_Bool bFullScope)
-{
-    OString typeName = typeMgr->getTypeName(rTypeKey);
-
-    if (!produceType(rTypeKey, bIsExtraType, typeMgr, generated, pOptions))
-    {
-        fprintf(stderr, "%s ERROR: %s\n",
-                pOptions->getProgramName().getStr(),
-                OString("cannot dump Type '" + typeName + "'").getStr());
-        exit(99);
-    }
-
-    RegistryKeyList typeKeys = typeMgr->getTypeKeys(typeName);
-    RegistryKeyList::const_iterator iter = typeKeys.begin();
-    RegistryKey key, subKey;
-    RegistryKeyArray subKeys;
-
-    while (iter != typeKeys.end())
-    {
-        key = (*iter).first;
-
-        if (!(*iter).second  && !key.openSubKeys(OUString(), subKeys))
-        {
-            for (sal_uInt32 i = 0; i < subKeys.getLength(); i++)
-            {
-                subKey = subKeys.getElement(i);
-                if (bFullScope)
-                {
-                    if (!produceAllTypes(
-                            subKey, (*iter).second,
-                            typeMgr, generated, pOptions, sal_True))
-                        return sal_False;
-                } else
-                {
-                    if (!produceType(subKey, (*iter).second,
-                                     typeMgr, generated, pOptions))
-                        return sal_False;
-                }
-            }
+SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
+    JavaOptions options;
+    try {
+        if (!options.initOptions(argc, argv)) {
+            return EXIT_FAILURE;
         }
-
-        ++iter;
-    }
-
-    return sal_True;
-}
-
-sal_Bool produceAllTypes(const OString& typeName,
-                         rtl::Reference< TypeManager > const & typeMgr,
-                         codemaker::GeneratedTypeSet & generated,
-                         JavaOptions* pOptions,
-                         sal_Bool bFullScope)
-{
-    if (!produceType(typeName, typeMgr, generated, pOptions))
-    {
-        fprintf(stderr, "%s ERROR: %s\n",
-                pOptions->getProgramName().getStr(),
-                OString("cannot dump Type '" + typeName + "'").getStr());
-        exit(99);
+    } catch (IllegalArgument & e) {
+        std::cerr << "Illegal option " << e.m_message << '\n';
+        return EXIT_FAILURE;
     }
-
-    RegistryKeyList typeKeys = typeMgr->getTypeKeys(typeName);
-    RegistryKeyList::const_iterator iter = typeKeys.begin();
-    RegistryKey key, subKey;
-    RegistryKeyArray subKeys;
-
-    while (iter != typeKeys.end())
-    {
-        key = (*iter).first;
-        if (!(*iter).second  && !key.openSubKeys(OUString(), subKeys))
+    try {
+        rtl::Reference< TypeManager > typeMgr(new TypeManager);
+        if (!typeMgr->init(
+                options.getInputFiles(), options.getExtraInputFiles()))
         {
-            for (sal_uInt32 i = 0; i < subKeys.getLength(); i++)
-            {
-                subKey = subKeys.getElement(i);
-                if (bFullScope)
-                {
-                    if (!produceAllTypes(
-                            subKey, (*iter).second,
-                            typeMgr, generated, pOptions, sal_True))
-                        return sal_False;
-                } else
-                {
-                    if (!produceType(subKey, (*iter).second,
-                                     typeMgr, generated, pOptions))
-                        return sal_False;
-                }
-            }
+            std::cerr << "Initialization of registries failed\n";
+            return EXIT_FAILURE;
         }
-
-        ++iter;
-    }
-
-    return sal_True;
-}
-
-SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
-{
-    JavaOptions options;
-
-    try
-    {
-        if (!options.initOptions(argc, argv))
+        for (std::vector< rtl::OString >::const_iterator i(
+                 options.getExtraInputFiles().begin());
+             i != options.getExtraInputFiles().end(); ++i)
         {
-            exit(1);
+            typeMgr->loadProvider(b2u(*i), false);
         }
-    }
-    catch( IllegalArgument& e)
-    {
-        fprintf(stderr, "Illegal option: %s\n", e.m_message.getStr());
-        exit(99);
-    }
-
-    rtl::Reference< TypeManager > typeMgr(new TypeManager);
-
-    if (!typeMgr->init(options.getInputFiles(), options.getExtraInputFiles()))
-    {
-        fprintf(stderr, "%s : init registries failed, check your registry files.\n", options.getProgramName().getStr());
-        exit(99);
-    }
-
-    if (options.isValid("-B"))
-    {
-        typeMgr->setBase(options.getOption("-B"));
-    }
-
-    for (std::vector< rtl::OString >::const_iterator i(
-             options.getExtraInputFiles().begin());
-         i != options.getExtraInputFiles().end(); ++i)
-    {
-        typeMgr->loadProvider(b2u(*i), false);
-    }
-    for (std::vector< rtl::OString >::const_iterator i(
-             options.getInputFiles().begin());
-         i != options.getInputFiles().end(); ++i)
-    {
-        typeMgr->loadProvider(b2u(*i), true);
-    }
-
-    try
-    {
-        if (options.isValid("-T"))
+        for (std::vector< rtl::OString >::const_iterator i(
+                 options.getInputFiles().begin());
+             i != options.getInputFiles().end(); ++i)
         {
-            OString tOption(options.getOption("-T"));
-            sal_Int32 nIndex = 0;
-
-            codemaker::GeneratedTypeSet generated;
-            OString typeName, tmpName;
-            sal_Bool ret = sal_False;
-            do
-            {
-                typeName = tOption.getToken(0, ';', nIndex);
-
-                sal_Int32 nPos = typeName.lastIndexOf( '.' );
-                tmpName = typeName.copy( nPos != -1 ? nPos+1 : 0 );
-                if (tmpName == "*")
-                {
-                    // produce this type and his scope.
-                    if (typeName == "*")
-                    {
-                        tmpName = "/";
-                    } else
-                    {
-                        tmpName = typeName.copy(0, typeName.lastIndexOf('.')).replace('.', '/');
-                        if (tmpName.isEmpty())
-                            tmpName = "/";
-                        else
-                            tmpName = tmpName.replace('.', '/');
-                    }
-                    // related to task #116780# the scope is recursively
-                    // generated.  bFullScope = true
-                    ret = produceAllTypes(
-                        tmpName, typeMgr, generated, &options, sal_True);
-                } else
-                {
-                    // produce only this type
-                    ret = produceType(
-                        typeName.replace('.', '/'), typeMgr, generated,
-                        &options);
-                }
-
-                if (!ret)
-                {
-                    fprintf(stderr, "%s ERROR: %s\n",
-                            options.getProgramName().getStr(),
-                            OString("cannot dump Type '" + typeName + "'").getStr());
-                    exit(99);
+            typeMgr->loadProvider(b2u(*i), true);
+        }
+        codemaker::GeneratedTypeSet generated;
+        if (options.isValid("-T")) {
+            OUString names(b2u(options.getOption("-T")));
+            for (sal_Int32 i = 0; i != -1;) {
+                OUString name(names.getToken(0, ';', i));
+                if (!name.isEmpty()) {
+                    produce(
+                        (name == "*"
+                         ? ""
+                         : name.endsWith(".*")
+                         ? name.copy(0, name.getLength() - std::strlen(".*"))
+                         : name),
+                        typeMgr, generated, options);
                 }
-            } while( nIndex != -1 );
-        } else
-        {
-            // produce all types
-            codemaker::GeneratedTypeSet generated;
-            if (!produceAllTypes("/", typeMgr, generated, &options, sal_True))
-            {
-                fprintf(stderr, "%s ERROR: %s\n",
-                        options.getProgramName().getStr(),
-                        "an error occurs while dumping all types.");
-                exit(99);
             }
+        } else {
+            produce("", typeMgr, generated, options);
         }
     }
-    catch( CannotDumpException& e)
-    {
-        fprintf(stderr, "%s ERROR: %s\n",
-                options.getProgramName().getStr(),
-                u2b(e.getMessage()).getStr());
-        exit(99);
+    catch (CannotDumpException & e) {
+        std::cerr << "ERROR: " << e.getMessage() << '\n';
+        return EXIT_FAILURE;
+    } catch (unoidl::NoSuchFileException & e) {
+        std::cerr << "ERROR: No such file <" << e.getUri() << ">\n";
+        return EXIT_FAILURE;
+    } catch (unoidl::FileFormatException & e) {
+        std::cerr
+            << "ERROR: Bad format of <" << e.getUri() << ">, \""
+            << e.getDetail() << "\"\n";
+        return EXIT_FAILURE;
     }
-
-    return 0;
+    return EXIT_SUCCESS;
 }
 
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/codemaker/source/javamaker/javaoptions.cxx b/codemaker/source/javamaker/javaoptions.cxx
index fa90256..ef57eec 100644
--- a/codemaker/source/javamaker/javaoptions.cxx
+++ b/codemaker/source/javamaker/javaoptions.cxx
@@ -87,30 +87,6 @@ sal_Bool JavaOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile)
 
                     m_options["-O"] = OString(s);
                     break;
-                case 'B':
-                    if (av[i][2] == '\0')
-                    {
-                        if (i < ac - 1 && av[i+1][0] != '-')
-                        {
-                            i++;
-                            s = av[i];
-                        } else
-                        {
-                            OString tmp("'-B', please check");
-                            if (i <= ac - 1)
-                            {
-                                tmp += " your input '" + OString(av[i+1]) + "'";
-                            }
-
-                            throw IllegalArgument(tmp);
-                        }
-                    } else
-                    {
-                        s = av[i] + 2;
-                    }
-
-                    m_options["-B"] = OString(s);
-                    break;
                 case 'n':
                     if (av[i][2] != 'D' || av[i][3] != '\0')
                     {
@@ -273,8 +249,6 @@ OString JavaOptions::prepareHelp()
     help += "      [t1;...]   type and all dependent types are generated. If no '-T' option is \n";
     help += "                 specified, then output for all types is generated.\n";
     help += "                 Example: 'com.sun.star.uno.XInterface' is a valid type.\n";
-    help += "    -B<name>   = name specifies the base node. All types are searched under this\n";
-    help += "                 node. Default is the root '/' of the registry files.\n";
     help += "    -nD        = no dependent types are generated.\n";
     help += "    -G         = generate only target files which does not exists.\n";
     help += "    -Gc        = generate only target files which content will be changed.\n";
diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx
index 82c4f51..3766b71 100644
--- a/codemaker/source/javamaker/javatype.cxx
+++ b/codemaker/source/javamaker/javatype.cxx
@@ -17,11 +17,16 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include "sal/config.h"
 
-#include "javatype.hxx"
-
-#include "classfile.hxx"
-#include "javaoptions.hxx"
+#include <algorithm>
+#include <cassert>
+#include <list>
+#include <map>
+#include <memory>
+#include <set>
+#include <utility>
+#include <vector>
 
 #include "codemaker/exceptiontree.hxx"
 #include "codemaker/generatedtypeset.hxx"
@@ -30,86 +35,66 @@
 #include "codemaker/typemanager.hxx"
 #include "codemaker/unotype.hxx"
 #include "codemaker/commonjava.hxx"
-
-#include "osl/diagnose.h"
-#include "registry/reader.hxx"
-#include "registry/refltype.hxx"
-#include "registry/types.h"
 #include "rtl/ref.hxx"
 #include "rtl/strbuf.hxx"
-#include "rtl/string.h"
 #include "rtl/string.hxx"
-#include "rtl/textcvt.h"
-#include "rtl/textenc.h"
-#include "rtl/ustring.h"
+#include "rtl/ustrbuf.hxx"
 #include "rtl/ustring.hxx"
 #include "sal/types.h"
+#include "unoidl/unoidl.hxx"
 
-#include <algorithm>
-#include <list>
-#include <map>
-#include <memory>
-#include <set>
-#include <utility>
-#include <vector>
+#include "classfile.hxx"
+#include "javaoptions.hxx"
+#include "javatype.hxx"
 
 using codemaker::javamaker::ClassFile;
 
 namespace {
 
-// helper function for createUnoName
 void appendUnoName(
-    rtl::Reference< TypeManager > const & manager, rtl::OString const & nucleus, sal_Int32 rank,
-    std::vector< rtl::OString > const & arguments, rtl::OStringBuffer * buffer)
+    rtl::Reference< TypeManager > const & manager, OUString const & nucleus,
+    sal_Int32 rank, std::vector< OUString > const & arguments,
+    OUStringBuffer * buffer)
 {
-    OSL_ASSERT(rank >= 0 && buffer != 0);
-    for (sal_Int32 i = 0; i < rank; ++i) {
+    assert(manager.is());
+    assert(rank >= 0);
+    assert(buffer != 0);
+    for (sal_Int32 i = 0; i != rank; ++i) {
         buffer->append("[]");
     }
-    buffer->append(nucleus.replace('/', '.'));
+    buffer->append(nucleus);
     if (!arguments.empty()) {
         buffer->append('<');
-        for (std::vector< rtl::OString >::const_iterator i(arguments.begin());
+        for (std::vector< OUString >::const_iterator i(arguments.begin());
              i != arguments.end(); ++i)
         {
             if (i != arguments.begin()) {
                 buffer->append(',');
             }
-            RTTypeClass argTypeClass;
-            rtl::OString argNucleus;
-            sal_Int32 argRank;
-            std::vector< rtl::OString > argArgs;
-            codemaker::decomposeAndResolve(
-                manager, *i, true, false, false, &argTypeClass, &argNucleus,
-                &argRank, &argArgs);
-            appendUnoName(manager, argNucleus, argRank, argArgs, buffer);
+            OUString n;
+            sal_Int32 k;
+            std::vector< OUString > args;
+            manager->getSortResolveAllSequencesTemplatesTypedefs(
+                *i, &n, &k, &args, 0);
+            appendUnoName(manager, n, k, args, buffer);
         }
         buffer->append('>');
     }
 }
 
-// Translate the name of a UNO type registry entity (enum type, plain struct
-// type, polymorphic struct type template, or interface type, decomposed into
-// nucleus, rank, and arguments) into a core UNO type name:
-rtl::OString createUnoName(
-    rtl::Reference< TypeManager > const & manager, rtl::OString const & nucleus, sal_Int32 rank,
-    std::vector< rtl::OString > const & arguments)
+// Translate the name of a UNOIDL entity (enum type, plain struct type,
+// polymorphic struct type template, or interface type, decomposed into nucleus,
+// sequence rank, and template arguments) into a core UNO type name:
+OUString createUnoName(
+    rtl::Reference< TypeManager > const & manager, OUString const & nucleus,
+    sal_Int32 rank, std::vector< OUString > const & arguments)
 {
-    rtl::OStringBuffer buf;
+    OUStringBuffer buf;
     appendUnoName(manager, nucleus, rank, arguments, &buf);
     return buf.makeStringAndClear();
 }
 
-/**
-   Set of UTF-8--encoded names of UNO type registry entities a given UNO type
-   registry entity depends on.
-
-   UNO type registry entities are enum types, plain struct types, polymorphic
-   struct type templates, exception types, interface types, typedefs, modules,
-   constant groupds, single-interface--based services, accumulation-based
-   services, interface-based singletons, and service-based singletons.
- */
-typedef std::set< rtl::OString > Dependencies;
+typedef std::set< OUString > Dependencies;
 
 enum SpecialType {
     SPECIAL_TYPE_NONE,
@@ -122,12 +107,15 @@ bool isSpecialType(SpecialType special) {
     return special >= SPECIAL_TYPE_UNSIGNED;
 }
 
-rtl::OString translateUnoTypeToJavaFullyQualifiedName(
-    rtl::OString const & type, rtl::OString const & prefix)
+OString translateUnoidlEntityNameToJavaFullyQualifiedName(
+    OUString const & name, OString const & prefix)
 {
-    sal_Int32 i = type.lastIndexOf('/') + 1;
-    return type.copy(0, i) +
-        codemaker::java::translateUnoToJavaIdentifier(type.copy(i), prefix);
+    assert(!name.startsWith("[]"));
+    assert(name.indexOf('<') == -1);
+    sal_Int32 i = name.lastIndexOf('.') + 1;
+    return codemaker::convertString(name.copy(0, i)).replace('.', '/')
+        + codemaker::java::translateUnoToJavaIdentifier(
+            codemaker::convertString(name.copy(i)), prefix);
 }
 
 struct PolymorphicUnoType {
@@ -135,32 +123,37 @@ struct PolymorphicUnoType {
 
     enum Kind { KIND_NONE, KIND_STRUCT, KIND_SEQUENCE };
     Kind kind;
-    rtl::OString name;
+    OUString name;
 };
 
 SpecialType translateUnoTypeToDescriptor(
-    rtl::Reference< TypeManager > const & manager, rtl::OString const & type,
+    rtl::Reference< TypeManager > const & manager, OUString const & type,
     bool array, bool classType, Dependencies * dependencies,
-    rtl::OStringBuffer * descriptor, rtl::OStringBuffer * signature,
+    OStringBuffer * descriptor, OStringBuffer * signature,
     bool * needsSignature, PolymorphicUnoType * polymorphicUnoType);
 
 SpecialType translateUnoTypeToDescriptor(
     rtl::Reference< TypeManager > const & manager,
-    codemaker::UnoType::Sort sort, RTTypeClass typeClass,
-    rtl::OString const & nucleus, sal_Int32 rank,
-    std::vector< rtl::OString > const & arguments, bool array, bool classType,
-    Dependencies * dependencies, rtl::OStringBuffer * descriptor,
-    rtl::OStringBuffer * signature, bool * needsSignature,
+    codemaker::UnoType::Sort sort, OUString const & nucleus, sal_Int32 rank,
+    std::vector< OUString > const & arguments, bool array, bool classType,
+    Dependencies * dependencies, OStringBuffer * descriptor,
+    OStringBuffer * signature, bool * needsSignature,
     PolymorphicUnoType * polymorphicUnoType)
 {
-    OSL_ASSERT(rank >= 0 && (signature == 0) == (needsSignature == 0));
+    assert(rank >= 0);
+    assert((signature == 0) == (needsSignature == 0));
+    assert(
+        arguments.empty()
+        == (sort
+            != codemaker::UnoType::SORT_INSTANTIATED_POLYMORPHIC_STRUCT_TYPE));
     if (rank > 0xFF - (array ? 1 : 0)) {
-        throw CannotDumpException("Too many array dimensions for Java class file format");
+        throw CannotDumpException(
+            "Too many array dimensions for Java class file format");
     }
     if (array) {
         ++rank;
     }
-    for (sal_Int32 i = 0; i < rank; ++i) {
+    for (sal_Int32 i = 0; i != rank; ++i) {
         if (descriptor != 0) {
             descriptor->append('[');
         }
@@ -168,60 +161,38 @@ SpecialType translateUnoTypeToDescriptor(
             signature->append('[');
         }
     }
-    if (sort == codemaker::UnoType::SORT_COMPLEX) {
-        //TODO: check that nucleus is a valid (Java-modified UTF-8) identifier
-        if (typeClass == RT_TYPE_INTERFACE && nucleus == "com/sun/star/uno/XInterface")
+    if (polymorphicUnoType != 0) {
+        if (sort
+            == codemaker::UnoType::SORT_INSTANTIATED_POLYMORPHIC_STRUCT_TYPE)
         {
-            if (descriptor != 0) {
-                descriptor->append("Ljava/lang/Object;");
-            }
-            if (signature != 0) {
-                signature->append("Ljava/lang/Object;");
-            }
-            if (polymorphicUnoType != 0) {
-                polymorphicUnoType->kind = PolymorphicUnoType::KIND_NONE;
-            }
-            return SPECIAL_TYPE_INTERFACE;
+            polymorphicUnoType->kind = rank == 0
+                ? PolymorphicUnoType::KIND_STRUCT
+                : PolymorphicUnoType::KIND_SEQUENCE;
+            polymorphicUnoType->name = createUnoName(
+                manager, nucleus, rank, arguments);
         } else {
-            if (dependencies != 0) {
-                dependencies->insert(nucleus);
-            }
-            if (descriptor != 0) {
-                descriptor->append("L" + nucleus + ";");
-            }
-            if (signature != 0) {
-                signature->append("L" + nucleus);
-                if (!arguments.empty()) {
-                    signature->append('<');
-                    for (std::vector< rtl::OString >::const_iterator i(
-                             arguments.begin());
-                         i != arguments.end(); ++i)
-                    {
-                        translateUnoTypeToDescriptor(
-                            manager, *i, false, true, dependencies, 0,
-                            signature, needsSignature, 0);
-                    }
-                    signature->append('>');
-                    *needsSignature = true;
-                }
-                signature->append(';');
-            }
-            if (polymorphicUnoType != 0) {
-                if (arguments.empty()) {
-                    polymorphicUnoType->kind = PolymorphicUnoType::KIND_NONE;
-                } else {
-                    polymorphicUnoType->kind = rank == 0
-                        ? PolymorphicUnoType::KIND_STRUCT
-                        : PolymorphicUnoType::KIND_SEQUENCE;
-                    polymorphicUnoType->name = createUnoName(
-                        manager, nucleus, rank, arguments);
-                }
-            }
-            return SPECIAL_TYPE_NONE;
+            polymorphicUnoType->kind = PolymorphicUnoType::KIND_NONE;
         }
-    } else {
-        static rtl::OString const
-            simpleTypeDescriptors[codemaker::UnoType::SORT_ANY + 1][2] = {
+    }
+    switch (sort) {
+    case codemaker::UnoType::SORT_VOID:
+    case codemaker::UnoType::SORT_BOOLEAN:
+    case codemaker::UnoType::SORT_BYTE:
+    case codemaker::UnoType::SORT_SHORT:
+    case codemaker::UnoType::SORT_UNSIGNED_SHORT:
+    case codemaker::UnoType::SORT_LONG:
+    case codemaker::UnoType::SORT_UNSIGNED_LONG:
+    case codemaker::UnoType::SORT_HYPER:
+    case codemaker::UnoType::SORT_UNSIGNED_HYPER:
+    case codemaker::UnoType::SORT_FLOAT:
+    case codemaker::UnoType::SORT_DOUBLE:
+    case codemaker::UnoType::SORT_CHAR:
+    case codemaker::UnoType::SORT_STRING:
+    case codemaker::UnoType::SORT_TYPE:
+    case codemaker::UnoType::SORT_ANY:
+        {
+            static char const * const
+                simpleTypeDescriptors[codemaker::UnoType::SORT_ANY + 1][2] = {
                 { "V", "Ljava/lang/Void;" },
                 { "Z", "Ljava/lang/Boolean;" },
                 { "B", "Ljava/lang/Byte;" },
@@ -237,55 +208,98 @@ SpecialType translateUnoTypeToDescriptor(
                 { "Ljava/lang/String;", "Ljava/lang/String;" },
                 { "Lcom/sun/star/uno/Type;", "Lcom/sun/star/uno/Type;" },
                 { "Ljava/lang/Object;", "Ljava/lang/Object;" } };
-        rtl::OString const & s
-            = simpleTypeDescriptors[sort][rank == 0 && classType];
-        if (descriptor != 0) {
-            descriptor->append(s);
-        }
-        if (signature != 0) {
-            signature->append(s);
-        }
-        if (polymorphicUnoType != 0) {
-            polymorphicUnoType->kind = PolymorphicUnoType::KIND_NONE;
-        }
-        static SpecialType const
-            simpleTypeSpecials[codemaker::UnoType::SORT_ANY + 1] = {
+            char const * s
+                = simpleTypeDescriptors[sort][rank == 0 && classType];
+            if (descriptor != 0) {
+                descriptor->append(s);
+            }
+            if (signature != 0) {
+                signature->append(s);
+            }
+            static SpecialType const
+                simpleTypeSpecials[codemaker::UnoType::SORT_ANY + 1] = {
                 SPECIAL_TYPE_NONE, SPECIAL_TYPE_NONE, SPECIAL_TYPE_NONE,
                 SPECIAL_TYPE_NONE, SPECIAL_TYPE_UNSIGNED, SPECIAL_TYPE_NONE,
                 SPECIAL_TYPE_UNSIGNED, SPECIAL_TYPE_NONE, SPECIAL_TYPE_UNSIGNED,
                 SPECIAL_TYPE_NONE, SPECIAL_TYPE_NONE, SPECIAL_TYPE_NONE,
                 SPECIAL_TYPE_NONE, SPECIAL_TYPE_NONE, SPECIAL_TYPE_ANY };
-        return simpleTypeSpecials[sort];
+            return simpleTypeSpecials[sort];
+        }
+    case codemaker::UnoType::SORT_INTERFACE_TYPE:
+        if (nucleus == "com.sun.star.uno.XInterface") {
+            if (descriptor != 0) {
+                descriptor->append("Ljava/lang/Object;");
+            }
+            if (signature != 0) {
+                signature->append("Ljava/lang/Object;");
+            }
+            return SPECIAL_TYPE_INTERFACE;
+        }
+        // fall through
+    case codemaker::UnoType::SORT_SEQUENCE_TYPE:
+    case codemaker::UnoType::SORT_ENUM_TYPE:
+    case codemaker::UnoType::SORT_PLAIN_STRUCT_TYPE:
+    case codemaker::UnoType::SORT_INSTANTIATED_POLYMORPHIC_STRUCT_TYPE:
+        if (dependencies != 0) {
+            dependencies->insert(nucleus);
+        }
+        if (descriptor != 0) {
+            descriptor->append(
+                "L" + codemaker::convertString(nucleus).replace('.', '/')
+                + ";");
+        }
+        if (signature != 0) {
+            signature->append(
+                "L" + codemaker::convertString(nucleus).replace('.', '/'));
+            if (!arguments.empty()) {
+                signature->append('<');
+                for (std::vector< OUString >::const_iterator i(
+                         arguments.begin());
+                     i != arguments.end(); ++i)
+                {
+                    translateUnoTypeToDescriptor(
+                        manager, *i, false, true, dependencies, 0, signature,
+                        needsSignature, 0);
+                }
+                signature->append('>');
+                *needsSignature = true;
+            }
+            signature->append(';');
+        }
+        return SPECIAL_TYPE_NONE;
+    default:
+        throw CannotDumpException(
+            "unexpected nucleus \"" + nucleus
+            + "\" in call to translateUnoTypeToDescriptor");
     }
 }
 
 SpecialType translateUnoTypeToDescriptor(
-    rtl::Reference< TypeManager > const & manager, rtl::OString const & type,
+    rtl::Reference< TypeManager > const & manager, OUString const & type,
     bool array, bool classType, Dependencies * dependencies,
-    rtl::OStringBuffer * descriptor, rtl::OStringBuffer * signature,
+    OStringBuffer * descriptor, OStringBuffer * signature,
     bool * needsSignature, PolymorphicUnoType * polymorphicUnoType)
 {
-    RTTypeClass typeClass;
-    rtl::OString nucleus;
+    assert(manager.is());
+    OUString nucleus;
     sal_Int32 rank;
-    std::vector< rtl::OString > args;
-    codemaker::UnoType::Sort sort = codemaker::decomposeAndResolve(
-        manager, type, true, true, false, &typeClass, &nucleus, &rank, &args);
-    OSL_ASSERT(rank < SAL_MAX_INT32);
+    std::vector< OUString > args;
+    codemaker::UnoType::Sort sort = manager->
+        getSortResolveAllSequencesTemplatesTypedefs(
+            type, &nucleus, &rank, &args, 0);
     return translateUnoTypeToDescriptor(
-        manager, sort, typeClass, nucleus, rank, args, array, classType,
-        dependencies, descriptor, signature, needsSignature,
-        polymorphicUnoType);
+        manager, sort, nucleus, rank, args, array, classType, dependencies,
+        descriptor, signature, needsSignature, polymorphicUnoType);
 }
 
 SpecialType getFieldDescriptor(
     rtl::Reference< TypeManager > const & manager, Dependencies * dependencies,
-    rtl::OString const & type, rtl::OString * descriptor,
-    rtl::OString * signature, PolymorphicUnoType * polymorphicUnoType)
+    OUString const & type, OString * descriptor, OString * signature,
+    PolymorphicUnoType * polymorphicUnoType)
 {
-    OSL_ASSERT(dependencies != 0 && descriptor != 0);
-    rtl::OStringBuffer desc;
-    rtl::OStringBuffer sig;
+    assert(descriptor != 0);
+    OStringBuffer desc;
+    OStringBuffer sig;
     bool needsSig = false;
     SpecialType specialType = translateUnoTypeToDescriptor(
         manager, type, false, false, dependencies, &desc, &sig, &needsSig,
@@ -295,7 +309,7 @@ SpecialType getFieldDescriptor(
         if (needsSig) {
             *signature = sig.makeStringAndClear();
         } else {
-            *signature = rtl::OString();
+            *signature = OString();
         }
     }
     return specialType;
@@ -305,42 +319,42 @@ class MethodDescriptor {
 public:
     MethodDescriptor(
         rtl::Reference< TypeManager > const & manager,
-        Dependencies * dependencies, rtl::OString const & returnType,
+        Dependencies * dependencies, OUString const & returnType,
         SpecialType * specialReturnType,
         PolymorphicUnoType * polymorphicUnoType);
 
     SpecialType addParameter(
-        rtl::OString const & type, bool array, bool dependency,
+        OUString const & type, bool array, bool dependency,
         PolymorphicUnoType * polymorphicUnoType);
 
-    void addTypeParameter(rtl::OString const & name);
+    void addTypeParameter(OUString const & name);
 
-    rtl::OString getDescriptor() const;
+    OString getDescriptor() const;
 
-    rtl::OString getSignature() const;
+    OString getSignature() const;
 
 private:
     rtl::Reference< TypeManager > m_manager;
     Dependencies * m_dependencies;
-    rtl::OStringBuffer m_descriptorStart;
-    rtl::OString m_descriptorEnd;
-    rtl::OStringBuffer m_signatureStart;
-    rtl::OString m_signatureEnd;
+    OStringBuffer m_descriptorStart;
+    OString m_descriptorEnd;
+    OStringBuffer m_signatureStart;
+    OString m_signatureEnd;
     bool m_needsSignature;
 };
 
 MethodDescriptor::MethodDescriptor(
     rtl::Reference< TypeManager > const & manager, Dependencies * dependencies,
-    rtl::OString const & returnType, SpecialType * specialReturnType,
+    OUString const & returnType, SpecialType * specialReturnType,
     PolymorphicUnoType * polymorphicUnoType):
     m_manager(manager), m_dependencies(dependencies), m_needsSignature(false)
 {
-    OSL_ASSERT(dependencies != 0);
+    assert(dependencies != 0);
     m_descriptorStart.append('(');
     m_signatureStart.append('(');
-    rtl::OStringBuffer descEnd;
+    OStringBuffer descEnd;
     descEnd.append(')');
-    rtl::OStringBuffer sigEnd;
+    OStringBuffer sigEnd;
     sigEnd.append(')');
     SpecialType special = translateUnoTypeToDescriptor(
         m_manager, returnType, false, false, m_dependencies, &descEnd, &sigEnd,
@@ -353,7 +367,7 @@ MethodDescriptor::MethodDescriptor(
 }
 
 SpecialType MethodDescriptor::addParameter(
-    rtl::OString const & type, bool array, bool dependency,
+    OUString const & type, bool array, bool dependency,
     PolymorphicUnoType * polymorphicUnoType)
 {
     return translateUnoTypeToDescriptor(
@@ -362,24 +376,20 @@ SpecialType MethodDescriptor::addParameter(
         polymorphicUnoType);
 }
 
-void MethodDescriptor::addTypeParameter(OString const & name) {
+void MethodDescriptor::addTypeParameter(OUString const & name) {
     m_descriptorStart.append("Ljava/lang/Object;");
-    m_signatureStart.append("T" + name + ";");
+    m_signatureStart.append("T" + codemaker::convertString(name) + ";");
     m_needsSignature = true;
 }
 
-rtl::OString MethodDescriptor::getDescriptor() const {
-    rtl::OStringBuffer buf(m_descriptorStart);
+OString MethodDescriptor::getDescriptor() const {
+    OStringBuffer buf(m_descriptorStart);
     buf.append(m_descriptorEnd);
     return buf.makeStringAndClear();
 }
 
-rtl::OString MethodDescriptor::getSignature() const {
-    if (m_needsSignature) {
-        return m_signatureStart + m_signatureEnd;
-    } else {
-        return rtl::OString();
-    }
+OString MethodDescriptor::getSignature() const {
+    return m_needsSignature ?  m_signatureStart + m_signatureEnd : OString();
 }
 
 class TypeInfo {
@@ -388,25 +398,24 @@ public:
 
     // Same values as in com/sun/star/lib/uno/typeinfo/TypeInfo.java:
     enum Flags {
-        FLAG_READONLY = 0x008, FLAG_BOUND = 0x100, FLAG_ONEWAY = 0x010
+        FLAG_READONLY = 0x008, FLAG_BOUND = 0x100
     };
 
     // KIND_MEMBER:
     TypeInfo(
-        rtl::OString const & name, SpecialType specialType, sal_Int32 index,
+        OString const & name, SpecialType specialType, sal_Int32 index,
         PolymorphicUnoType const & polymorphicUnoType,
         sal_Int32 typeParameterIndex);
 
     // KIND_ATTRIBUTE/METHOD:
     TypeInfo(
-        Kind kind, rtl::OString const & name, SpecialType specialType,
-        Flags flags, sal_Int32 index,
-        PolymorphicUnoType const & polymorphicUnoType);
+        Kind kind, OString const & name, SpecialType specialType, Flags flags,
+        sal_Int32 index, PolymorphicUnoType const & polymorphicUnoType);
 
     // KIND_PARAMETER:
     TypeInfo(
-        rtl::OString const & parameterName, SpecialType specialType,
-        bool inParameter, bool outParameter, rtl::OString const & methodName,
+        OString const & parameterName, SpecialType specialType,
+        bool inParameter, bool outParameter, OString const & methodName,
         sal_Int32 index, PolymorphicUnoType const & polymorphicUnoType);
 
     sal_uInt16 generateCode(ClassFile::Code & code, Dependencies * dependencies)
@@ -417,10 +426,10 @@ public:
 
 private:
     Kind m_kind;
-    rtl::OString m_name;
+    OString m_name;
     sal_Int32 m_flags;
     sal_Int32 m_index;
-    rtl::OString m_methodName;
+    OString m_methodName;
     PolymorphicUnoType m_polymorphicUnoType;
     sal_Int32 m_typeParameterIndex;
 };
@@ -441,7 +450,7 @@ sal_Int32 translateSpecialTypeFlags(
 }
 
 TypeInfo::TypeInfo(
-    rtl::OString const & name, SpecialType specialType, sal_Int32 index,
+    OString const & name, SpecialType specialType, sal_Int32 index,
     PolymorphicUnoType const & polymorphicUnoType,
     sal_Int32 typeParameterIndex):
     m_kind(KIND_MEMBER), m_name(name),
@@ -449,26 +458,25 @@ TypeInfo::TypeInfo(
     m_index(index), m_polymorphicUnoType(polymorphicUnoType),
     m_typeParameterIndex(typeParameterIndex)
 {
-    OSL_ASSERT(
+    assert(
         polymorphicUnoType.kind == PolymorphicUnoType::KIND_NONE
         ? typeParameterIndex >= -1 : typeParameterIndex == -1);
 }
 
 TypeInfo::TypeInfo(
-    Kind kind, rtl::OString const & name, SpecialType specialType,
-    Flags flags, sal_Int32 index,
-    PolymorphicUnoType const & polymorphicUnoType):
+    Kind kind, OString const & name, SpecialType specialType, Flags flags,
+    sal_Int32 index, PolymorphicUnoType const & polymorphicUnoType):
     m_kind(kind), m_name(name),
     m_flags(flags | translateSpecialTypeFlags(specialType, false, false)),
     m_index(index), m_polymorphicUnoType(polymorphicUnoType)
 {
-    OSL_ASSERT(kind == KIND_ATTRIBUTE || kind == KIND_METHOD);
+    assert(kind == KIND_ATTRIBUTE || kind == KIND_METHOD);
 }
 
 TypeInfo::TypeInfo(
-    rtl::OString const & parameterName, SpecialType specialType,
-    bool inParameter, bool outParameter, rtl::OString const & methodName,
-    sal_Int32 index, PolymorphicUnoType const & polymorphicUnoType):
+    OString const & parameterName, SpecialType specialType, bool inParameter,
+    bool outParameter, OString const & methodName, sal_Int32 index,
+    PolymorphicUnoType const & polymorphicUnoType):
     m_kind(KIND_PARAMETER), m_name(parameterName),
     m_flags(translateSpecialTypeFlags(specialType, inParameter, outParameter)),
     m_index(index), m_methodName(methodName),
@@ -478,7 +486,6 @@ TypeInfo::TypeInfo(
 sal_uInt16 TypeInfo::generateCode(
     ClassFile::Code & code, Dependencies * dependencies) const
 {
-    OSL_ASSERT(dependencies != 0);
     switch (m_kind) {
     case KIND_MEMBER:
         code.instrNew("com/sun/star/lib/uno/typeinfo/MemberTypeInfo");
@@ -489,21 +496,23 @@ sal_uInt16 TypeInfo::generateCode(
         if (m_polymorphicUnoType.kind != PolymorphicUnoType::KIND_NONE) {
             generatePolymorphicUnoTypeCode(code, dependencies);
             code.loadIntegerConstant(m_typeParameterIndex);
-            code.instrInvokespecial("com/sun/star/lib/uno/typeinfo/MemberTypeInfo"
-                                   ,"<init>", "(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V");
+            code.instrInvokespecial(
+                "com/sun/star/lib/uno/typeinfo/MemberTypeInfo", "<init>",
+                "(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V");
             return 8;
         } else if (m_typeParameterIndex >= 0) {
             code.instrAconstNull();
             code.loadIntegerConstant(m_typeParameterIndex);
-            code.instrInvokespecial("com/sun/star/lib/uno/typeinfo/MemberTypeInfo"
-                                   ,"<init>", "(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V");
+            code.instrInvokespecial(
+                "com/sun/star/lib/uno/typeinfo/MemberTypeInfo", "<init>",
+                "(Ljava/lang/String;IILcom/sun/star/uno/Type;I)V");
             return 6;
         } else {
-            code.instrInvokespecial("com/sun/star/lib/uno/typeinfo/MemberTypeInfo"
-                                   ,"<init>", "(Ljava/lang/String;II)V");
+            code.instrInvokespecial(
+                "com/sun/star/lib/uno/typeinfo/MemberTypeInfo", "<init>",
+                "(Ljava/lang/String;II)V");
             return 4;
         }
-
     case KIND_ATTRIBUTE:
         code.instrNew("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo");
         code.instrDup();
@@ -512,15 +521,16 @@ sal_uInt16 TypeInfo::generateCode(
         code.loadIntegerConstant(m_flags);
         if (m_polymorphicUnoType.kind != PolymorphicUnoType::KIND_NONE) {
             generatePolymorphicUnoTypeCode(code, dependencies);
-            code.instrInvokespecial("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo"
-                                   ,"<init>", "(Ljava/lang/String;IILcom/sun/star/uno/Type;)V");
+            code.instrInvokespecial(
+                "com/sun/star/lib/uno/typeinfo/AttributeTypeInfo", "<init>",
+                "(Ljava/lang/String;IILcom/sun/star/uno/Type;)V");
             return 8;
         } else {
-            code.instrInvokespecial("com/sun/star/lib/uno/typeinfo/AttributeTypeInfo"
-                                   ,"<init>", "(Ljava/lang/String;II)V");
+            code.instrInvokespecial(
+                "com/sun/star/lib/uno/typeinfo/AttributeTypeInfo", "<init>",
+                "(Ljava/lang/String;II)V");
             return 4;
         }
-
     case KIND_METHOD:
         code.instrNew("com/sun/star/lib/uno/typeinfo/MethodTypeInfo");
         code.instrDup();
@@ -529,15 +539,16 @@ sal_uInt16 TypeInfo::generateCode(
         code.loadIntegerConstant(m_flags);
         if (m_polymorphicUnoType.kind != PolymorphicUnoType::KIND_NONE) {
             generatePolymorphicUnoTypeCode(code, dependencies);
-            code.instrInvokespecial("com/sun/star/lib/uno/typeinfo/MethodTypeInfo"
-                                   ,"<init>", "(Ljava/lang/String;IILcom/sun/star/uno/Type;)V");
+            code.instrInvokespecial(
+                "com/sun/star/lib/uno/typeinfo/MethodTypeInfo", "<init>",
+                "(Ljava/lang/String;IILcom/sun/star/uno/Type;)V");
             return 8;
         } else {
-            code.instrInvokespecial("com/sun/star/lib/uno/typeinfo/MethodTypeInfo"
-                                   ,"<init>", "(Ljava/lang/String;II)V");
+            code.instrInvokespecial(
+                "com/sun/star/lib/uno/typeinfo/MethodTypeInfo", "<init>",
+                "(Ljava/lang/String;II)V");
             return 4;
         }
-
     case KIND_PARAMETER:
         code.instrNew("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo");
         code.instrDup();
@@ -547,18 +558,19 @@ sal_uInt16 TypeInfo::generateCode(
         code.loadIntegerConstant(m_flags);
         if (m_polymorphicUnoType.kind != PolymorphicUnoType::KIND_NONE) {
             generatePolymorphicUnoTypeCode(code, dependencies);
-            code.instrInvokespecial("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo"
-                                    ,"<init>", "(Ljava/lang/String;Ljava/lang/String;II"
-                                               "Lcom/sun/star/uno/Type;)V");
+            code.instrInvokespecial(
+                "com/sun/star/lib/uno/typeinfo/ParameterTypeInfo", "<init>",
+                ("(Ljava/lang/String;Ljava/lang/String;II"
+                 "Lcom/sun/star/uno/Type;)V"));
             return 9;
         } else {
-            code.instrInvokespecial("com/sun/star/lib/uno/typeinfo/ParameterTypeInfo"
-                                   ,"<init>", "(Ljava/lang/String;Ljava/lang/String;II)V");
+            code.instrInvokespecial(
+                "com/sun/star/lib/uno/typeinfo/ParameterTypeInfo", "<init>",
+                "(Ljava/lang/String;Ljava/lang/String;II)V");
             return 5;
         }
-
     default:
-        OSL_ASSERT(false);
+        assert(false);
         return 0;
     }
 }
@@ -566,23 +578,29 @@ sal_uInt16 TypeInfo::generateCode(
 void TypeInfo::generatePolymorphicUnoTypeCode(
     ClassFile::Code & code, Dependencies * dependencies) const
 {
-    OSL_ASSERT(
-        dependencies != 0
-        && m_polymorphicUnoType.kind != PolymorphicUnoType::KIND_NONE);
+    assert(dependencies != 0);
+    assert(m_polymorphicUnoType.kind != PolymorphicUnoType::KIND_NONE);
     code.instrNew("com/sun/star/uno/Type");
     code.instrDup();
-    code.loadStringConstant(m_polymorphicUnoType.name);
+    code.loadStringConstant(
+        codemaker::convertString(m_polymorphicUnoType.name));
     if (m_polymorphicUnoType.kind == PolymorphicUnoType::KIND_STRUCT) {
-        code.instrGetstatic("com/sun/star/uno/TypeClass", "STRUCT", "Lcom/sun/star/uno/TypeClass;");
+        code.instrGetstatic(
+            "com/sun/star/uno/TypeClass", "STRUCT",
+            "Lcom/sun/star/uno/TypeClass;");
     } else {
-        code.instrGetstatic("com/sun/star/uno/TypeClass", "SEQUENCE", "Lcom/sun/star/uno/TypeClass;");
-    }
-    dependencies->insert("com/sun/star/uno/TypeClass");
-    code.instrInvokespecial("com/sun/star/uno/Type", "<init>", "(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V");
+        code.instrGetstatic(
+            "com/sun/star/uno/TypeClass", "SEQUENCE",
+            "Lcom/sun/star/uno/TypeClass;");
+    }
+    dependencies->insert("com.sun.star.uno.TypeClass");
+    code.instrInvokespecial(
+        "com/sun/star/uno/Type", "<init>",
+        "(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V");
 }
 
 void writeClassFile(
-    JavaOptions /*TODO const*/ & options, OString const & type,
+    JavaOptions const & options, OString const & type,
     ClassFile const & classFile)
 {
     OString path;
@@ -600,9 +618,10 @@ void writeClassFile(
     FileStream tempfile;
     tempfile.createTempFile(getTempDir(filename));
     if (!tempfile.isValid()) {
-        throw CannotDumpException("Cannot create temporary file for " + b2u(filename));
+        throw CannotDumpException(
+            "Cannot create temporary file for " + b2u(filename));
     }
-    rtl::OString tempname(tempfile.getName());
+    OString tempname(tempfile.getName());
     try {
         classFile.write(tempfile);
     } catch (...) {
@@ -616,18 +635,21 @@ void writeClassFile(
     }
     tempfile.close();
     if (!makeValidTypeFile(filename, tempname, check)) {
-        throw CannotDumpException("Cannot create " + b2u(filename) + " from temporary file " + b2u(tempname));
+        throw CannotDumpException(
+            "Cannot create " + b2u(filename) + " from temporary file "
+            + b2u(tempname));
     }
 }
 
 void addTypeInfo(
-    rtl::OString const & className, std::vector< TypeInfo > const & typeInfo,
+    OString const & className, std::vector< TypeInfo > const & typeInfo,
     Dependencies * dependencies, ClassFile * classFile)
 {
-    OSL_ASSERT(dependencies != 0 && classFile != 0);
+    assert(classFile != 0);
     std::vector< TypeInfo >::size_type typeInfos = typeInfo.size();
     if (typeInfos > SAL_MAX_INT32) {
-        throw CannotDumpException("UNOTYPEINFO array too big for Java class file format");
+        throw CannotDumpException(
+            "UNOTYPEINFO array too big for Java class file format");
     }
     if (typeInfos != 0) {
         classFile->addField(
@@ -651,38 +673,28 @@ void addTypeInfo(
             stack = std::max(stack, i->generateCode(*code, dependencies));
             code->instrAastore();
         }
-        code->instrPutstatic(className, "UNOTYPEINFO", "[Lcom/sun/star/lib/uno/typeinfo/TypeInfo;");
+        code->instrPutstatic(
+            className, "UNOTYPEINFO",
+            "[Lcom/sun/star/lib/uno/typeinfo/TypeInfo;");
         code->instrReturn();
         if (stack > SAL_MAX_UINT16 - 4) {
-            throw CannotDumpException("Stack too big for Java class file format");
+            throw CannotDumpException(
+                "Stack too big for Java class file format");
         }
         code->setMaxStackAndLocals(static_cast< sal_uInt16 >(stack + 4), 0);
         classFile->addMethod(
             static_cast< ClassFile::AccessFlags >(
                 ClassFile::ACC_PRIVATE | ClassFile::ACC_STATIC),
-            "<clinit>", "()V", code.get(),
-            std::vector< rtl::OString >(), "");
+            "<clinit>", "()V", code.get(), std::vector< OString >(), "");
     }
 }
 
-typedef void (* handleUnoTypeRegistryEntityFunction)(
-    rtl::Reference< TypeManager > const & manager,
-    JavaOptions /*TODO const*/ & options, typereg::Reader const & reader,
-    Dependencies * dependencies);
-
 void handleEnumType(
-    SAL_UNUSED_PARAMETER rtl::Reference< TypeManager > const &,
-    JavaOptions /*TODO const*/ & options, typereg::Reader const & reader,
-    SAL_UNUSED_PARAMETER Dependencies *)
+    OUString name, rtl::Reference< unoidl::EnumTypeEntity > const & entity,
+    JavaOptions const & options)
 {
-    sal_uInt16 fields = reader.getFieldCount();
-    if (fields == 0 || reader.getSuperTypeCount() != 0
-        || reader.getMethodCount() != 0 || reader.getReferenceCount() != 0)
-    {
-        throw CannotDumpException("Bad type information");
-            //TODO
-    }
-    rtl::OString className(codemaker::convertString(reader.getTypeName()));
+    assert(entity.is());
+    OString className(codemaker::convertString(name).replace('.', '/'));
     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     std::auto_ptr< ClassFile > cf(
         new ClassFile(
@@ -691,28 +703,23 @@ void handleEnumType(
                 | ClassFile::ACC_SUPER),
             className, "com/sun/star/uno/Enum", ""));
     SAL_WNODEPRECATED_DECLARATIONS_POP
-    rtl::OString classDescriptor("L" + className + ";");
-    for (sal_uInt16 i = 0; i < fields; ++i) {
-        RTConstValue fieldValue(reader.getFieldValue(i));
-        if (fieldValue.m_type != RT_TYPE_INT32
-            || reader.getFieldFlags(i) != RT_ACCESS_CONST
-            || reader.getFieldTypeName(i).getLength() != 0)
-        {
-            throw CannotDumpException("Bad type information"); //TODO
-        }
-        rtl::OString fieldName(
-            codemaker::convertString(reader.getFieldName(i)));
+    OString classDescriptor("L" + className + ";");
+    for (std::vector< unoidl::EnumTypeEntity::Member >::const_iterator i(
+             entity->getMembers().begin());
+         i != entity->getMembers().end(); ++i)
+    {
+        OString fieldName(codemaker::convertString(i->name));
         cf->addField(
             static_cast< ClassFile::AccessFlags >(
                 ClassFile::ACC_PUBLIC | ClassFile::ACC_STATIC
                 | ClassFile::ACC_FINAL),
-            fieldName, classDescriptor, 0, rtl::OString());
+            fieldName, classDescriptor, 0, OString());
         cf->addField(
             static_cast< ClassFile::AccessFlags >(
                 ClassFile::ACC_PUBLIC | ClassFile::ACC_STATIC
                 | ClassFile::ACC_FINAL),
             fieldName + "_value", "I",
-            cf->addIntegerInfo(fieldValue.m_value.aLong), "");
+            cf->addIntegerInfo(i->value), "");
     }
     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     std::auto_ptr< ClassFile::Code > code(cf->newCode());
@@ -729,7 +736,8 @@ void handleEnumType(
     code.reset(cf->newCode());
     code->instrGetstatic(
         className,
-        codemaker::convertString(reader.getFieldName(0)), classDescriptor);
+        codemaker::convertString(entity->getMembers()[0].name),
+        classDescriptor);
     code->instrAreturn();
     code->setMaxStackAndLocals(1, 0);
     cf->addMethod(
@@ -739,16 +747,18 @@ void handleEnumType(
         code.get(), std::vector< OString >(), "");
     code.reset(cf->newCode());
     code->loadLocalInteger(0);
-    std::map< sal_Int32, rtl::OString > map;
+    std::map< sal_Int32, OString > map;
     sal_Int32 min = SAL_MAX_INT32;
     sal_Int32 max = SAL_MIN_INT32;
-    for (sal_uInt16 i = 0; i < fields; ++i) {
-        sal_Int32 value = reader.getFieldValue(i).m_value.aLong;
-        min = std::min(min, value);
-        max = std::max(max, value);
+    for (std::vector< unoidl::EnumTypeEntity::Member >::const_iterator i(
+             entity->getMembers().begin());
+         i != entity->getMembers().end(); ++i)
+    {
+        min = std::min(min, i->value);
+        max = std::max(max, i->value);
         map.insert(
-            std::map< sal_Int32, rtl::OString >::value_type(
-                value, codemaker::convertString(reader.getFieldName(i))));
+            std::map< sal_Int32, OString >::value_type(
+                i->value, codemaker::convertString(i->name)));
     }
     sal_uInt64 size = static_cast< sal_uInt64 >(map.size());
     if ((static_cast< sal_uInt64 >(max) - static_cast< sal_uInt64 >(min)
@@ -763,7 +773,7 @@ void handleEnumType(
         std::list< ClassFile::Code * > blocks;
             //FIXME: pointers contained in blocks may leak
         sal_Int32 last = SAL_MAX_INT32;
-        for (std::map< sal_Int32, rtl::OString >::iterator i(map.begin());
+        for (std::map< sal_Int32, OString >::iterator i(map.begin());
              i != map.end(); ++i)
         {
             sal_Int32 value = i->first;
@@ -795,7 +805,7 @@ void handleEnumType(
         defCode->instrAreturn();
         std::list< std::pair< sal_Int32, ClassFile::Code * > > blocks;
             //FIXME: pointers contained in blocks may leak
-        for (std::map< sal_Int32, rtl::OString >::iterator i(map.begin());
+        for (std::map< sal_Int32, OString >::iterator i(map.begin());
              i != map.end(); ++i)
         {
             SAL_WNODEPRECATED_DECLARATIONS_PUSH
@@ -818,192 +828,204 @@ void handleEnumType(
     cf->addMethod(
         static_cast< ClassFile::AccessFlags >(
             ClassFile::ACC_PUBLIC | ClassFile::ACC_STATIC),
-        "fromInt", "(I)" + classDescriptor,
-        code.get(), std::vector< rtl::OString >(), "");
+        "fromInt", "(I)" + classDescriptor, code.get(),
+        std::vector< OString >(), "");
     code.reset(cf->newCode());
-    for (sal_uInt16 i = 0; i < fields; ++i) {
+    for (std::vector< unoidl::EnumTypeEntity::Member >::const_iterator i(
+             entity->getMembers().begin());
+         i != entity->getMembers().end(); ++i)
+    {
         code->instrNew(className);
         code->instrDup();
-        code->loadIntegerConstant(reader.getFieldValue(i).m_value.aLong);
+        code->loadIntegerConstant(i->value);
         code->instrInvokespecial(className, "<init>", "(I)V");
         code->instrPutstatic(
-            className,
-            codemaker::convertString(reader.getFieldName(i)),
-            classDescriptor);
+            className, codemaker::convertString(i->name), classDescriptor);
     }
     code->instrReturn();
     code->setMaxStackAndLocals(3, 0);
     cf->addMethod(
         static_cast< ClassFile::AccessFlags >(
             ClassFile::ACC_PRIVATE | ClassFile::ACC_STATIC),
-        "<clinit>", "()V", code.get(),
-        std::vector< rtl::OString >(), "");
+        "<clinit>", "()V", code.get(), std::vector< OString >(), "");
     writeClassFile(options, className, *cf.get());
 }
 
 void addField(
     rtl::Reference< TypeManager > const & manager, Dependencies * dependencies,
     ClassFile * classFile, std::vector< TypeInfo > * typeInfo,
-    sal_Int32 typeParameterIndex, rtl::OString const & type,
-    rtl::OString const & name, sal_Int32 index)
+    sal_Int32 typeParameterIndex, OUString const & type, OUString const & name,
+    sal_Int32 index)
 {
-    OSL_ASSERT(dependencies != 0 && classFile != 0 && typeInfo != 0);
-    rtl::OString descriptor;
-    rtl::OString signature;
+    assert(classFile != 0);
+    assert(typeInfo != 0);
+    OString descriptor;
+    OString signature;
     SpecialType specialType;
     PolymorphicUnoType polymorphicUnoType;
     if (typeParameterIndex >= 0) {
         descriptor = "Ljava/lang/Object;";
-        signature = "T" + type + ";";
+        signature = "T" + codemaker::convertString(type).replace('.', '/')
+            + ";";
         specialType = SPECIAL_TYPE_NONE; //TODO: SPECIAL_TYPE_TYPE_PARAMETER?
     } else {
         specialType = getFieldDescriptor(
             manager, dependencies, type, &descriptor, &signature,
             &polymorphicUnoType);
     }
-    classFile->addField(ClassFile::ACC_PUBLIC, name, descriptor, 0, signature);
+    classFile->addField(
+        ClassFile::ACC_PUBLIC, codemaker::convertString(name), descriptor, 0,
+        signature);
     typeInfo->push_back(
         TypeInfo(
-            name, specialType, index, polymorphicUnoType, typeParameterIndex));
+            codemaker::convertString(name), specialType, index,
+            polymorphicUnoType, typeParameterIndex));
 }
 
 sal_uInt16 addFieldInit(
-    rtl::Reference< TypeManager > const & manager,
-    rtl::OString const & className, rtl::OString const & fieldName,
-    bool typeParameter, rtl::OString const & fieldType,
+    rtl::Reference< TypeManager > const & manager, OString const & className,
+    OUString const & fieldName, bool typeParameter, OUString const & fieldType,
     Dependencies * dependencies, ClassFile::Code * code)
 {
-    OSL_ASSERT(dependencies != 0 && code != 0);
+    assert(manager.is());
+    assert(code != 0);
     if (typeParameter) {
         return 0;
-    } else {
-        RTTypeClass typeClass;
-        rtl::OString nucleus;
-        sal_Int32 rank;
-        std::vector< rtl::OString > args;
-        codemaker::UnoType::Sort sort = codemaker::decomposeAndResolve(
-            manager, fieldType, true, false, false, &typeClass, &nucleus, &rank,
-            &args);
-        if (rank == 0) {
-            switch (sort) {
-            case codemaker::UnoType::SORT_STRING:
-                code->loadLocalReference(0);
-                code->loadStringConstant(rtl::OString());
-                code->instrPutfield(className, fieldName, "Ljava/lang/String;");
-                return 2;
-
-            case codemaker::UnoType::SORT_TYPE:
-                code->loadLocalReference(0);
-                code->instrGetstatic("com/sun/star/uno/Type", "VOID", "Lcom/sun/star/uno/Type;");
-                code->instrPutfield(className, fieldName, "Lcom/sun/star/uno/Type;");
-                return 2;
-
-            case codemaker::UnoType::SORT_ANY:
+    }
+    OString name(codemaker::convertString(fieldName));
+    OUString nucleus;
+    sal_Int32 rank;
+    std::vector< rtl::OUString > args;
+    rtl::Reference< unoidl::Entity > ent;
+    codemaker::UnoType::Sort sort
+        = manager->getSortResolveAllSequencesTemplatesTypedefs(
+            fieldType, &nucleus, &rank, &args, &ent);
+    if (rank == 0) {
+        switch (sort) {
+        case codemaker::UnoType::SORT_BOOLEAN:
+        case codemaker::UnoType::SORT_BYTE:
+        case codemaker::UnoType::SORT_SHORT:
+        case codemaker::UnoType::SORT_UNSIGNED_SHORT:
+        case codemaker::UnoType::SORT_LONG:
+        case codemaker::UnoType::SORT_UNSIGNED_LONG:
+        case codemaker::UnoType::SORT_HYPER:
+        case codemaker::UnoType::SORT_UNSIGNED_HYPER:
+        case codemaker::UnoType::SORT_FLOAT:
+        case codemaker::UnoType::SORT_DOUBLE:
+        case codemaker::UnoType::SORT_CHAR:
+        case codemaker::UnoType::SORT_INTERFACE_TYPE:
+            return 0;
+        case codemaker::UnoType::SORT_STRING:
+            code->loadLocalReference(0);
+            code->loadStringConstant(OString());
+            code->instrPutfield(className, name, "Ljava/lang/String;");
+            return 2;
+        case codemaker::UnoType::SORT_TYPE:
+            code->loadLocalReference(0);
+            code->instrGetstatic(
+                "com/sun/star/uno/Type", "VOID", "Lcom/sun/star/uno/Type;");
+            code->instrPutfield(className, name, "Lcom/sun/star/uno/Type;");
+            return 2;
+        case codemaker::UnoType::SORT_ANY:
+            code->loadLocalReference(0);
+            code->instrGetstatic(
+                "com/sun/star/uno/Any", "VOID", "Lcom/sun/star/uno/Any;");
+            code->instrPutfield(className, name, "Ljava/lang/Object;");
+            return 2;
+        case codemaker::UnoType::SORT_ENUM_TYPE:
+            {
+                rtl::Reference< unoidl::EnumTypeEntity > ent2(
+                    dynamic_cast< unoidl::EnumTypeEntity * >(ent.get()));
+                assert(ent2.is());
                 code->loadLocalReference(0);
-                code->instrGetstatic("com/sun/star/uno/Any", "VOID", "Lcom/sun/star/uno/Any;");
-                code->instrPutfield(className, fieldName, "Ljava/lang/Object;");
+                OStringBuffer descBuf;
+                translateUnoTypeToDescriptor(
+                    manager, sort, nucleus, 0, std::vector< OUString >(), false,
+                    false, dependencies, &descBuf, 0, 0, 0);
+                OString desc(descBuf.makeStringAndClear());
+                code->instrGetstatic(
+                    codemaker::convertString(nucleus).replace('.', '/'),
+                    codemaker::convertString(ent2->getMembers()[0].name), desc);
+                code->instrPutfield(className, name, desc);
                 return 2;
-
-            case codemaker::UnoType::SORT_COMPLEX:
-                switch (typeClass) {
-                case RT_TYPE_ENUM:
-                    {
-                        code->loadLocalReference(0);
-                        typereg::Reader reader(manager->getTypeReader(nucleus));
-                        if (reader.getFieldCount() == 0) {
-                            throw CannotDumpException("Bad type information"); //TODO
-                        }
-                        rtl::OStringBuffer descBuf;
-                        translateUnoTypeToDescriptor(
-                            manager, sort, typeClass, nucleus, 0,
-                            std::vector< rtl::OString >(), false, false,
-                            dependencies, &descBuf, 0, 0, 0);
-                        rtl::OString desc(descBuf.makeStringAndClear());
-                        code->instrGetstatic(
-                            nucleus,
-                            codemaker::convertString(reader.getFieldName(0)),
-                            desc);
-                        code->instrPutfield(className, fieldName, desc);
-                        return 2;
-                    }
-
-                case RT_TYPE_STRUCT:
-                    {
-                        code->loadLocalReference(0);
-                        code->instrNew(nucleus);
-                        code->instrDup();
-                        code->instrInvokespecial(nucleus, "<init>", "()V");
-                        rtl::OStringBuffer desc;
-                        translateUnoTypeToDescriptor(
-                            manager, sort, typeClass, nucleus, 0,
-                            std::vector< rtl::OString >(), false, false,
-                            dependencies, &desc, 0, 0, 0);
-                        code->instrPutfield(
-                            className, fieldName, desc.makeStringAndClear());
-                        return 3;
-                    }
-
-                default:
-                    OSL_ASSERT(typeClass == RT_TYPE_INTERFACE);
-                    return 0;
-                }
-
-            default:
-                return 0;
             }
-        } else {
-            code->loadLocalReference(0);
-            code->loadIntegerConstant(0);
-            if (rank == 1) {
-                if (sort >= codemaker::UnoType::SORT_BOOLEAN
-                    && sort <= codemaker::UnoType::SORT_CHAR)
-                {
-                    code->instrNewarray(sort);
-                } else {
-                    code->instrAnewarray(
-                        codemaker::java::translateUnoToJavaType(sort, typeClass,
-                                                                nucleus, 0));
-                }
-            } else {
-                rtl::OStringBuffer desc;
+        case codemaker::UnoType::SORT_PLAIN_STRUCT_TYPE:
+        case codemaker::UnoType::SORT_INSTANTIATED_POLYMORPHIC_STRUCT_TYPE:
+            {
+                code->loadLocalReference(0);
+                code->instrNew(
+                    codemaker::convertString(nucleus).replace('.', '/'));
+                code->instrDup();
+                code->instrInvokespecial(
+                    codemaker::convertString(nucleus).replace('.', '/'),
+                    "<init>", "()V");
+                OStringBuffer desc;
                 translateUnoTypeToDescriptor(
-                    manager, sort, typeClass, nucleus, rank - 1,
-                    std::vector< rtl::OString >(), false, false, dependencies,
+                    manager, sort, nucleus, 0, args, false, false, dependencies,
                     &desc, 0, 0, 0);
-                code->instrAnewarray(desc.makeStringAndClear());
+                code->instrPutfield(className, name, desc.makeStringAndClear());
+                return 3;
             }
-            rtl::OStringBuffer desc;
-            translateUnoTypeToDescriptor(
-                manager, sort, typeClass, nucleus, rank,
-                std::vector< rtl::OString >(), false, false, dependencies,
-                &desc, 0, 0, 0);
-            code->instrPutfield(
-                className, fieldName, desc.makeStringAndClear());
-            return 2;
+        case codemaker::UnoType::SORT_SEQUENCE_TYPE:
+        case codemaker::UnoType::SORT_TYPEDEF:
+            assert(false); // this cannot happen
+            // fall through
+        default:
+            throw CannotDumpException(
+                "unexpected entity \"" + fieldType
+                + "\" in call to addFieldInit");
         }
     }
+    code->loadLocalReference(0);
+    code->loadIntegerConstant(0);
+    if (rank == 1) {
+        if (sort >= codemaker::UnoType::SORT_BOOLEAN
+            && sort <= codemaker::UnoType::SORT_CHAR)
+        {
+            code->instrNewarray(sort);
+        } else {
+            code->instrAnewarray(
+                codemaker::java::translateUnoToJavaType(
+                    sort, codemaker::convertString(nucleus).replace('.', '/'),
+                    false));
+        }
+    } else {
+        OStringBuffer desc;
+        translateUnoTypeToDescriptor(
+            manager, sort, nucleus, rank - 1, std::vector< OUString >(), false,
+            false, dependencies, &desc, 0, 0, 0);
+        code->instrAnewarray(desc.makeStringAndClear());
+    }
+    OStringBuffer desc;
+    translateUnoTypeToDescriptor(
+        manager, sort, nucleus, rank, std::vector< OUString >(), false, false,
+        dependencies, &desc, 0, 0, 0);
+    code->instrPutfield(className, name, desc.makeStringAndClear());
+    return 2;
 }
 
 sal_uInt16 addLoadLocal(
     rtl::Reference< TypeManager > const & manager, ClassFile::Code * code,
-    sal_uInt16 * index, bool typeParameter, rtl::OString const & type, bool any,
+    sal_uInt16 * index, bool typeParameter, OUString const & type, bool any,
     Dependencies * dependencies)
 {
-    OSL_ASSERT(
-        code != 0 && index != 0 && !(typeParameter && any)
-        && dependencies != 0);
+    assert(manager.is());
+    assert(code != 0);
+    assert(index != 0);
+    assert(!(typeParameter && any));
+    assert(dependencies != 0);
     sal_uInt16 stack = 1;
     sal_uInt16 size = 1;
     if (typeParameter) {
         code->loadLocalReference(*index);
         stack = size = 1;
     } else {
-        RTTypeClass typeClass;
-        rtl::OString nucleus;
+        OUString nucleus;
         sal_Int32 rank;
-        std::vector< rtl::OString > args;
-        codemaker::UnoType::Sort sort = codemaker::decomposeAndResolve(
-            manager, type, true, false, false, &typeClass, &nucleus, &rank, &args);
+        std::vector< OUString > args;
+        codemaker::UnoType::Sort sort = manager->
+            getSortResolveAllSequencesTemplatesTypedefs(
+                type, &nucleus, &rank, &args, 0);
         if (rank == 0) {
             switch (sort) {
             case codemaker::UnoType::SORT_BOOLEAN:
@@ -1011,7 +1033,8 @@ sal_uInt16 addLoadLocal(
                     code->instrNew("java/lang/Boolean");
                     code->instrDup();
                     code->loadLocalInteger(*index);
-                    code->instrInvokespecial("java/lang/Boolean", "<init>", "(Z)V");
+                    code->instrInvokespecial(
+                        "java/lang/Boolean", "<init>", "(Z)V");
                     stack = 3;
                 } else {
                     code->loadLocalInteger(*index);
@@ -1019,13 +1042,13 @@ sal_uInt16 addLoadLocal(
                 }
                 size = 1;
                 break;
-
             case codemaker::UnoType::SORT_BYTE:
                 if (any) {
                     code->instrNew("java/lang/Byte");
                     code->instrDup();
                     code->loadLocalInteger(*index);
-                    code->instrInvokespecial("java/lang/Byte", "<init>", "(B)V");
+                    code->instrInvokespecial(
+                        "java/lang/Byte", "<init>", "(B)V");
                     stack = 3;
                 } else {
                     code->loadLocalInteger(*index);
@@ -1033,13 +1056,13 @@ sal_uInt16 addLoadLocal(
                 }
                 size = 1;
                 break;
-
             case codemaker::UnoType::SORT_SHORT:
                 if (any) {
                     code->instrNew("java/lang/Short");
                     code->instrDup();
                     code->loadLocalInteger(*index);
-                    code->instrInvokespecial("java/lang/Short", "<init>", "(S)V");
+                    code->instrInvokespecial(
+                        "java/lang/Short", "<init>", "(S)V");
                     stack = 3;
                 } else {
                     code->loadLocalInteger(*index);
@@ -1047,18 +1070,21 @@ sal_uInt16 addLoadLocal(
                 }
                 size = 1;
                 break;
-
             case codemaker::UnoType::SORT_UNSIGNED_SHORT:
                 if (any) {
                     code->instrNew("com/sun/star/uno/Any");
                     code->instrDup();
-                    code->instrGetstatic("com/sun/star/uno/Type", "UNSIGNED_SHORT", "Lcom/sun/star/uno/Type;");
+                    code->instrGetstatic(
+                        "com/sun/star/uno/Type", "UNSIGNED_SHORT",
+                        "Lcom/sun/star/uno/Type;");
                     code->instrNew("java/lang/Short");
                     code->instrDup();
                     code->loadLocalInteger(*index);
-                    code->instrInvokespecial("java/lang/Short", "<init>", "(S)V");
-                    code->instrInvokespecial("com/sun/star/uno/Any", "<init>",
-                                "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V");
+                    code->instrInvokespecial(
+                        "java/lang/Short", "<init>", "(S)V");
+                    code->instrInvokespecial(
+                        "com/sun/star/uno/Any", "<init>",
+                        "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V");
                     stack = 6;
                 } else {
                     code->loadLocalInteger(*index);
@@ -1066,13 +1092,13 @@ sal_uInt16 addLoadLocal(
                 }
                 size = 1;
                 break;
-
             case codemaker::UnoType::SORT_LONG:
                 if (any) {
                     code->instrNew("java/lang/Integer");
                     code->instrDup();
                     code->loadLocalInteger(*index);
-                    code->instrInvokespecial("java/lang/Integer", "<init>", "(I)V");
+                    code->instrInvokespecial(
+                        "java/lang/Integer", "<init>", "(I)V");
                     stack = 3;
                 } else {
                     code->loadLocalInteger(*index);
@@ -1080,18 +1106,21 @@ sal_uInt16 addLoadLocal(
                 }
                 size = 1;
                 break;
-
             case codemaker::UnoType::SORT_UNSIGNED_LONG:
                 if (any) {
                     code->instrNew("com/sun/star/uno/Any");
                     code->instrDup();
-                    code->instrGetstatic("com/sun/star/uno/Type", "UNSIGNED_LONG", "Lcom/sun/star/uno/Type;");
+                    code->instrGetstatic(
+                        "com/sun/star/uno/Type", "UNSIGNED_LONG",
+                        "Lcom/sun/star/uno/Type;");
                     code->instrNew("java/lang/Integer");
                     code->instrDup();
                     code->loadLocalInteger(*index);
-                    code->instrInvokespecial("java/lang/Integer", "<init>", "(I)V");
-                    code->instrInvokespecial("com/sun/star/uno/Any", "<init>"
-                                            ,"(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V");
+                    code->instrInvokespecial(
+                        "java/lang/Integer", "<init>", "(I)V");
+                    code->instrInvokespecial(
+                        "com/sun/star/uno/Any", "<init>",
+                        "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V");
                     stack = 6;
                 } else {
                     code->loadLocalInteger(*index);
@@ -1099,13 +1128,13 @@ sal_uInt16 addLoadLocal(
                 }
                 size = 1;
                 break;
-
             case codemaker::UnoType::SORT_HYPER:
                 if (any) {
                     code->instrNew("java/lang/Long");
                     code->instrDup();
                     code->loadLocalLong(*index);
-                    code->instrInvokespecial("java/lang/Long", "<init>", "(J)V");
+                    code->instrInvokespecial(
+                        "java/lang/Long", "<init>", "(J)V");
                     stack = 4;
                 } else {
                     code->loadLocalLong(*index);
@@ -1113,19 +1142,21 @@ sal_uInt16 addLoadLocal(
                 }
                 size = 2;
                 break;
-
             case codemaker::UnoType::SORT_UNSIGNED_HYPER:
                 if (any) {
                     code->instrNew("com/sun/star/uno/Any");
                     code->instrDup();
-                    code->instrGetstatic("com/sun/star/uno/Type", "UNSIGNED_HYPER"
-                                        ,"Lcom/sun/star/uno/Type;");
+                    code->instrGetstatic(
+                        "com/sun/star/uno/Type", "UNSIGNED_HYPER",
+                        "Lcom/sun/star/uno/Type;");
                     code->instrNew("java/lang/Long");
                     code->instrDup();
                     code->loadLocalLong(*index);
-                    code->instrInvokespecial("java/lang/Long", "<init>", "(J)V");
-                    code->instrInvokespecial("com/sun/star/uno/Any", "<init>"
-                                            ,"(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V");
+                    code->instrInvokespecial(
+                        "java/lang/Long", "<init>", "(J)V");
+                    code->instrInvokespecial(
+                        "com/sun/star/uno/Any", "<init>",
+                        "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V");
                     stack = 7;
                 } else {
                     code->loadLocalLong(*index);
@@ -1133,13 +1164,13 @@ sal_uInt16 addLoadLocal(
                 }
                 size = 2;
                 break;
-
             case codemaker::UnoType::SORT_FLOAT:
                 if (any) {
                     code->instrNew("java/lang/Float");
                     code->instrDup();
                     code->loadLocalFloat(*index);
-                    code->instrInvokespecial("java/lang/Float", "<init>", "(F)V");
+                    code->instrInvokespecial(
+                        "java/lang/Float", "<init>", "(F)V");
                     stack = 3;
                 } else {
                     code->loadLocalFloat(*index);
@@ -1147,13 +1178,13 @@ sal_uInt16 addLoadLocal(
                 }
                 size = 1;
                 break;
-
             case codemaker::UnoType::SORT_DOUBLE:
                 if (any) {
                     code->instrNew("java/lang/Double");
                     code->instrDup();
                     code->loadLocalDouble(*index);
-                    code->instrInvokespecial("java/lang/Double", "<init>", "(D)V");
+                    code->instrInvokespecial(
+                        "java/lang/Double", "<init>", "(D)V");
                     stack = 4;
                 } else {
                     code->loadLocalDouble(*index);
@@ -1161,13 +1192,13 @@ sal_uInt16 addLoadLocal(
                 }
                 size = 2;
                 break;
-
             case codemaker::UnoType::SORT_CHAR:
                 if (any) {
                     code->instrNew("java/lang/Character");
                     code->instrDup();
                     code->loadLocalInteger(*index);
-                    code->instrInvokespecial("java/lang/Character", "<init>", "(C)V");
+                    code->instrInvokespecial(
+                        "java/lang/Character", "<init>", "(C)V");
                     stack = 3;
                 } else {
                     code->loadLocalInteger(*index);
@@ -1175,79 +1206,79 @@ sal_uInt16 addLoadLocal(
                 }
                 size = 1;
                 break;
-
             case codemaker::UnoType::SORT_STRING:
             case codemaker::UnoType::SORT_TYPE:
             case codemaker::UnoType::SORT_ANY:
                 code->loadLocalReference(*index);
                 stack = size = 1;
                 break;
-
-            case codemaker::UnoType::SORT_COMPLEX:
-                switch (typeClass) {
-                case RT_TYPE_ENUM:
-                    // Assuming that no Java types are derived from Java types
-                    // that are directly derived from com.sun.star.uno.Enum:
+            case codemaker::UnoType::SORT_ENUM_TYPE:
+                // Assuming that no Java types are derived from Java types that
+                // are directly derived from com.sun.star.uno.Enum:
+                code->loadLocalReference(*index);
+                stack = size = 1;
+                break;
+            case codemaker::UnoType::SORT_PLAIN_STRUCT_TYPE:
+            case codemaker::UnoType::SORT_INSTANTIATED_POLYMORPHIC_STRUCT_TYPE:
+                if (any) {
+                    code->instrNew("com/sun/star/uno/Any");
+                    code->instrDup();
+                    code->instrNew("com/sun/star/uno/Type");
+                    code->instrDup();
+                    code->loadStringConstant(
+                        codemaker::convertString(
+                            createUnoName(manager, nucleus, rank, args)));
+                    code->instrGetstatic(
+                        "com/sun/star/uno/TypeClass", "STRUCT",
+                        "Lcom/sun/star/uno/TypeClass;");
+                    dependencies->insert("com.sun.star.uno.TypeClass");
+                    code->instrInvokespecial(
+                        "com/sun/star/uno/Type", "<init>",
+                        "(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V");
                     code->loadLocalReference(*index);
-                    stack = size = 1;
-                    break;
-
-                case RT_TYPE_STRUCT:
-                    if (any) {
-                        code->instrNew("com/sun/star/uno/Any");
-                        code->instrDup();
-                        code->instrNew("com/sun/star/uno/Type");
-                        code->instrDup();
-                        code->loadStringConstant(
-                            createUnoName(manager, nucleus, rank, args));
-                        code->instrGetstatic("com/sun/star/uno/TypeClass", "STRUCT", "Lcom/sun/star/uno/TypeClass;");
-                        dependencies->insert("com/sun/star/uno/TypeClass");
-                        code->instrInvokespecial("com/sun/star/uno/Type", "<init>"
-                                                ,"(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V");
-                        code->loadLocalReference(*index);
-                        code->instrInvokespecial("com/sun/star/uno/Any", "<init>"
-                                                ,"(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V");
-                        stack = 6;
-                    } else {
-                        code->loadLocalReference(*index);
-                        stack = 1;
-                    }
-                    size = 1;
-                    break;
-
-                case RT_TYPE_INTERFACE:
-                    if (any && nucleus != "com/sun/star/uno/XInterface")
-                    {
-                        code->instrNew("com/sun/star/uno/Any");
-                        code->instrDup();
-                        code->instrNew("com/sun/star/uno/Type");
-                        code->instrDup();
-                        code->loadStringConstant(nucleus.replace('/', '.'));
-                        code->instrGetstatic("com/sun/star/uno/TypeClass", "INTERFACE"
-                                           , "Lcom/sun/star/uno/TypeClass;");
-                        dependencies->insert("com/sun/star/uno/TypeClass");
-                        code->instrInvokespecial("com/sun/star/uno/Type", "<init>"
-                                                ,"(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V");
-                        code->loadLocalReference(*index);
-                        code->instrInvokespecial("com/sun/star/uno/Any", "<init>"
-                                                ,"(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V");
-                        stack = 6;
-                    } else {
-                        code->loadLocalReference(*index);
-                        stack = 1;
-                    }
-                    size = 1;
-                    break;
-
-                default:
-                    OSL_ASSERT(false);
-                    break;
+                    code->instrInvokespecial(
+                        "com/sun/star/uno/Any", "<init>",
+                        "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V");
+                    stack = 6;
+                } else {
+                    code->loadLocalReference(*index);
+                    stack = 1;
                 }
+                size = 1;
                 break;
-
-            default:
-                OSL_ASSERT(false);
+            case codemaker::UnoType::SORT_INTERFACE_TYPE:
+                if (any && nucleus != "com.sun.star.uno.XInterface") {
+                    code->instrNew("com/sun/star/uno/Any");
+                    code->instrDup();
+                    code->instrNew("com/sun/star/uno/Type");
+                    code->instrDup();
+                    code->loadStringConstant(codemaker::convertString(nucleus));
+                    code->instrGetstatic(
+                        "com/sun/star/uno/TypeClass", "INTERFACE",
+                        "Lcom/sun/star/uno/TypeClass;");
+                    dependencies->insert("com.sun.star.uno.TypeClass");
+                    code->instrInvokespecial(
+                        "com/sun/star/uno/Type", "<init>",
+                        "(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V");
+                    code->loadLocalReference(*index);
+                    code->instrInvokespecial(
+                        "com/sun/star/uno/Any", "<init>",
+                        "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V");
+                    stack = 6;
+                } else {
+                    code->loadLocalReference(*index);
+                    stack = 1;
+                }
+                size = 1;
                 break;
+            case codemaker::UnoType::SORT_SEQUENCE_TYPE:
+            case codemaker::UnoType::SORT_TYPEDEF:
+                assert(false); // this cannot happen
+                // fall through
+            default:
+                throw CannotDumpException(
+                    "unexpected entity \"" + type
+                    + "\" in call to addLoadLocal");
             }
         } else {
             bool wrap = false;
@@ -1265,37 +1296,29 @@ sal_uInt16 addLoadLocal(
                 case codemaker::UnoType::SORT_TYPE:
                         // assuming that no Java types are derived from
                         // com.sun.star.uno.Type
+                case codemaker::UnoType::SORT_ENUM_TYPE:
+                        // assuming that no Java types are derived from Java
+                        // types that are directly derived from
+                        // com.sun.star.uno.Enum
                     break;
-
                 case codemaker::UnoType::SORT_UNSIGNED_SHORT:
                 case codemaker::UnoType::SORT_UNSIGNED_LONG:
                 case codemaker::UnoType::SORT_UNSIGNED_HYPER:
                 case codemaker::UnoType::SORT_ANY:
+                case codemaker::UnoType::SORT_PLAIN_STRUCT_TYPE:
+                case codemaker::UnoType::
+                    SORT_INSTANTIATED_POLYMORPHIC_STRUCT_TYPE:
+                case codemaker::UnoType::SORT_INTERFACE_TYPE:
                     wrap = true;
                     break;
-
-                case codemaker::UnoType::SORT_COMPLEX:
-                    switch (typeClass) {
-                    case RT_TYPE_ENUM:
-                            // assuming that no Java types are derived from Java
-                            // types that are directly derived from
-                            // com.sun.star.uno.Enum
-                        break;
-
-                    case RT_TYPE_STRUCT:
-                    case RT_TYPE_INTERFACE:
-                        wrap = true;
-                        break;
-
-                    default:
-                        OSL_ASSERT(false);
-                        break;
-                    }
-                    break;
-
+                case codemaker::UnoType::SORT_SEQUENCE_TYPE:
+                case codemaker::UnoType::SORT_TYPEDEF:
+                    assert(false); // this cannot happen
+                    // fall through
                 default:
-                    OSL_ASSERT(false);
-                    break;
+                    throw CannotDumpException(
+                        "unexpected entity \"" + type
+                        + "\" in call to addLoadLocal");
                 }
             }
             if (wrap) {
@@ -1304,11 +1327,14 @@ sal_uInt16 addLoadLocal(
                 code->instrNew("com/sun/star/uno/Type");
                 code->instrDup();
                 code->loadStringConstant(
-                    createUnoName(manager, nucleus, rank, args));
-                code->instrInvokespecial("com/sun/star/uno/Type", "<init>", "(Ljava/lang/String;)V");
+                    codemaker::convertString(
+                        createUnoName(manager, nucleus, rank, args)));
+                code->instrInvokespecial(
+                    "com/sun/star/uno/Type", "<init>", "(Ljava/lang/String;)V");
                 code->loadLocalReference(*index);
-                code->instrInvokespecial("com/sun/star/uno/Any", "<init>"
-                                        ,"(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V");
+                code->instrInvokespecial(
+                    "com/sun/star/uno/Any", "<init>",
+                    "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V");
                 stack = 5;
             } else {
                 code->loadLocalReference(*index);
@@ -1318,74 +1344,22 @@ sal_uInt16 addLoadLocal(
         }
     }
     if (*index > SAL_MAX_UINT16 - size) {
-        throw CannotDumpException("Too many local variables for Java class file format");
+        throw CannotDumpException(
+            "Too many local variables for Java class file format");
     }
     *index = *index + size;
     return stack;
 }
 
-void addBaseArguments(
-    rtl::Reference< TypeManager > const & manager, Dependencies * dependencies,
-    MethodDescriptor * methodDescriptor, ClassFile::Code * code,
-    RTTypeClass typeClass, rtl::OString const & type, sal_uInt16 * index)
-{
-    OSL_ASSERT(
-        dependencies != 0 && methodDescriptor != 0 && code != 0 && index != 0);
-    typereg::Reader reader(manager->getTypeReader(type));
-    if (!reader.isValid() || reader.getTypeClass() != typeClass
-        || codemaker::convertString(reader.getTypeName()) != type
-        || reader.getMethodCount() != 0 || reader.getReferenceCount() != 0)
-    {
-        throw CannotDumpException("Bad type information");
-            //TODO
-    }
-    sal_uInt16 superTypes = reader.getSuperTypeCount();
-    sal_uInt16 fields = reader.getFieldCount();
-    sal_uInt16 firstField = 0;
-    if (type  == "com/sun/star/uno/Exception")
-    {
-        if (typeClass != RT_TYPE_EXCEPTION || superTypes != 0 || fields != 2) {
-            throw CannotDumpException("Bad type information"); //TODO
-        }
-        firstField = 1;
-    } else {
-        if (
-            (typeClass == RT_TYPE_STRUCT && (superTypes > 1 || fields == 0)) ||
-            (typeClass == RT_TYPE_EXCEPTION && superTypes != 1)
-           )
-        {
-            throw CannotDumpException("Bad type information"); //TODO
-        }
-        if (superTypes == 1) {
-            addBaseArguments(
-                manager, dependencies, methodDescriptor, code, typeClass,
-                codemaker::convertString(reader.getSuperTypeName(0)), index);
-        }
-    }
-    for (sal_uInt16 i = firstField; i < fields; ++i) {
-        if (reader.getFieldFlags(i) != RT_ACCESS_READWRITE
-            || reader.getFieldValue(i).m_type != RT_TYPE_NONE)
-        {
-            throw CannotDumpException("Bad type information"); //TODO
-        }
-        rtl::OString fieldType(
-            codemaker::convertString(reader.getFieldTypeName(i)));
-        methodDescriptor->addParameter(fieldType, false, true, 0);
-        addLoadLocal(
-            manager, code, index, false, fieldType, false, dependencies);
-    }
-}
-
 sal_uInt16 addDirectArgument(
     rtl::Reference< TypeManager > const & manager, Dependencies * dependencies,
     MethodDescriptor * methodDescriptor, ClassFile::Code * code,
-    sal_uInt16 * index, rtl::OString const & className,
-    rtl::OString const & fieldName, bool typeParameter,
-    rtl::OString const & fieldType)
+    sal_uInt16 * index, OString const & className, OString const & fieldName,
+    bool typeParameter, OUString const & fieldType)
 {
-    OSL_ASSERT(
-        dependencies != 0 && methodDescriptor != 0 && code != 0 && index != 0);
-    rtl::OString desc;
+    assert(methodDescriptor != 0);
+    assert(code != 0);
+    OString desc;
     if (typeParameter) {
         methodDescriptor->addTypeParameter(fieldType);
         desc = "Ljava/lang/Object;";
@@ -1400,130 +1374,307 @@ sal_uInt16 addDirectArgument(
     return stack + 1;
 }
 
-void handleAggregatingType(
-    rtl::Reference< TypeManager > const & manager,
-    JavaOptions /*TODO const*/ & options, typereg::Reader const & reader,
-    Dependencies * dependencies)
+void addPlainStructBaseArguments(
+    rtl::Reference< TypeManager > const & manager, Dependencies * dependencies,
+    MethodDescriptor * methodDescriptor, ClassFile::Code * code,
+    OUString const & base, sal_uInt16 * index)
 {
-    OSL_ASSERT(dependencies != 0);
-    if (reader.getMethodCount() != 0)
-    {
-        throw CannotDumpException("Bad type information");
-            //TODO
-    }
-    RTTypeClass typeClass = reader.getTypeClass();
-    rtl::OString className(codemaker::convertString(reader.getTypeName()));
-    sal_uInt16 superTypes = reader.getSuperTypeCount();

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list