Skip to content

Feature request: expose an API in Resolver to retrieve the module name for handling mangling of internal members #1621

@ZacSweers

Description

@ZacSweers

internal members will have mangled names when seen from Java. In an existing non-KSP compiler plugin (Anvil) we use this logic to compute the mangled suffix that these functions would have like so

private fun ModuleDescriptor.mangledNameSuffix(): String {
  // We replace - with _ to maintain interoperability with Dagger's expected generated identifiers
  val name = name.asString().replace('-', '_')
  return if (name.startsWith('<') && name.endsWith('>')) {
    name.substring(1, name.length - 1)
  } else {
    name
  }
}

Could KSP expose an API to access ModuleDescriptor.name? This would allow ensuring generation of jvm-compatible sources when migrating to KSP in our case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions