the method X is undefined for type Y (Polymorphism issue?)

Error attached. Here are my two classes and interface:

class BatchRegionResult extends BatchRegionReportData {

  public SignedInfo getSignedInfo() {
        return getData().getBatch().getSignedInfo();



class BatchRegionReportData implements ReportData {

  public BatchRegion getData() {
      return batchRegion;


public interface ReportData {

Object getData();


Defining variables:

  1. signedInfo: (This version works because of the method getSignedInfo() I added to BatchRegionResult) HOWEVER I want the logic to be in the jrxml. This is my workaround using the method to show it works this way.
    1. Expression $F{batchRegionResult}.getSignedInfo()
    2. Value Class Name com.agenabio.container.plates.SignedInfo
  2. signedInfo: (This version does not work and throws the error)
    1. Expression $F{batchRegionResult}.getData().getBatch().getSignedInfo()
    2. Value Class Name com.agenabio.container.plates.SignedInfo

I feel like there is an issue with the jrxml because it calls the interface method getData() which has return type Object. BUT the class implementing it overrides it with the return type BatchRegion. So now I keep getting the error "The method getData() is undefined for the type BatchRegionResult.

How can I get this to work so that I can call $F{batchRegionResult}.getData().getBatch().getSignedInfo() directly in the jrxml expression?

Thanks for the help!!

jamesatollefson's picture
Joined: Feb 9 2022 - 10:44am
Last seen: 10 months 3 weeks ago

0 Answers:

No answers yet