It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Ambiguous method overloading for method ApplicationUsers#from


Recently we upgraded to JIRA 6.3.15 and ScriptRunner v3 and one of the our Scripted Fields does not work anymor.  The log file records the following error:

groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method com.atlassian.jira.user.ApplicationUsers#from.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[interface com.atlassian.crowd.embedded.api.User]
[interface java.util.Collection]

It was working just fine previously in JIRA 5.  I'm aware of a change in ApplicationUser interface in JIRA 6 but just wondering if the problem lies with my script or the fact that the use of this interface has been changed since the upgrade?

My script is just a simple script that collects user from customfields:

Collection<ApplicationUser> appUserCollection = []


2 answers

1 accepted

0 votes
Answer accepted

Hi Jamie, Thanks for the pointer. We handled the null value by adding '?' operator when getting the custom field value. However what we found is that your suggestion still returns the same error. We tried different permutations such as below (enforce it in one level before):

appUserCollection.add(ApplicationUsers.from(issue.getCustomFieldValue(CustomFieldObject)) as ApplicationUser)

But still received the same error. If I enforce it at the lowest level like this:

appUserCollection.add(ApplicationUsers.from(issue.getCustomFieldValue(CustomFieldObject) as ApplicationUser))

We will get

'No signature of method: static com.atlassian.jira.user.ApplicationUsers.from() is applicable for argument types: (null) values: [null]'.

What we found to be working is to enforce it as User when the ApplicationUsers is calling the 'from' method:

appUserCollection.add(ApplicationUsers.from(issue.getCustomFieldValue(CustomFieldObject) as User))

as this will feed User type to ApplicationUsers and return a single User. Hope this can help others.

JamieA Apr 17, 2015

You're right, in my example I had the "as ApplicationUser" in the wrong place, it should have been inside the parens. Better though just to check it for null then do something else.

1 vote
JamieA Apr 09, 2015

It's going to fail when issue.getCustomFieldValue(CustomFieldObject) is null, as there are two methods for  com.atlassian.jira.user.ApplicationUsers#from. In groovy, method selection happens at runtime.

So you can handle the null value yourself, or force one or other method to be selected by using 

appUserCollection.add(ApplicationUsers.from(issue.getCustomFieldValue(CustomFieldObject))) as ApplicationUser

(or the other choice).

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Jira Software

Demo Den Ep. 5: Meet Jira Mobile

See how to use Jira on the go! Demo Den Episode 5 is here: meet Jira Mobile with  Jira  Product Manager Rayen Magpantay.  Demo Den is in our monthly series where a Jira PM demonstrates...

441 views 1 10
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you