On Tue, Nov 19, 2019 at 10:27 AM medianopepeter
<
jm.rodulf...@gmail.com> wrote:
> I am not fully understanding how the resource translate.txt actually works
I suppose you are referring to translatable.txt and
https://github.com/cloudbees/groovy-cps/blob/4916a1f80c5c8b1a1a23c2bf366d98be7e87ab56/dgm-builder/src/main/java/com/cloudbees/groovy/cps/tool/Translator.java#L189
> I see it is a list of methods from groovy to translate but seems that they are not all the methods listed in the DefaultGroovyMethods, DefaultGroovyStaticMethods and StringGroovyMethods.
Correct, it is a subset.
> how methods are chosen, what to translate and what no.
GDK methods can be added to it when `Translator` bugs are fixed so
that the translation actually works, as verified mostly by
`CpsDefaultGroovyMethodsTest`.
While curiosity is great, please be aware that no one is expecting to
make changes here other than for security vulnerabilities or critical
regressions: the code is so hard to follow (I am speaking as a
coauthor!) that we are reluctant to spend the time even reviewing
proposed support for the remaining methods. Few people will ever
notice that, say, `Set.takeWhile(Closure)` is not supported (as of
recent changes, this is called out with a runtime warning in the build
log), and these gaps are not so hard to work around with either
`@NonCPS` or just using more common idioms. In the longer term, we
would rather find ways to run scripts out of process so this library
(and `groovy-sandbox`) can be retired.