-
Bug
-
Resolution: Unresolved
-
Major
-
Jenkins 2.210, workflow-cps 2.78
Sample code which demonstrates the issue:
abstract class SuperBuild { // If I comment this out, the problem goes away abstract String getTestString() } class Build extends SuperBuild { String testString = 'hello' // Replace above with this and it works //String getTestString() { 'hello' } // Adding @NonCPS annotation here also makes the problem go away void test() { // Works as expected assert testString == 'hello' Closure cl = { // Works as expected assert resolveStrategy == Closure.OWNER_FIRST assert getOwner() instanceof Build assert this.testString == 'hello' // Fails with: No such field found: field org.jenkinsci.plugins.workflow.cps.CpsClosure2 testString assert testString == 'hello' }() } } new Build().test()
The same code works as expected when run directly with Groovy 2.4.12