Skip to content

querybean-generator:19.3.0+ warning: Failed to write EntityClassRegister #3882

Description

@raphaelNguyen

An instance of this error was previously reported at issue #3582 and fixed by PR #3583. However, it seems the same code change which caused this issue might haqve been reintroduced in #3852 which went into 18.3.0+ and 19.3.0+.

Hi @rbygrave, I would like to report an issue when using querybean-generator:19.3.0.

Summary

The querybean-generator:19.3.0 logs an warning while trying to write embedded.example.EbeanEntityRegister. I have reproduced this in https://github.com/integrated-application-development/querybean-generator-processor-issue with only the querybean-generator annotation processor.

When compiling with -Werror, this warning triggers -Werror error.

When used alongside manifold-exception annotation processor, javac will fail to render this warning and throw an NPE instead, obscuring the warning.

Details

Environment
java: 25.0.3
ebean: 19.3.0
maven: 3.9.9

Reproduction steps:

Reproducible project https://github.com/integrated-application-development/querybean-generator-processor-issue. The README.md in this project also contains explanations of this issue. This project is a sample project containing a few entity beans and using querybean-generator.

Run mvn compile on the linked sample project.
Observe the following warning when the compile goal runs.

[INFO] --- compiler:3.15.0:compile (default-compile) @ querybean-generator-processor-issue ---
[INFO] Recompiling the module because of changed source code.
[INFO] Compiling 3 source files with javac [forked debug deprecation target 25] to target\classes
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
[WARNING] File for type 'embedded.example.EbeanEntityRegister' created in the last round will not be subject to annotation processing.
[INFO] 1 warning
[INFO] -------------------------------------------------------------

Expected behaviour

compile does not throw any WARNING related to querybean-generator.

Investigations

In the previous reported instance of this issue, I mentioned that the issue might be related to a change made in #3542 and reverted in the fix #3583. This change looks like it has been reintroduced in #3852 which went into 18.3.0+ and 19.3.0+.

Part of the changes in this PR removes initModuleInfoBean() which creates SimpleModuleInfoWriter once if it's null and storing it in a instance field. Instead, it switches to creating a new SimpleModuleInfoWriter every time Processor.process is called. I had a sneaky feeling this might be what's causing the WARNING to be logged in the first place. In the previous instance, I did a quick test reverting this change (raphaelNguyen@fa8f98d) which did not trigger the WARNING mentioned above while compiling. Given that the same change has been put back. my guess is that's what's causing the issue again.

Thank you for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions