Skip to content

Commit d7d7946

Browse files
authored
Add stability configuration and apply @immutable annotation to data classes (#1606)
Add stability configuration and apply @immutable annotation to data classes, add fix type method ### **Before compose compiler add stability** <img width="840" height="706" alt="Screenshot 2025-08-20 at 19 16 01" src="https://github.com/user-attachments/assets/cfc2a6f6-eb97-4222-8af8-9952a38fdee3" /> ### **After add stability configuration** <img width="968" height="695" alt="Screenshot 2025-08-20 at 19 37 00" src="https://github.com/user-attachments/assets/68e8d573-a35c-48de-b8c1-a6ea1fd7fcc7" />
2 parents 6a82130 + 2462d32 commit d7d7946

File tree

17 files changed

+58
-12
lines changed

17 files changed

+58
-12
lines changed

Jetcaster/core/data/src/main/java/com/example/jetcaster/core/data/database/model/EpisodeToPodcast.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616

1717
package com.example.jetcaster.core.data.database.model
1818

19+
import androidx.compose.runtime.Immutable
1920
import androidx.room.Embedded
2021
import androidx.room.Ignore
2122
import androidx.room.Relation
2223
import java.util.Objects
2324

25+
@Immutable
2426
class EpisodeToPodcast {
2527
@Embedded
2628
lateinit var episode: Episode

Jetcaster/core/domain/src/main/java/com/example/jetcaster/core/model/CategoryInfo.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616

1717
package com.example.jetcaster.core.model
1818

19+
import androidx.compose.runtime.Immutable
1920
import com.example.jetcaster.core.data.database.model.Category
2021

22+
@Immutable
2123
data class CategoryInfo(val id: Long, val name: String)
2224

2325
const val CategoryTechnology = "Technology"

Jetcaster/core/domain/src/main/java/com/example/jetcaster/core/model/EpisodeInfo.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@
1616

1717
package com.example.jetcaster.core.model
1818

19+
import androidx.compose.runtime.Immutable
1920
import com.example.jetcaster.core.data.database.model.Episode
2021
import java.time.Duration
2122
import java.time.OffsetDateTime
2223

2324
/**
2425
* External data layer representation of an episode.
2526
*/
27+
28+
@Immutable
2629
data class EpisodeInfo(
2730
val uri: String = "",
2831
val podcastUri: String = "",

Jetcaster/core/domain/src/main/java/com/example/jetcaster/core/model/FilterableCategoriesModel.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@
1616

1717
package com.example.jetcaster.core.model
1818

19+
import androidx.compose.runtime.Immutable
20+
1921
/**
2022
* Model holding a list of categories and a selected category in the collection
2123
*/
24+
25+
@Immutable
2226
data class FilterableCategoriesModel(val categories: List<CategoryInfo> = emptyList(), val selectedCategory: CategoryInfo? = null) {
2327
val isEmpty = categories.isEmpty() || selectedCategory == null
2428
}

Jetcaster/core/domain/src/main/java/com/example/jetcaster/core/model/PodcastCategoryFilterResult.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616

1717
package com.example.jetcaster.core.model
1818

19+
import androidx.compose.runtime.Immutable
20+
1921
/**
2022
* A model holding top podcasts and matching episodes when filtering based on a category.
2123
*/
24+
@Immutable
2225
data class PodcastCategoryFilterResult(
2326
val topPodcasts: List<PodcastInfo> = emptyList(),
2427
val episodes: List<PodcastToEpisodeInfo> = emptyList(),

Jetcaster/core/domain/src/main/java/com/example/jetcaster/core/model/PodcastInfo.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616

1717
package com.example.jetcaster.core.model
1818

19+
import androidx.compose.runtime.Immutable
1920
import com.example.jetcaster.core.data.database.model.Podcast
2021
import com.example.jetcaster.core.data.database.model.PodcastWithExtraInfo
2122
import java.time.OffsetDateTime
2223

2324
/**
2425
* External data layer representation of a podcast.
2526
*/
27+
@Immutable
2628
data class PodcastInfo(
2729
val uri: String = "",
2830
val title: String = "",

Jetcaster/core/domain/src/main/java/com/example/jetcaster/core/model/PodcastToEpisodeInfo.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616

1717
package com.example.jetcaster.core.model
1818

19+
import androidx.compose.runtime.Immutable
1920
import com.example.jetcaster.core.data.database.model.EpisodeToPodcast
2021

22+
@Immutable
2123
data class PodcastToEpisodeInfo(val episode: EpisodeInfo, val podcast: PodcastInfo)
2224

2325
fun EpisodeToPodcast.asPodcastToEpisodeInfo(): PodcastToEpisodeInfo = PodcastToEpisodeInfo(

Jetcaster/core/domain/src/main/java/com/example/jetcaster/core/player/EpisodePlayer.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616

1717
package com.example.jetcaster.core.player
1818

19+
import androidx.compose.runtime.Immutable
1920
import com.example.jetcaster.core.player.model.PlayerEpisode
2021
import java.time.Duration
2122
import kotlinx.coroutines.flow.StateFlow
2223

2324
val DefaultPlaybackSpeed = Duration.ofSeconds(1)
25+
26+
@Immutable
2427
data class EpisodePlayerState(
2528
val currentEpisode: PlayerEpisode? = null,
2629
val queue: List<PlayerEpisode> = emptyList(),

Jetcaster/core/domain/src/main/java/com/example/jetcaster/core/player/model/PlayerEpisode.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.example.jetcaster.core.player.model
1818

19+
import androidx.compose.runtime.Immutable
1920
import com.example.jetcaster.core.data.database.model.EpisodeToPodcast
2021
import com.example.jetcaster.core.model.EpisodeInfo
2122
import com.example.jetcaster.core.model.PodcastInfo
@@ -25,6 +26,8 @@ import java.time.OffsetDateTime
2526
/**
2627
* Episode data with necessary information to be used within a player.
2728
*/
29+
30+
@Immutable
2831
data class PlayerEpisode(
2932
val uri: String = "",
3033
val title: String = "",

Jetcaster/mobile/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ android {
9797
excludes += "/META-INF/AL2.0"
9898
excludes += "/META-INF/LGPL2.1"
9999
}
100+
101+
composeCompiler {
102+
reportsDestination = layout.buildDirectory.dir("compose_compiler")
103+
metricsDestination = layout.buildDirectory.dir("compose_compiler")
104+
stabilityConfigurationFiles = listOf(rootProject.layout.projectDirectory.file("stability_config.conf"))
105+
}
100106
}
101107

102108
dependencies {

0 commit comments

Comments
 (0)