From 61365c7e90042787ca09e2d1b47be93aa184fb1d Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Wed, 7 Dec 2016 14:29:44 +0300 Subject: [PATCH] vcs: cleanup - move field copying into copy constructor --- .../vcs/changes/LocalChangeListImpl.java | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/LocalChangeListImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/LocalChangeListImpl.java index 2cc3cd7b3189..c5e080fcf894 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/LocalChangeListImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/LocalChangeListImpl.java @@ -49,6 +49,23 @@ public class LocalChangeListImpl extends LocalChangeList { myId = origin.getId(); myProject = origin.myProject; setName(origin.myName); + + myComment = origin.myComment; + myIsDefault = origin.myIsDefault; + myIsReadOnly = origin.myIsReadOnly; + myData = origin.myData; + + if (myChanges != null) { + myChanges = ContainerUtil.newHashSet(origin.myChanges); + } + + if (myChangesBeforeUpdate != null) { + myChangesBeforeUpdate = new OpenTHashSet((Collection)origin.myChangesBeforeUpdate); + } + + if (myReadChangesCache != null) { + myReadChangesCache = ContainerUtil.newHashSet(origin.myReadChangesCache); + } } @NotNull @@ -246,25 +263,7 @@ public class LocalChangeListImpl extends LocalChangeList { } public LocalChangeList copy() { - final LocalChangeListImpl copy = new LocalChangeListImpl(this); - copy.myComment = myComment; - copy.myIsDefault = myIsDefault; - copy.myIsReadOnly = myIsReadOnly; - copy.myData = myData; - - if (myChanges != null) { - copy.myChanges = ContainerUtil.newHashSet(myChanges); - } - - if (myChangesBeforeUpdate != null) { - copy.myChangesBeforeUpdate = new OpenTHashSet<>((Collection)myChangesBeforeUpdate); - } - - if (myReadChangesCache != null) { - copy.myReadChangesCache = ContainerUtil.newHashSet(myReadChangesCache); - } - - return copy; + return new LocalChangeListImpl(this); } public void setId(String id) {