Groovy : Constructor call must be the first statement in a constructor

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Groovy : Constructor call must be the first statement in a constructor



New to Groovy. Using scripts as part of Jenkins pipeline. Editing in Sublime with only a linter.



Receiving this error:



org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:



file:/var/jenkins_home/jobs/{repo}/branches/master/builds/9/libs/{jenkins-library-name}/src/{srcPath}/Pom_EX.groovy: 12:



Constructor call must be the first statement in a constructor.
at line: 12 column: 11.



Capture of offending code




1 Answer
1



Really beat myself up here for taking so long to see it. I didn't see it, since I've been working in Java for a few years now - and the IDE points out this type of mistake. Name of the constructor didn't match the class....



I reproduced the problem with a dummy class.



Reproduce the problem



Running DUMMY d = new DUMMY('blah') produced :


DUMMY d = new DUMMY('blah')



1 compilation error:



Constructor call must be the first statement in a constructor. at line: 5 column: 11. File: file:/{path}/DUMMY.groovy at line: 5, column: 11






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

UnvNgmFk mKHbcT0ZM5jc6UMDd7OmrxLsDx,c0Acsry8rZZ,P
932 KG,89Yg,Iu18bEyMql3SsfRQTAI8eJZVMnjvJRRj 9BIjAO2JOi IeS,Y3 B0

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results