diff --git a/firebase-functions/firebase-functions.gradle b/firebase-functions/firebase-functions.gradle index 06244bfcea7..dce829719ba 100644 --- a/firebase-functions/firebase-functions.gradle +++ b/firebase-functions/firebase-functions.gradle @@ -19,7 +19,6 @@ plugins { firebaseLibrary { testLab.enabled = true publishSources = true - staticAnalysis.disableKotlinInteropLint() } android { diff --git a/firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctions.java b/firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctions.java index 699d729db0d..ae9137fa09b 100644 --- a/firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctions.java +++ b/firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctions.java @@ -128,7 +128,8 @@ public void onProviderInstallFailed(int i, android.content.Intent intent) { * @param app The app for the Firebase project. * @param region The region for the HTTPS trigger, such as "us-central1". */ - public static FirebaseFunctions getInstance(FirebaseApp app, String region) { + @NonNull + public static FirebaseFunctions getInstance(@NonNull FirebaseApp app, @NonNull String region) { Preconditions.checkNotNull(app, "You must call FirebaseApp.initializeApp first."); Preconditions.checkNotNull(region); @@ -143,7 +144,8 @@ public static FirebaseFunctions getInstance(FirebaseApp app, String region) { * * @param app The app for the Firebase project. */ - public static FirebaseFunctions getInstance(FirebaseApp app) { + @NonNull + public static FirebaseFunctions getInstance(@NonNull FirebaseApp app) { return getInstance(app, "us-central1"); } @@ -152,17 +154,20 @@ public static FirebaseFunctions getInstance(FirebaseApp app) { * * @param region The region for the HTTPS trigger, such as "us-central1". */ - public static FirebaseFunctions getInstance(String region) { + @NonNull + public static FirebaseFunctions getInstance(@NonNull String region) { return getInstance(FirebaseApp.getInstance(), region); } /** Creates a Cloud Functions client with the default app. */ + @NonNull public static FirebaseFunctions getInstance() { return getInstance(FirebaseApp.getInstance(), "us-central1"); } /** Returns a reference to the Callable HTTPS trigger with the given name. */ - public HttpsCallableReference getHttpsCallable(String name) { + @NonNull + public HttpsCallableReference getHttpsCallable(@NonNull String name) { return new HttpsCallableReference(this, name); } diff --git a/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableReference.java b/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableReference.java index 0094f9ad43c..667a9b862f9 100644 --- a/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableReference.java +++ b/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableReference.java @@ -76,6 +76,7 @@ public class HttpsCallableReference { * @see java.io.IOException * @see FirebaseFunctionsException */ + @NonNull public Task call(@Nullable Object data) { return functionsClient.call(name, data, options); } @@ -94,6 +95,7 @@ public Task call(@Nullable Object data) { * * @return A Task that will be completed when the HTTPS request has completed. */ + @NonNull public Task call() { return functionsClient.call(name, null, options); } @@ -104,11 +106,10 @@ public Task call() { * @param timeout The length of the timeout, in the given units. * @param units The units for the specified timeout. */ - public void setTimeout(long timeout, TimeUnit units) { + public void setTimeout(long timeout, @NonNull TimeUnit units) { options.setTimeout(timeout, units); } - @NonNull /** * Returns the timeout for calls from this instance of Functions. * @@ -124,7 +125,8 @@ public long getTimeout() { * @param timeout The length of the timeout, in the given units. * @param units The units for the specified timeout. */ - public HttpsCallableReference withTimeout(long timeout, TimeUnit units) { + @NonNull + public HttpsCallableReference withTimeout(long timeout, @NonNull TimeUnit units) { HttpsCallableReference other = new HttpsCallableReference(functionsClient, name); other.setTimeout(timeout, units); return other; diff --git a/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableResult.java b/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableResult.java index 36ed89eb9d7..51f37839d9e 100644 --- a/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableResult.java +++ b/firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallableResult.java @@ -14,6 +14,8 @@ package com.google.firebase.functions; +import androidx.annotation.Nullable; + /** The result of calling a HttpsCallableReference function. */ public class HttpsCallableResult { // The actual result data, as generic types decoded from JSON. @@ -30,6 +32,7 @@ public class HttpsCallableResult { * array, this object would be a List. If your trigger returned a JavaScript object with * keys and values, this object would be a Map. */ + @Nullable public Object getData() { return data; }