[git] migration to Java 11: use explicit 'setUI' call instead of 'ui' property
authorNikolay Chashnikov <Nikolay.Chashnikov@jetbrains.com>
Mon, 10 Aug 2020 16:27:26 +0000 (19:27 +0300)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Mon, 10 Aug 2020 18:06:46 +0000 (18:06 +0000)
...to fix "Val cannot be reassigned" error when compiling IntelliJ sources under Java 11 (see KT-31926).

This repeats changes made in 0bfb01c7 which were reverted recently.

GitOrigin-RevId: e7ec292e8a87a87c347534d6aeb4fdd359120a93

plugins/git4idea/src/git4idea/merge/GitMergeDialog.kt
plugins/git4idea/src/git4idea/pull/GitPullDialog.kt
plugins/git4idea/src/git4idea/rebase/GitRebaseDialog.kt

index 5a6161257cf0953c31ac8b97c911d212b2c2dbef..aec003c4f2867ad70bf1b15ba188bc4d7ceebd5b 100644 (file)
@@ -317,7 +317,8 @@ class GitMergeDialog(private val project: Project,
     return ComboBox(model).apply {
       item = defaultRoot.name
       isSwingPopup = false
-      ui = FlatComboBoxUI(outerInsets = Insets(BW.get(), BW.get(), BW.get(), 0))
+      @Suppress("UsePropertyAccessSyntax")
+      setUI(FlatComboBoxUI(outerInsets = Insets(BW.get(), BW.get(), BW.get(), 0)))
 
       addItemListener { e ->
         if (e.stateChange == ItemEvent.SELECTED
@@ -351,9 +352,10 @@ class GitMergeDialog(private val project: Project,
       }
       prototypeDisplayValue = COMBOBOX_VALUE_PROTOTYPE
       renderer = ComboBoxPrototypeRenderer.create(this) { it }
-      ui = FlatComboBoxUI(
+      @Suppress("UsePropertyAccessSyntax")
+      setUI(FlatComboBoxUI(
         outerInsets = Insets(BW.get(), 0, BW.get(), BW.get()),
-        popupEmptyText = GitBundle.message("merge.branch.popup.empty.text"))
+        popupEmptyText = GitBundle.message("merge.branch.popup.empty.text")))
     }
   }
 
index 4442e6e378630a288c54dbef9a4b909778515360..bd46da9dc9420a5726e1c9405b28e5f9d0d2583b 100644 (file)
@@ -437,11 +437,12 @@ class GitPullDialog(private val project: Project,
 
     prototypeDisplayValue = COMBOBOX_VALUE_PROTOTYPE
     renderer = ComboBoxPrototypeRenderer.create(this) { it }
-    ui = FlatComboBoxUI(
+    @Suppress("UsePropertyAccessSyntax")
+    setUI(FlatComboBoxUI(
       Insets(1, 0, 1, 1),
       Insets(BW.get(), 0, BW.get(), BW.get()),
       GitBundle.message("pull.branch.nothing.to.pull"),
-      this@GitPullDialog::createBranchFieldPopupComponent)
+      this@GitPullDialog::createBranchFieldPopupComponent))
   }
 
   private fun createBranchFieldPopupComponent(content: JComponent): JComponent {
index a050fde4a56d52acb322a05f8fb84ab4441294dd..8deb0b34fb625a168262f7acc598f9f595ea0883 100644 (file)
@@ -411,7 +411,8 @@ internal class GitRebaseDialog(private val project: Project,
     editor = createFieldEditor(GitBundle.message("rebase.dialog.new.base"))
     prototypeDisplayValue = PresentableRef(GitLocalBranch(COMBOBOX_VALUE_PROTOTYPE))
     renderer = ComboBoxPrototypeRenderer.create(this, PresentableRef::toString)
-    ui = FlatComboBoxUI(outerInsets = Insets(BW.get(), 0, BW.get(), 0))
+    @Suppress("UsePropertyAccessSyntax")
+    setUI(FlatComboBoxUI(outerInsets = Insets(BW.get(), 0, BW.get(), 0)))
   }
 
   private fun createUpstreamField() = ComboBox<PresentableRef>(MutableCollectionComboBoxModel()).apply {
@@ -421,13 +422,15 @@ internal class GitRebaseDialog(private val project: Project,
     editor = createFieldEditor(GitBundle.message("rebase.dialog.target"))
     prototypeDisplayValue = PresentableRef(GitLocalBranch(COMBOBOX_VALUE_PROTOTYPE))
     renderer = ComboBoxPrototypeRenderer.create(this, PresentableRef::toString)
-    ui = FlatComboBoxUI(outerInsets = Insets(BW.get(), 0, BW.get(), 0))
+    @Suppress("UsePropertyAccessSyntax")
+    setUI(FlatComboBoxUI(outerInsets = Insets(BW.get(), 0, BW.get(), 0)))
   }
 
   private fun createRootField() = ComboBox(CollectionComboBoxModel(roots)).apply {
     isSwingPopup = false
     renderer = SimpleListCellRenderer.create(GitBundle.message("rebase.dialog.invalid.root")) { it.name }
-    ui = FlatComboBoxUI(outerInsets = Insets(BW.get(), BW.get(), BW.get(), 0))
+    @Suppress("UsePropertyAccessSyntax")
+    setUI(FlatComboBoxUI(outerInsets = Insets(BW.get(), BW.get(), BW.get(), 0)))
     item = defaultRoot ?: roots[0]
 
     val listener = ActionListener {
@@ -441,9 +444,10 @@ internal class GitRebaseDialog(private val project: Project,
     isSwingPopup = false
     isEditable = true
     editor = createFieldEditor(GitBundle.message("rebase.dialog.branch.field"))
-    ui = FlatComboBoxUI(
+    @Suppress("UsePropertyAccessSyntax")
+    setUI(FlatComboBoxUI(
       outerInsets = Insets(BW.get(), 0, BW.get(), 0),
-      popupEmptyText = GitBundle.message("merge.branch.popup.empty.text"))
+      popupEmptyText = GitBundle.message("merge.branch.popup.empty.text")))
   }
 
   private fun createFieldEditor(@Nls placeHolder: String) = object : BasicComboBoxEditor() {