This is laughable, but 2 bugs nonetheless:
The code:
/*
imgs.each({
if(it["alt"] && (it["alt"] =~ /^(?i).*image.*/)) {
aMentionsImage.push(it)
}
})
*/
Screenshot of the issue in Katalon Studio:
How the Problems tab reports the problem (which is quite misleading in itself)
Interesting to note, even Discourse has the exact same issue when trying to parse it (though in Discourse’s case, perhaps more forgivable).
Did anyone catch what the problem is?
Let me spell it out. Take another look at the code, especially the screenshot of it.
On line 54 I’m starting a block comment with /*
. The block continues up to and including line 60 ending with */
Now look carefully at line 56 in the middle of the code lines. Line 56 contains a groovy
/slashy string/
. That is, a string delineated by /
and /
. Slashy strings are typically used for regular expressions – which is exactly what I’m using them for.
At this point, the eagle eyed, if they didn’t spot the problem before now, will have seen the cause of the issue:
The regex ends with
.*
followed immediately by/
giving*/
All perfectly understandable here in Discourse and maybe even forgivable that the KS/Eclipse syntax coloring routines get it wrong, but completely unforgivable that the Groovy compiler flatly refuses to compile perfectly legal code.
Put more succinctly, the Groovy compiler takes no account of slashy strings while parsing block comments.
Of course, the issue wasn’t helped by the KS Problems tab telling me there was a problem on line 73 but I can live with that since it almost certainly gets its info passed to it from a Groovy lib somewhere. But Groovy itself not understanding Groovy… that’s terrible.