24
24
import java .io .IOException ;
25
25
import java .io .InputStream ;
26
26
import java .lang .ref .SoftReference ;
27
- import java .lang .reflect .Constructor ;
28
27
import java .util .HashMap ;
29
28
import java .util .Iterator ;
30
29
import java .util .Map ;
@@ -47,7 +46,6 @@ public final class CouchbaseLite {
47
46
private CouchbaseLite () {}
48
47
49
48
private static final String LITECORE_JNI_LIBRARY = "LiteCoreJNI" ;
50
- private static final String MVALUE_DELEGATE_CLASS = "com.couchbase.lite.MValueDelegate" ;
51
49
52
50
private static final AtomicReference <ExecutionService > EXECUTION_SERVICE = new AtomicReference <>();
53
51
private static final AtomicReference <SoftReference <Context >> CONTEXT = new AtomicReference <>();
@@ -64,7 +62,7 @@ public static void init(@NonNull Context ctxt) {
64
62
65
63
System .loadLibrary (LITECORE_JNI_LIBRARY );
66
64
67
- initMValue ( );
65
+ MValue . registerDelegate ( new MValueDelegate () );
68
66
69
67
CONTEXT .set (new SoftReference <>(ctxt .getApplicationContext ()));
70
68
@@ -130,17 +128,6 @@ private static String verifyDir(@Nullable File dir) {
130
128
throw new IllegalStateException ("Cannot create or access directory at " + path );
131
129
}
132
130
133
- private static void initMValue () {
134
- try {
135
- final Constructor ctor = Class .forName (MVALUE_DELEGATE_CLASS ).getDeclaredConstructor ();
136
- ctor .setAccessible (true );
137
- MValue .registerDelegate ((MValue .Delegate ) ctor .newInstance ());
138
- }
139
- catch (Exception e ) {
140
- throw new IllegalStateException ("Cannot initialize MValue delegate" , e );
141
- }
142
- }
143
-
144
131
@ NonNull
145
132
private static Map <String , String > loadErrorMessages (@ NonNull Context ctxt ) {
146
133
final Map <String , String > errorMessages = new HashMap <>();
0 commit comments