Skip to content

Commit

Permalink
FirebaseAndroid: fix & remove nullability annotations
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
compnerd committed Apr 2, 2024
1 parent 9842cb3 commit 3d0ba8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Sources/FirebaseAndroid/include/FirebaseAndroid.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
extern "C" {
#endif

jobject _Nullable SwiftFirebase_GetActivity(void);
JNIEnv * _Nullable SwiftFirebase_GetJavaEnvironment(void);
JavaVM * _Nullable SwiftFirebase_GetJVM(void);
jobject SwiftFirebase_GetActivity(void);
JNIEnv *SwiftFirebase_GetJavaEnvironment(void);
JavaVM *SwiftFirebase_GetJVM(void);

#if defined(__cplusplus)
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/FirebaseAndroid/jni.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ FIREBASE_ANDROID_ABI
jint JNI_OnLoad(JavaVM *vm, void *reserved)
{
g_VM = vm;
if ((*g_VM)->GetEnv(g_VM, (void **)&g_Env, JNI_VERSION_1_6) == JNI_OK)
return JNI_VERSION_1_6;
if ((*g_VM)->GetEnv(g_VM, (void **)&g_Env, JNI_VERSION_1_6) != JNI_OK)
return -1;
RegisterNativeMethods(g_Env);
return -1;
return JNI_VERSION_1_6;
}

FIREBASE_ANDROID_ABI
Expand Down

0 comments on commit 3d0ba8c

Please sign in to comment.