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

Support Refaster templates which use lambdas #111

Merged
merged 1 commit into from
Sep 15, 2024
Merged

Conversation

knutwannheden
Copy link
Contributor

@knutwannheden knutwannheden commented Sep 15, 2024

This still doesn't allow a template to directly return a lambda, because the JavaTemplate doesn't capture the lambda's type in any way, but at least a template can still use a lambda (e.g. as a method argument).

The actual fix is to make sure that variable references aren't printed as fully qualified names with the owning method as qualifier.

This still doesn't allow a template to directly return a lambda, because the `JavaTemplate` doesn't capture the lambda's type in any way, but at least a template can still use a lambda (e.g. as a method argument).
@timtebeek
Copy link
Contributor

This change brings the totals of rules from ErroProne Support not supported to

@Matches is currently not supported=1
@NotMatches is currently not supported=2
Lambdas are currently not supported=2
Method references are currently not supported=3
If statements are currently not supported=8
@Placeholder is currently not supported=15
@Repeated is currently not supported=21
Generic type parameters are currently not supported=519

@knutwannheden knutwannheden merged commit e1eabde into main Sep 15, 2024
1 check passed
@knutwannheden knutwannheden deleted the method-arg-lambda branch September 15, 2024 12:36
@knutwannheden
Copy link
Contributor Author

I doubt this change will have moved the needle by a lot. Using lambdas as a method argument in a Refaster template is probably fairly uncommon. Also, I don't even think we had a detection for this, only the detection for a template returning a lambda, which unfortunately still isn't supported. We should try to overhaul JavaTemplate so that we can support more Refaster templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
2 participants