Hi, What's the best way to change functions' visi...
# compiler
a
Hi, What's the best way to change functions' visibility with a compiler plugin? I've tried something like this:
Copy code
class MySyntheticResolveExtension : SyntheticResolveExtension {
    override fun generateSyntheticMethods(
            thisDescriptor: ClassDescriptor,
            name: Name,
            bindingContext: BindingContext,
            fromSupertypes: List<SimpleFunctionDescriptor>,
            result: MutableCollection<SimpleFunctionDescriptor>
    ) {
        result.lastOrNull()?.let { lastDescriptor ->
            val newCopy = lastDescriptor.createCustomCopy {
                it.newCopyBuilder().setVisibility(visibility)
            }
            result.remove(lastDescriptor)
            result.add(newCopy)
        }
    }
}
But this spawns some problems when changing the visibility to
internal
where it tries to call a
synthetic
function that does not exist. Is there a better way to do this? or maybe a way to fix this? Slack Conversation