can anyone help me with: ```e: /home/runner/work/i...
# getting-started
d
can anyone help me with:
Copy code
e: /home/runner/work/intellij-plugin-ld/intellij-plugin-ld/src/main/kotlin/com/github/intheclouddan/intellijpluginld/settings/LaunchDarklySettings.kt: (155, 21): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
public fun <T> MutableCollection<in ???>.addAll(elements: Array<out ???>): Boolean defined in kotlin.collections
public fun <T> MutableCollection<in ???>.addAll(elements: Sequence<???>): Boolean defined in kotlin.collections
public fun <T> MutableCollection<in String!>.addAll(elements: Iterable<String!>): Boolean defined in kotlin.collections
I’ve tried assigned it to a variable and suppressing that as Unused, I’ve wrapped that section with a
with
block but nothing so far is helping me with this error. Here’s a link to the line in the repo https://github.com/InTheCloudDan/intellij-plugin-ld/blob/master/src/main/kotlin/com/github/intheclouddan/intellijpluginld/settings/LaunchDarklySettings.kt#L155
This is happening on a
DefaultComboBoxModel
which has its own
addAll
so I don’t know why it’s referencing MutableCollections?
m
type mismatch should be the biggest hint I think. I dont know much about the used datamodels. Since DefaultComboBoxModel wants a string, are you sure that select the keys from the items in projectContrainer, are strings too? I can see you are activelly using a toString to check for equality on "Check Api Key", so my first instinct is that you're trying to add a non-string to a string collection
d
the type of
keys
is String, so it’s making a List of Strings
I guess I’m confused why it’s trying to us
kotlin.collections
when the method is part of the
DefaultComboBoxModel
i
It is possible that
DefaultComboBoxModel
doesn't have
addAll
method. For example, I don't see it in JDK 8 docs https://docs.oracle.com/javase/8/docs/api/javax/swing/DefaultComboBoxModel.html, but I see it in the docs of JDK 11: https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/javax/swing/DefaultComboBoxModel.html
So it may be a good idea to check which JDK version you use for compilation.
d
thanks @ilya.gorbunov! That didn’t even occur to me as a possibility. This is for an intellij plugin, so I think it’s jdk 1.8, in this case I should just loop over the list calling add element then?
I changed it to loop over addElement and that’s it!