jayasuryat/dowel

Consider parent class's visibility for nested classes

jayasuryat opened this issue · 0 comments

Currently, Dowel does not consider the parent class's visibility modifier.
Here parent class does not refer to a super-type. It just refers to the parent class in which another class is nested in.

For example :

@Dowel
internal data class NewsArticle(
    val id: Long,
    val author: Author,
) {

    @Dowel
    data class Author(
        val name: String,
    )
}

And DowelGenerator generates a PreviewParameterProvider for the Author class with a public visibility modifier as the Author class does not have any visibility modifier specified. Here the effective visibility of Author is internal and marking it otherwise would be a compilation error.

TLDR;

Consider all of the parent classes recursively and determine the appropriate visibility of a class and use it as the visibility modifier for the generated PreviewParameterProvider