[JIRA] [workflow-plugin] (JENKINS-34428) workflow-cps-global-lib: inheritance (extends) not working

8 views
Skip to first unread message

vehovsky@gmail.com (JIRA)

unread,
Apr 25, 2016, 7:36:01 AM4/25/16
to jenkinsc...@googlegroups.com
Martin Vehovsky created an issue
 
Jenkins / Bug JENKINS-34428
workflow-cps-global-lib: inheritance (extends) not working
Issue Type: Bug Bug
Assignee: Jesse Glick
Components: workflow-plugin
Created: 2016/Apr/25 11:35 AM
Priority: Major Major
Reporter: Martin Vehovsky

I'm not able to use inheritance in Workflow Global Library code.

Here is a simple example to demonstrate:

// src/com/test/MyMap.groovy

package com.test

class MyMap extends HashMap {

    def test(String property) {
        super.get(property)
    }
}
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

jelian@gmail.com (JIRA)

unread,
Jun 21, 2016, 6:32:02 PM6/21/16
to jenkinsc...@googlegroups.com
Zhelyan Panchev commented on Bug JENKINS-34428
 
Re: workflow-cps-global-lib: inheritance (extends) not working

I can extend abstract classes but calling super.somemethod() from the implementation throws StackOverflow exception

This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

jglick@cloudbees.com (JIRA)

unread,
Aug 29, 2016, 5:21:01 PM8/29/16
to jenkinsc...@googlegroups.com
Jesse Glick updated an issue
 
Change By: Jesse Glick
Component/s: workflow-cps-plugin
Component/s: pipeline

jglick@cloudbees.com (JIRA)

unread,
Aug 29, 2016, 5:22:02 PM8/29/16
to jenkinsc...@googlegroups.com
Jesse Glick commented on Bug JENKINS-34428
 
Re: workflow-cps-global-lib: inheritance (extends) not working

Probably a groovy-cps issue not specific to global libraries.

joshft91@gmail.com (JIRA)

unread,
Aug 23, 2018, 10:02:02 AM8/23/18
to jenkinsc...@googlegroups.com

Is there any update to this? I'm running into this same issue... attempting to call

super.method()

appears to result in an exception. As shown below, I'm passing in a map but it doesn't think that I am... even the possible solutions show that I should pass a map.

groovy.lang.MissingMethodException: No signature of method: method() is applicable for argument types: (java.util.LinkedHashMap)
Possible solutions: method(java.util.Map), method(java.util.Map)
This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

joerg.schwaerzler@infineon.com (JIRA)

unread,
Aug 23, 2018, 10:44:03 AM8/23/18
to jenkinsc...@googlegroups.com

No sure whether this is really the same issue like JENKINS-47143. Are you able to reproduce this using a custom base class without extending HashMap?

joshft91@gmail.com (JIRA)

unread,
Aug 23, 2018, 11:10:03 AM8/23/18
to jenkinsc...@googlegroups.com
Josh Theisen edited a comment on Bug JENKINS-34428
Yes, it's definitely not specific to HashMap. Here's a more complete example:

 

 
{code:java}
abstract class AbstractClass implements Serializable {
  def jenkins
  AbstractClass(jenkins) {
    this.jenkins = jenkins
  }
  def someMethod(Map input) {
    performSomething(input)
  }
  abstract def performSomething(Map input)
}
{code}
Then in my implementation class

 
{code:java}
ImplClass extends AbstractClass {
  //setup stuff here for the class

  @Override
  def someMethod(Map input) {
    // Do some extra work here for this specific class
    super.someMethod(input)
  }
}
{code}
When calling the "someMethod" with a Map as input from the implementation class, Jenkins will fail with something like this:
{code:java}
hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: someMethod() is applicable for argument types: (java.util.LinkedHashMap)
{code}
Just below, it then even gives possible solutions:
{code:java}
Possible solutions: someMethod(java.util.Map), someMethod(java.util.Map){code}
If I stop overriding the super method with a bit of extra work, Jenkins will call into the abstract class no problem.

joshft91@gmail.com (JIRA)

unread,
Aug 23, 2018, 11:10:03 AM8/23/18
to jenkinsc...@googlegroups.com

Yes, it's definitely not specific to HashMap. Here's a more complete example:

 

 

abstract class AbstractClass implements Serializable {
  def jenkins
  AbstractClass(jenkins) {
    this.jenkins = jenkins
  }
  def someMethod(Map input) {
    performSomething(input)
  }
  abstract def performSomething(Map input)
}

Then in my implementation class

 

ImplClass extends AbstractClass {
  
//setup stuff here for the class

  @Override
  def someMethod(Map input) {
    // Do some extra work here for this specific class
    super.someMethod(input)
  }
}

When calling the "someMethod" with a Map as input from the implementation class, Jenkins will fail with something like this:

hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: someMethod() is applicable for argument types: (java.util.LinkedHashMap)

Just below, it then even gives possible solutions:

Possible solutions: someMethod(java.util.Map), someMethod(java.util.Map)

If I stop overriding the super method with a bit of extra work, Jenkins will call into the abstract class no problem.

joshft91@gmail.com (JIRA)

unread,
Aug 23, 2018, 11:17:05 AM8/23/18
to jenkinsc...@googlegroups.com
Josh Theisen edited a comment on Bug JENKINS-34428
Yes, it's definitely not specific to HashMap. Here's a more complete example:

 
{code:java}

abstract class AbstractClass implements Serializable {
  def jenkins
  AbstractClass(jenkins) {
    this.jenkins = jenkins
  }
  def someMethod(Map input) {
    performSomething(input)
  }
  abstract def performSomething(Map input)
}
{code}

Then in my implementation class
{code:java}

ImplClass extends AbstractClass {
  //setup stuff here for the class

  @Override
  def someMethod(Map input) {
    // Do some extra work here for this specific class

    // Then do the rest of the work in the
    super class
    super
.someMethod(input)
  }
}
{code}

When calling the "someMethod" with a Map as input from the implementation class, Jenkins will fail with something like this:
{code:java}

hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: someMethod() is applicable for argument types: (java.util.LinkedHashMap)
{code}

Just below, it then even gives possible solutions:
{code:java}
Possible solutions: someMethod(java.util.Map), someMethod(java.util.Map){code}
If I stop overriding the super method with a bit of extra work, Jenkins will call into the abstract class no problem.

brunoc.conrado@gmail.com (JIRA)

unread,
Jul 2, 2019, 10:23:02 AM7/2/19
to jenkinsc...@googlegroups.com
Bruno Conrado Santos assigned an issue to Bruno Conrado Santos
 
Change By: Bruno Conrado Santos
Assignee: Andrew Bayer Bruno Conrado Santos
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

brunoc.conrado@gmail.com (JIRA)

unread,
Jul 2, 2019, 10:28:03 AM7/2/19
to jenkinsc...@googlegroups.com
Bruno Conrado Santos commented on Bug JENKINS-34428
 
Re: workflow-cps-global-lib: inheritance (extends) not working

Hi,

I have the same problem. We can`t call super methods when super is abstract or not. 
hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: br.com.itau.devopspipelinelibrary.pipeline.impl.JavaPipelineImpl.initialize() is applicable for argument types: (java.lang.String, java.lang.String) values: [migrate-jobs, EB4]
 

Do you have some prediction to fix it? 

 

Thanks

 

brunoc.conrado@gmail.com (JIRA)

unread,
Jul 2, 2019, 10:29:03 AM7/2/19
to jenkinsc...@googlegroups.com
Hi,

I have the same problem. We can`t call super methods when super is abstract or not. 
{code:java}
hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: br.com.itau.devopspipelinelibrary.pipeline.impl.JavaPipelineImpl.initialize() is applicable for argument types: (java.lang.String, java.lang.String) values: [migrate-jobs, EB4] {code}
 

Do you have some prediction to fix it? 

 

Thanks

 

brunoc.conrado@gmail.com (JIRA)

unread,
Jul 2, 2019, 10:30:02 AM7/2/19
to jenkinsc...@googlegroups.com

brunoc.conrado@gmail.com (JIRA)

unread,
Jul 2, 2019, 10:52:06 AM7/2/19
to jenkinsc...@googlegroups.com
Hi,

I have the same problem
using the last Jenkins LTS version and plugins . We can`t call super methods when super is abstract or not. 

{code:java}
hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: br.com.itau.devopspipelinelibrary.pipeline.impl.JavaPipelineImpl.initialize() is applicable for argument types: (java.lang.String, java.lang.String) values: [migrate-jobs, EB4]{code}
Do you have some prediction to fix it? 

 

Thanks

 
Reply all
Reply to author
Forward
0 new messages