Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[querybean-generator] FilerException trying to write EntityClassRegister with Quarkus dev mode / hot reload #3541

Closed
rbygrave opened this issue Jan 16, 2025 · 1 comment · Fixed by #3542
Assignees
Labels
Milestone

Comments

@rbygrave
Copy link
Member

When using Quarkus dev mode / hot reload with the querybean-generator we can get the compilation error below.

This is because with the dev mode / hot reload the annotation processor tries to write the EntityClassRegister which already exists.

The fix for this issue is to not log this at ERROR level (which effectively means the compilation failed) but instead log it at WARN or INFO/NOTE level.

Steps to reproduce

Using Quarkus dev mode / hot reload with the querybean-generator

  • mvn Quarkus:dev
  • Trigger the "resume testing" r
  • Wait for tests to all run
  • Make some reasonable change to an entity bean
Compilation Failed:
error: FilerException trying to write EntityClassRegister error:javax.annotation.processing.FilerException: Attempt to recreate a file for type org.acme.domain.EbeanEntityRegister stack:[jdk.compiler/com.sun.tools.javac.processing.JavacFiler.checkNameAndExistence(JavacFiler.java:741), jdk.compiler/com.sun.tools.javac.processing.JavacFiler.createSourceOrClassFile(JavacFiler.java:498), jdk.compiler/com.sun.tools.javac.processing.JavacFiler.createSourceFile(JavacFiler.java:435), io.ebean.querybean.generator.ProcessingContext.createWriter(ProcessingContext.java:399), io.ebean.querybean.generator.SimpleModuleInfoWriter.<init>(SimpleModuleInfoWriter.java:31), io.ebean.querybean.generator.Processor.writeModuleInfoBean(Processor.java:90), io.ebean.querybean.generator.Processor.process(Processor.java:53), jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:1021), ...

After this fix is applied, and this is now logged as WARN we get:

2025-01-16 15:49:13,221 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2025-01-16 15:49:13,221 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, rest, smallrye-context-propagation, vertx]
2025-01-16 15:49:49,038 WARN  [io.qua.dep.dev.JavaCompilationProvider] (Test Compile Timer) Ebean APT generated 1 query beans, loaded 0 others - META-INF/ebean-generated-info.mf entity-packages: [org.acme.domain], line -1 in [unknown source]
2025-01-16 15:49:49,039 WARN  [io.qua.dep.dev.JavaCompilationProvider] (Test Compile Timer) File for type 'org.acme.domain.EbeanEntityRegister' created in the last round will not be subject to annotation processing., line -1 in [unknown source]
2025-01-16 15:49:49,039 WARN  [io.qua.dep.dev.JavaCompilationProvider] (Test Compile Timer) filterMany(java.lang.String,java.lang.Object...) in io.ebean.typequery.TQAssocMany has been deprecated and marked for removal, line 154 in /Users/robinbygrave/Documents/github/rob/code-with-quarkus/target/generated-sources/annotations/org/acme/domain/query/QMyEntity.java
2025-01-16 15:49:49,040 WARN  [io.qua.dep.dev.JavaCompilationProvider] (Test Compile Timer) _filterMany(java.lang.String,java.lang.Object...) in io.ebean.typequery.TQAssocBean has been deprecated and marked for removal, line 154 in /Users/robinbygrave/Documents/github/rob/code-with-quarkus/target/generated-sources/annotations/org/acme/domain/query/QMyEntity.java

So its still a bit noisy but with no ERROR logged Quarkus dev mode / hot reload will still continue and run tests etc.

rbygrave added a commit that referenced this issue Jan 16, 2025
…ter with Quarkus dev mode / hot reload #3541

Drop to log at WARN level when we catch FilerException such that Quarkus dev mode / hot reload works
@rbygrave
Copy link
Member Author

The effective change here is to catch FilerException and log at WARN rather than ERROR:

} catch (FilerException e) {
  processingContext.logWarn(null, "FilerException trying to write EntityClassRegister: " + e);
}

@rbygrave rbygrave added the bug label Jan 16, 2025
@rbygrave rbygrave added this to the 14.8.2 milestone Jan 16, 2025
@rbygrave rbygrave self-assigned this Jan 16, 2025
rbygrave added a commit that referenced this issue Jan 16, 2025
[querybean-generator] FilerException trying to write EntityClassRegister with Quarkus dev mode / hot reload #3541
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant