[JIRA] (JENKINS-60599) Closure in CPS-transformed method fails to resolve automatic property getter which implements abstract method unless "this" qualifier is provided

2 views
Skip to first unread message

aaronkmiller@gmail.com (JIRA)

unread,
Dec 27, 2019, 6:00:03 PM12/27/19
to jenkinsc...@googlegroups.com
Aaron Miller created an issue
 
Jenkins / Bug JENKINS-60599
Closure in CPS-transformed method fails to resolve automatic property getter which implements abstract method unless "this" qualifier is provided
Issue Type: Bug Bug
Assignee: Unassigned
Components: workflow-cps-plugin
Created: 2019-12-27 22:59
Environment: Jenkins 2.210, workflow-cps 2.78
Labels: pipeline cps groovy
Priority: Major Major
Reporter: Aaron Miller

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

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages