Skip to content

Restrict ViewModel visibility to internal within feature modules #1921

@audgns10

Description

@audgns10

Summary

All ViewModel classes across the project are currently declared as public, even though they are only used within their respective feature modules. This can lead to unintended usages across modules and violates encapsulation principles.

Proposal

Change the visibility modifier of each ViewModel from public to internal if it is not used outside the module it belongs to.

This adjustment:

  • Prevents accidental access from other modules
  • Reinforces module boundaries
  • Keeps internal logic private to its domain
  • Makes the codebase more maintainable and intention-revealing

Example

// Current (public by default)
@HiltViewModel
class BookmarksViewModel @Inject constructor(...) : ViewModel() {
    ...
}

// Suggested
@HiltViewModel
internal class BookmarksViewModel @Inject constructor(...) : ViewModel() {
    ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions