Hello guys,
I try to clone an issue and remove a specific label from it (named CCB). Following code is working fine (this is just a snippet as in the original code I will really create the cloned issue)
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.label.LabelManager
import com.atlassian.jira.issue.label.Label
// get Issue
def issueManager = ComponentAccessor.getIssueManager()
def issue = issueManager.getIssueObject("SWCM-46")
// Clone Issue
def issueFactory = ComponentAccessor.getIssueFactory()
def newIssue = issueFactory.cloneIssue(issue)
// get Labels from Issue
LabelManager labelManager = ComponentAccessor.getComponent(LabelManager)
List <String> labels = labelManager.getLabels(issue.id).collect{ it.getLabel() }
labels -= 'CCB'
newIssue.setLabels(labels.toSet())
return null
Now my problem concerns static type checking:

As I can see labels is a collection and is converted to a Set by calling toSet() - so everything should fine as the argument of method setLabels() must be a Set according to documentation: http://docs.groovy-lang.org/2.4.15/html/groovy-jdk/java/util/Collection.html#toSet()
So why is type checking failing here?
Kind Regards
Frank