-
Notifications
You must be signed in to change notification settings - Fork 339
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
Add initial support for java references for yaml #4698
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have expected this PR to only contain the SourceFileWithReferences
implementation in Yaml.Documents
and not a generic Reference.Provider
implementation. But possibly I have missed something here.
rewrite-java-test/src/test/java/org/openrewrite/java/ChangeTypeTest.java
Outdated
Show resolved
Hide resolved
rewrite-java/src/main/java/org/openrewrite/java/TypeMatcher.java
Outdated
Show resolved
Hide resolved
|
||
@Incubating(since = "8.40.3") | ||
@Value | ||
class YamlReference implements Reference { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT this will now try to match any YAML scalar values against the regexp we have for Java identifiers. This seems wrong to me. I don't think there is any need to add this class here. Instead I would expect "domain-specific" implementations like SpringReference
which look for type references in specific YAML documents (matching some given file name or similar).
AFAIK Spring also allows config to be in YAML, so maybe we could provide an implementation for that.
I'd applied some light polish to the parallel PR in 713ced2 ; would be good to apply those same changes here as well, and resolve the conflicts. |
# Conflicts: # rewrite-java-test/src/test/java/org/openrewrite/java/ChangeTypeTest.java # rewrite-java/src/main/java/org/openrewrite/java/TypeMatcher.java
Yes, would be good to update this PR now that the dust has settled a bit regarding the rename refactoring. |
# Conflicts: # rewrite-java/src/main/java/org/openrewrite/java/PackageMatcher.java # rewrite-java/src/main/java/org/openrewrite/java/TypeMatcher.java
rewrite-yaml/src/main/java/org/openrewrite/yaml/trait/package-info.java
Outdated
Show resolved
Hide resolved
rewrite-yaml/src/main/java/org/openrewrite/yaml/trait/package-info.java
Outdated
Show resolved
Hide resolved
rewrite-yaml/src/main/java/org/openrewrite/yaml/trait/package-info.java
Outdated
Show resolved
Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
What's changed?
This adds initial support for generating references to java type from a Yaml fine in a similar fashion, and with similar limitations, as in:
What's your motivation?
Adding this feature allows existing recipes that support references to be applied to .properties files. For more details see:
Reference
to include.properties
and.yml
#4681Anything in particular you'd like reviewers to focus on?
The focus points are almost on to one with the previously referenced implementation of references to Java type in
.properties
files.Anyone you would like to review specifically?
@timtebeek @Laurens-W
Any additional context
Checklist