-
Notifications
You must be signed in to change notification settings - Fork 5k
ProblemReporter methods take all mandatory info as arguments #31854
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
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1bcb568
to
ef71a9d
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
e2cc233
to
11eac63
Compare
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.
Replied to comments, PTAL.
No blockers from my side anymore: can be merged!
public void execute() { | ||
Exception wrappedException = new Exception("Wrapped cause"); | ||
getProblems().getReporter().throwing(${targetVersion >= GradleVersion.version('8.13') ? 'new RuntimeException("Exception message", wrappedException), ' : ''}problem -> problem | ||
getProblems().getReporter().throwing(${targetVersion >= GradleVersion.version('8.13') ? 'new RuntimeException("Exception message", wrappedException), ' + ProblemsApiGroovyScriptUtils.createIdExpression() + ', ' : ''}problem -> problem |
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 not exactly what I meant – if your change is based on my feedback. My idea is to create completely separate, even if repetitive, methods for reporting a problem. In this case, that would be from L140:144.
What you did is also fine; I'm just expressing that this wasn't my exact idea.
String contextualMessage = String.format("The 'tools.jar' cannot be found in the JDK '%s'.", jvm.getJavaHome()); | ||
throw problemReporter.throwing(new IllegalStateException(contextualMessage), problemSpec -> problemSpec | ||
.id(ProblemId.create("groovy-daemon-compiler", "Missing tools.jar", GradleCoreProblemGroup.compilation().groovy())) | ||
ProblemId problemId = ProblemId.create("groovy-daemon-compiler", "Missing tools.jar", GradleCoreProblemGroup.compilation().groovy()); |
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.
As I said, I have no strong preferences over here. I still think this is a sort of infrastructure problem, and this doesn't communicate that well. OTOH the importance of this is really low.
It's more about thinking and establishing best practices, which we could document for the larger community.
// This needs to be Java 6 compatible, as we are in a worker | ||
getProblems().getReporter().report(problem -> problem | ||
.id(org.gradle.api.problems.ProblemId.create("type", "label", org.gradle.api.problems.ProblemGroup.create("generic", "Generic"))) | ||
getProblems().getReporter().report(org.gradle.api.problems.ProblemId.create("type", "label", org.gradle.api.problems.ProblemGroup.create("generic", "Generic")), problem -> problem |
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.
You gave a 👍 but I don't see any change related to this. Can you confirm?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
c793ec2
to
22718a4
Compare
This comment has been minimized.
This comment has been minimized.
22718a4
to
265a6dd
Compare
This comment has been minimized.
This comment has been minimized.
265a6dd
to
979cf3e
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The following builds have failed: |
979cf3e
to
7d156fb
Compare
@bot-gradle merge |
In other words, the definition of
ProblemId
is moved fromProblemSpec
to a method argument ofProblemReporter
members.Context
Reviewing cheatsheet
Before merging the PR, comments starting with