No suitable method found with new Maven

1.3k views Asked by At

I am migrating from Maven 2.2.1 to 3.3.3 and an error appears which seems seems to be caused partly because of strange design. Exception occurs at line :

DataSource ds = service.generatePdfDocument(dataBean.getModel(), getFormName() + "_A0024", OUTPUT_FILE_NAME, parameters);

whit the first parameter of the method. New Maven says:

no suitable method found for generatePdfDocument(java.lang.Object,java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.Object>)

There are two methods which fit this description, which differ only in the type of first parameter:

public DataSource generatePdfDocument(EkMessage pModel, String pFormName, String pOutputFileName, Map<String, Object> parameters) throws IOException, CloneNotSupportedException {
    return this.generatePdfDocument(pModel.getXml(), pFormName, pOutputFileName, parameters);
}

and

 public DataSource generatePdfDocument(MessageType pMessage, String pFormName, String pOutputFileName, Map<String, Object> parameters) throws IOException, CloneNotSupportedException {
    LOG.debug("Generating pdf document... ");
    ...
}

so that first method is calling the second one. However, Maven does not want to accept any of these two, as dataBean.getModel() is a generic (dataBean extends DetailData):

@Getter
@Setter
public abstract class DetailData<T extends Object> extends GeneralDataBean {

private static final Logger LOG = LoggerFactory.getLogger(DetailData.class);

    private T model;
...
}

This used to be OK with Maven 2.2.1, but Maven 3.3.3 fails. I would like to know what is the best way to refactor the code without using instanceOf().

0

There are 0 answers