skinny85 / jilt

Java annotation processor library for auto-generating Builder (including Staged Builder) pattern classes
Other
240 stars 12 forks source link

Does Jilt support generic classes? #5

Closed ThibaultUrien closed 10 months ago

ThibaultUrien commented 2 years ago

It is not mentioned in the documentation. On my side it seem that classes with generic argument are given a builder that do use the argument but never declare it.

skinny85 commented 2 years ago

Hey @ThibaultUrien,

thanks for opening the issue!

Can you show the code for the class you're trying to generate the Builder for?

Thanks, Adam

ThibaultUrien commented 2 years ago

Hello Adam, thank for the quick answer. I don't have the code anymore, but I'll try to come-up with a new one.

Le mer. 9 févr. 2022 à 08:49, Adam Ruka @.***> a écrit :

Hey @ThibaultUrien https://github.com/ThibaultUrien,

thanks for opening the issue!

Can you show the code for the class you're trying to generate the Builder for?

Thanks, Adam

— Reply to this email directly, view it on GitHub https://github.com/skinny85/jilt/issues/5#issuecomment-1033444664, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTS6IORCX6XTW37SE2PD4LU2IMBHANCNFSM5N4V5J6Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

skinny85 commented 2 years ago

Thanks, that will be super helpful in trying to reproduce this issue!

skinny85 commented 2 years ago

@ThibaultUrien any updates here? 🙂

gbaso commented 10 months ago

Not OP, but I'd imagine something like this would be nice:

class MyClass<T> {
  T myField;
}
MyClass<String> mc = MyClassBuilder.<String>myclass()
  .myField("some string")
  .build();
skinny85 commented 10 months ago

Thanks @gbaso. Confirming that placing @Builder on your example MyClass does not work currently.

I'll work on a fix for this.

skinny85 commented 10 months ago

This has been fixed on the current develop branch, and will be included in the next 1.4 release (which will also cover #10, #11 and #12).

skinny85 commented 10 months ago

This has been fixed in the latest Jilt release (1.4).

I'm closing this issue as "Resolved", please comment if you run into any more problems related to this area, and I'll reopen the issue.