Bug #3416

Mis à jour par Matthieu Decorde il y a presque 2 ans

<pre>
def s = "$variable"
Partition p = ...(s)
p.compute()
</pre>

Raises an exception:
<pre>
** 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').
</pre>

h3. Solution 0

Force resolution of the GStringImpl before using it
<pre>
String s = "$variable"
</pre>
or
<pre>
s = ''+"$variable"
</pre>
or
<pre>
s = "$variable".toString()
</pre>

h3. 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
classloader

Retour