Aspose does not see getters when migrating from Java 11 to Java 17.0.4.1 does not work

Good afternoon! Tell me please, we are moving from version 11 of Java to 17.0.4.1. And Aspose stopped seeing getters.
We are using Aspose version 19.11.
Code example:

public class AsposeQuestion {
    @Test
    void test() throws Exception {
        final ReportingEngine engine = new ReportingEngine();
        Document doc = new Document("C:\\Temp\\in.docx");
        Source source = getSource();


        engine.buildReport(doc, source, "source");
        try (var outputStream = new ByteArrayOutputStream()) {
            doc.save(outputStream, SaveFormat.DOCX);
            Path path = Paths.get("C:\\Temp\\out.docx");
            Files.write(path, outputStream.toByteArray());
        } catch (Exception ex) {
            System.out.println(ex);
            throw ex;
        }
    }

    private Source getSource() {
        return Source.builder()
                .sourceName("sourceName")
                .build();
    }
}

@Builder
public class Source {
    private String sourceName;

    public String getSourceName() {
        return sourceName;
    }

    public void setSourceName(String sourceName) {
        this.sourceName = sourceName;
    }
}

I also attach the in.docx filein.docx (19.0 KB)
We are getting this error:

java.lang.IllegalStateException: An error has been encountered at the end of expression ' source.getSourceName()]>'. Can not resolve method 'getSourceName' on type 'class ru.project.xxx.Source'.

In java11 version everything worked fine.
Thank you!

@fedorov.java,

This issue has been logged as WORDSJAVA- 2711 . We will keep you posted and will let you know as soon as the issue is resolved. Please accept our apologies for the inconvenience.
As a temporary workaround, you can set

ReportingEngine.setUseReflectionOptimization(false);

Thank you very much for the answer!! We will try.

1 Like

Good evening! Yes, the error has indeed been fixed. Thanks!!

1 Like