Skip to content

Commit e425d9b

Browse files
committed
FirebaseAndroid: fix & remove nullability annotations
The nullability annotations seem to cause warnings due to `-Wnullability-completeness`. Correctly annotating the types as `_Nullable JavaVM * _Nonnull` seems to not work across Swift and C/C++. Rather than try to force this, simply avoid the nullability annotations. Clear up the method registration which was never being invoked due to an early return in the success case.
1 parent 803f2cc commit e425d9b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Sources/FirebaseAndroid/include/FirebaseAndroid.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
extern "C" {
1010
#endif
1111

12-
jobject _Nullable SwiftFirebase_GetActivity(void);
13-
JNIEnv * _Nullable SwiftFirebase_GetJavaEnvironment(void);
14-
JavaVM * _Nullable SwiftFirebase_GetJVM(void);
12+
jobject SwiftFirebase_GetActivity(void);
13+
JNIEnv *SwiftFirebase_GetJavaEnvironment(void);
14+
JavaVM *SwiftFirebase_GetJVM(void);
1515

1616
#if defined(__cplusplus)
1717
}

Sources/FirebaseAndroid/jni.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ FIREBASE_ANDROID_ABI
5353
jint JNI_OnLoad(JavaVM *vm, void *reserved)
5454
{
5555
g_VM = vm;
56-
if ((*g_VM)->GetEnv(g_VM, (void **)&g_Env, JNI_VERSION_1_6) == JNI_OK)
57-
return JNI_VERSION_1_6;
56+
if ((*g_VM)->GetEnv(g_VM, (void **)&g_Env, JNI_VERSION_1_6) != JNI_OK)
57+
return -1;
5858
RegisterNativeMethods(g_Env);
59-
return -1;
59+
return JNI_VERSION_1_6;
6060
}
6161

6262
FIREBASE_ANDROID_ABI

0 commit comments

Comments
 (0)