[JIRA] (JENKINS-39719) Internal workflowLib libraries throwing errors

2 views
Skip to first unread message

dtranter@cloudbees.com (JIRA)

unread,
Nov 14, 2016, 11:10:02 AM11/14/16
to jenkinsc...@googlegroups.com
Dan Tranter created an issue
 
Jenkins / Bug JENKINS-39719
Internal workflowLib libraries throwing errors
Issue Type: Bug Bug
Assignee: Unassigned
Components: workflow-cps-global-lib-plugin
Created: 2016/Nov/14 4:09 PM
Environment: Pipeline Shared Groovy Libraries Plugin 2.2+
Priority: Minor Minor
Reporter: Dan Tranter

When importing an internal library (as described at https://github.com/jenkinsci/workflow-cps-global-lib-plugin), I'm encountering an issue:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: -1: You are not allowed to override the final method __cps__2() from class 'com.acme.foo.test.MyTest'.
@ line -1, column -1.
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1073)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:67)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:410)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:373)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:213)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Finished: FAILURE

Using the following libraries to produce this error:

workflowLibs/src/com/acme/foo/test/MyTest.groovy:

#!groovy
package com.acme.foo.test
class MyTest
{
def mytest1() {}
}

workflowLibs/src/com/acme/foo/test/MyOtherTest.groovy:

#!groovy
package com.acme.foo.test
class MyOtherTest {
def test1() {}
def test2() {}
}

Pipeline content:

#!groovy
import com.acme.foo.test.MyTest
import com.acme.foo.test.MyOtherTest

class MyTestExtended
extends MyTest
{
def mytestfunction() {}
}

node('localhost')

{ def pipeline = new MyTestExtended() }

Now here's the odd part. The error only manifests for certain class names. The error is thrown with the stack trace described above when the class/file is named "MyTest", "Test2", "Test3", or "What". If I change the name to "Test1" or "DoStuff", the same pipeline finishes successfully.

Additionally, the second (unused) import in the pipeline script, is required to produce the issue. When I remove the second import statement (import com.acme.foo.test.MyOtherTest), the pipeline passes for all names of the primary class being expanded upon.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages