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

Builder class is not being generated under Java 21 (was ok under Java 17) #168

Open
dmitrystalle opened this issue Feb 26, 2024 · 1 comment

Comments

@dmitrystalle
Copy link

dmitrystalle commented Feb 26, 2024

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.

@Randgalt
Copy link
Owner

Can you post a project that fails? I built the example below that works correctly.

java21test.zip

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants