Bug #3416
Groovy, class exception while evaluating GStringImpl
Statut: | New | Début: | 04/07/2023 | |
---|---|---|---|---|
Priorité: | Normal | Echéance: | ||
Assigné à: | - | % réalisé: | 0% |
|
Catégorie: | Macros | Temps passé: | - | |
Version cible: | 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
Historique
#1 Mis à jour par Serge Heiden il y a environ 2 ans
- Description mis à jour (diff)
#2 Mis à jour par Matthieu Decorde il y a presque 2 ans
- Sujet changé de Groovy, class exeception while evaluating GStringImpl à Groovy, class exception while evaluating GStringImpl
- Description mis à jour (diff)
#3 Mis à jour par Matthieu Decorde il y a presque 2 ans
- Description mis à jour (diff)
- Version cible changé de TXM 0.8.3 à TXM 0.8.4