bridges/source/jni_uno/jni_bridge.cxx                 |  177 +++++++---------
 bridges/source/jni_uno/jni_bridge.h                   |   20 -
 bridges/source/jni_uno/jni_data.cxx                   |  198 +++++++++---------
 bridges/source/jni_uno/jni_info.cxx                   |   16 +
 bridges/source/jni_uno/jni_info.h                     |    4 
 bridges/source/jni_uno/jni_java2uno.cxx               |   31 +-
 bridges/source/jni_uno/jni_uno2java.cxx               |   30 +-
 bridges/source/jni_uno/jniunoenvironmentdata.hxx      |   55 +++++
 jurt/com/sun/star/lib/util/AsynchronousFinalizer.java |   10 
 9 files changed, 300 insertions(+), 241 deletions(-)

New commits:
commit b09964e97f65f7ca6e7dfaf33e34f2bbefe4e02b
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Thu Dec 11 13:27:26 2014 +0100

    update documentation
    
    Change-Id: Icd966a850b7c5e276e8b1d74566a4ea02e5b4a5c

diff --git a/jurt/com/sun/star/lib/util/AsynchronousFinalizer.java 
b/jurt/com/sun/star/lib/util/AsynchronousFinalizer.java
index 71743b2..908a53e 100644
--- a/jurt/com/sun/star/lib/util/AsynchronousFinalizer.java
+++ b/jurt/com/sun/star/lib/util/AsynchronousFinalizer.java
@@ -24,15 +24,17 @@ import java.util.LinkedList;
  * Helper class to asynchronously execute finalize methods.
  *
  * <p>Current JVMs seem not to be robust against long-running finalize methods,
- * in that such long-running finalize methods may lead to OutOfMemoryErrors. 
This
- * class mitigates the problem by asynchronously shifting the bodies of
+ * in that such long-running finalize methods may lead to OutOfMemoryErrors.
+ * This class mitigates the problem by asynchronously shifting the bodies of
  * potentially long-running finalize methods into an extra thread.  Classes 
that
  * make use of this in their finalize methods are the proxies used in the
  * intra-process JNI UNO bridge and the inter-process Java URP UNO bridge 
(where
  * in both cases finalizers lead to synchronous UNO release calls).</p>
  *
- * <p>If JVMs are getting more mature and should no longer have problems with
- * long-running finalize methods, this class could be removed again.</p>
+ * <p>Irrespective whether JVMs are getting more mature and should no longer
+ * have problems with long-running finalize methods, at least the JNI UNO 
bridge
+ * needs some way to stop finalization of proxies (to C++ objects) well before
+ * process exit, as provided by drain().</p>
  */
 public final class AsynchronousFinalizer {
     public AsynchronousFinalizer() {
commit ebd2d28c64146dd3c0686556f7ec344c8b92c624
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Thu Dec 11 13:08:29 2014 +0100

    Fix JNI calls to AsynchronousFinalizer
    
    ...make sure the class is actually found, etc.
    
    Change-Id: I5459d531be39b07594a975ae708a7611d1667a2f

diff --git a/bridges/source/jni_uno/jni_bridge.cxx 
b/bridges/source/jni_uno/jni_bridge.cxx
index 192aaf1..7be6363 100644
--- a/bridges/source/jni_uno/jni_bridge.cxx
+++ b/bridges/source/jni_uno/jni_bridge.cxx
@@ -434,29 +434,16 @@ void SAL_CALL java_env_dispose(uno_Environment * env) {
         }
         if (async != nullptr) {
             try {
-                jvmaccess::VirtualMachine::AttachGuard g(
-                    envData->machine->getVirtualMachine());
-                JNIEnv * jniEnv = g.getEnvironment();
-                jclass cl = jniEnv->FindClass(
-                    "com/sun/star/lib/util/AsynchronousFinalizer");
-                if (cl == nullptr) {
-                    jniEnv->ExceptionClear();
-                    SAL_WARN("bridges", "exception in FindClass");
-                } else {
-                    jmethodID id = jniEnv->GetMethodID(cl, "drain", "()V");
-                    if (id == nullptr) {
-                        jniEnv->ExceptionClear();
-                        SAL_WARN("bridges", "exception in GetMethodID");
-                    } else {
-                        jniEnv->CallObjectMethod(async, id);
-                        if (jniEnv->ExceptionOccurred()) {
-                            jniEnv->ExceptionClear();
-                            SAL_WARN(
-                                "bridges", "exception in CallObjectMethod");
-                        }
-                    }
-                }
-                jniEnv->DeleteGlobalRef(async);
+                JNI_guarded_context jni(envData->info, envData->machine);
+                jni->CallObjectMethodA(
+                    async, envData->info->m_method_AsynchronousFinalizer_drain,
+                    nullptr);
+                jni.ensure_no_exception();
+                jni->DeleteGlobalRef(async);
+            } catch (const BridgeRuntimeError & e) {
+                SAL_WARN(
+                    "bridges",
+                    "ignoring BridgeRuntimeError \"" << e.m_message << "\"");
             } catch (
                 jvmaccess::VirtualMachine::AttachGuard::CreationException &)
             {
@@ -499,39 +486,15 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_initEnvironment( 
uno_Environment * java_e
         std::unique_ptr<jni_uno::JniUnoEnvironmentData> envData(
             new jni_uno::JniUnoEnvironmentData(vm));
         {
-            jvmaccess::VirtualMachine::AttachGuard g(
-                envData->machine->getVirtualMachine());
-            JNIEnv * jniEnv = g.getEnvironment();
-            jclass cl = jniEnv->FindClass(
-                "com/sun/star/lib/util/AsynchronousFinalizer");
-            if (cl == nullptr) {
-                jniEnv->ExceptionClear();
-                SAL_WARN("bridges", "exception in FindClass");
-                    //TODO: report failure
-            } else {
-                jmethodID id = jniEnv->GetMethodID(cl, "<init>", "()V");
-                if (id == nullptr) {
-                    jniEnv->ExceptionClear();
-                    SAL_WARN("bridges", "exception in GetMethodID");
-                        //TODO: report failure
-                } else {
-                    jobject o = jniEnv->NewObject(cl, id);
-                    if (o == nullptr) {
-                        jniEnv->ExceptionClear();
-                        SAL_WARN("bridges", "exception in NewObject");
-                            //TODO: report failure
-                    } else {
-                        o = jniEnv->NewGlobalRef(o);
-                        if (o == nullptr) {
-                            jniEnv->ExceptionClear();
-                            SAL_WARN("bridges", "exception in NewGlobalRef");
-                                //TODO: report failure
-                        } else {
-                            envData->asynchronousFinalizer = o;
-                        }
-                    }
-                }
-            }
+            JNI_guarded_context jni(envData->info, envData->machine);
+            JLocalAutoRef ref(
+                jni,
+                jni->NewObject(
+                    envData->info->m_class_AsynchronousFinalizer,
+                    envData->info->m_ctor_AsynchronousFinalizer));
+            jni.ensure_no_exception();
+            envData->asynchronousFinalizer = jni->NewGlobalRef(ref.get());
+            jni.ensure_no_exception();
         }
         java_env->pContext = envData.release();
     } catch (const BridgeRuntimeError & e) {
diff --git a/bridges/source/jni_uno/jni_info.cxx 
b/bridges/source/jni_uno/jni_info.cxx
index aa910f1..84ac6aa 100644
--- a/bridges/source/jni_uno/jni_info.cxx
+++ b/bridges/source/jni_uno/jni_info.cxx
@@ -537,6 +537,8 @@ JNI_info::JNI_info(
         jni, find_class( jni, "com.sun.star.uno.IEnvironment" ) );
     JLocalAutoRef jo_JNI_proxy(
         jni, find_class( jni, "com.sun.star.bridges.jni_uno.JNI_proxy" ) );
+    JLocalAutoRef jo_AsynchronousFinalizer(
+        jni, find_class( jni, "com.sun.star.lib.util.AsynchronousFinalizer" ) 
);
 
     // method Object.toString()
     m_method_Object_toString = jni->GetMethodID(
@@ -749,6 +751,17 @@ JNI_info::JNI_info(
     jni.ensure_no_exception();
     assert( 0 != m_field_JNI_proxy_m_oid );
 
+    // ctor AsynchronousFinalizer
+    m_ctor_AsynchronousFinalizer = jni->GetMethodID(
+        (jclass) jo_AsynchronousFinalizer.get(), "<init>", "()V" );
+    jni.ensure_no_exception();
+    assert( 0 != m_ctor_AsynchronousFinalizer );
+    // method AsynchronousFinalizer.drain()
+    m_method_AsynchronousFinalizer_drain = jni->GetMethodID(
+        (jclass) jo_AsynchronousFinalizer.get(), "drain", "()V" );
+    jni.ensure_no_exception();
+    assert( 0 != m_method_AsynchronousFinalizer_drain );
+
     // get java env
     OUString java_env_type_name( UNO_LB_JAVA );
     JLocalAutoRef jo_java(
@@ -812,6 +825,8 @@ JNI_info::JNI_info(
         (jclass) jni->NewGlobalRef( jo_TypeClass.get() );
     m_class_JNI_proxy =
         (jclass) jni->NewGlobalRef( jo_JNI_proxy.get() );
+    m_class_AsynchronousFinalizer =
+        (jclass) jni->NewGlobalRef( jo_AsynchronousFinalizer.get() );
 
     m_class_Character =
         (jclass) jni->NewGlobalRef( jo_Character.get() );
@@ -896,6 +911,7 @@ void JNI_info::destruct( JNIEnv * jni_env )
     jni_env->DeleteGlobalRef( m_class_Boolean );
     jni_env->DeleteGlobalRef( m_class_Character );
 
+    jni_env->DeleteGlobalRef( m_class_AsynchronousFinalizer );
     jni_env->DeleteGlobalRef( m_class_JNI_proxy );
     jni_env->DeleteGlobalRef( m_class_RuntimeException );
     jni_env->DeleteGlobalRef( m_class_UnoRuntime );
diff --git a/bridges/source/jni_uno/jni_info.h 
b/bridges/source/jni_uno/jni_info.h
index e030602..e38c4b3 100644
--- a/bridges/source/jni_uno/jni_info.h
+++ b/bridges/source/jni_uno/jni_info.h
@@ -150,6 +150,7 @@ public:
     jclass                      m_class_Type;
     jclass                      m_class_TypeClass;
     jclass                      m_class_JNI_proxy;
+    jclass                      m_class_AsynchronousFinalizer;
 
     jmethodID                   m_method_Object_toString;
     jmethodID                   m_method_Class_getName;
@@ -191,6 +192,9 @@ public:
     jfieldID                    m_field_JNI_proxy_m_type;
     jfieldID                    m_field_JNI_proxy_m_oid;
 
+    jmethodID                   m_ctor_AsynchronousFinalizer;
+    jmethodID                   m_method_AsynchronousFinalizer_drain;
+
     ::com::sun::star::uno::TypeDescription m_XInterface_queryInterface_td;
     ::com::sun::star::uno::Type const & m_Exception_type;
     ::com::sun::star::uno::Type const & m_RuntimeException_type;
commit f2c6bbf4606d3e5274e5ba621e3a8b7f939d2f82
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Thu Dec 11 11:48:33 2014 +0100

    Store JNI_info in JniUnoEnvironmentData instead of Bridge
    
    ...to have it available during JNI-UNO's uno_initEnvironment (see next)
    
    Change-Id: I7a2f27b512fc74f418b4648d92dafbf0304eaa96

diff --git a/bridges/source/jni_uno/jni_bridge.cxx 
b/bridges/source/jni_uno/jni_bridge.cxx
index ea28c5d5..192aaf1 100644
--- a/bridges/source/jni_uno/jni_bridge.cxx
+++ b/bridges/source/jni_uno/jni_bridge.cxx
@@ -84,14 +84,14 @@ void SAL_CALL Mapping_map_to_uno(
             Bridge const * bridge =
                 static_cast< Mapping const * >( mapping )->m_bridge;
             JNI_guarded_context jni(
-                bridge->m_jni_info,
+                bridge->getJniInfo(),
                 (static_cast<jni_uno::JniUnoEnvironmentData *>(
                     bridge->m_java_env->pContext)
                  ->machine));
 
             JNI_interface_type_info const * info =
                 static_cast< JNI_interface_type_info const * >(
-                    bridge->m_jni_info->get_type_info(
+                    bridge->getJniInfo()->get_type_info(
                         jni, (typelib_TypeDescription *)td ) );
             uno_Interface * pUnoI = bridge->map_to_uno( jni, javaI, info );
             if (0 != *ppUnoI)
@@ -136,7 +136,7 @@ void SAL_CALL Mapping_map_to_java(
                 Bridge const * bridge =
                     static_cast< Mapping const * >( mapping )->m_bridge;
                 JNI_guarded_context jni(
-                    bridge->m_jni_info,
+                    bridge->getJniInfo(),
                     (static_cast<jni_uno::JniUnoEnvironmentData *>(
                         bridge->m_java_env->pContext)
                      ->machine));
@@ -149,14 +149,14 @@ void SAL_CALL Mapping_map_to_java(
             Bridge const * bridge =
                 static_cast< Mapping const * >( mapping )->m_bridge;
             JNI_guarded_context jni(
-                bridge->m_jni_info,
+                bridge->getJniInfo(),
                 (static_cast<jni_uno::JniUnoEnvironmentData *>(
                     bridge->m_java_env->pContext)
                  ->machine));
 
             JNI_interface_type_info const * info =
                 static_cast< JNI_interface_type_info const * >(
-                    bridge->m_jni_info->get_type_info(
+                    bridge->getJniInfo()->get_type_info(
                         jni, (typelib_TypeDescription *)td ) );
             jobject jlocal = bridge->map_to_java( jni, pUnoI, info );
             if (0 != *ppJavaI)
@@ -235,13 +235,17 @@ Bridge::Bridge(
       m_java_env( java_env ),
       m_registered_java2uno( registered_java2uno )
 {
-    // bootstrapping bridge jni_info
-    m_jni_info = JNI_info::get_jni_info(
-        static_cast<jni_uno::JniUnoEnvironmentData *>(m_java_env->pContext)
-        ->machine);
-
     assert(m_java_env != 0);
     assert(m_uno_env != 0);
+
+    // uno_initEnvironment (below) cannot report errors directly, so it clears
+    // its pContext upon error to indirectly report errors from here:
+    if (static_cast<jni_uno::JniUnoEnvironmentData *>(m_java_env->pContext)
+        == nullptr)
+    {
+        throw BridgeRuntimeError("error during JNI-UNO's uno_initEnvironment");
+    }
+
     (*((uno_Environment *)m_uno_env)->acquire)( (uno_Environment *)m_uno_env );
     (*m_java_env->acquire)( m_java_env );
 
@@ -264,7 +268,10 @@ Bridge::~Bridge()
     (*((uno_Environment *)m_uno_env)->release)( (uno_Environment *)m_uno_env );
 }
 
-
+JNI_info const * Bridge::getJniInfo() const {
+    return static_cast<jni_uno::JniUnoEnvironmentData *>(m_java_env->pContext)
+        ->info;
+}
 
 void JNI_context::java_exc_occurred() const
 {
@@ -418,40 +425,46 @@ extern "C" {
 void SAL_CALL java_env_dispose(uno_Environment * env) {
     auto * envData
         = static_cast<jni_uno::JniUnoEnvironmentData *>(env->pContext);
-    jobject async;
-    {
-        osl::MutexGuard g(envData->mutex);
-        async = envData->asynchronousFinalizer;
-        envData->asynchronousFinalizer = nullptr;
-    }
-    if (async != nullptr) {
-        try {
-            jvmaccess::VirtualMachine::AttachGuard g(
-                envData->machine->getVirtualMachine());
-            JNIEnv * jniEnv = g.getEnvironment();
-            jclass cl = jniEnv->FindClass(
-                "com/sun/star/lib/util/AsynchronousFinalizer");
-            if (cl == nullptr) {
-                jniEnv->ExceptionClear();
-                SAL_WARN("bridges", "exception in FindClass");
-            } else {
-                jmethodID id = jniEnv->GetMethodID(cl, "drain", "()V");
-                if (id == nullptr) {
+    if (envData != nullptr) {
+        jobject async;
+        {
+            osl::MutexGuard g(envData->mutex);
+            async = envData->asynchronousFinalizer;
+            envData->asynchronousFinalizer = nullptr;
+        }
+        if (async != nullptr) {
+            try {
+                jvmaccess::VirtualMachine::AttachGuard g(
+                    envData->machine->getVirtualMachine());
+                JNIEnv * jniEnv = g.getEnvironment();
+                jclass cl = jniEnv->FindClass(
+                    "com/sun/star/lib/util/AsynchronousFinalizer");
+                if (cl == nullptr) {
                     jniEnv->ExceptionClear();
-                    SAL_WARN("bridges", "exception in GetMethodID");
+                    SAL_WARN("bridges", "exception in FindClass");
                 } else {
-                    jniEnv->CallObjectMethod(async, id);
-                    if (jniEnv->ExceptionOccurred()) {
+                    jmethodID id = jniEnv->GetMethodID(cl, "drain", "()V");
+                    if (id == nullptr) {
                         jniEnv->ExceptionClear();
-                        SAL_WARN("bridges", "exception in CallObjectMethod");
+                        SAL_WARN("bridges", "exception in GetMethodID");
+                    } else {
+                        jniEnv->CallObjectMethod(async, id);
+                        if (jniEnv->ExceptionOccurred()) {
+                            jniEnv->ExceptionClear();
+                            SAL_WARN(
+                                "bridges", "exception in CallObjectMethod");
+                        }
                     }
                 }
+                jniEnv->DeleteGlobalRef(async);
+            } catch (
+                jvmaccess::VirtualMachine::AttachGuard::CreationException &)
+            {
+                SAL_WARN(
+                    "bridges",
+                    ("ignoring jvmaccess::VirtualMachine::AttachGuard"
+                     "::CreationException"));
             }
-            jniEnv->DeleteGlobalRef(async);
-        } catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) {
-            SAL_WARN(
-                "bridges",
-                "jvmaccess::VirtualMachine::AttachGuard::CreationException");
         }
     }
 }
@@ -469,50 +482,60 @@ void SAL_CALL java_env_disposing(uno_Environment * env) {
 SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_initEnvironment( uno_Environment * 
java_env )
     SAL_THROW_EXTERN_C()
 {
-    // JavaComponentLoader::getJavaLoader (in
-    // stoc/source/javaloader/javaloader.cxx) stores a
-    // jvmaccess::UnoVirtualMachine pointer into java_env->pContext; replace it
-    // here with a pointer to a full JniUnoEnvironmentData:
-    auto * envData = new jni_uno::JniUnoEnvironmentData(
-        static_cast<jvmaccess::UnoVirtualMachine *>(java_env->pContext));
-    java_env->pContext = envData;
-    java_env->dispose = java_env_dispose;
-    java_env->environmentDisposing = java_env_disposing;
-    java_env->pExtEnv = 0; // no extended support
     try {
-        jvmaccess::VirtualMachine::AttachGuard g(
-            envData->machine->getVirtualMachine());
-        JNIEnv * jniEnv = g.getEnvironment();
-        jclass cl = jniEnv->FindClass(
-            "com/sun/star/lib/util/AsynchronousFinalizer");
-        if (cl == nullptr) {
-            jniEnv->ExceptionClear();
-            SAL_WARN("bridges", "exception in FindClass");
-                //TODO: report failure
-        } else {
-            jmethodID id = jniEnv->GetMethodID(cl, "<init>", "()V");
-            if (id == nullptr) {
+        // JavaComponentLoader::getJavaLoader (in
+        // stoc/source/javaloader/javaloader.cxx) stores a
+        // jvmaccess::UnoVirtualMachine pointer into java_env->pContext; 
replace
+        // it here with either a pointer to a full JniUnoEnvironmentData upon
+        // success, or with a null pointer upon failure (as this function 
cannot
+        // directly report back failure, so it uses that way to indirectly
+        // report failure later from within the Bridge ctor):
+        rtl::Reference<jvmaccess::UnoVirtualMachine> vm(
+            static_cast<jvmaccess::UnoVirtualMachine *>(java_env->pContext));
+        java_env->pContext = nullptr;
+        java_env->dispose = java_env_dispose;
+        java_env->environmentDisposing = java_env_disposing;
+        java_env->pExtEnv = 0; // no extended support
+        std::unique_ptr<jni_uno::JniUnoEnvironmentData> envData(
+            new jni_uno::JniUnoEnvironmentData(vm));
+        {
+            jvmaccess::VirtualMachine::AttachGuard g(
+                envData->machine->getVirtualMachine());
+            JNIEnv * jniEnv = g.getEnvironment();
+            jclass cl = jniEnv->FindClass(
+                "com/sun/star/lib/util/AsynchronousFinalizer");
+            if (cl == nullptr) {
                 jniEnv->ExceptionClear();
-                SAL_WARN("bridges", "exception in GetMethodID");
+                SAL_WARN("bridges", "exception in FindClass");
                     //TODO: report failure
             } else {
-                jobject o = jniEnv->NewObject(cl, id);
-                if (o == nullptr) {
+                jmethodID id = jniEnv->GetMethodID(cl, "<init>", "()V");
+                if (id == nullptr) {
                     jniEnv->ExceptionClear();
-                    SAL_WARN("bridges", "exception in NewObject");
+                    SAL_WARN("bridges", "exception in GetMethodID");
                         //TODO: report failure
                 } else {
-                    o = jniEnv->NewGlobalRef(o);
+                    jobject o = jniEnv->NewObject(cl, id);
                     if (o == nullptr) {
                         jniEnv->ExceptionClear();
-                        SAL_WARN("bridges", "exception in NewGlobalRef");
+                        SAL_WARN("bridges", "exception in NewObject");
                             //TODO: report failure
                     } else {
-                        envData->asynchronousFinalizer = o;
+                        o = jniEnv->NewGlobalRef(o);
+                        if (o == nullptr) {
+                            jniEnv->ExceptionClear();
+                            SAL_WARN("bridges", "exception in NewGlobalRef");
+                                //TODO: report failure
+                        } else {
+                            envData->asynchronousFinalizer = o;
+                        }
                     }
                 }
             }
         }
+        java_env->pContext = envData.release();
+    } catch (const BridgeRuntimeError & e) {
+        SAL_WARN("bridges", "BridgeRuntimeError \"" << e.m_message << "\"");
     } catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) {
         SAL_WARN(
             "bridges",
@@ -581,13 +604,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping(
     }
     catch (const BridgeRuntimeError & err)
     {
-        SAL_WARN(
-            "bridges",
-            "ingoring BridgeRuntimeError \"" << err.m_message << "\"");
-    }
-    catch (const ::jvmaccess::VirtualMachine::AttachGuard::CreationException &)
-    {
-        SAL_WARN("bridges", "attaching current thread to java failed");
+        SAL_WARN("bridges", "BridgeRuntimeError \"" << err.m_message << "\"");
     }
 
     *ppMapping = mapping;
diff --git a/bridges/source/jni_uno/jni_bridge.h 
b/bridges/source/jni_uno/jni_bridge.h
index e1a2aad..8a216e0 100644
--- a/bridges/source/jni_uno/jni_bridge.h
+++ b/bridges/source/jni_uno/jni_bridge.h
@@ -21,7 +21,6 @@
 #define INCLUDED_BRIDGES_SOURCE_JNI_UNO_JNI_BRIDGE_H
 
 #include "jni_base.h"
-#include "jni_info.h"
 #include "jni_helper.h"
 
 #include "osl/diagnose.h"
@@ -36,13 +35,15 @@
 namespace jni_uno
 {
 
-//==== holds environments and mappings 
=========================================
+class JNI_info;
 struct Bridge;
+
 struct Mapping : public uno_Mapping
 {
     Bridge * m_bridge;
 };
 
+// Holds environments and mappings:
 struct Bridge
 {
     mutable oslInterlockedCount m_ref;
@@ -54,8 +55,6 @@ struct Bridge
     Mapping                     m_uno2java;
     bool                        m_registered_java2uno;
 
-    JNI_info const *            m_jni_info;
-
     ~Bridge();
     explicit Bridge(
         uno_Environment * java_env, uno_ExtEnvironment * uno_env,
@@ -107,6 +106,8 @@ struct Bridge
     uno_Interface * map_to_uno(
         JNI_context const & jni,
         jobject javaI, JNI_interface_type_info const * info ) const;
+
+    JNI_info const * getJniInfo() const;
 };
 
 }
diff --git a/bridges/source/jni_uno/jni_data.cxx 
b/bridges/source/jni_uno/jni_data.cxx
index 745a655..5e37302 100644
--- a/bridges/source/jni_uno/jni_data.cxx
+++ b/bridges/source/jni_uno/jni_data.cxx
@@ -231,7 +231,7 @@ void Bridge::map_to_uno(
         else if (special_wrapped_integral_types)
         {
             *(jchar *) uno_data = jni->CallCharMethodA(
-                java_data.l, m_jni_info->m_method_Character_charValue, 0 );
+                java_data.l, getJniInfo()->m_method_Character_charValue, 0 );
             jni.ensure_no_exception();
         }
         else
@@ -249,7 +249,7 @@ void Bridge::map_to_uno(
         else if (special_wrapped_integral_types)
         {
             *(jboolean *) uno_data = jni->CallBooleanMethodA(
-                java_data.l, m_jni_info->m_method_Boolean_booleanValue, 0 );
+                java_data.l, getJniInfo()->m_method_Boolean_booleanValue, 0 );
             jni.ensure_no_exception();
         }
         else
@@ -267,7 +267,7 @@ void Bridge::map_to_uno(
         else if (special_wrapped_integral_types)
         {
             *(jbyte *) uno_data = jni->CallByteMethodA(
-                java_data.l, m_jni_info->m_method_Byte_byteValue, 0 );
+                java_data.l, getJniInfo()->m_method_Byte_byteValue, 0 );
             jni.ensure_no_exception();
         }
         else
@@ -286,7 +286,7 @@ void Bridge::map_to_uno(
         else if (special_wrapped_integral_types)
         {
             *(jshort *) uno_data = jni->CallShortMethodA(
-                java_data.l, m_jni_info->m_method_Short_shortValue, 0 );
+                java_data.l, getJniInfo()->m_method_Short_shortValue, 0 );
             jni.ensure_no_exception();
         }
         else
@@ -305,7 +305,7 @@ void Bridge::map_to_uno(
         else if (special_wrapped_integral_types)
         {
             *(jint *) uno_data = jni->CallIntMethodA(
-                java_data.l, m_jni_info->m_method_Integer_intValue, 0 );
+                java_data.l, getJniInfo()->m_method_Integer_intValue, 0 );
             jni.ensure_no_exception();
         }
         else
@@ -324,7 +324,7 @@ void Bridge::map_to_uno(
         else if (special_wrapped_integral_types)
         {
             *(jlong *) uno_data = jni->CallLongMethodA(
-                java_data.l, m_jni_info->m_method_Long_longValue, 0 );
+                java_data.l, getJniInfo()->m_method_Long_longValue, 0 );
             jni.ensure_no_exception();
         }
         else
@@ -342,7 +342,7 @@ void Bridge::map_to_uno(
         else if (special_wrapped_integral_types)
         {
             *(jfloat *) uno_data = jni->CallFloatMethodA(
-                java_data.l, m_jni_info->m_method_Float_floatValue, 0 );
+                java_data.l, getJniInfo()->m_method_Float_floatValue, 0 );
             jni.ensure_no_exception();
         }
         else
@@ -360,7 +360,7 @@ void Bridge::map_to_uno(
         else if (special_wrapped_integral_types)
         {
             *(jdouble *) uno_data = jni->CallDoubleMethodA(
-                java_data.l, m_jni_info->m_method_Double_doubleValue, 0 );
+                java_data.l, getJniInfo()->m_method_Double_doubleValue, 0 );
             jni.ensure_no_exception();
         }
         else
@@ -410,7 +410,7 @@ void Bridge::map_to_uno(
         // type name
         JLocalAutoRef jo_type_name(
             jni, jni->GetObjectField(
-                java_data.l, m_jni_info->m_field_Type__typeName ) );
+                java_data.l, getJniInfo()->m_field_Type__typeName ) );
         if (! jo_type_name.is())
         {
             throw BridgeRuntimeError(
@@ -454,7 +454,7 @@ void Bridge::map_to_uno(
             if (assign)
                 uno_any_destruct( pAny, 0 );
             uno_any_construct(
-                pAny, 0, m_jni_info->m_XInterface_type_info->m_td.get(), 0 );
+                pAny, 0, getJniInfo()->m_XInterface_type_info->m_td.get(), 0 );
             break;
         }
 
@@ -462,11 +462,11 @@ void Bridge::map_to_uno(
         JLocalAutoRef jo_wrapped_holder( jni );
 
         if (JNI_FALSE != jni->IsInstanceOf(
-                java_data.l, m_jni_info->m_class_Any ))
+                java_data.l, getJniInfo()->m_class_Any ))
         {
             // boxed any
             jo_type.reset( jni->GetObjectField(
-                               java_data.l, m_jni_info->m_field_Any__type ) );
+                               java_data.l, getJniInfo()->m_field_Any__type ) 
);
             if (! jo_type.is())
             {
                 throw BridgeRuntimeError(
@@ -477,7 +477,7 @@ void Bridge::map_to_uno(
             // wrapped value
             jo_wrapped_holder.reset(
                 jni->GetObjectField(
-                    java_data.l, m_jni_info->m_field_Any__object ) );
+                    java_data.l, getJniInfo()->m_field_Any__object ) );
             java_data.l = jo_wrapped_holder.get();
         }
         else
@@ -490,7 +490,7 @@ void Bridge::map_to_uno(
         // get type name
         JLocalAutoRef jo_type_name(
             jni, jni->GetObjectField(
-                jo_type.get(), m_jni_info->m_field_Type__typeName ) );
+                jo_type.get(), getJniInfo()->m_field_Type__typeName ) );
         jni.ensure_no_exception();
         OUString type_name(
             jstring_to_oustring( jni, (jstring) jo_type_name.get() ) );
@@ -519,33 +519,33 @@ void Bridge::map_to_uno(
             case typelib_TypeClass_CHAR:
                 pAny->pData = &pAny->pReserved;
                 *(jchar *) pAny->pData = jni->CallCharMethodA(
-                    java_data.l, m_jni_info->m_method_Character_charValue, 0 );
+                    java_data.l, getJniInfo()->m_method_Character_charValue, 0 
);
                 jni.ensure_no_exception();
                 break;
             case typelib_TypeClass_BOOLEAN:
                 pAny->pData = &pAny->pReserved;
                 *(jboolean *) pAny->pData = jni->CallBooleanMethodA(
-                    java_data.l, m_jni_info->m_method_Boolean_booleanValue, 0 
);
+                    java_data.l, getJniInfo()->m_method_Boolean_booleanValue, 
0 );
                 jni.ensure_no_exception();
                 break;
             case typelib_TypeClass_BYTE:
                 pAny->pData = &pAny->pReserved;
                 *(jbyte *) pAny->pData = jni->CallByteMethodA(
-                    java_data.l, m_jni_info->m_method_Byte_byteValue, 0 );
+                    java_data.l, getJniInfo()->m_method_Byte_byteValue, 0 );
                 jni.ensure_no_exception();
                 break;
             case typelib_TypeClass_SHORT:
             case typelib_TypeClass_UNSIGNED_SHORT:
                 pAny->pData = &pAny->pReserved;
                 *(jshort *) pAny->pData = jni->CallShortMethodA(
-                    java_data.l, m_jni_info->m_method_Short_shortValue, 0 );
+                    java_data.l, getJniInfo()->m_method_Short_shortValue, 0 );
                 jni.ensure_no_exception();
                 break;
             case typelib_TypeClass_LONG:
             case typelib_TypeClass_UNSIGNED_LONG:
                 pAny->pData = &pAny->pReserved;
                 *(jint *) pAny->pData = jni->CallIntMethodA(
-                    java_data.l, m_jni_info->m_method_Integer_intValue, 0 );
+                    java_data.l, getJniInfo()->m_method_Integer_intValue, 0 );
                 jni.ensure_no_exception();
                 break;
             case typelib_TypeClass_HYPER:
@@ -554,7 +554,7 @@ void Bridge::map_to_uno(
                 {
                     pAny->pData = &pAny->pReserved;
                     *(jlong *) pAny->pData = jni->CallLongMethodA(
-                        java_data.l, m_jni_info->m_method_Long_longValue, 0 );
+                        java_data.l, getJniInfo()->m_method_Long_longValue, 0 
);
                     jni.ensure_no_exception();
                 }
                 else
@@ -562,7 +562,7 @@ void Bridge::map_to_uno(
                     std::unique_ptr< rtl_mem > mem(
                         rtl_mem::allocate( sizeof (sal_Int64) ) );
                     *(jlong *) mem.get() = jni->CallLongMethodA(
-                        java_data.l, m_jni_info->m_method_Long_longValue, 0 );
+                        java_data.l, getJniInfo()->m_method_Long_longValue, 0 
);
                     jni.ensure_no_exception();
                     pAny->pData = mem.release();
                 }
@@ -572,7 +572,7 @@ void Bridge::map_to_uno(
                 {
                     pAny->pData = &pAny->pReserved;
                     *(jfloat *) pAny->pData = jni->CallFloatMethodA(
-                        java_data.l, m_jni_info->m_method_Float_floatValue, 0 
);
+                        java_data.l, getJniInfo()->m_method_Float_floatValue, 
0 );
                     jni.ensure_no_exception();
                 }
                 else
@@ -580,7 +580,7 @@ void Bridge::map_to_uno(
                     std::unique_ptr< rtl_mem > mem(
                         rtl_mem::allocate( sizeof (float) ) );
                     *(jfloat *) mem.get() = jni->CallFloatMethodA(
-                        java_data.l, m_jni_info->m_method_Float_floatValue, 0 
);
+                        java_data.l, getJniInfo()->m_method_Float_floatValue, 
0 );
                     jni.ensure_no_exception();
                     pAny->pData = mem.release();
                 }
@@ -592,7 +592,7 @@ void Bridge::map_to_uno(
                     *(jdouble *) pAny->pData =
                         jni->CallDoubleMethodA(
                             java_data.l,
-                            m_jni_info->m_method_Double_doubleValue, 0 );
+                            getJniInfo()->m_method_Double_doubleValue, 0 );
                     jni.ensure_no_exception();
                 }
                 else
@@ -602,7 +602,7 @@ void Bridge::map_to_uno(
                     *(jdouble *) mem.get() =
                         jni->CallDoubleMethodA(
                             java_data.l,
-                            m_jni_info->m_method_Double_doubleValue, 0 );
+                            getJniInfo()->m_method_Double_doubleValue, 0 );
                     jni.ensure_no_exception();
                     pAny->pData = mem.release();
                 }
@@ -676,7 +676,7 @@ void Bridge::map_to_uno(
         }
 
         *(jint *) uno_data = jni->GetIntField(
-            java_data.l, m_jni_info->m_field_Enum_m_value );
+            java_data.l, getJniInfo()->m_field_Enum_m_value );
         break;
     }
     case typelib_TypeClass_STRUCT:
@@ -698,7 +698,7 @@ void Bridge::map_to_uno(
         }
 
         if (0 == info)
-            info = m_jni_info->get_type_info( jni, type );
+            info = getJniInfo()->get_type_info( jni, type );
         JNI_compound_type_info const * comp_info =
             static_cast< JNI_compound_type_info const * >( info );
 
@@ -890,17 +890,17 @@ void Bridge::map_to_uno(
                         assert(
                             type_equals(
                                 type,
-                                m_jni_info->m_Exception_type.getTypeLibType() )
+                                
getJniInfo()->m_Exception_type.getTypeLibType() )
                             || type_equals(
                                 type,
-                                m_jni_info->m_RuntimeException_type.
+                                getJniInfo()->m_RuntimeException_type.
                                 getTypeLibType() ) );
                         assert( 0 == nPos ); // first member
                         // call getMessage()
                         jo_field.reset(
                             jni->CallObjectMethodA(
                                 java_data.l,
-                                m_jni_info->m_method_Throwable_getMessage, 0 )
+                                getJniInfo()->m_method_Throwable_getMessage, 0 
)
                             );
                         jni.ensure_no_exception();
                         checkNull = true;
@@ -1052,7 +1052,7 @@ void Bridge::map_to_uno(
                 typelib_TypeClass_INTERFACE == element_type->eTypeClass)
             {
                 element_info =
-                    m_jni_info->get_type_info( jni, element_td.get() );
+                    getJniInfo()->get_type_info( jni, element_td.get() );
             }
             else
             {
@@ -1131,7 +1131,7 @@ void Bridge::map_to_uno(
         else
         {
             if (0 == info)
-                info = m_jni_info->get_type_info( jni, type );
+                info = getJniInfo()->get_type_info( jni, type );
             JNI_interface_type_info const * iface_info =
                 static_cast< JNI_interface_type_info const * >( info );
             uno_Interface * pUnoI = map_to_uno( jni, java_data.l, iface_info );
@@ -1196,8 +1196,8 @@ void Bridge::map_to_java(
             jvalue arg;
             arg.c = *(jchar const *) uno_data;
             java_data->l = jni->NewObjectA(
-                m_jni_info->m_class_Character,
-                m_jni_info->m_ctor_Character_with_char, &arg );
+                getJniInfo()->m_class_Character,
+                getJniInfo()->m_ctor_Character_with_char, &arg );
             jni.ensure_no_exception();
         }
         else
@@ -1237,8 +1237,8 @@ void Bridge::map_to_java(
             jvalue arg;
             arg.z = *(jboolean const *) uno_data;
             java_data->l = jni->NewObjectA(
-                m_jni_info->m_class_Boolean,
-                m_jni_info->m_ctor_Boolean_with_boolean, &arg );
+                getJniInfo()->m_class_Boolean,
+                getJniInfo()->m_ctor_Boolean_with_boolean, &arg );
             jni.ensure_no_exception();
         }
         else
@@ -1276,8 +1276,8 @@ void Bridge::map_to_java(
             jvalue arg;
             arg.b = *(jbyte const *) uno_data;
             java_data->l = jni->NewObjectA(
-                m_jni_info->m_class_Byte,
-                m_jni_info->m_ctor_Byte_with_byte, &arg );
+                getJniInfo()->m_class_Byte,
+                getJniInfo()->m_ctor_Byte_with_byte, &arg );
             jni.ensure_no_exception();
         }
         else
@@ -1316,8 +1316,8 @@ void Bridge::map_to_java(
             jvalue arg;
             arg.s = *(jshort const *) uno_data;
             java_data->l = jni->NewObjectA(
-                m_jni_info->m_class_Short,
-                m_jni_info->m_ctor_Short_with_short, &arg );
+                getJniInfo()->m_class_Short,
+                getJniInfo()->m_ctor_Short_with_short, &arg );
             jni.ensure_no_exception();
         }
         else
@@ -1356,8 +1356,8 @@ void Bridge::map_to_java(
             jvalue arg;
             arg.i = *(jint const *) uno_data;
             java_data->l = jni->NewObjectA(
-                m_jni_info->m_class_Integer,
-                m_jni_info->m_ctor_Integer_with_int, &arg );
+                getJniInfo()->m_class_Integer,
+                getJniInfo()->m_ctor_Integer_with_int, &arg );
             jni.ensure_no_exception();
         }
         else
@@ -1396,8 +1396,8 @@ void Bridge::map_to_java(
             jvalue arg;
             arg.j = *(jlong const *) uno_data;
             java_data->l = jni->NewObjectA(
-                m_jni_info->m_class_Long,
-                m_jni_info->m_ctor_Long_with_long, &arg );
+                getJniInfo()->m_class_Long,
+                getJniInfo()->m_ctor_Long_with_long, &arg );
             jni.ensure_no_exception();
         }
         else
@@ -1435,8 +1435,8 @@ void Bridge::map_to_java(
             jvalue arg;
             arg.f = *(jfloat const *) uno_data;
             java_data->l = jni->NewObjectA(
-                m_jni_info->m_class_Float,
-                m_jni_info->m_ctor_Float_with_float, &arg );
+                getJniInfo()->m_class_Float,
+                getJniInfo()->m_ctor_Float_with_float, &arg );
             jni.ensure_no_exception();
         }
         else
@@ -1476,8 +1476,8 @@ void Bridge::map_to_java(
             jvalue arg;
             arg.d = *(double const *)uno_data;
             java_data->l = jni->NewObjectA(
-                m_jni_info->m_class_Double,
-                m_jni_info->m_ctor_Double_with_double, &arg );
+                getJniInfo()->m_class_Double,
+                getJniInfo()->m_ctor_Double_with_double, &arg );
             jni.ensure_no_exception();
         }
         else
@@ -1499,7 +1499,7 @@ void Bridge::map_to_java(
             if (0 == java_data->l)
             {
                 java_data->l = jni->NewObjectArray(
-                    1, m_jni_info->m_class_String, jo_in.get() );
+                    1, getJniInfo()->m_class_String, jo_in.get() );
                 jni.ensure_no_exception();
             }
             else
@@ -1533,7 +1533,7 @@ void Bridge::map_to_java(
             if (0 == java_data->l)
             {
                 java_data->l = jni->NewObjectArray(
-                    1, m_jni_info->m_class_Type, jo_in.get() );
+                    1, getJniInfo()->m_class_Type, jo_in.get() );
                 jni.ensure_no_exception();
             }
             else
@@ -1563,7 +1563,7 @@ void Bridge::map_to_java(
             {
             case typelib_TypeClass_VOID:
                 jo_any.reset(
-                    jni->NewLocalRef( m_jni_info->m_object_Any_VOID ) );
+                    jni->NewLocalRef( getJniInfo()->m_object_Any_VOID ) );
                 break;
             case typelib_TypeClass_UNSIGNED_SHORT:
             {
@@ -1571,16 +1571,16 @@ void Bridge::map_to_java(
                 args[ 0 ].s = *(jshort const *) pAny->pData;
                 JLocalAutoRef jo_val(
                     jni, jni->NewObjectA(
-                        m_jni_info->m_class_Short,
-                        m_jni_info->m_ctor_Short_with_short, args ) );
+                        getJniInfo()->m_class_Short,
+                        getJniInfo()->m_ctor_Short_with_short, args ) );
                 jni.ensure_no_exception();
                 // box up in com.sun.star.uno.Any
-                args[ 0 ].l = m_jni_info->m_object_Type_UNSIGNED_SHORT;
+                args[ 0 ].l = getJniInfo()->m_object_Type_UNSIGNED_SHORT;
                 args[ 1 ].l = jo_val.get();
                 jo_any.reset(
                     jni->NewObjectA(
-                        m_jni_info->m_class_Any,
-                        m_jni_info->m_ctor_Any_with_Type_Object, args ) );
+                        getJniInfo()->m_class_Any,
+                        getJniInfo()->m_ctor_Any_with_Type_Object, args ) );
                 jni.ensure_no_exception();
                 break;
             }
@@ -1590,16 +1590,16 @@ void Bridge::map_to_java(
                 args[ 0 ].i = *(jint const *) pAny->pData;
                 JLocalAutoRef jo_val(
                     jni, jni->NewObjectA(
-                        m_jni_info->m_class_Integer,
-                        m_jni_info->m_ctor_Integer_with_int, args ) );
+                        getJniInfo()->m_class_Integer,
+                        getJniInfo()->m_ctor_Integer_with_int, args ) );
                 jni.ensure_no_exception();
                 // box up in com.sun.star.uno.Any
-                args[ 0 ].l = m_jni_info->m_object_Type_UNSIGNED_LONG;
+                args[ 0 ].l = getJniInfo()->m_object_Type_UNSIGNED_LONG;
                 args[ 1 ].l = jo_val.get();
                 jo_any.reset(
                     jni->NewObjectA(
-                        m_jni_info->m_class_Any,
-                        m_jni_info->m_ctor_Any_with_Type_Object, args ) );
+                        getJniInfo()->m_class_Any,
+                        getJniInfo()->m_ctor_Any_with_Type_Object, args ) );
                 jni.ensure_no_exception();
                 break;
             }
@@ -1609,16 +1609,16 @@ void Bridge::map_to_java(
                 args[ 0 ].j = *(jlong const *) pAny->pData;
                 JLocalAutoRef jo_val(
                     jni, jni->NewObjectA(
-                        m_jni_info->m_class_Long,
-                        m_jni_info->m_ctor_Long_with_long, args ) );
+                        getJniInfo()->m_class_Long,
+                        getJniInfo()->m_ctor_Long_with_long, args ) );
                 jni.ensure_no_exception();
                 // box up in com.sun.star.uno.Any
-                args[ 0 ].l = m_jni_info->m_object_Type_UNSIGNED_HYPER;
+                args[ 0 ].l = getJniInfo()->m_object_Type_UNSIGNED_HYPER;
                 args[ 1 ].l = jo_val.get();
                 jo_any.reset(
                     jni->NewObjectA(
-                        m_jni_info->m_class_Any,
-                        m_jni_info->m_ctor_Any_with_Type_Object, args ) );
+                        getJniInfo()->m_class_Any,
+                        getJniInfo()->m_ctor_Any_with_Type_Object, args ) );
                 jni.ensure_no_exception();
                 break;
             }
@@ -1664,8 +1664,8 @@ void Bridge::map_to_java(
                     args[ 1 ].l = jo_any.get();
                     jo_any.reset(
                         jni->NewObjectA(
-                            m_jni_info->m_class_Any,
-                            m_jni_info->m_ctor_Any_with_Type_Object, args ) );
+                            getJniInfo()->m_class_Any,
+                            getJniInfo()->m_ctor_Any_with_Type_Object, args ) 
);
                     jni.ensure_no_exception();
                     break;
                 }
@@ -1684,7 +1684,7 @@ void Bridge::map_to_java(
                         jo_any.reset(
                             map_to_java(
                                 jni, pUnoI,
-                                m_jni_info->m_XInterface_type_info ) );
+                                getJniInfo()->m_XInterface_type_info ) );
                     }
                     // else: empty XInterface ref maps to null-ref
                 }
@@ -1692,7 +1692,7 @@ void Bridge::map_to_java(
                 {
                     JNI_interface_type_info const * iface_info =
                         static_cast< JNI_interface_type_info const * >(
-                            m_jni_info->get_type_info( jni, pAny->pType ) );
+                            getJniInfo()->get_type_info( jni, pAny->pType ) );
                     if (0 != pUnoI)
                     {
                         jo_any.reset( map_to_java( jni, pUnoI, iface_info ) );
@@ -1703,8 +1703,8 @@ void Bridge::map_to_java(
                     args[ 1 ].l = jo_any.get();
                     jo_any.reset(
                         jni->NewObjectA(
-                            m_jni_info->m_class_Any,
-                            m_jni_info->m_ctor_Any_with_Type_Object, args ) );
+                            getJniInfo()->m_class_Any,
+                            getJniInfo()->m_ctor_Any_with_Type_Object, args ) 
);
                     jni.ensure_no_exception();
                 }
                 break;
@@ -1730,8 +1730,8 @@ void Bridge::map_to_java(
                     args[1].l = jo_any.get();
                     jo_any.reset(
                         jni->NewObjectA(
-                            m_jni_info->m_class_Any,
-                            m_jni_info->m_ctor_Any_with_Type_Object, args));
+                            getJniInfo()->m_class_Any,
+                            getJniInfo()->m_ctor_Any_with_Type_Object, args));
                     jni.ensure_no_exception();
                     break;
                 }
@@ -1755,7 +1755,7 @@ void Bridge::map_to_java(
             if (0 == java_data->l)
             {
                 java_data->l = jni->NewObjectArray(
-                    1, m_jni_info->m_class_Object, jo_any.get() );
+                    1, getJniInfo()->m_class_Object, jo_any.get() );
                 jni.ensure_no_exception();
             }
             else
@@ -1825,7 +1825,7 @@ void Bridge::map_to_java(
     case typelib_TypeClass_EXCEPTION:
     {
         if (0 == info)
-            info = m_jni_info->get_type_info( jni, type );
+            info = getJniInfo()->get_type_info( jni, type );
         JNI_compound_type_info const * comp_info =
             static_cast< JNI_compound_type_info const * >( info );
 
@@ -1885,8 +1885,8 @@ void Bridge::map_to_java(
                                 JLocalAutoRef jo(
                                     jni,
                                     jni->NewObjectA(
-                                        m_jni_info->m_class_Character,
-                                        m_jni_info->m_ctor_Character_with_char,
+                                        getJniInfo()->m_class_Character,
+                                        
getJniInfo()->m_ctor_Character_with_char,
                                         &arg ) );
                                 jni.ensure_no_exception();
                                 jni->SetObjectField(
@@ -1904,8 +1904,8 @@ void Bridge::map_to_java(
                                 JLocalAutoRef jo(
                                     jni,
                                     jni->NewObjectA(
-                                        m_jni_info->m_class_Boolean,
-                                        
m_jni_info->m_ctor_Boolean_with_boolean,
+                                        getJniInfo()->m_class_Boolean,
+                                        
getJniInfo()->m_ctor_Boolean_with_boolean,
                                         &arg ) );
                                 jni.ensure_no_exception();
                                 jni->SetObjectField(
@@ -1923,8 +1923,8 @@ void Bridge::map_to_java(
                                 JLocalAutoRef jo(
                                     jni,
                                     jni->NewObjectA(
-                                        m_jni_info->m_class_Byte,
-                                        m_jni_info->m_ctor_Byte_with_byte,
+                                        getJniInfo()->m_class_Byte,
+                                        getJniInfo()->m_ctor_Byte_with_byte,
                                         &arg ) );
                                 jni.ensure_no_exception();
                                 jni->SetObjectField(
@@ -1943,8 +1943,8 @@ void Bridge::map_to_java(
                                 JLocalAutoRef jo(
                                     jni,
                                     jni->NewObjectA(
-                                        m_jni_info->m_class_Short,
-                                        m_jni_info->m_ctor_Short_with_short,
+                                        getJniInfo()->m_class_Short,
+                                        getJniInfo()->m_ctor_Short_with_short,
                                         &arg ) );
                                 jni.ensure_no_exception();
                                 jni->SetObjectField(
@@ -1963,8 +1963,8 @@ void Bridge::map_to_java(
                                 JLocalAutoRef jo(
                                     jni,
                                     jni->NewObjectA(
-                                        m_jni_info->m_class_Integer,
-                                        m_jni_info->m_ctor_Integer_with_int,
+                                        getJniInfo()->m_class_Integer,
+                                        getJniInfo()->m_ctor_Integer_with_int,
                                         &arg ) );
                                 jni.ensure_no_exception();
                                 jni->SetObjectField(
@@ -1983,8 +1983,8 @@ void Bridge::map_to_java(
                                 JLocalAutoRef jo(
                                     jni,
                                     jni->NewObjectA(
-                                        m_jni_info->m_class_Long,
-                                        m_jni_info->m_ctor_Long_with_long,
+                                        getJniInfo()->m_class_Long,
+                                        getJniInfo()->m_ctor_Long_with_long,
                                         &arg ) );
                                 jni.ensure_no_exception();
                                 jni->SetObjectField(
@@ -2002,8 +2002,8 @@ void Bridge::map_to_java(
                                 JLocalAutoRef jo(
                                     jni,
                                     jni->NewObjectA(
-                                        m_jni_info->m_class_Float,
-                                        m_jni_info->m_ctor_Float_with_float,
+                                        getJniInfo()->m_class_Float,
+                                        getJniInfo()->m_ctor_Float_with_float,
                                         &arg ) );
                                 jni.ensure_no_exception();
                                 jni->SetObjectField(
@@ -2021,8 +2021,8 @@ void Bridge::map_to_java(
                                 JLocalAutoRef jo(
                                     jni,
                                     jni->NewObjectA(
-                                        m_jni_info->m_class_Double,
-                                        m_jni_info->m_ctor_Double_with_double,
+                                        getJniInfo()->m_class_Double,
+                                        
getJniInfo()->m_ctor_Double_with_double,
                                         &arg ) );
                                 jni.ensure_no_exception();
                                 jni->SetObjectField(
@@ -2196,7 +2196,7 @@ void Bridge::map_to_java(
         case typelib_TypeClass_STRING:
             jo_ar.reset(
                 jni->NewObjectArray(
-                    nElements, m_jni_info->m_class_String, 0 ) );
+                    nElements, getJniInfo()->m_class_String, 0 ) );
             jni.ensure_no_exception();
             if (in_param)
             {
@@ -2214,7 +2214,7 @@ void Bridge::map_to_java(
             break;
         case typelib_TypeClass_TYPE:
             jo_ar.reset(
-                jni->NewObjectArray( nElements, m_jni_info->m_class_Type, 0 ) 
);
+                jni->NewObjectArray( nElements, getJniInfo()->m_class_Type, 0 
) );
             jni.ensure_no_exception();
             if (in_param)
             {
@@ -2236,7 +2236,7 @@ void Bridge::map_to_java(
         case typelib_TypeClass_ANY:
             jo_ar.reset(
                 jni->NewObjectArray(
-                    nElements, m_jni_info->m_class_Object, 0 ) );
+                    nElements, getJniInfo()->m_class_Object, 0 ) );
             jni.ensure_no_exception();
             if (in_param)
             {
@@ -2302,7 +2302,7 @@ void Bridge::map_to_java(
         case typelib_TypeClass_EXCEPTION:
         {
             JNI_type_info const * element_info =
-                m_jni_info->get_type_info( jni, element_type );
+                getJniInfo()->get_type_info( jni, element_type );
 
             jo_ar.reset(
                 jni->NewObjectArray( nElements, element_info->m_class, 0 ) );
@@ -2364,7 +2364,7 @@ void Bridge::map_to_java(
         {
             JNI_interface_type_info const * iface_info =
                 static_cast< JNI_interface_type_info const * >(
-                    m_jni_info->get_type_info( jni, element_type ) );
+                    getJniInfo()->get_type_info( jni, element_type ) );
 
             jo_ar.reset(
                 jni->NewObjectArray( nElements, iface_info->m_class, 0 ) );
@@ -2439,7 +2439,7 @@ void Bridge::map_to_java(
             if (0 != pUnoI)
             {
                 if (0 == info)
-                    info = m_jni_info->get_type_info( jni, type );
+                    info = getJniInfo()->get_type_info( jni, type );
                 JNI_interface_type_info const * iface_info =
                     static_cast< JNI_interface_type_info const * >( info );
                 jo_iface.reset( map_to_java( jni, pUnoI, iface_info ) );
@@ -2450,7 +2450,7 @@ void Bridge::map_to_java(
             if (0 == java_data->l)
             {
                 if (0 == info)
-                    info = m_jni_info->get_type_info( jni, type );
+                    info = getJniInfo()->get_type_info( jni, type );
                 java_data->l =
                     jni->NewObjectArray( 1, info->m_class, jo_iface.get() );
                 jni.ensure_no_exception();
diff --git a/bridges/source/jni_uno/jni_java2uno.cxx 
b/bridges/source/jni_uno/jni_java2uno.cxx
index 4c19043..8d432cd 100644
--- a/bridges/source/jni_uno/jni_java2uno.cxx
+++ b/bridges/source/jni_uno/jni_java2uno.cxx
@@ -47,8 +47,8 @@ jobject Bridge::map_to_java(
     args[ 0 ].l = jo_oid.get();
     args[ 1 ].l = info->m_type;
     jobject jo_iface = jni->CallObjectMethodA(
-        m_jni_info->m_object_java_env,
-        m_jni_info->m_method_IEnvironment_getRegisteredInterface, args );
+        getJniInfo()->m_object_java_env,
+        getJniInfo()->m_method_IEnvironment_getRegisteredInterface, args );
     jni.ensure_no_exception();
 
     if (0 == jo_iface) // no registered iface
@@ -63,7 +63,7 @@ jobject Bridge::map_to_java(
         acquire();
         args2[ 0 ].j = reinterpret_cast< sal_Int64 >( this );
         (*pUnoI->acquire)( pUnoI );
-        args2[ 1 ].l = m_jni_info->m_object_java_env;
+        args2[ 1 ].l = getJniInfo()->m_object_java_env;
         args2[ 2 ].j = reinterpret_cast< sal_Int64 >( pUnoI );
         typelib_typedescription_acquire( info->m_td.get() );
         args2[ 3 ].j = reinterpret_cast< sal_Int64 >( info->m_td.get() );
@@ -77,8 +77,8 @@ jobject Bridge::map_to_java(
             args2[ 7 ].l = envData->asynchronousFinalizer;
         }
         jo_iface = jni->CallStaticObjectMethodA(
-            m_jni_info->m_class_JNI_proxy,
-            m_jni_info->m_method_JNI_proxy_create, args2 );
+            getJniInfo()->m_class_JNI_proxy,
+            getJniInfo()->m_method_JNI_proxy_create, args2 );
         jni.ensure_no_exception();
     }
 
@@ -125,7 +125,7 @@ void Bridge::handle_uno_exc( JNI_context const & jni, 
uno_Any * uno_exc ) const
             // call toString()
             JLocalAutoRef jo_descr(
                 jni, jni->CallObjectMethodA(
-                    jo_exc.get(), m_jni_info->m_method_Object_toString, 0 ) );
+                    jo_exc.get(), getJniInfo()->m_method_Object_toString, 0 ) 
);
             jni.ensure_no_exception();
             throw BridgeRuntimeError(
                 "throwing java exception failed: "
@@ -376,7 +376,7 @@ JNICALL 
Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call(
     jobjectArray jo_args /* may be 0 */ )
 {
     Bridge const * bridge = reinterpret_cast< Bridge const * >( bridge_handle 
);
-    JNI_info const * jni_info = bridge->m_jni_info;
+    JNI_info const * jni_info = bridge->getJniInfo();
     JNI_context jni(
         jni_info, jni_env,
         static_cast< jobject >(
@@ -623,7 +623,7 @@ JNICALL 
Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_finalize__J(
     JNIEnv * jni_env, jobject jo_proxy, jlong bridge_handle )
 {
     Bridge const * bridge = reinterpret_cast< Bridge const * >( bridge_handle 
);
-    JNI_info const * jni_info = bridge->m_jni_info;
+    JNI_info const * jni_info = bridge->getJniInfo();
     JNI_context jni(
         jni_info, jni_env,
         static_cast< jobject >(
diff --git a/bridges/source/jni_uno/jni_uno2java.cxx 
b/bridges/source/jni_uno/jni_uno2java.cxx
index 578c3d0..1885c88 100644
--- a/bridges/source/jni_uno/jni_uno2java.cxx
+++ b/bridges/source/jni_uno/jni_uno2java.cxx
@@ -75,7 +75,7 @@ void Bridge::handle_java_exc(
     JLocalAutoRef jo_class( jni, jni->GetObjectClass( jo_exc.get() ) );
     JLocalAutoRef jo_class_name(
         jni, jni->CallObjectMethodA(
-            jo_class.get(), m_jni_info->m_method_Class_getName, 0 ) );
+            jo_class.get(), getJniInfo()->m_method_Class_getName, 0 ) );
     jni.ensure_no_exception();
     OUString exc_name(
         jstring_to_oustring( jni, (jstring) jo_class_name.get() ) );
@@ -86,7 +86,7 @@ void Bridge::handle_java_exc(
         // call toString()
         JLocalAutoRef jo_descr(
             jni, jni->CallObjectMethodA(
-                jo_exc.get(), m_jni_info->m_method_Object_toString, 0 ) );
+                jo_exc.get(), getJniInfo()->m_method_Object_toString, 0 ) );
         jni.ensure_no_exception();
         throw BridgeRuntimeError(
             "non-UNO exception occurred: "
@@ -129,7 +129,7 @@ void Bridge::call_java(
     assert( function_pos_offset == 0 || function_pos_offset == 1 );
 
     JNI_guarded_context jni(
-        m_jni_info,
+        getJniInfo(),
         static_cast<JniUnoEnvironmentData *>(m_java_env->pContext)->machine);
 
     // assure fully initialized iface_td:
@@ -208,7 +208,7 @@ void Bridge::call_java(
 
     JNI_interface_type_info const * info =
         static_cast< JNI_interface_type_info const * >(
-            m_jni_info->get_type_info( jni, &iface_td->aBase ) );
+            getJniInfo()->get_type_info( jni, &iface_td->aBase ) );
     jmethodID method_id = info->m_methods[ function_pos ];
 
 #if OSL_DEBUG_LEVEL > 0
@@ -219,20 +219,20 @@ void Bridge::call_java(
     jni.ensure_no_exception();
     JLocalAutoRef jo_descr(
         jni, jni->CallObjectMethodA(
-            jo_method.get(), m_jni_info->m_method_Object_toString, 0 ) );
+            jo_method.get(), getJniInfo()->m_method_Object_toString, 0 ) );
     jni.ensure_no_exception();
     trace_buf.append( jstring_to_oustring( jni, (jstring) jo_descr.get() ) );
     trace_buf.append( " on " );
     jo_descr.reset(
         jni->CallObjectMethodA(
-            javaI, m_jni_info->m_method_Object_toString, 0 ) );
+            javaI, getJniInfo()->m_method_Object_toString, 0 ) );
     jni.ensure_no_exception();
     trace_buf.append( jstring_to_oustring( jni, (jstring) jo_descr.get() ) );
     trace_buf.append( " (" );
     JLocalAutoRef jo_class( jni, jni->GetObjectClass( javaI ) );
     jo_descr.reset(
         jni->CallObjectMethodA(
-            jo_class.get(), m_jni_info->m_method_Object_toString, 0 ) );
+            jo_class.get(), getJniInfo()->m_method_Object_toString, 0 ) );
     jni.ensure_no_exception();
     trace_buf.append( jstring_to_oustring( jni, (jstring) jo_descr.get() ) );
     trace_buf.append( ")" );
@@ -427,7 +427,7 @@ inline UNO_proxy::UNO_proxy(
       m_oid( oid ),
       m_type_info( info )
 {
-    JNI_info const * jni_info = bridge->m_jni_info;
+    JNI_info const * jni_info = bridge->getJniInfo();
     JLocalAutoRef jo_string_array(
         jni, jni->NewObjectArray( 1, jni_info->m_class_String, jo_oid ) );
     jni.ensure_no_exception();
@@ -529,7 +529,7 @@ void SAL_CALL UNO_proxy_free( uno_ExtEnvironment * env, 
void * proxy )
     try
     {
         JNI_guarded_context jni(
-            bridge->m_jni_info,
+            bridge->getJniInfo(),
             (static_cast<JniUnoEnvironmentData *>(bridge->m_java_env->pContext)
              ->machine));
 
@@ -617,7 +617,7 @@ void SAL_CALL UNO_proxy_dispatch(
                 bridge->call_java(
                     that->m_javaI, iface_td,
                     attrib_td->nIndex, 1, // get, then set method
-                    bridge->m_jni_info->m_void_type.getTypeLibType(),
+                    bridge->getJniInfo()->m_void_type.getTypeLibType(),
                     &param, 1,
                     0, uno_args, uno_exc );
             }
@@ -672,7 +672,7 @@ void SAL_CALL UNO_proxy_dispatch(
 
                 if (0 == pInterface)
                 {
-                    JNI_info const * jni_info = bridge->m_jni_info;
+                    JNI_info const * jni_info = bridge->getJniInfo();
                     JNI_guarded_context jni(
                         jni_info,
                         (static_cast<JniUnoEnvironmentData *>(
diff --git a/bridges/source/jni_uno/jniunoenvironmentdata.hxx 
b/bridges/source/jni_uno/jniunoenvironmentdata.hxx
index 843d29e..4ca91ad 100644
--- a/bridges/source/jni_uno/jniunoenvironmentdata.hxx
+++ b/bridges/source/jni_uno/jniunoenvironmentdata.hxx
@@ -29,16 +29,21 @@
 #include <osl/mutex.hxx>
 #include <rtl/ref.hxx>
 
+#include <jni_info.h>
+
 namespace jni_uno {
 
 // The pContext payload of a JNI uno_Environment:
 struct JniUnoEnvironmentData: boost::noncopyable {
     explicit JniUnoEnvironmentData(
         rtl::Reference<jvmaccess::UnoVirtualMachine> const & theMachine):
-        machine(theMachine), asynchronousFinalizer(nullptr)
+        machine(theMachine), info(JNI_info::get_jni_info(theMachine)),
+        asynchronousFinalizer(nullptr)
     {}
 
-    rtl::Reference<jvmaccess::UnoVirtualMachine> machine;
+    rtl::Reference<jvmaccess::UnoVirtualMachine> const machine;
+    JNI_info const * const info;
+
     osl::Mutex mutex;
     jobject asynchronousFinalizer;
 };
commit 36af1d315cc4dbdf3000a1de4756f94d1c410683
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Thu Dec 11 11:53:57 2014 +0100

    better documentation
    
    Change-Id: Ife9a98cfe2166ccc7aac3904c7be4ea71443d857

diff --git a/bridges/source/jni_uno/jni_bridge.cxx 
b/bridges/source/jni_uno/jni_bridge.cxx
index 9f0648a..ea28c5d5 100644
--- a/bridges/source/jni_uno/jni_bridge.cxx
+++ b/bridges/source/jni_uno/jni_bridge.cxx
@@ -469,6 +469,10 @@ void SAL_CALL java_env_disposing(uno_Environment * env) {
 SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_initEnvironment( uno_Environment * 
java_env )
     SAL_THROW_EXTERN_C()
 {
+    // JavaComponentLoader::getJavaLoader (in
+    // stoc/source/javaloader/javaloader.cxx) stores a
+    // jvmaccess::UnoVirtualMachine pointer into java_env->pContext; replace it
+    // here with a pointer to a full JniUnoEnvironmentData:
     auto * envData = new jni_uno::JniUnoEnvironmentData(
         static_cast<jvmaccess::UnoVirtualMachine *>(java_env->pContext));
     java_env->pContext = envData;
commit c8314441109548ab6ed12a3cc3cdbee6d1fd8eaf
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Thu Dec 11 11:23:11 2014 +0100

    Move JniUnoEnvironmentData into its own include file
    
    Change-Id: I8e6fb1fc0acff781dd6e6b62018c7ccd5d0e2307

diff --git a/bridges/source/jni_uno/jni_bridge.cxx 
b/bridges/source/jni_uno/jni_bridge.cxx
index a3ffe01..9f0648a 100644
--- a/bridges/source/jni_uno/jni_bridge.cxx
+++ b/bridges/source/jni_uno/jni_bridge.cxx
@@ -23,6 +23,7 @@
 #include <memory>
 
 #include "jni_bridge.h"
+#include "jniunoenvironmentdata.hxx"
 
 #include <boost/static_assert.hpp>
 #include "jvmaccess/unovirtualmachine.hxx"
diff --git a/bridges/source/jni_uno/jni_bridge.h 
b/bridges/source/jni_uno/jni_bridge.h
index 9328c67..e1a2aad 100644
--- a/bridges/source/jni_uno/jni_bridge.h
+++ b/bridges/source/jni_uno/jni_bridge.h
@@ -36,17 +36,6 @@
 namespace jni_uno
 {
 
-struct JniUnoEnvironmentData: boost::noncopyable {
-    explicit JniUnoEnvironmentData(
-        rtl::Reference<jvmaccess::UnoVirtualMachine> const & theMachine):
-        machine(theMachine), asynchronousFinalizer(nullptr)
-    {}
-
-    rtl::Reference<jvmaccess::UnoVirtualMachine> machine;
-    osl::Mutex mutex;
-    jobject asynchronousFinalizer;
-};
-
 //==== holds environments and mappings 
=========================================
 struct Bridge;
 struct Mapping : public uno_Mapping
diff --git a/bridges/source/jni_uno/jni_java2uno.cxx 
b/bridges/source/jni_uno/jni_java2uno.cxx
index 6209879..4c19043 100644
--- a/bridges/source/jni_uno/jni_java2uno.cxx
+++ b/bridges/source/jni_uno/jni_java2uno.cxx
@@ -25,6 +25,7 @@
 #include <sal/alloca.h>
 
 #include "jni_bridge.h"
+#include "jniunoenvironmentdata.hxx"
 
 namespace jni_uno
 {
diff --git a/bridges/source/jni_uno/jni_uno2java.cxx 
b/bridges/source/jni_uno/jni_uno2java.cxx
index 8058550..578c3d0 100644
--- a/bridges/source/jni_uno/jni_uno2java.cxx
+++ b/bridges/source/jni_uno/jni_uno2java.cxx
@@ -29,6 +29,7 @@
 #include "rtl/ustrbuf.hxx"
 
 #include "jni_bridge.h"
+#include "jniunoenvironmentdata.hxx"
 
 namespace
 {
diff --git a/bridges/source/jni_uno/jniunoenvironmentdata.hxx 
b/bridges/source/jni_uno/jniunoenvironmentdata.hxx
new file mode 100644
index 0000000..843d29e
--- /dev/null
+++ b/bridges/source/jni_uno/jniunoenvironmentdata.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BRIDGES_SOURCE_JNI_UNO_JNIUNOENVIRONMENTDATA_HXX
+#define INCLUDED_BRIDGES_SOURCE_JNI_UNO_JNIUNOENVIRONMENTDATA_HXX
+
+#include <sal/config.h>
+
+#include <jni.h>
+
+#include <boost/noncopyable.hpp>
+#include <jvmaccess/unovirtualmachine.hxx>
+#include <osl/mutex.hxx>
+#include <rtl/ref.hxx>
+
+namespace jni_uno {
+
+// The pContext payload of a JNI uno_Environment:
+struct JniUnoEnvironmentData: boost::noncopyable {
+    explicit JniUnoEnvironmentData(
+        rtl::Reference<jvmaccess::UnoVirtualMachine> const & theMachine):
+        machine(theMachine), asynchronousFinalizer(nullptr)
+    {}
+
+    rtl::Reference<jvmaccess::UnoVirtualMachine> machine;
+    osl::Mutex mutex;
+    jobject asynchronousFinalizer;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit f53bc68922dd15a53f6128b130d78d4239008d81
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Thu Dec 11 11:15:41 2014 +0100

    Rename Context -> JniUnoEnvironmentData
    
    Change-Id: I97879d250ed0ed20d5e129ff3af6dbc2f5759078

diff --git a/bridges/source/jni_uno/jni_bridge.cxx 
b/bridges/source/jni_uno/jni_bridge.cxx
index 809eb3b..a3ffe01 100644
--- a/bridges/source/jni_uno/jni_bridge.cxx
+++ b/bridges/source/jni_uno/jni_bridge.cxx
@@ -84,7 +84,8 @@ void SAL_CALL Mapping_map_to_uno(
                 static_cast< Mapping const * >( mapping )->m_bridge;
             JNI_guarded_context jni(
                 bridge->m_jni_info,
-                (static_cast<jni_uno::Context *>(bridge->m_java_env->pContext)
+                (static_cast<jni_uno::JniUnoEnvironmentData *>(
+                    bridge->m_java_env->pContext)
                  ->machine));
 
             JNI_interface_type_info const * info =
@@ -135,7 +136,7 @@ void SAL_CALL Mapping_map_to_java(
                     static_cast< Mapping const * >( mapping )->m_bridge;
                 JNI_guarded_context jni(
                     bridge->m_jni_info,
-                    (static_cast<jni_uno::Context *>(
+                    (static_cast<jni_uno::JniUnoEnvironmentData *>(
                         bridge->m_java_env->pContext)
                      ->machine));
                 jni->DeleteGlobalRef( *ppJavaI );
@@ -148,7 +149,8 @@ void SAL_CALL Mapping_map_to_java(
                 static_cast< Mapping const * >( mapping )->m_bridge;
             JNI_guarded_context jni(
                 bridge->m_jni_info,
-                (static_cast<jni_uno::Context *>(bridge->m_java_env->pContext)
+                (static_cast<jni_uno::JniUnoEnvironmentData *>(
+                    bridge->m_java_env->pContext)
                  ->machine));
 
             JNI_interface_type_info const * info =
@@ -234,7 +236,8 @@ Bridge::Bridge(
 {
     // bootstrapping bridge jni_info
     m_jni_info = JNI_info::get_jni_info(
-        static_cast<jni_uno::Context *>(m_java_env->pContext)->machine);
+        static_cast<jni_uno::JniUnoEnvironmentData *>(m_java_env->pContext)
+        ->machine);
 
     assert(m_java_env != 0);
     assert(m_uno_env != 0);
@@ -412,17 +415,18 @@ using namespace ::jni_uno;
 extern "C" {
 
 void SAL_CALL java_env_dispose(uno_Environment * env) {
-    jni_uno::Context * context = static_cast<jni_uno::Context 
*>(env->pContext);
+    auto * envData
+        = static_cast<jni_uno::JniUnoEnvironmentData *>(env->pContext);
     jobject async;
     {
-        osl::MutexGuard g(context->mutex);
-        async = context->asynchronousFinalizer;
-        context->asynchronousFinalizer = nullptr;
+        osl::MutexGuard g(envData->mutex);
+        async = envData->asynchronousFinalizer;
+        envData->asynchronousFinalizer = nullptr;
     }
     if (async != nullptr) {
         try {
             jvmaccess::VirtualMachine::AttachGuard g(
-                context->machine->getVirtualMachine());
+                envData->machine->getVirtualMachine());
             JNIEnv * jniEnv = g.getEnvironment();
             jclass cl = jniEnv->FindClass(
                 "com/sun/star/lib/util/AsynchronousFinalizer");
@@ -453,7 +457,7 @@ void SAL_CALL java_env_dispose(uno_Environment * env) {
 
 void SAL_CALL java_env_disposing(uno_Environment * env) {
     java_env_dispose(env);
-    delete static_cast<jni_uno::Context *>(env->pContext);
+    delete static_cast<jni_uno::JniUnoEnvironmentData *>(env->pContext);
 }
 
 #ifdef DISABLE_DYNLOADING
@@ -464,15 +468,15 @@ void SAL_CALL java_env_disposing(uno_Environment * env) {
 SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_initEnvironment( uno_Environment * 
java_env )
     SAL_THROW_EXTERN_C()
 {
-    java_env->pContext = new jni_uno::Context(
+    auto * envData = new jni_uno::JniUnoEnvironmentData(
         static_cast<jvmaccess::UnoVirtualMachine *>(java_env->pContext));
+    java_env->pContext = envData;
     java_env->dispose = java_env_dispose;
     java_env->environmentDisposing = java_env_disposing;
     java_env->pExtEnv = 0; // no extended support
     try {
         jvmaccess::VirtualMachine::AttachGuard g(
-            static_cast<jni_uno::Context *>(java_env->pContext)->machine
-            ->getVirtualMachine());
+            envData->machine->getVirtualMachine());
         JNIEnv * jniEnv = g.getEnvironment();
         jclass cl = jniEnv->FindClass(
             "com/sun/star/lib/util/AsynchronousFinalizer");
@@ -499,9 +503,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_initEnvironment( 
uno_Environment * java_e
                         SAL_WARN("bridges", "exception in NewGlobalRef");
                             //TODO: report failure
                     } else {
-                        (static_cast<jni_uno::Context *>(java_env->pContext)->
-                         asynchronousFinalizer)
-                            = o;
+                        envData->asynchronousFinalizer = o;
                     }
                 }
             }
diff --git a/bridges/source/jni_uno/jni_bridge.h 
b/bridges/source/jni_uno/jni_bridge.h
index 7c5bf37..9328c67 100644
--- a/bridges/source/jni_uno/jni_bridge.h
+++ b/bridges/source/jni_uno/jni_bridge.h
@@ -36,8 +36,8 @@
 namespace jni_uno
 {
 
-struct Context: boost::noncopyable {
-    explicit Context(
+struct JniUnoEnvironmentData: boost::noncopyable {
+    explicit JniUnoEnvironmentData(
         rtl::Reference<jvmaccess::UnoVirtualMachine> const & theMachine):
         machine(theMachine), asynchronousFinalizer(nullptr)
     {}
diff --git a/bridges/source/jni_uno/jni_java2uno.cxx 
b/bridges/source/jni_uno/jni_java2uno.cxx
index 086399e..6209879 100644
--- a/bridges/source/jni_uno/jni_java2uno.cxx
+++ b/bridges/source/jni_uno/jni_java2uno.cxx
@@ -69,11 +69,11 @@ jobject Bridge::map_to_java(
         args2[ 4 ].l = info->m_type;
         args2[ 5 ].l = jo_oid.get();
         args2[ 6 ].l = info->m_proxy_ctor;
-        jni_uno::Context * context = static_cast<jni_uno::Context *>(
+        auto * envData = static_cast<jni_uno::JniUnoEnvironmentData *>(
             m_java_env->pContext);
         {
-            osl::MutexGuard g(context->mutex);
-            args2[ 7 ].l = context->asynchronousFinalizer;
+            osl::MutexGuard g(envData->mutex);
+            args2[ 7 ].l = envData->asynchronousFinalizer;
         }
         jo_iface = jni->CallStaticObjectMethodA(
             m_jni_info->m_class_JNI_proxy,
@@ -379,8 +379,8 @@ JNICALL 
Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call(
     JNI_context jni(
         jni_info, jni_env,
         static_cast< jobject >(
-            static_cast<Context *>(bridge->m_java_env->pContext)->machine
-            ->getClassLoader()));
+            static_cast<JniUnoEnvironmentData *>(bridge->m_java_env->pContext)
+            ->machine->getClassLoader()));
 
     OUString method_name;
 
@@ -626,8 +626,8 @@ JNICALL 
Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_finalize__J(
     JNI_context jni(
         jni_info, jni_env,
         static_cast< jobject >(
-            static_cast<Context *>(bridge->m_java_env->pContext)->machine
-            ->getClassLoader()));
+            static_cast<JniUnoEnvironmentData *>(bridge->m_java_env->pContext)
+            ->machine->getClassLoader()));
 
     uno_Interface * pUnoI = reinterpret_cast< uno_Interface * >(
         jni->GetLongField(
diff --git a/bridges/source/jni_uno/jni_uno2java.cxx 
b/bridges/source/jni_uno/jni_uno2java.cxx
index c50be5d..8058550 100644
--- a/bridges/source/jni_uno/jni_uno2java.cxx
+++ b/bridges/source/jni_uno/jni_uno2java.cxx
@@ -128,7 +128,8 @@ void Bridge::call_java(
     assert( function_pos_offset == 0 || function_pos_offset == 1 );
 
     JNI_guarded_context jni(
-        m_jni_info, static_cast<Context *>(m_java_env->pContext)->machine);
+        m_jni_info,
+        static_cast<JniUnoEnvironmentData *>(m_java_env->pContext)->machine);
 
     // assure fully initialized iface_td:
     ::com::sun::star::uno::TypeDescription iface_holder;
@@ -528,7 +529,8 @@ void SAL_CALL UNO_proxy_free( uno_ExtEnvironment * env, 
void * proxy )
     {
         JNI_guarded_context jni(
             bridge->m_jni_info,
-            static_cast<Context *>(bridge->m_java_env->pContext)->machine);
+            (static_cast<JniUnoEnvironmentData *>(bridge->m_java_env->pContext)
+             ->machine));
 
         jni->DeleteGlobalRef( that->m_javaI );
         jni->DeleteGlobalRef( that->m_jo_oid );
@@ -672,7 +674,8 @@ void SAL_CALL UNO_proxy_dispatch(
                     JNI_info const * jni_info = bridge->m_jni_info;
                     JNI_guarded_context jni(
                         jni_info,
-                        (static_cast<Context *>(bridge->m_java_env->pContext)
+                        (static_cast<JniUnoEnvironmentData *>(
+                            bridge->m_java_env->pContext)
                          ->machine));
 
                     JNI_interface_type_info const * info =
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to