Builder class is not being generated under Java 21 (was ok under Java 17)
dmitrystalle opened this issue · comments
Describe the bug
Builder class was generated with Java 17 but is not generated under Java 21.
Version of used
40
Log file
There is no log for this issue, it is a maven compile "ClassNotFound" error.
To Reproduce:
We have our own @builder annotation with RecordBuilder like that:
@RecordBuilder.Template(options = @RecordBuilder.Options(addClassRetainedGenerated = true, addStaticBuilder = false))
@retention(RetentionPolicy.SOURCE)
https://github.com/target(ElementType.TYPE)
@inherited
public @interface Builder {}
And then we use:
@builder
public record SomeDto(
Long id,
Integer version,
…
)
implements IdentifiedDto, SomeDtoBuilder.With, InDataDomainDto {
^^^ This class SomeDtoBuilder is not generated/not found.
Under Java 17 the Builder class was generated, under Java 21 the class is no longer generated.
Expected behavior
The builder class is generated.
Additional context
Java 21.0.2 LTE and the latest libraries.
Can you post a project that fails? I built the example below that works correctly.
cd java21test
mvn clean verify
mvn exec:java -Dexec.mainClass=test.Main
This is my Java version:
$ java -version
java version "21.0.2" 2024-01-16 LTS
Java(TM) SE Runtime Environment (build 21.0.2+13-LTS-58)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.2+13-LTS-58, mixed mode, sharing)