Bug #3416
Groovy, class exception while evaluating GStringImpl
Status: | New | Start date: | 07/04/2023 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | - | % Done: | 0% |
|
Category: | Macros | Spent time: | - | |
Target version: | TXM 0.8.4 |
Description
def s = "$variable" Partition p = ...(s) p.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
History
#1 Updated by Serge Heiden 5 months ago
- Description updated (diff)
#2 Updated by Matthieu Decorde about 1 month ago
- Subject changed from Groovy, class exeception while evaluating GStringImpl to Groovy, class exception while evaluating GStringImpl
- Description updated (diff)
#3 Updated by Matthieu Decorde about 1 month ago
- Description updated (diff)
- Target version changed from TXM 0.8.3 to TXM 0.8.4