Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to solve "cannot assign java.util.list linkedhashmap to java.util.list map"

Christian Stein
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 14, 2022

Hey there,

after updating Jira to v8.20.2 I was facing several issues in groovy scripts. Think I solved the ComponentManager vs. ComponentAccessor thing but one problem is still there.

 

List<Map> getArguments() 

is throwing the error 

cannot assign java.util.list linkedhashmap to java.util.list map

and I have no clue how to solve it

 

Thank you already so much for your support!

 

Here is the top part of the code:

 

package com.onresolve.jira.groovy.jql
import com.atlassian.jira.util.JiraUtils
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.component.pico.ComponentManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.search.SearchProvider
import com.atlassian.jira.jql.operand.QueryLiteral
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.jql.query.RangeQueryFactory
import com.atlassian.jira.util.MessageSetImpl
import com.atlassian.query.operand.FunctionOperand
import com.atlassian.query.operator.Operator
import org.apache.log4j.Category
import com.atlassian.jira.util.MessageSet
//import com.atlassian.crowd.embedded.api.User
import com.atlassian.query.clause.TerminalClause
import com.atlassian.jira.jql.query.QueryCreationContext
import com.atlassian.jira.JiraDataType
import com.atlassian.jira.JiraDataTypes
import com.onresolve.jira.groovy.jql.AbstractScriptedJqlFunction
import org.apache.lucene.search.BooleanClause
import org.apache.lucene.search.BooleanQuery
import org.apache.lucene.search.Query
import org.apache.lucene.search.TermQuery
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.security.JiraAuthenticationContext
import com.atlassian.jira.security.roles.*
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.project.Project


class UserInProjectRole extends AbstractScriptedJqlFunction implements JqlValuesFunction{


@Override
String getDescription() {
"Returns a set of users that are in the specified role of specified project"
}

@Override
List<Map> getArguments() {
[
["project": "Project Key","optional": false],
["role": "Role X", "optional": false]
]
}

1 answer

1 accepted

2 votes
Answer accepted
PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 14, 2022

Just cast your map to the type expected by the interface

@Override
List<Map> getArguments() {
[
["project": "Project Key", "optional": false],
["role": "Role X", "optional": false]
] as List<Map>
}
Christian Stein
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 15, 2022

Awesome, thank you so much @PD Sheehan !

Feels like I am a total noob^^

Suggest an answer

Log in or Sign up to answer