Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class InjectGenerator(
val createFunction = createGenerator.create(astClass, constructor, injectComponent, classOptIn)

return FileSpec.builder(astClass.packageName, injectName).apply {
addAnnotation(createSuppressAnnotation("REDUNDANT_VISIBILITY_MODIFIER"))
astClass.containingFile?.optInAnnotation()?.let { addAnnotation(it) }
createFunction.forEach { addFunction(it) }
addType(injectComponent)
Expand Down Expand Up @@ -425,6 +426,11 @@ fun AstType.toVariableName(): String =
fun AstAnnotated.optInAnnotation(): AnnotationSpec? =
annotation(OPT_IN.packageName, OPT_IN.simpleName)?.toAnnotationSpec()

fun createSuppressAnnotation(reason: String): AnnotationSpec =
AnnotationSpec.builder(Suppress::class)
.addMember("%S", reason)
.build()

private fun AstType.joinArgumentTypeNames(): String = when {
arguments.isEmpty() -> ""
else -> arguments.joinToString(separator = "") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class KmpComponentCreateGenerator(
packageName = componentClass.packageName,
fileName = "KmpComponentCreate${componentClass.name}",
).apply {
addAnnotation(createSuppressAnnotation("REDUNDANT_VISIBILITY_MODIFIER"))
kmpComponentCreateFunctions.forEach { kmpComponentCreateFunction ->
addFunction(
FunSpec
Expand Down