fun clone()

in intellij-plugin-structure/structure-intellij/src/main/java/com/jetbrains/plugin/structure/intellij/plugin/IdePluginImpl.kt [146:193]


    fun clone(old: IdePlugin, overriddenProblems: List<PluginProblem>): IdePlugin {
      return IdePluginImpl().apply {
        pluginId = old.pluginId
        pluginName = old.pluginName
        pluginVersion = old.pluginVersion
        sinceBuild = old.sinceBuild
        untilBuild = old.untilBuild
        originalFile = old.originalFile
        productDescriptor = old.productDescriptor
        vendor = old.vendor
        vendorEmail = old.vendorEmail
        vendorUrl = old.vendorUrl
        description = old.description
        changeNotes = old.changeNotes
        url = old.url
        useIdeClassLoader = old.useIdeClassLoader
        classpath = old.classpath
        isImplementationDetail = old.isImplementationDetail
        moduleVisibility = old.moduleVisibility
        hasPackagePrefix = old.hasPackagePrefix
        kotlinPluginMode = old.kotlinPluginMode
        hasDotNetPart = old.hasDotNetPart
        underlyingDocument = old.underlyingDocument
        declaredThemes.addAll(old.declaredThemes)
        _pluginAliases.addAll(old.pluginAliases)
        _definedModules.addAll(old.definedModules)
        _dependsList.addAll(old.dependsList)
        _contentModuleDependencies.addAll(old.contentModuleDependencies)
        _pluginMainModuleDependencies.addAll(old.pluginMainModuleDependencies)
        dependencies.addAll(old.dependencies)
        incompatibleWith.addAll(old.incompatibleWith)
        if (old is IdePluginImpl) {
          extensions.putAll(old.extensions)
          actions.addAll(old.actions)
          old.appContainerDescriptor.copyInto(appContainerDescriptor)
          old.projectContainerDescriptor.copyInto(projectContainerDescriptor)
          old.moduleContainerDescriptor.copyInto(moduleContainerDescriptor)
        }
        icons = old.icons.toMutableList()
        optionalDescriptors.addAll(old.optionalDescriptors)
        modulesDescriptors.addAll(old.modulesDescriptors)
        contentModules.addAll(old.contentModules)
        thirdPartyDependencies = old.thirdPartyDependencies.toMutableList()
        if (old is StructurallyValidated) {
          problems.addAll(overriddenProblems)
        }
      }
    }