oopgroovyruntime-errorgroovyshellgroovy-console

Groovy: Could not find matching constructor


Can anyone help me resolve why I am getting this run time error(cannot find the matching constructor) for the following class (JobStage). I tried to create an instance of the following class but it results in the following run time error.

class JobStage {
    String name
    StageType stageType
    String transformationType
    List<ImField> fields
    TableAttribute tableAttributes
    List<Connector> inputConnectors
    List<Connector> outputConnectors
    JobStageProperties stageProperties

    JobStage(String name, StageType stageType, String transformationType,
              List<ImField> fields,TableAttribute tableAttributes, List<Connector> inputConnectors,
             List<Connector> outputConnectors, JobStageProperties stageProperties){

        this.name = name
        this.stageType = stageType
        this.transformationType = transformationType
        this.fields = fields
        this.tableAttributes = tableAttributes
        this.inputConnectors = inputConnectors
        this.outputConnectors = outputConnectors
        this.stageProperties = stageProperties
    }
}


groovy.lang.GroovyRuntimeException: Could not find matching constructor for: com.starling.informatica.dto.jobstage.JobStage(String, com.starling.informatica.dto.StageType, String, ArrayList, null, ArrayList, com.starling.informatica.dto.stageProperties.SourceRelationalStageProperties)

The error here assumes the TableAttribute class as null and igonres List<Connector> outputConnectors argument

I tried to create instance like so :

JobStageProperties stageProperties = TeradataSpecUtil.getSourceStageProperties()
List<ImField> fields = [new SourceField("integer","","customer_id","NULL","","10","0","","1","NOT A KEY","0","ELEMITEM","NO","11","0","0","0","10","0",""),
 new SourceField("varchar","","customer_name","NULL","","50","0","","2","NOT A KEY","0","ELEMITEM","NO","0","0","0","11","50","10","")
]
List<Connector> inputConnectors = []
List<Connector> outputConnectors = [new Connector("customer_id","informatica_customer_source","Source Definition","customer_id","SQ_informatica_customer_source" ,"Source Qualifier"),
 new Connector("customer_name","informatica_customer_source","Source Definition","customer_name","SQ_informatica_customer_source" ,"Source Qualifier")
]
TableAttribute tableAttribute = null
List<JobStage> expectedJobStage= [new JobStage("informatica_customer_source",
 StageType.TERADATA_CONNECTOR, "Source Definition", fields,tableAttribute, inputConnectors,
 outputConnectors, stageProperties)]

Solution

  • My Code is logically correct, the problem was with Intellij. The code ran successfully after I performed "Invalidate Caches and Restart".