Yeah, this is horrible and would be more than happy to get rid of it if possible. Please advise.

KK was asking me about this some time ago too. Here's the conversation...

I'll check is it still needed. At the time I added it though it was definitely needed - I didn't add it for fun.

From memory, I think it was down to JEXL (I may be wrong - it was a while ago). I think it was needed in situations where the 'abc' variable you talk about in your example was the output of an earlier JEXL _expression_ that created a GString object instance in the jelly context used to evaluate the expressions. Then later, when ${icons.getIconByUrl(abc)} is being evaluated, JEXL was trying to find an Icons.getIconByUrl(GString) method (because abc is of type GString) but was failing.

As I say... this is from memory so I may be slightly wrong on the exact details, but I don't think I'm too far off and I certainly did not add it randomly. That said, it may be that this is no longer needed because I do remember having some trouble implementing the tag library in that plugin, which resulted in me implementing it a few different ways before I was able to get it to work (http://goo.gl/RSbacS). So maybe the GStrings are legacy from one of those attempts.

On 19/10/2014 06:01, Kohsuke Kawaguchi wrote:
> I remember what I wanted to ask you.
>
> In the following code, you have every method overloaded between String and GString.
>
> https://github.com/jenkinsci/icon-shim-plugin/blob/master/icon-set/src/main/java/org/jenkins/ui/icon/IconSet.java
>
> What is that for? GString is mostly internal implementation details in Groovy, and it'll perform the appropriate type coercison to generate a plain String. So this seems redundant.
>
> And worse yet, JEXL (used by Jelly) has a trouble resolving overload when the null is an argument. So for example, invocations like
>
> ${icons.getIconByUrl(abc)}
>
> results in a problem if 'abc' is null.
>
> –
> Kohsuke Kawaguchi

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to