diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/jstasks/NoRetryPolicy.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/jstasks/NoRetryPolicy.java deleted file mode 100644 index df4ca841fd5..00000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/jstasks/NoRetryPolicy.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.jstasks; - -import com.facebook.infer.annotation.Nullsafe; - -@Nullsafe(Nullsafe.Mode.LOCAL) -class NoRetryPolicy implements HeadlessJsTaskRetryPolicy { - - public static final NoRetryPolicy INSTANCE = new NoRetryPolicy(); - - private NoRetryPolicy() {} - - @Override - public boolean canRetry() { - return false; - } - - @Override - public int getDelay() { - throw new IllegalStateException("Should not retrieve delay as canRetry is: " + canRetry()); - } - - @Override - public HeadlessJsTaskRetryPolicy update() { - throw new IllegalStateException("Should not update as canRetry is: " + canRetry()); - } - - @Override - public HeadlessJsTaskRetryPolicy copy() { - // Class is immutable so no need to copy - return this; - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/jstasks/NoRetryPolicy.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/jstasks/NoRetryPolicy.kt new file mode 100644 index 00000000000..df245683fd8 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/jstasks/NoRetryPolicy.kt @@ -0,0 +1,28 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.jstasks + +internal class NoRetryPolicy private constructor() : HeadlessJsTaskRetryPolicy { + + override public fun canRetry(): Boolean = false + + override public fun getDelay(): Int { + throw IllegalStateException("Should not retrieve delay as canRetry is: ${canRetry()}") + } + + override public fun update(): HeadlessJsTaskRetryPolicy { + throw IllegalStateException("Should not update as canRetry is: ${canRetry()}") + } + + // Class is immutable so no need to copy + override public fun copy(): HeadlessJsTaskRetryPolicy = this + + public companion object { + @JvmField public val INSTANCE: NoRetryPolicy = NoRetryPolicy() + } +}