[workspace model] Make entity source the latest parameter at entity initialization method

GitOrigin-RevId: 15a1a246c35daab81f4e186b384d7a65ae0c4b41
This commit is contained in:
Mikhail Mazurkevich
2022-07-20 21:06:58 +04:00
committed by intellij-monorepo-bot
parent d399cd5773
commit 2c76fd7909
60 changed files with 133 additions and 140 deletions

View File

@@ -124,7 +124,7 @@ internal class LibraryModifiableModelBridgeImpl(
val properties = entity.libraryProperties
if (properties == null) {
diff.addEntity(LibraryPropertiesEntity(entity.entitySource, libraryType) {
diff.addEntity(LibraryPropertiesEntity(libraryType, entity.entitySource) {
library = entity
if (propertiesXmlTag != null) this.propertiesXmlTag = propertiesXmlTag
})

View File

@@ -2,13 +2,10 @@
package com.intellij.workspaceModel.codegen
import com.intellij.workspaceModel.codegen.SKIPPED_TYPES
import com.intellij.workspaceModel.codegen.classes.*
import com.intellij.workspaceModel.storage.*
import com.intellij.workspaceModel.codegen.fields.javaType
import org.jetbrains.deft.Type
import com.intellij.workspaceModel.codegen.classes.noDefaultValue
import com.intellij.workspaceModel.codegen.classes.noOptional
import com.intellij.workspaceModel.codegen.classes.noRefs
import com.intellij.workspaceModel.codegen.classes.noPersistentId
import com.intellij.workspaceModel.codegen.fields.referencedField
import com.intellij.workspaceModel.codegen.fields.wsCode
import com.intellij.workspaceModel.codegen.deft.model.DefType
@@ -56,7 +53,7 @@ fun DefType.generatedApiCode(indent: String = " ", isEmptyGenBlock: Boolean):
}
val mandatoryFields = structure.allFields.noRefs().noOptional().noPersistentId().noDefaultValue()
if (!mandatoryFields.isEmpty()) {
val fields = mandatoryFields.joinToString { "${it.name}: ${it.type.javaType}" }
val fields = (mandatoryFields.noEntitySource() + mandatoryFields.first { it.name == "entitySource" }).joinToString { "${it.name}: ${it.type.javaType}" }
section(companionObjectHeader) {
section("operator fun invoke($fields, init: (Builder$builderGeneric.() -> Unit)? = null): $javaFullName") {
line("val builder = builder()")

View File

@@ -29,7 +29,7 @@ interface DefaultFieldEntity : WorkspaceEntity {
}
companion object: Type<DefaultFieldEntity, Builder>() {
operator fun invoke(version: Int, entitySource: EntitySource, data: TestData, init: (Builder.() -> Unit)? = null): DefaultFieldEntity {
operator fun invoke(version: Int, data: TestData, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): DefaultFieldEntity {
val builder = builder()
builder.version = version
builder.entitySource = entitySource

View File

@@ -22,7 +22,7 @@ interface CollectionFieldEntity : WorkspaceEntity {
}
companion object: Type<CollectionFieldEntity, Builder>() {
operator fun invoke(versions: Set<Int>, entitySource: EntitySource, names: List<String>, init: (Builder.() -> Unit)? = null): CollectionFieldEntity {
operator fun invoke(versions: Set<Int>, names: List<String>, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): CollectionFieldEntity {
val builder = builder()
builder.versions = versions
builder.entitySource = entitySource

View File

@@ -28,7 +28,7 @@ interface SimplePersistentIdEntity : WorkspaceEntityWithPersistentId {
}
companion object: Type<SimplePersistentIdEntity, Builder>() {
operator fun invoke(version: Int, entitySource: EntitySource, name: String, related: SimpleId, init: (Builder.() -> Unit)? = null): SimplePersistentIdEntity {
operator fun invoke(version: Int, name: String, related: SimpleId, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): SimplePersistentIdEntity {
val builder = builder()
builder.version = version
builder.entitySource = entitySource

View File

@@ -24,7 +24,7 @@ interface SimpleEntity : WorkspaceEntity {
}
companion object: Type<SimpleEntity, Builder>() {
operator fun invoke(version: Int, entitySource: EntitySource, name: String, isSimple: Boolean, init: (Builder.() -> Unit)? = null): SimpleEntity {
operator fun invoke(version: Int, name: String, isSimple: Boolean, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): SimpleEntity {
val builder = builder()
builder.version = version
builder.entitySource = entitySource

View File

@@ -736,7 +736,7 @@ fun storeSourceRootsOrder(orderOfItems: List<VirtualFileUrl>,
// Save the order in which sourceRoots appear in the module
val orderingEntity = contentRootEntity.sourceRootOrder
if (orderingEntity == null) {
builder.addEntity(SourceRootOrderEntity(contentRootEntity.entitySource, orderOfItems) {
builder.addEntity(SourceRootOrderEntity(orderOfItems, contentRootEntity.entitySource) {
this.contentRootEntity = contentRootEntity
})
}

View File

@@ -64,7 +64,7 @@ class ImlSerializationTest {
@Test
fun externalIndexIsNotSerialized() {
val builder = MutableEntityStorage.create()
val entity = SampleEntity2("Test", Source, true)
val entity = SampleEntity2("Test", true, Source)
builder.addEntity(entity)
val index = builder.getMutableExternalMapping<String>("test.my.index")
index.addMapping(entity, "Hello")

View File

@@ -87,7 +87,7 @@ open class ArchivePackagingElementEntityImpl: ArchivePackagingElementEntity, Wor
fun checkInitialization() {
val _diff = diff
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDREN_CONNECTION_ID, this) == null) {
error("Field CompositePackagingElementEntity#children should be initialized")

View File

@@ -116,7 +116,7 @@ open class ArtifactEntityImpl: ArtifactEntity, WorkspaceEntityBase() {
error("Field ArtifactEntity#rootElement should be initialized")
}
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CUSTOMPROPERTIES_CONNECTION_ID, this) == null) {
error("Field ArtifactEntity#customProperties should be initialized")

View File

@@ -86,7 +86,7 @@ open class ArtifactRootElementEntityImpl: ArtifactRootElementEntity, WorkspaceEn
if (!getEntityData().isEntitySourceInitialized()) {
error("Field CompositePackagingElementEntity#entitySource should be initialized")
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDREN_CONNECTION_ID, this) == null) {
error("Field CompositePackagingElementEntity#children should be initialized")

View File

@@ -116,7 +116,7 @@ open class ContentRootEntityImpl: ContentRootEntity, WorkspaceEntityBase() {
if (!getEntityData().isExcludedPatternsInitialized()) {
error("Field ContentRootEntity#excludedPatterns should be initialized")
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(SOURCEROOTS_CONNECTION_ID, this) == null) {
error("Field ContentRootEntity#sourceRoots should be initialized")

View File

@@ -91,7 +91,7 @@ open class CustomPackagingElementEntityImpl: CustomPackagingElementEntity, Works
fun checkInitialization() {
val _diff = diff
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDREN_CONNECTION_ID, this) == null) {
error("Field CompositePackagingElementEntity#children should be initialized")

View File

@@ -87,7 +87,7 @@ open class DirectoryPackagingElementEntityImpl: DirectoryPackagingElementEntity,
fun checkInitialization() {
val _diff = diff
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDREN_CONNECTION_ID, this) == null) {
error("Field CompositePackagingElementEntity#children should be initialized")

View File

@@ -118,7 +118,7 @@ open class ModuleEntityImpl: ModuleEntity, WorkspaceEntityBase() {
if (!getEntityData().isDependenciesInitialized()) {
error("Field ModuleEntity#dependencies should be initialized")
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CONTENTROOTS_CONNECTION_ID, this) == null) {
error("Field ModuleEntity#contentRoots should be initialized")
@@ -129,7 +129,7 @@ open class ModuleEntityImpl: ModuleEntity, WorkspaceEntityBase() {
error("Field ModuleEntity#contentRoots should be initialized")
}
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(FACETS_CONNECTION_ID, this) == null) {
error("Field ModuleEntity#facets should be initialized")

View File

@@ -113,7 +113,7 @@ open class SourceRootEntityImpl: SourceRootEntity, WorkspaceEntityBase() {
if (!getEntityData().isRootTypeInitialized()) {
error("Field SourceRootEntity#rootType should be initialized")
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(JAVASOURCEROOTS_CONNECTION_ID, this) == null) {
error("Field SourceRootEntity#javaSourceRoots should be initialized")
@@ -124,7 +124,7 @@ open class SourceRootEntityImpl: SourceRootEntity, WorkspaceEntityBase() {
error("Field SourceRootEntity#javaSourceRoots should be initialized")
}
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(JAVARESOURCEROOTS_CONNECTION_ID, this) == null) {
error("Field SourceRootEntity#javaResourceRoots should be initialized")

View File

@@ -43,7 +43,7 @@ interface ArtifactEntity : WorkspaceEntityWithPersistentId {
}
companion object: Type<ArtifactEntity, Builder>() {
operator fun invoke(name: String, entitySource: EntitySource, artifactType: String, includeInProjectBuild: Boolean, init: (Builder.() -> Unit)? = null): ArtifactEntity {
operator fun invoke(name: String, artifactType: String, includeInProjectBuild: Boolean, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): ArtifactEntity {
val builder = builder()
builder.name = name
builder.entitySource = entitySource
@@ -82,7 +82,7 @@ interface ArtifactPropertiesEntity : WorkspaceEntity {
}
companion object: Type<ArtifactPropertiesEntity, Builder>() {
operator fun invoke(entitySource: EntitySource, providerType: String, init: (Builder.() -> Unit)? = null): ArtifactPropertiesEntity {
operator fun invoke(providerType: String, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): ArtifactPropertiesEntity {
val builder = builder()
builder.entitySource = entitySource
builder.providerType = providerType
@@ -537,7 +537,7 @@ interface CustomPackagingElementEntity : CompositePackagingElementEntity {
}
companion object: Type<CustomPackagingElementEntity, Builder>(CompositePackagingElementEntity) {
operator fun invoke(typeId: String, entitySource: EntitySource, propertiesXmlTag: String, init: (Builder.() -> Unit)? = null): CustomPackagingElementEntity {
operator fun invoke(typeId: String, propertiesXmlTag: String, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): CustomPackagingElementEntity {
val builder = builder()
builder.typeId = typeId
builder.entitySource = entitySource

View File

@@ -42,7 +42,7 @@ interface LibraryEntity : WorkspaceEntityWithPersistentId {
}
companion object: Type<LibraryEntity, Builder>() {
operator fun invoke(name: String, entitySource: EntitySource, tableId: LibraryTableId, roots: List<LibraryRoot>, excludedRoots: List<VirtualFileUrl>, init: (Builder.() -> Unit)? = null): LibraryEntity {
operator fun invoke(name: String, tableId: LibraryTableId, roots: List<LibraryRoot>, excludedRoots: List<VirtualFileUrl>, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): LibraryEntity {
val builder = builder()
builder.name = name
builder.entitySource = entitySource
@@ -82,7 +82,7 @@ interface LibraryPropertiesEntity : WorkspaceEntity {
}
companion object: Type<LibraryPropertiesEntity, Builder>() {
operator fun invoke(entitySource: EntitySource, libraryType: String, init: (Builder.() -> Unit)? = null): LibraryPropertiesEntity {
operator fun invoke(libraryType: String, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): LibraryPropertiesEntity {
val builder = builder()
builder.entitySource = entitySource
builder.libraryType = libraryType
@@ -113,7 +113,7 @@ interface SdkEntity : WorkspaceEntity {
}
companion object: Type<SdkEntity, Builder>() {
operator fun invoke(entitySource: EntitySource, homeUrl: VirtualFileUrl, init: (Builder.() -> Unit)? = null): SdkEntity {
operator fun invoke(homeUrl: VirtualFileUrl, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): SdkEntity {
val builder = builder()
builder.entitySource = entitySource
builder.homeUrl = homeUrl

View File

@@ -40,7 +40,7 @@ interface FacetEntity: WorkspaceEntityWithPersistentId {
}
companion object: Type<FacetEntity, Builder>() {
operator fun invoke(name: String, entitySource: EntitySource, facetType: String, moduleId: ModuleId, init: (Builder.() -> Unit)? = null): FacetEntity {
operator fun invoke(name: String, facetType: String, moduleId: ModuleId, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): FacetEntity {
val builder = builder()
builder.name = name
builder.entitySource = entitySource

View File

@@ -48,7 +48,7 @@ interface ModuleEntity : WorkspaceEntityWithPersistentId {
}
companion object: Type<ModuleEntity, Builder>() {
operator fun invoke(name: String, entitySource: EntitySource, dependencies: List<ModuleDependencyItem>, init: (Builder.() -> Unit)? = null): ModuleEntity {
operator fun invoke(name: String, dependencies: List<ModuleDependencyItem>, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): ModuleEntity {
val builder = builder()
builder.name = name
builder.entitySource = entitySource
@@ -86,7 +86,7 @@ interface ModuleCustomImlDataEntity : WorkspaceEntity {
}
companion object: Type<ModuleCustomImlDataEntity, Builder>() {
operator fun invoke(entitySource: EntitySource, customModuleOptions: Map<String, String>, init: (Builder.() -> Unit)? = null): ModuleCustomImlDataEntity {
operator fun invoke(customModuleOptions: Map<String, String>, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): ModuleCustomImlDataEntity {
val builder = builder()
builder.entitySource = entitySource
builder.customModuleOptions = customModuleOptions
@@ -118,7 +118,7 @@ interface ModuleGroupPathEntity : WorkspaceEntity {
}
companion object: Type<ModuleGroupPathEntity, Builder>() {
operator fun invoke(entitySource: EntitySource, path: List<String>, init: (Builder.() -> Unit)? = null): ModuleGroupPathEntity {
operator fun invoke(path: List<String>, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): ModuleGroupPathEntity {
val builder = builder()
builder.entitySource = entitySource
builder.path = path
@@ -158,7 +158,7 @@ interface JavaModuleSettingsEntity: WorkspaceEntity {
}
companion object: Type<JavaModuleSettingsEntity, Builder>() {
operator fun invoke(entitySource: EntitySource, inheritedCompilerOutput: Boolean, excludeOutput: Boolean, init: (Builder.() -> Unit)? = null): JavaModuleSettingsEntity {
operator fun invoke(inheritedCompilerOutput: Boolean, excludeOutput: Boolean, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): JavaModuleSettingsEntity {
val builder = builder()
builder.entitySource = entitySource
builder.inheritedCompilerOutput = inheritedCompilerOutput

View File

@@ -39,7 +39,7 @@ interface ContentRootEntity : WorkspaceEntity {
}
companion object: Type<ContentRootEntity, Builder>() {
operator fun invoke(entitySource: EntitySource, url: VirtualFileUrl, excludedUrls: List<VirtualFileUrl>, excludedPatterns: List<String>, init: (Builder.() -> Unit)? = null): ContentRootEntity {
operator fun invoke(url: VirtualFileUrl, excludedUrls: List<VirtualFileUrl>, excludedPatterns: List<String>, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): ContentRootEntity {
val builder = builder()
builder.entitySource = entitySource
builder.url = url
@@ -82,7 +82,7 @@ interface SourceRootEntity : WorkspaceEntity {
}
companion object: Type<SourceRootEntity, Builder>() {
operator fun invoke(entitySource: EntitySource, url: VirtualFileUrl, rootType: String, init: (Builder.() -> Unit)? = null): SourceRootEntity {
operator fun invoke(url: VirtualFileUrl, rootType: String, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): SourceRootEntity {
val builder = builder()
builder.entitySource = entitySource
builder.url = url
@@ -115,7 +115,7 @@ interface SourceRootOrderEntity : WorkspaceEntity {
}
companion object: Type<SourceRootOrderEntity, Builder>() {
operator fun invoke(entitySource: EntitySource, orderOfSourceRoots: List<VirtualFileUrl>, init: (Builder.() -> Unit)? = null): SourceRootOrderEntity {
operator fun invoke(orderOfSourceRoots: List<VirtualFileUrl>, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): SourceRootOrderEntity {
val builder = builder()
builder.entitySource = entitySource
builder.orderOfSourceRoots = orderOfSourceRoots
@@ -146,7 +146,7 @@ interface CustomSourceRootPropertiesEntity: WorkspaceEntity {
}
companion object: Type<CustomSourceRootPropertiesEntity, Builder>() {
operator fun invoke(entitySource: EntitySource, propertiesXmlTag: String, init: (Builder.() -> Unit)? = null): CustomSourceRootPropertiesEntity {
operator fun invoke(propertiesXmlTag: String, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): CustomSourceRootPropertiesEntity {
val builder = builder()
builder.entitySource = entitySource
builder.propertiesXmlTag = propertiesXmlTag
@@ -180,7 +180,7 @@ interface JavaSourceRootEntity : WorkspaceEntity {
}
companion object: Type<JavaSourceRootEntity, Builder>() {
operator fun invoke(entitySource: EntitySource, generated: Boolean, packagePrefix: String, init: (Builder.() -> Unit)? = null): JavaSourceRootEntity {
operator fun invoke(generated: Boolean, packagePrefix: String, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): JavaSourceRootEntity {
val builder = builder()
builder.entitySource = entitySource
builder.generated = generated
@@ -215,7 +215,7 @@ interface JavaResourceRootEntity: WorkspaceEntity {
}
companion object: Type<JavaResourceRootEntity, Builder>() {
operator fun invoke(entitySource: EntitySource, generated: Boolean, relativeOutputPath: String, init: (Builder.() -> Unit)? = null): JavaResourceRootEntity {
operator fun invoke(generated: Boolean, relativeOutputPath: String, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): JavaResourceRootEntity {
val builder = builder()
builder.entitySource = entitySource
builder.generated = generated

View File

@@ -13,7 +13,7 @@ fun MutableEntityStorage.addModuleEntity(name: String,
dependencies: List<ModuleDependencyItem>,
source: EntitySource,
type: String? = null): ModuleEntity {
val entity = ModuleEntity(name, source, dependencies) {
val entity = ModuleEntity(name, dependencies, source) {
this.type = type
}
this.addEntity(entity)
@@ -27,7 +27,7 @@ fun MutableEntityStorage.addJavaModuleSettingsEntity(inheritedCompilerOutput: Bo
languageLevelId: String?,
module: ModuleEntity,
source: EntitySource): JavaModuleSettingsEntity {
val entity = JavaModuleSettingsEntity(source, inheritedCompilerOutput, excludeOutput) {
val entity = JavaModuleSettingsEntity(inheritedCompilerOutput, excludeOutput, source) {
this.compilerOutput = compilerOutput
this.compilerOutputForTests = compilerOutputForTests
this.languageLevelId = languageLevelId
@@ -41,7 +41,7 @@ fun MutableEntityStorage.addModuleCustomImlDataEntity(rootManagerTagCustomData:
customModuleOptions: Map<String, String>,
module: ModuleEntity,
source: EntitySource): ModuleCustomImlDataEntity {
val entity = ModuleCustomImlDataEntity(source, HashMap(customModuleOptions)) {
val entity = ModuleCustomImlDataEntity(HashMap(customModuleOptions), source) {
this.rootManagerTagCustomData = rootManagerTagCustomData
this.module = module
}
@@ -52,7 +52,7 @@ fun MutableEntityStorage.addModuleCustomImlDataEntity(rootManagerTagCustomData:
fun MutableEntityStorage.addModuleGroupPathEntity(path: List<String>,
module: ModuleEntity,
source: EntitySource): ModuleGroupPathEntity {
val entity = ModuleGroupPathEntity(source, path) {
val entity = ModuleGroupPathEntity(path, source) {
this.module = module
}
this.addEntity(entity)
@@ -63,7 +63,7 @@ fun MutableEntityStorage.addSourceRootEntity(contentRoot: ContentRootEntity,
url: VirtualFileUrl,
rootType: String,
source: EntitySource): SourceRootEntity {
val entity = SourceRootEntity(source, url, rootType) {
val entity = SourceRootEntity(url, rootType, source) {
this.contentRoot = contentRoot
}
this.addEntity(entity)
@@ -78,7 +78,7 @@ fun MutableEntityStorage.addSourceRootEntity(contentRoot: ContentRootEntity,
fun MutableEntityStorage.addJavaSourceRootEntity(sourceRoot: SourceRootEntity,
generated: Boolean,
packagePrefix: String): JavaSourceRootEntity {
val entity = JavaSourceRootEntity(sourceRoot.entitySource, generated, packagePrefix) {
val entity = JavaSourceRootEntity(generated, packagePrefix, sourceRoot.entitySource) {
this.sourceRoot = sourceRoot
}
this.addEntity(entity)
@@ -88,7 +88,7 @@ fun MutableEntityStorage.addJavaSourceRootEntity(sourceRoot: SourceRootEntity,
fun MutableEntityStorage.addJavaResourceRootEntity(sourceRoot: SourceRootEntity,
generated: Boolean,
relativeOutputPath: String): JavaResourceRootEntity {
val entity = JavaResourceRootEntity(sourceRoot.entitySource, generated, relativeOutputPath) {
val entity = JavaResourceRootEntity(generated, relativeOutputPath, sourceRoot.entitySource) {
this.sourceRoot = sourceRoot
}
this.addEntity(entity)
@@ -97,7 +97,7 @@ fun MutableEntityStorage.addJavaResourceRootEntity(sourceRoot: SourceRootEntity,
fun MutableEntityStorage.addCustomSourceRootPropertiesEntity(sourceRoot: SourceRootEntity,
propertiesXmlTag: String): CustomSourceRootPropertiesEntity {
val entity = CustomSourceRootPropertiesEntity(sourceRoot.entitySource, propertiesXmlTag) {
val entity = CustomSourceRootPropertiesEntity(propertiesXmlTag, sourceRoot.entitySource) {
this.sourceRoot = sourceRoot
}
this.addEntity(entity)
@@ -120,7 +120,7 @@ fun MutableEntityStorage.addContentRootEntityWithCustomEntitySource(url: Virtual
excludedPatterns: List<String>,
module: ModuleEntity,
source: EntitySource): ContentRootEntity {
val entity = ContentRootEntity(source, url, excludedUrls, excludedPatterns) {
val entity = ContentRootEntity(url, excludedUrls, excludedPatterns, source) {
this.module = module
}
this.addEntity(entity)
@@ -129,7 +129,7 @@ fun MutableEntityStorage.addContentRootEntityWithCustomEntitySource(url: Virtual
fun MutableEntityStorage.addLibraryEntity(name: String, tableId: LibraryTableId, roots: List<LibraryRoot>,
excludedRoots: List<VirtualFileUrl>, source: EntitySource): LibraryEntity {
val entity = LibraryEntity(name, source, tableId, roots, excludedRoots)
val entity = LibraryEntity(name, tableId, roots, excludedRoots, source)
this.addEntity(entity)
return entity
}
@@ -142,7 +142,7 @@ fun MutableEntityStorage.addLibraryEntity(name: String, tableId: LibraryTableId,
fun MutableEntityStorage.addLibraryPropertiesEntity(library: LibraryEntity,
libraryType: String,
propertiesXmlTag: String?): LibraryPropertiesEntity {
val entity = LibraryPropertiesEntity(library.entitySource, libraryType) {
val entity = LibraryPropertiesEntity(libraryType, library.entitySource) {
this.library = library
this.propertiesXmlTag = propertiesXmlTag
}
@@ -152,7 +152,7 @@ fun MutableEntityStorage.addLibraryPropertiesEntity(library: LibraryEntity,
fun MutableEntityStorage.addSdkEntity(library: LibraryEntity,
homeUrl: VirtualFileUrl, source: EntitySource): SdkEntity {
val entity = SdkEntity(source, homeUrl) {
val entity = SdkEntity(homeUrl, source) {
this.library = library
}
this.addEntity(entity)
@@ -176,7 +176,7 @@ fun MutableEntityStorage.addFacetEntity(name: String,
module: ModuleEntity,
underlyingFacet: FacetEntity?,
source: EntitySource): FacetEntity {
val entity = FacetEntity(name, source, facetType, module.persistentId) {
val entity = FacetEntity(name, facetType, module.persistentId, source) {
this.configurationXmlTag = configurationXmlTag
this.module = module
this.underlyingFacet = underlyingFacet
@@ -191,7 +191,7 @@ fun MutableEntityStorage.addArtifactEntity(name: String,
outputUrl: VirtualFileUrl?,
rootElement: CompositePackagingElementEntity,
source: EntitySource): ArtifactEntity {
val entity = ArtifactEntity(name, source, artifactType, includeInProjectBuild) {
val entity = ArtifactEntity(name, artifactType, includeInProjectBuild, source) {
this.outputUrl = outputUrl
this.rootElement = rootElement
}
@@ -203,7 +203,7 @@ fun MutableEntityStorage.addArtifactPropertiesEntity(artifact: ArtifactEntity,
providerType: String,
propertiesXmlTag: String?,
source: EntitySource): ArtifactPropertiesEntity {
val entity = ArtifactPropertiesEntity(source, providerType) {
val entity = ArtifactPropertiesEntity(providerType, source) {
this.artifact = artifact
this.propertiesXmlTag = propertiesXmlTag
}
@@ -314,7 +314,7 @@ fun MutableEntityStorage.addCustomPackagingElementEntity(typeId: String,
propertiesXmlTag: String,
children: List<PackagingElementEntity>,
source: EntitySource): CustomPackagingElementEntity {
val entity = CustomPackagingElementEntity(typeId, source, propertiesXmlTag) {
val entity = CustomPackagingElementEntity(typeId, propertiesXmlTag, source) {
this.children = children
}
this.addEntity(entity)

View File

@@ -1,12 +1,10 @@
package com.intellij.workspaceModel.storage.entities.test.api
import com.intellij.workspaceModel.storage.*
import com.intellij.workspaceModel.storage.EntityInformation
import com.intellij.workspaceModel.storage.EntitySource
import com.intellij.workspaceModel.storage.EntityStorage
import com.intellij.workspaceModel.storage.GeneratedCodeApiVersion
import com.intellij.workspaceModel.storage.GeneratedCodeImplVersion
import com.intellij.workspaceModel.storage.ModifiableReferableWorkspaceEntity
import com.intellij.workspaceModel.storage.ModifiableWorkspaceEntity
import com.intellij.workspaceModel.storage.MutableEntityStorage
import com.intellij.workspaceModel.storage.WorkspaceEntity

View File

@@ -91,7 +91,7 @@ open class CompositeChildAbstractEntityImpl: CompositeChildAbstractEntity, Works
error("Field SimpleAbstractEntity#parentInList should be initialized")
}
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDREN_CONNECTION_ID, this) == null) {
error("Field CompositeAbstractEntity#children should be initialized")

View File

@@ -155,7 +155,7 @@ open class EntityWithSoftLinksImpl: EntityWithSoftLinks, WorkspaceEntityBase() {
if (!getEntityData().isDeepSealedClassInitialized()) {
error("Field EntityWithSoftLinks#deepSealedClass should be initialized")
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDREN_CONNECTION_ID, this) == null) {
error("Field EntityWithSoftLinks#children should be initialized")

View File

@@ -75,7 +75,7 @@ open class LeftEntityImpl: LeftEntity, WorkspaceEntityBase() {
fun checkInitialization() {
val _diff = diff
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDREN_CONNECTION_ID, this) == null) {
error("Field CompositeBaseEntity#children should be initialized")

View File

@@ -1,12 +1,10 @@
package com.intellij.workspaceModel.storage.entities.test.api
import com.intellij.workspaceModel.storage.*
import com.intellij.workspaceModel.storage.EntityInformation
import com.intellij.workspaceModel.storage.EntitySource
import com.intellij.workspaceModel.storage.EntityStorage
import com.intellij.workspaceModel.storage.GeneratedCodeApiVersion
import com.intellij.workspaceModel.storage.GeneratedCodeImplVersion
import com.intellij.workspaceModel.storage.ModifiableReferableWorkspaceEntity
import com.intellij.workspaceModel.storage.ModifiableWorkspaceEntity
import com.intellij.workspaceModel.storage.MutableEntityStorage
import com.intellij.workspaceModel.storage.WorkspaceEntity
@@ -77,7 +75,7 @@ open class MainEntityParentListImpl: MainEntityParentList, WorkspaceEntityBase()
if (!getEntityData().isEntitySourceInitialized()) {
error("Field MainEntityParentList#entitySource should be initialized")
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDREN_CONNECTION_ID, this) == null) {
error("Field MainEntityParentList#children should be initialized")

View File

@@ -81,7 +81,7 @@ open class NamedEntityImpl: NamedEntity, WorkspaceEntityBase() {
if (!getEntityData().isEntitySourceInitialized()) {
error("Field NamedEntity#entitySource should be initialized")
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDREN_CONNECTION_ID, this) == null) {
error("Field NamedEntity#children should be initialized")

View File

@@ -67,7 +67,7 @@ open class ParentAbEntityImpl: ParentAbEntity, WorkspaceEntityBase() {
fun checkInitialization() {
val _diff = diff
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDREN_CONNECTION_ID, this) == null) {
error("Field ParentAbEntity#children should be initialized")

View File

@@ -75,7 +75,7 @@ open class ParentMultipleEntityImpl: ParentMultipleEntity, WorkspaceEntityBase()
if (!getEntityData().isEntitySourceInitialized()) {
error("Field ParentMultipleEntity#entitySource should be initialized")
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDREN_CONNECTION_ID, this) == null) {
error("Field ParentMultipleEntity#children should be initialized")

View File

@@ -76,7 +76,7 @@ open class ParentWithNullsMultipleImpl: ParentWithNullsMultiple, WorkspaceEntity
if (!getEntityData().isEntitySourceInitialized()) {
error("Field ParentWithNullsMultiple#entitySource should be initialized")
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDREN_CONNECTION_ID, this) == null) {
error("Field ParentWithNullsMultiple#children should be initialized")

View File

@@ -75,7 +75,7 @@ open class RightEntityImpl: RightEntity, WorkspaceEntityBase() {
fun checkInitialization() {
val _diff = diff
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDREN_CONNECTION_ID, this) == null) {
error("Field CompositeBaseEntity#children should be initialized")

View File

@@ -108,7 +108,7 @@ open class SampleEntityImpl: SampleEntity, WorkspaceEntityBase() {
if (!getEntityData().isFilePropertyInitialized()) {
error("Field SampleEntity#fileProperty should be initialized")
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDREN_CONNECTION_ID, this) == null) {
error("Field SampleEntity#children should be initialized")

View File

@@ -78,7 +78,7 @@ open class SourceEntityImpl: SourceEntity, WorkspaceEntityBase() {
if (!getEntityData().isEntitySourceInitialized()) {
error("Field SourceEntity#entitySource should be initialized")
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDREN_CONNECTION_ID, this) == null) {
error("Field SourceEntity#children should be initialized")

View File

@@ -82,7 +82,7 @@ open class TreeEntityImpl: TreeEntity, WorkspaceEntityBase() {
if (!getEntityData().isEntitySourceInitialized()) {
error("Field TreeEntity#entitySource should be initialized")
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDREN_CONNECTION_ID, this) == null) {
error("Field TreeEntity#children should be initialized")

View File

@@ -97,7 +97,7 @@ open class XChildEntityImpl: XChildEntity, WorkspaceEntityBase() {
error("Field XChildEntity#parentEntity should be initialized")
}
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDCHILD_CONNECTION_ID, this) == null) {
error("Field XChildEntity#childChild should be initialized")

View File

@@ -86,7 +86,7 @@ open class XParentEntityImpl: XParentEntity, WorkspaceEntityBase() {
if (!getEntityData().isEntitySourceInitialized()) {
error("Field XParentEntity#entitySource should be initialized")
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDREN_CONNECTION_ID, this) == null) {
error("Field XParentEntity#children should be initialized")
@@ -97,7 +97,7 @@ open class XParentEntityImpl: XParentEntity, WorkspaceEntityBase() {
error("Field XParentEntity#children should be initialized")
}
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(OPTIONALCHILDREN_CONNECTION_ID, this) == null) {
error("Field XParentEntity#optionalChildren should be initialized")
@@ -108,7 +108,7 @@ open class XParentEntityImpl: XParentEntity, WorkspaceEntityBase() {
error("Field XParentEntity#optionalChildren should be initialized")
}
}
// Check initialization for list with ref type
// Check initialization for collection with ref type
if (_diff != null) {
if (_diff.extractOneToManyChildren<WorkspaceEntityBase>(CHILDCHILD_CONNECTION_ID, this) == null) {
error("Field XParentEntity#childChild should be initialized")

View File

@@ -27,7 +27,7 @@ interface TestEntity: WorkspaceEntity {
}
companion object: Type<TestEntity, Builder>() {
operator fun invoke(name: String, entitySource: EntitySource, count: Int, anotherField: One, init: (Builder.() -> Unit)? = null): TestEntity {
operator fun invoke(name: String, count: Int, anotherField: One, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): TestEntity {
val builder = builder()
builder.name = name
builder.entitySource = entitySource

View File

@@ -58,7 +58,7 @@ interface AttachedEntity : WorkspaceEntity {
}
companion object: Type<AttachedEntity, Builder>() {
operator fun invoke(entitySource: EntitySource, data: String, init: (Builder.() -> Unit)? = null): AttachedEntity {
operator fun invoke(data: String, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): AttachedEntity {
val builder = builder()
builder.entitySource = entitySource
builder.data = data

View File

@@ -56,7 +56,7 @@ interface AttachedEntityList : WorkspaceEntity {
}
companion object: Type<AttachedEntityList, Builder>() {
operator fun invoke(entitySource: EntitySource, data: String, init: (Builder.() -> Unit)? = null): AttachedEntityList {
operator fun invoke(data: String, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): AttachedEntityList {
val builder = builder()
builder.entitySource = entitySource
builder.data = data

View File

@@ -26,7 +26,7 @@ interface MainEntityToParent : WorkspaceEntity {
}
companion object: Type<MainEntityToParent, Builder>() {
operator fun invoke(entitySource: EntitySource, x: String, init: (Builder.() -> Unit)? = null): MainEntityToParent {
operator fun invoke(x: String, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): MainEntityToParent {
val builder = builder()
builder.entitySource = entitySource
builder.x = x

View File

@@ -34,7 +34,7 @@ interface LinkedListEntity : WorkspaceEntityWithPersistentId {
}
companion object: Type<LinkedListEntity, Builder>() {
operator fun invoke(myName: String, entitySource: EntitySource, next: LinkedListEntityId, init: (Builder.() -> Unit)? = null): LinkedListEntity {
operator fun invoke(myName: String, next: LinkedListEntityId, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): LinkedListEntity {
val builder = builder()
builder.myName = myName
builder.entitySource = entitySource
@@ -52,7 +52,7 @@ fun MutableEntityStorage.modifyEntity(entity: LinkedListEntity, modification: Li
//endregion
fun MutableEntityStorage.addLinkedListEntity(name: String, next: LinkedListEntityId): LinkedListEntity {
val linkedListEntity = LinkedListEntity(name, MySource, next)
val linkedListEntity = LinkedListEntity(name, next, MySource)
this.addEntity(linkedListEntity)
return linkedListEntity
}

View File

@@ -38,7 +38,7 @@ interface SampleEntity : WorkspaceEntity {
}
companion object: Type<SampleEntity, Builder>() {
operator fun invoke(booleanProperty: Boolean, entitySource: EntitySource, stringProperty: String, stringListProperty: List<String>, stringMapProperty: Map<String, String>, fileProperty: VirtualFileUrl, init: (Builder.() -> Unit)? = null): SampleEntity {
operator fun invoke(booleanProperty: Boolean, stringProperty: String, stringListProperty: List<String>, stringMapProperty: Map<String, String>, fileProperty: VirtualFileUrl, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): SampleEntity {
val builder = builder()
builder.booleanProperty = booleanProperty
builder.entitySource = entitySource

View File

@@ -27,7 +27,7 @@ interface SampleEntity2 : WorkspaceEntity {
}
companion object: Type<SampleEntity2, Builder>() {
operator fun invoke(data: String, entitySource: EntitySource, boolData: Boolean, init: (Builder.() -> Unit)? = null): SampleEntity2 {
operator fun invoke(data: String, boolData: Boolean, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): SampleEntity2 {
val builder = builder()
builder.data = data
builder.entitySource = entitySource
@@ -62,7 +62,7 @@ interface VFUEntity2 : WorkspaceEntity {
}
companion object: Type<VFUEntity2, Builder>() {
operator fun invoke(data: String, entitySource: EntitySource, directoryPath: VirtualFileUrl, notNullRoots: List<VirtualFileUrl>, init: (Builder.() -> Unit)? = null): VFUEntity2 {
operator fun invoke(data: String, directoryPath: VirtualFileUrl, notNullRoots: List<VirtualFileUrl>, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): VFUEntity2 {
val builder = builder()
builder.data = data
builder.entitySource = entitySource

View File

@@ -92,7 +92,7 @@ interface ChildSubSubEntity : WorkspaceEntity {
}
companion object: Type<ChildSubSubEntity, Builder>() {
operator fun invoke(entitySource: EntitySource, childData: String, init: (Builder.() -> Unit)? = null): ChildSubSubEntity {
operator fun invoke(childData: String, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): ChildSubSubEntity {
val builder = builder()
builder.entitySource = entitySource
builder.childData = childData

View File

@@ -122,7 +122,7 @@ interface EntityWithSoftLinks : WorkspaceEntity {
}
companion object: Type<EntityWithSoftLinks, Builder>() {
operator fun invoke(link: OnePersistentId, entitySource: EntitySource, manyLinks: List<OnePersistentId>, inContainer: Container, inContainerList: List<Container>, deepContainer: List<TooDeepContainer>, sealedContainer: SealedContainer, listSealedContainer: List<SealedContainer>, justProperty: String, justListProperty: List<String>, deepSealedClass: DeepSealedOne, init: (Builder.() -> Unit)? = null): EntityWithSoftLinks {
operator fun invoke(link: OnePersistentId, manyLinks: List<OnePersistentId>, inContainer: Container, inContainerList: List<Container>, deepContainer: List<TooDeepContainer>, sealedContainer: SealedContainer, listSealedContainer: List<SealedContainer>, justProperty: String, justListProperty: List<String>, deepSealedClass: DeepSealedOne, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): EntityWithSoftLinks {
val builder = builder()
builder.link = link
builder.entitySource = entitySource

View File

@@ -224,7 +224,7 @@ interface WithListSoftLinksEntity : WorkspaceEntityWithPersistentId {
}
companion object: Type<WithListSoftLinksEntity, Builder>() {
operator fun invoke(myName: String, entitySource: EntitySource, links: List<NameId>, init: (Builder.() -> Unit)? = null): WithListSoftLinksEntity {
operator fun invoke(myName: String, links: List<NameId>, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): WithListSoftLinksEntity {
val builder = builder()
builder.myName = myName
builder.entitySource = entitySource
@@ -247,7 +247,7 @@ fun MutableEntityStorage.addWithListSoftLinksEntity(
links: List<NameId>,
source: EntitySource = MySource
): WithListSoftLinksEntity {
val withListSoftLinksEntity = WithListSoftLinksEntity(name, source, links)
val withListSoftLinksEntity = WithListSoftLinksEntity(name, links, source)
this.addEntity(withListSoftLinksEntity)
return withListSoftLinksEntity
}
@@ -270,7 +270,7 @@ interface ComposedIdSoftRefEntity : WorkspaceEntityWithPersistentId {
}
companion object: Type<ComposedIdSoftRefEntity, Builder>() {
operator fun invoke(myName: String, entitySource: EntitySource, link: NameId, init: (Builder.() -> Unit)? = null): ComposedIdSoftRefEntity {
operator fun invoke(myName: String, link: NameId, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): ComposedIdSoftRefEntity {
val builder = builder()
builder.myName = myName
builder.entitySource = entitySource
@@ -292,7 +292,7 @@ fun MutableEntityStorage.addComposedIdSoftRefEntity(
link: NameId,
source: EntitySource = MySource
): ComposedIdSoftRefEntity {
val composedIdSoftRefEntity = ComposedIdSoftRefEntity(name, source, link)
val composedIdSoftRefEntity = ComposedIdSoftRefEntity(name, link, source)
this.addEntity(composedIdSoftRefEntity)
return composedIdSoftRefEntity
}

View File

@@ -27,7 +27,7 @@ interface VFUEntity : WorkspaceEntity {
}
companion object: Type<VFUEntity, Builder>() {
operator fun invoke(data: String, entitySource: EntitySource, fileProperty: VirtualFileUrl, init: (Builder.() -> Unit)? = null): VFUEntity {
operator fun invoke(data: String, fileProperty: VirtualFileUrl, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): VFUEntity {
val builder = builder()
builder.data = data
builder.entitySource = entitySource
@@ -61,7 +61,7 @@ interface VFUWithTwoPropertiesEntity : WorkspaceEntity {
}
companion object: Type<VFUWithTwoPropertiesEntity, Builder>() {
operator fun invoke(data: String, entitySource: EntitySource, fileProperty: VirtualFileUrl, secondFileProperty: VirtualFileUrl, init: (Builder.() -> Unit)? = null): VFUWithTwoPropertiesEntity {
operator fun invoke(data: String, fileProperty: VirtualFileUrl, secondFileProperty: VirtualFileUrl, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): VFUWithTwoPropertiesEntity {
val builder = builder()
builder.data = data
builder.entitySource = entitySource
@@ -125,7 +125,7 @@ interface ListVFUEntity : WorkspaceEntity {
}
companion object: Type<ListVFUEntity, Builder>() {
operator fun invoke(data: String, entitySource: EntitySource, fileProperty: List<VirtualFileUrl>, init: (Builder.() -> Unit)? = null): ListVFUEntity {
operator fun invoke(data: String, fileProperty: List<VirtualFileUrl>, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): ListVFUEntity {
val builder = builder()
builder.data = data
builder.entitySource = entitySource
@@ -148,7 +148,7 @@ fun MutableEntityStorage.addVFUEntity(
virtualFileManager: VirtualFileUrlManager,
source: EntitySource = SampleEntitySource("test")
): VFUEntity {
val vfuEntity = VFUEntity(data, source, virtualFileManager.fromUrl(fileUrl))
val vfuEntity = VFUEntity(data, virtualFileManager.fromUrl(fileUrl), source)
this.addEntity(vfuEntity)
return vfuEntity
}
@@ -160,7 +160,7 @@ fun MutableEntityStorage.addVFU2Entity(
virtualFileManager: VirtualFileUrlManager,
source: EntitySource = SampleEntitySource("test")
): VFUWithTwoPropertiesEntity {
val vfuWithTwoPropertiesEntity = VFUWithTwoPropertiesEntity(data, source, virtualFileManager.fromUrl(fileUrl), virtualFileManager.fromUrl(secondFileUrl))
val vfuWithTwoPropertiesEntity = VFUWithTwoPropertiesEntity(data, virtualFileManager.fromUrl(fileUrl), virtualFileManager.fromUrl(secondFileUrl), source)
this.addEntity(vfuWithTwoPropertiesEntity)
return vfuWithTwoPropertiesEntity
}
@@ -184,7 +184,7 @@ fun MutableEntityStorage.addListVFUEntity(
virtualFileManager: VirtualFileUrlManager,
source: EntitySource = SampleEntitySource("test")
): ListVFUEntity {
val listVFUEntity = ListVFUEntity(data, source, fileUrl.map { virtualFileManager.fromUrl(it) })
val listVFUEntity = ListVFUEntity(data, fileUrl.map { virtualFileManager.fromUrl(it) }, source)
this.addEntity(listVFUEntity)
return listVFUEntity
}

View File

@@ -73,7 +73,7 @@ fun MutableEntityStorage.addSampleEntity(stringProperty: String,
info: String = "",
stringMapProperty: MutableMap<String, String> = HashMap(),
): SampleEntity {
val entity = SampleEntity(booleanProperty, source, stringProperty, stringListProperty, stringMapProperty, fileProperty) {
val entity = SampleEntity(booleanProperty, stringProperty, stringListProperty, stringMapProperty, fileProperty, source) {
this.children = emptyList()
}
this.addEntity(entity)

View File

@@ -48,8 +48,8 @@ class EntityStorageSerializationTest {
put("ab", "bc")
put("bc", "ce")
}
val entity = SampleEntity(false, SampleEntitySource("test"), "MyEntity", stringListProperty,
stringMapProperty, virtualFileManager.fromUrl("file:///tmp"))
val entity = SampleEntity(false, "MyEntity", stringListProperty,
stringMapProperty, virtualFileManager.fromUrl("file:///tmp"), SampleEntitySource("test"))
builder.addEntity(entity)
SerializationRoundTripChecker.verifyPSerializationRoundTrip(builder.toSnapshot(), virtualFileManager)
@@ -59,8 +59,8 @@ class EntityStorageSerializationTest {
fun `entity uuid serialization`() {
val virtualFileManager: VirtualFileUrlManager = VirtualFileUrlManagerImpl()
val builder = createEmptyBuilder()
val entity = SampleEntity(false, SampleEntitySource("test"), "MyEntity", emptyList(),
emptyMap(), virtualFileManager.fromUrl("file:///tmp")) {
val entity = SampleEntity(false, "MyEntity", emptyList(),
emptyMap(), virtualFileManager.fromUrl("file:///tmp"), SampleEntitySource("test")) {
randomUUID = UUID.fromString("58e0a7d7-eebc-11d8-9669-0800200c9a66")
}
builder.addEntity(entity)

View File

@@ -11,7 +11,7 @@ import kotlin.test.assertEquals
class ExtensionListTest {
@Test
fun `access by extension without builder`() {
val entity = AttachedEntityList(MySource, "xyz") {
val entity = AttachedEntityList("xyz", MySource) {
ref = MainEntityList("123", MySource)
}
@@ -24,7 +24,7 @@ class ExtensionListTest {
@Test
fun `access by extension without builder on parent`() {
val entity = MainEntityList("123", MySource) {
this.child = listOf(AttachedEntityList(MySource, "xyz"))
this.child = listOf(AttachedEntityList("xyz", MySource))
}
assertEquals("123", entity.x)
@@ -36,9 +36,9 @@ class ExtensionListTest {
@Test
fun `access by extension without builder on parent with an additional child`() {
val entity = MainEntityList("123", MySource) {
this.child = listOf(AttachedEntityList(MySource, "xyz"))
this.child = listOf(AttachedEntityList("xyz", MySource))
}
val newChild = AttachedEntityList(MySource, "abc") {
val newChild = AttachedEntityList("abc", MySource) {
this.ref = entity
}
@@ -52,7 +52,7 @@ class ExtensionListTest {
@Test
fun `access by extension`() {
val entity = AttachedEntityList(MySource, "xyz") {
val entity = AttachedEntityList("xyz", MySource) {
ref = MainEntityList("123", MySource)
}
val builder = createEmptyBuilder()
@@ -73,7 +73,7 @@ class ExtensionListTest {
fun `access by extension on parent`() {
val entity = MainEntityList("123", MySource) {
this.child = listOf(
AttachedEntityList(MySource, "xyz")
AttachedEntityList("xyz", MySource)
)
}
val builder = createEmptyBuilder()
@@ -92,9 +92,9 @@ class ExtensionListTest {
@Test
fun `add via single child`() {
val child = AttachedEntityList(MySource, "abc")
val child = AttachedEntityList("abc", MySource)
val entity = MainEntityList("123", MySource) {
this.child = listOf(AttachedEntityList(MySource, "xyz"), child)
this.child = listOf(AttachedEntityList("xyz", MySource), child)
}
val builder = createEmptyBuilder()
builder.addEntity(child)
@@ -113,11 +113,11 @@ class ExtensionListTest {
@Test
fun `partially in builder`() {
val entity = MainEntityList("123", MySource) {
this.child = listOf(AttachedEntityList(MySource, "xyz"))
this.child = listOf(AttachedEntityList("xyz", MySource))
}
val builder = createEmptyBuilder()
builder.addEntity(entity)
val child = AttachedEntityList(MySource, "abc") {
val child = AttachedEntityList("abc", MySource) {
this.ref = entity
}

View File

@@ -14,7 +14,7 @@ class ExtensionParentTest {
fun `access by extension`() {
val builder = createEmptyBuilder()
builder.addEntity(AttachedEntityToParent("xyz", MySource) {
ref = MainEntityToParent(MySource, "123")
ref = MainEntityToParent("123", MySource)
})
val child: AttachedEntityToParent = builder.toSnapshot().entities(MainEntityToParent::class.java).single().child!!
assertEquals("xyz", child.data)
@@ -26,7 +26,7 @@ class ExtensionParentTest {
@Test
fun `access by extension without builder`() {
val entity = AttachedEntityToParent("xyz", MySource) {
ref = MainEntityToParent(MySource, "123")
ref = MainEntityToParent("123", MySource)
}
assertEquals("xyz", entity.data)
@@ -38,7 +38,7 @@ class ExtensionParentTest {
@Test
fun `access by extension opposite`() {
val builder = createEmptyBuilder()
builder.addEntity(MainEntityToParent(MySource, "123") {
builder.addEntity(MainEntityToParent("123", MySource) {
this.child = AttachedEntityToParent("xyz", MySource)
})
val child: AttachedEntityToParent = builder.toSnapshot().entities(MainEntityToParent::class.java).single().child!!
@@ -51,7 +51,7 @@ class ExtensionParentTest {
@Test
fun `access by extension opposite in builder`() {
val builder = createEmptyBuilder()
val entity = MainEntityToParent(MySource, "123") {
val entity = MainEntityToParent("123", MySource) {
this.child = AttachedEntityToParent("xyz", MySource)
}
builder.addEntity(entity)
@@ -61,7 +61,7 @@ class ExtensionParentTest {
@Test
fun `access by extension opposite in modification`() {
val builder = createEmptyBuilder()
val entity = MainEntityToParent(MySource, "123") {
val entity = MainEntityToParent("123", MySource) {
this.child = AttachedEntityToParent("xyz", MySource)
}
builder.addEntity(entity)
@@ -78,7 +78,7 @@ class ExtensionParentTest {
@Test
fun `access by extension opposite without builder`() {
val entity = MainEntityToParent(MySource, "123") {
val entity = MainEntityToParent("123", MySource) {
this.child = AttachedEntityToParent("xyz", MySource)
}

View File

@@ -14,7 +14,7 @@ class ExtensionTest {
@Test
fun `access by extension`() {
val builder = createEmptyBuilder()
builder.addEntity(AttachedEntity(MySource, "xyz") {
builder.addEntity(AttachedEntity("xyz", MySource) {
ref = MainEntity("123", MySource)
})
val child: AttachedEntity = builder.toSnapshot().entities(MainEntity::class.java).single().child!!
@@ -26,7 +26,7 @@ class ExtensionTest {
@Test
fun `access by extension without builder`() {
val entity = AttachedEntity(MySource, "xyz") {
val entity = AttachedEntity("xyz", MySource) {
ref = MainEntity("123", MySource)
}
@@ -40,7 +40,7 @@ class ExtensionTest {
fun `access by extension opposite`() {
val builder = createEmptyBuilder()
builder.addEntity(MainEntity("123", MySource) {
this.child = AttachedEntity(MySource, "xyz")
this.child = AttachedEntity("xyz", MySource)
})
val child: AttachedEntity = builder.toSnapshot().entities(MainEntity::class.java).single().child!!
assertEquals("xyz", child.data)
@@ -53,7 +53,7 @@ class ExtensionTest {
fun `access by extension opposite in builder`() {
val builder = createEmptyBuilder()
val entity = MainEntity("123", MySource) {
this.child = AttachedEntity(MySource, "xyz")
this.child = AttachedEntity("xyz", MySource)
}
builder.addEntity(entity)
assertEquals("xyz", entity.child!!.data)
@@ -63,10 +63,10 @@ class ExtensionTest {
fun `access by extension opposite in modification`() {
val builder = createEmptyBuilder()
val entity = MainEntity("123", MySource) {
this.child = AttachedEntity(MySource, "xyz")
this.child = AttachedEntity("xyz", MySource)
}
builder.addEntity(entity)
val anotherChild = AttachedEntity(MySource, "abc")
val anotherChild = AttachedEntity("abc", MySource)
builder.modifyEntity(entity) {
assertEquals("xyz", this.child!!.data)
@@ -80,7 +80,7 @@ class ExtensionTest {
@Test
fun `access by extension opposite without builder`() {
val entity = MainEntity("123", MySource) {
this.child = AttachedEntity(MySource, "xyz")
this.child = AttachedEntity("xyz", MySource)
}
assertEquals("123", entity.x)

View File

@@ -11,7 +11,7 @@ class MutableStorageTest {
@Test
fun `simple entity mutation test`() {
val builder = MutableEntityStorage.create()
val sampleEntity = SampleEntity2("ParentData", MySource, true)
val sampleEntity = SampleEntity2("ParentData", true, MySource)
builder.addEntity(sampleEntity)
val simpleEntityFromStore = builder.entities(SampleEntity2::class.java).single()
@@ -49,7 +49,7 @@ class MutableStorageTest {
@Test
fun `check exception if request data from entity which was removed`() {
val builder = MutableEntityStorage.create()
val sampleEntity = SampleEntity2("ParentData", MySource, false)
val sampleEntity = SampleEntity2("ParentData", false, MySource)
builder.addEntity(sampleEntity)
val newBuilder = MutableEntityStorage.from(builder.toSnapshot())
val entityFromStore = newBuilder.entities(SampleEntity2::class.java).single()

View File

@@ -11,13 +11,13 @@ import kotlin.test.assertTrue
class SampleTest {
@Test
fun `entity creation`() {
val entity = SampleEntity2("myData", MySource, true)
val entity = SampleEntity2("myData", true, MySource)
assertEquals("myData", entity.data)
}
@Test
fun `optional field`() {
val entity = SampleEntity2("", MySource, true){
val entity = SampleEntity2("", true, MySource){
this.optionalData = null
}
val builder = MutableEntityStorage.create()

View File

@@ -119,7 +119,7 @@ class SoftLinksTest {
fun `change persistent id in list`() {
val builder = createEmptyBuilder()
val entity = builder.addNamedEntity("Name")
builder.addEntity(WithListSoftLinksEntity("xyz", MySource, listOf(NameId("Name"))))
builder.addEntity(WithListSoftLinksEntity("xyz", listOf(NameId("Name")), MySource))
builder.modifyEntity(entity) {
this.myName = "newName"
@@ -157,7 +157,6 @@ class SoftLinksTest {
builder.addEntity(entity)
val persistentId = entity.persistentId
val softLinkEntity = EntityWithSoftLinks(persistentId,
MySource,
listOf(persistentId),
Container(persistentId),
listOf(Container(persistentId)),
@@ -166,7 +165,8 @@ class SoftLinksTest {
listOf(SealedContainer.SmallContainer(persistentId)),
"Hello",
listOf("Hello"),
DeepSealedOne.DeepSealedTwo.DeepSealedThree.DeepSealedFour(persistentId)
DeepSealedOne.DeepSealedTwo.DeepSealedThree.DeepSealedFour(persistentId),
MySource
) {
optionalLink = persistentId
inOptionalContainer = Container(persistentId)

View File

@@ -16,7 +16,7 @@ class StorageIndexiesTest {
fun `check entity source index`() {
val entity = ParentSubEntity("ParentData", MySource) {
child = ChildSubEntity(MySource) {
child = ChildSubSubEntity(MySource, "ChildData")
child = ChildSubSubEntity("ChildData", MySource)
}
}
@@ -45,7 +45,7 @@ class StorageIndexiesTest {
val firstRoot = virtualFileUrlManager.fromPath("/m2/root/one")
val secondRoot = virtualFileUrlManager.fromPath("/m2/root/second")
val entity = VFUEntity2("VFUEntityData", VFUEntitySource(sourceUrl), directory, listOf(firstRoot, secondRoot))
val entity = VFUEntity2("VFUEntityData", directory, listOf(firstRoot, secondRoot), VFUEntitySource(sourceUrl))
val builder = MutableEntityStorage.create()
builder.addEntity(entity)

View File

@@ -13,7 +13,7 @@ class SubChildrenTest {
fun `parent with child`() {
val entity = ParentSubEntity("ParentData", MySource) {
child = ChildSubEntity(MySource) {
child = ChildSubSubEntity(MySource, "ChildData")
child = ChildSubSubEntity("ChildData", MySource)
}
}
@@ -24,7 +24,7 @@ class SubChildrenTest {
fun `parent with child in builder`() {
val entity = ParentSubEntity("ParentData", MySource) {
child = ChildSubEntity(MySource) {
child = ChildSubSubEntity(MySource, "ChildData")
child = ChildSubSubEntity("ChildData", MySource)
}
}
@@ -39,7 +39,7 @@ class SubChildrenTest {
fun `parent with child in builder and accessing`() {
val entity = ParentSubEntity("ParentData", MySource) {
child = ChildSubEntity(MySource) {
child = ChildSubSubEntity(MySource, "ChildData")
child = ChildSubSubEntity("ChildData", MySource)
}
}
@@ -54,7 +54,7 @@ class SubChildrenTest {
fun `get parent from child`() {
val entity = ParentSubEntity("ParentData", MySource) {
child = ChildSubEntity(MySource) {
child = ChildSubSubEntity(MySource, "ChildData")
child = ChildSubSubEntity("ChildData", MySource)
}
}

View File

@@ -52,7 +52,7 @@ interface EclipseProjectPropertiesEntity : WorkspaceEntity {
}
companion object: Type<EclipseProjectPropertiesEntity, Builder>() {
operator fun invoke(entitySource: EntitySource, variablePaths: Map<String, String>, eclipseUrls: List<VirtualFileUrl>, unknownCons: List<String>, knownCons: List<String>, forceConfigureJdk: Boolean, expectedModuleSourcePlace: Int, srcPlace: Map<String, Int>, init: (Builder.() -> Unit)? = null): EclipseProjectPropertiesEntity {
operator fun invoke(variablePaths: Map<String, String>, eclipseUrls: List<VirtualFileUrl>, unknownCons: List<String>, knownCons: List<String>, forceConfigureJdk: Boolean, expectedModuleSourcePlace: Int, srcPlace: Map<String, Int>, entitySource: EntitySource, init: (Builder.() -> Unit)? = null): EclipseProjectPropertiesEntity {
val builder = builder()
builder.entitySource = entitySource
builder.variablePaths = variablePaths
@@ -90,7 +90,7 @@ data class EclipseProjectFile(
}
fun MutableEntityStorage.addEclipseProjectPropertiesEntity(module: ModuleEntity, source: EntitySource): EclipseProjectPropertiesEntity {
val entity = EclipseProjectPropertiesEntity(source, LinkedHashMap(), ArrayList(), ArrayList(), ArrayList(), false, 0, LinkedHashMap()) {
val entity = EclipseProjectPropertiesEntity(LinkedHashMap(), ArrayList(), ArrayList(), ArrayList(), false, 0, LinkedHashMap(), source) {
this.module = module
}
this.addEntity(entity)

View File

@@ -106,7 +106,7 @@ class ModuleModelProxyImpl(private val diff: MutableEntityStorage,
PathUtil.getParentPath(
systemIndependentPath)), ExternalProjectSystemRegistry.getInstance().getSourceById(
ExternalProjectSystemRegistry.MAVEN_EXTERNAL_SOURCE_ID))
val moduleEntity = ModuleEntity(name, source, listOf(ModuleDependencyItem.ModuleSourceDependency)) {
val moduleEntity = ModuleEntity(name, listOf(ModuleDependencyItem.ModuleSourceDependency), source) {
type = moduleTypeId
}
diff.addEntity(moduleEntity)