Groovy, class exception while evaluating GStringImpl
def s = "$variable"
Partition p = ...(s)
compute()
Raises an exception:
** class org.codehaus.groovy.runtime.GStringImpl cannot be cast to class java.lang.String (org.codehaus.groovy.runtime.GStringImpl is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @156106f5; java.lang.String is in module java.base of loader 'bootstrap').
Solution 0
Force resolution of the GStringImpl before using it
String s = "$variable"
or
s = ''+"$variable"
or
s = "$variable".toString()
Solution
Understand why GStringImpl is not mutated (.toString() should be called automatically) in a String when called from the EquinoxLoader (org.txm.rcp) which has the Groovy classes in its classloaders
see http://docs.groovy-lang.org/latest/html/documentation/index.html#all-strings and https://docs.groovy-lang.org/latest/html/api/groovy/lang/GString.html
(from redmine: issue id 3416, created on 2023/07/04 by Matthieu Decorde)