-
Couldn't load subscription status.
- Fork 2.8k
Pull #2292: Modernize codebase with Java improvements - SOC DefaultModelProcessor#read
#2292
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
Pull #2292: Modernize codebase with Java improvements - SOC DefaultModelProcessor#read
#2292
Conversation
4e0114f to
4ba53a1
Compare
d897766 to
4a35897
Compare
|
whats the mystery about this? |
Modernize codebase with Java improvements - functional DefaultModelProcessor#readModernize codebase with Java improvements - functionalize DefaultModelProcessor#read
…nalize DefaultModelProcessor#read
4a35897 to
594f1bc
Compare
Modernize codebase with Java improvements - functionalize DefaultModelProcessor#readModernize codebase with Java improvements - functionalize DefaultModelProcessor#read
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.
This totally breaks the exception handling.
yes, then we need test, thanks. |
| private Model readOnSelfOrParent(Path pomFile, XmlReaderRequest request) throws IOException { | ||
| return pomFile == null | ||
| ? doRead(request) | ||
| : modelParsers.stream() |
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.
extract concern into readParent() to hide impl. detail and give dedicated concern
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.
Please don't. The original code is clearer. Lambdas do not improve this.
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.
Test cases might be missing here, but it looks like this changes functionality in a negative way by not grouping exceptions
|
Yes it’s a test blind spot I want to cover.
|
594f1bc to
0cd0f4e
Compare
…nalize DefaultModelProcessor#read
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.
add tc; challenge API
| } | ||
| } | ||
|
|
||
| private Model doRead(XmlReaderRequest request) throws IOException { |
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.
| try { | ||
| return doRead(request); | ||
| } catch (IOException e) { | ||
| exceptions.forEach(e::addSuppressed); |
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.
Then this is the last branch not covered.
…nalize DefaultModelProcessor#read
…nalize DefaultModelProcessor#read
0cd0f4e to
b52e0d0
Compare
…nalize DefaultModelProcessor#read
b52e0d0 to
e1d0f96
Compare
| if (Files.isDirectory(project)) { | ||
| Path pom = project.resolve("pom.xml"); | ||
| return Files.isRegularFile(pom) ? pom : null; | ||
| } else if (Files.isRegularFile(project)) { |
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.
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.
| * This is because the ModelProcessor interface extends ModelLocator and ModelReader. If we | ||
| * made this component available under all its interfaces then it could end up being injected | ||
| * into itself leading to a stack overflow. | ||
| * |
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.
…nalize DefaultModelProcessor#read
fb93e7d to
13ff316
Compare
…nalize DefaultModelProcessor#read
13ff316 to
739cc50
Compare
Thanks for the feedback. But just to clarify — this reflects what the current implementation actually does, right? Otherwise, I’d consider removing the I'm not fully aware of all the requirements, but ideally, we can follow |
Currently, the API is designed to throw XmlReaderException. Check the implemented interface, there's no IOException thrown here.
Not sure what you mean exactly, but refactoring is not supposed to change the API in any way. |
yes of course will adapt then. sorry |
…nalize DefaultModelProcessor#read
739cc50 to
323035c
Compare
…nalize DefaultModelProcessor#read
323035c to
2279d78
Compare
…nalize DefaultModelProcessor#read
…nalize DefaultModelProcessor#read
…nalize DefaultModelProcessor#read
…nalize DefaultModelProcessor#read
…nalize DefaultModelProcessor#read
…nalize DefaultModelProcessor#read
please notice dedicated thread: https://github.com/apache/maven/pull/2304/files#r2079127763 |
Modernize codebase with Java improvements - functionalize DefaultModelProcessor#readDefaultModelProcessor#read
|
It's not thrown, that's right. So do not add a throw clause. |
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' not completely sure you actually understand what you remove.
So let's keep focused PRs and let us know if you ran the tests successfully first.
|
|
||
| @Override | ||
| public Model read(XmlReaderRequest request) throws IOException { | ||
| Objects.requireNonNull(request, "source cannot be null"); |
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.
source --> request
|
wip reopen |







Pull #2292:
Modernize codebase with Java improvements - functionalize DefaultModelProcessor#readenable for:
Unnecessary throws#2291depends on:
DefaultModelProcessor#read#2304add missing Exception requirement to prevent:




finally 100