diff --git a/plugins/allopen/allopen-ide/src/AllOpenModelBuilderService.kt b/plugins/allopen/allopen-ide/src/AllOpenModelBuilderService.kt index 65bf3740d5a..76f3e33b8a5 100644 --- a/plugins/allopen/allopen-ide/src/AllOpenModelBuilderService.kt +++ b/plugins/allopen/allopen-ide/src/AllOpenModelBuilderService.kt @@ -17,13 +17,11 @@ package org.jetbrains.kotlin.allopen.ide import com.intellij.openapi.util.Key -import org.jetbrains.kotlin.annotation.plugin.ide.AnnotationBasedPluginModel -import org.jetbrains.kotlin.annotation.plugin.ide.AnnotationBasedPluginModelBuilderService -import org.jetbrains.kotlin.annotation.plugin.ide.AnnotationBasedPluginProjectResolverExtension +import org.jetbrains.kotlin.annotation.plugin.ide.* interface AllOpenModel : AnnotationBasedPluginModel { - override fun copy(): AllOpenModel { - return AllOpenModelImpl(annotations.toList(), presets.toList()) + override fun dump(): DumpedPluginModel { + return DumpedPluginModelImpl(AllOpenModelImpl::class.java, annotations.toList(), presets.toList()) } } diff --git a/plugins/annotation-based-compiler-plugins-ide-support/src/AnnotationBasedPluginProjectResolverExtension.kt b/plugins/annotation-based-compiler-plugins-ide-support/src/AnnotationBasedPluginProjectResolverExtension.kt index 7a68f2ddba2..af802c09fc0 100644 --- a/plugins/annotation-based-compiler-plugins-ide-support/src/AnnotationBasedPluginProjectResolverExtension.kt +++ b/plugins/annotation-based-compiler-plugins-ide-support/src/AnnotationBasedPluginProjectResolverExtension.kt @@ -29,11 +29,32 @@ import org.jetbrains.plugins.gradle.tooling.ErrorMessageBuilder import java.io.Serializable import java.lang.Exception +interface DumpedPluginModel { + val className: String + + // May contain primitives, Strings and collections of primitives/Strings + val args: Array<*> + + operator fun component1() = className + operator fun component2() = args +} + +class DumpedPluginModelImpl( + override val className: String, + override val args: Array<*> +) : DumpedPluginModel, Serializable { + constructor(clazz: Class<*>, vararg args: Any?) : this(clazz.canonicalName, args) +} + interface AnnotationBasedPluginModel : Serializable { val annotations: List val presets: List - fun copy(): AnnotationBasedPluginModel + /* + Objects returned from Gradle importer are implicitly wrapped in a proxy that can potentially leak internal Gradle structures. + So we need a way to safely serialize the arbitrary annotation plugin model. + */ + fun dump(): DumpedPluginModel val isEnabled get() = annotations.isNotEmpty() || presets.isNotEmpty() } @@ -58,7 +79,12 @@ abstract class AnnotationBasedPluginProjectResolverExtension