Jump to content
We've recently updated our Privacy Statement, available here ×

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


Recommended Posts

Error attached. Here are my two classes and interface:

class BatchRegionResult extends BatchRegionReportData {

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



class BatchRegionReportData implements ReportData {

  @Override  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!!

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...