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

Skip Class generics #41

Merged
merged 2 commits into from
Dec 16, 2023
Merged

Skip Class generics #41

merged 2 commits into from
Dec 16, 2023

Conversation

timtebeek
Copy link
Contributor

@timtebeek timtebeek commented Dec 16, 2023

What's changed?

Add tests to show we ought to skip both Refaster (ok) and Class generics (not ok).

What's your motivation?

OrOrElseThrows is found in error-prone-support, but breaks template generation there due to a compilation error.

Anything in particular you'd like reviewers to focus on?

There's also the issue that the test template only works on Java 11.
I wonder if we should use that as minimum for rewrite-templating.

Have you considered any alternatives or workarounds?

Not quite sure yet how to catch and resolve this compilation error when using Java 11:

Compilation produced the following diagnostics:
Note: Generics are currently not supported
/home/tim/Documents/workspace/openrewrite/rewrite-templating/out/test/resources/refaster/OrOrElseThrow.java:26: error: incompatible types: bad return type in lambda expression
        return o1.orElseGet(() -> o2.orElseThrow());
                                                ^
    T cannot be converted to T
No files were generated.

@timtebeek timtebeek self-assigned this Dec 16, 2023
@timtebeek timtebeek changed the title Skip Refaster and OrOrElseThrow with class generics Skip Class generics Dec 16, 2023
@timtebeek timtebeek marked this pull request as ready for review December 16, 2023 15:31
@timtebeek
Copy link
Contributor Author

There's something about the original recipe that still fails; but at least we can get these tests in already to ensure we do the right thing in these two cases, then the diff with the third case is easier to see.

@timtebeek timtebeek added documentation Improvements or additions to documentation refaster labels Dec 16, 2023
@timtebeek timtebeek merged commit 6113623 into main Dec 16, 2023
1 check passed
@timtebeek timtebeek deleted the skip-ororelsethrow branch December 16, 2023 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation refaster
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants