Skip to content

Commit 1c68e55

Browse files
committed
Make LoadingState subclasses data class to follow the official convention
1 parent b41312e commit 1c68e55

4 files changed

Lines changed: 40 additions & 2 deletions

File tree

common/api/android/compose-multiplatform-html-unified-common.api

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,25 @@ public abstract class com/huanshankeji/compose/ext/LoadingState {
2222
public final class com/huanshankeji/compose/ext/LoadingState$Error : com/huanshankeji/compose/ext/LoadingState {
2323
public static final field $stable I
2424
public fun <init> (Ljava/lang/Object;)V
25+
public final fun component1 ()Ljava/lang/Object;
26+
public final fun copy (Ljava/lang/Object;)Lcom/huanshankeji/compose/ext/LoadingState$Error;
27+
public static synthetic fun copy$default (Lcom/huanshankeji/compose/ext/LoadingState$Error;Ljava/lang/Object;ILjava/lang/Object;)Lcom/huanshankeji/compose/ext/LoadingState$Error;
28+
public fun equals (Ljava/lang/Object;)Z
2529
public final fun getError ()Ljava/lang/Object;
30+
public fun hashCode ()I
31+
public fun toString ()Ljava/lang/String;
2632
}
2733

2834
public final class com/huanshankeji/compose/ext/LoadingState$Loaded : com/huanshankeji/compose/ext/LoadingState {
2935
public static final field $stable I
3036
public fun <init> (Ljava/lang/Object;)V
37+
public final fun component1 ()Ljava/lang/Object;
38+
public final fun copy (Ljava/lang/Object;)Lcom/huanshankeji/compose/ext/LoadingState$Loaded;
39+
public static synthetic fun copy$default (Lcom/huanshankeji/compose/ext/LoadingState$Loaded;Ljava/lang/Object;ILjava/lang/Object;)Lcom/huanshankeji/compose/ext/LoadingState$Loaded;
40+
public fun equals (Ljava/lang/Object;)Z
3141
public final fun getValue ()Ljava/lang/Object;
42+
public fun hashCode ()I
43+
public fun toString ()Ljava/lang/String;
3244
}
3345

3446
public final class com/huanshankeji/compose/ext/LoadingState$Loading : com/huanshankeji/compose/ext/LoadingState {

common/api/compose-multiplatform-html-unified-common.klib.api

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,13 +686,25 @@ sealed class <#A: out kotlin/Any?, #B: out kotlin/Any?> com.huanshankeji.compose
686686

687687
final val error // com.huanshankeji.compose.ext/LoadingState.Error.error|{}error[0]
688688
final fun <get-error>(): #A1 // com.huanshankeji.compose.ext/LoadingState.Error.error.<get-error>|<get-error>(){}[0]
689+
690+
final fun component1(): #A1 // com.huanshankeji.compose.ext/LoadingState.Error.component1|component1(){}[0]
691+
final fun copy(#A1 = ...): com.huanshankeji.compose.ext/LoadingState.Error<#A1> // com.huanshankeji.compose.ext/LoadingState.Error.copy|copy(1:0){}[0]
692+
final fun equals(kotlin/Any?): kotlin/Boolean // com.huanshankeji.compose.ext/LoadingState.Error.equals|equals(kotlin.Any?){}[0]
693+
final fun hashCode(): kotlin/Int // com.huanshankeji.compose.ext/LoadingState.Error.hashCode|hashCode(){}[0]
694+
final fun toString(): kotlin/String // com.huanshankeji.compose.ext/LoadingState.Error.toString|toString(){}[0]
689695
}
690696

691697
final class <#A1: out kotlin/Any?> Loaded : com.huanshankeji.compose.ext/LoadingState<#A1, kotlin/Nothing> { // com.huanshankeji.compose.ext/LoadingState.Loaded|null[0]
692698
constructor <init>(#A1) // com.huanshankeji.compose.ext/LoadingState.Loaded.<init>|<init>(1:0){}[0]
693699

694700
final val value // com.huanshankeji.compose.ext/LoadingState.Loaded.value|{}value[0]
695701
final fun <get-value>(): #A1 // com.huanshankeji.compose.ext/LoadingState.Loaded.value.<get-value>|<get-value>(){}[0]
702+
703+
final fun component1(): #A1 // com.huanshankeji.compose.ext/LoadingState.Loaded.component1|component1(){}[0]
704+
final fun copy(#A1 = ...): com.huanshankeji.compose.ext/LoadingState.Loaded<#A1> // com.huanshankeji.compose.ext/LoadingState.Loaded.copy|copy(1:0){}[0]
705+
final fun equals(kotlin/Any?): kotlin/Boolean // com.huanshankeji.compose.ext/LoadingState.Loaded.equals|equals(kotlin.Any?){}[0]
706+
final fun hashCode(): kotlin/Int // com.huanshankeji.compose.ext/LoadingState.Loaded.hashCode|hashCode(){}[0]
707+
final fun toString(): kotlin/String // com.huanshankeji.compose.ext/LoadingState.Loaded.toString|toString(){}[0]
696708
}
697709

698710
final object Loading : com.huanshankeji.compose.ext/LoadingState<kotlin/Nothing, kotlin/Nothing> // com.huanshankeji.compose.ext/LoadingState.Loading|null[0]

common/api/jvm/compose-multiplatform-html-unified-common.api

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,25 @@ public abstract class com/huanshankeji/compose/ext/LoadingState {
2222
public final class com/huanshankeji/compose/ext/LoadingState$Error : com/huanshankeji/compose/ext/LoadingState {
2323
public static final field $stable I
2424
public fun <init> (Ljava/lang/Object;)V
25+
public final fun component1 ()Ljava/lang/Object;
26+
public final fun copy (Ljava/lang/Object;)Lcom/huanshankeji/compose/ext/LoadingState$Error;
27+
public static synthetic fun copy$default (Lcom/huanshankeji/compose/ext/LoadingState$Error;Ljava/lang/Object;ILjava/lang/Object;)Lcom/huanshankeji/compose/ext/LoadingState$Error;
28+
public fun equals (Ljava/lang/Object;)Z
2529
public final fun getError ()Ljava/lang/Object;
30+
public fun hashCode ()I
31+
public fun toString ()Ljava/lang/String;
2632
}
2733

2834
public final class com/huanshankeji/compose/ext/LoadingState$Loaded : com/huanshankeji/compose/ext/LoadingState {
2935
public static final field $stable I
3036
public fun <init> (Ljava/lang/Object;)V
37+
public final fun component1 ()Ljava/lang/Object;
38+
public final fun copy (Ljava/lang/Object;)Lcom/huanshankeji/compose/ext/LoadingState$Loaded;
39+
public static synthetic fun copy$default (Lcom/huanshankeji/compose/ext/LoadingState$Loaded;Ljava/lang/Object;ILjava/lang/Object;)Lcom/huanshankeji/compose/ext/LoadingState$Loaded;
40+
public fun equals (Ljava/lang/Object;)Z
3141
public final fun getValue ()Ljava/lang/Object;
42+
public fun hashCode ()I
43+
public fun toString ()Ljava/lang/String;
3244
}
3345

3446
public final class com/huanshankeji/compose/ext/LoadingState$Loading : com/huanshankeji/compose/ext/LoadingState {

common/src/commonMain/kotlin/com/huanshankeji/compose/ext/LoadingState.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package com.huanshankeji.compose.ext
22

33
import androidx.compose.runtime.Immutable
4+
import com.huanshankeji.compose.ExperimentalApi
45

6+
@ExperimentalApi
57
@Immutable
68
sealed class LoadingState<out T, out E> {
79
object Loading : LoadingState<Nothing, Nothing>()
8-
class Loaded<out T>(val value: T) : LoadingState<T, Nothing>()
9-
class Error<out E>(val error: E) : LoadingState<Nothing, E>()
10+
data class Loaded<out T>(val value: T) : LoadingState<T, Nothing>()
11+
data class Error<out E>(val error: E) : LoadingState<Nothing, E>()
1012
}
1113

1214
typealias ThrowableErrorLoadingState<T> = LoadingState<T, Throwable>

0 commit comments

Comments
 (0)