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
Don't return null in JobManager::createMonitor #1282
Don't return null in JobManager::createMonitor #1282
Conversation
Revert unintentional change made in 9c3525c and don't return null when creating a progress monitor. This is part of the contract of the method. Contributes to eclipse-platform#664
- Only set the progress monitor of the Job if it hasn't one already. This makes sure that the progress monitor set via Job::setProgressGroup is not replaced with a new one and ergo when the group is canceled, all the monitors in that group are canceled too. - Add regression test: JobTest.testSetProgressGroup_progressGroupIsCanceled_monitorInJobIsCanceled() - Simplify private method JobManager::createMonitor(Job). Remove the annotation "@GuardedBy" in it. Fixes #664
Test Results 639 files ±0 639 suites ±0 38m 48s ⏱️ - 1m 57s For more details on these failures and errors, see this check. Results for commit 84578cc. ± Comparison against base commit 6de5471. |
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 avoid unrelated changes or ensure that they are correct. In this PR, there are conditions that have been merged such that the associated comments are not placed at the conditions they refer to anymore. Can you please fix that?
Yes, this is very sensible & hard to understand code code. Such changes shouldn't be part of any unrelated fix. Please revert them. |
Hm, it was probably the cleanup "Single 'if' statement rather than duplicate blocks that fall through", which is part of the Eclipse [built-in] profile. I'll take a look at it tomorrow and see if it's ok to disable it. Thank you for noticing, I reverted the changes in #1285 (since this PR is already merged) |
Cleanup is not performed automatically, so it probably was the save actions. The save actions have that option enabled and that is intended (see #1001) as the option usually makes sense. |
Has someone run a cleanup on several files yet or was that never the intention? (see #1001 (comment)) |
I have not noticed that anyone did that. Note that this would require to first thoroughly align all cleanup configurations with the save action configurations, as they need to be consistent. Not sure whether that's worth the effort. |
👍 |
Revert unintentional changes made in 5919685 See eclipse-platform#1282 (comment) Contributes to eclipse-platform#664
Revert unintentional changes made in 5919685 See #1282 (comment) Contributes to #664
Applying useful batch clean-ups is something the PMC encourages. If done they should be split is small PR to enable manual checks. That could be project or package related Note, in the past the Jdt cleanups not yet used in platform used to be buggy. Most of them have improved and stabilised over time based on our usage of them in platform and pde |
Apologies in advance for the lenghty response. We can move this to a discussion if you guys think it would be better. @vogella even though I'm a big fan of automatic Clean ups (they achieve "homogeneous" code, they help prevent "indentation bugs", etc), there are some considerations to it, like:
Are there any general guidelines/recommendations to do the clean-ups that I can follow? Or should we start writing some as we go along? As a side note: A clean up in |
The discussion becomes far broader than it was (or needs to be) in the context of this PR. Of course we can discuss about general cleanup, but that's competely unrelated to this PR, as in this case no cleanup was performed at all. I just want to repeat my initial statement:
The original issue was about executed save actions and the risk of having further changes because of save actions being applied unnoticed. To prevent that, it is not necessary to apply the concurrently configured cleanup options, as they will apply far more changes than requires to prevent accidental changes by save actions. In this case, it's about the mentioned 133 changes in JobManager via cleanup vs. the few ones that have been applied via the save actions). That's why I wrote:
So to summarize:
|
The pmc rule is that clean-ups are fine (in whatever scope the committer finds useful). Git commit history "pollution" is no reason not to do it. In the past, I applied code clean-ups to all code:
Any change should be reasonable small so that is can be reviewed by others if they want and should only contain one type of clean-up. Additional manual changes should be avoided or clearly marked via the commit message. Search the Git history for clean-ups to see examples. |
If we are in a side discussion anyway: Please be aware that the project settings are often not fully maintained. Let me explain what I mean by that, taking the core.search project of this PR as example.
At work I've therefore come to a solution where I regularly overwrite all prefs files of all projects with a centrally managed copy. And that copy is refreshed after every Eclipse release, to make sure that all key/values and version numbers are available. Not sure if some more strict management can and should be applied here, too. If I remember right, @merks also has some kind of template mechanism in Oomph to copy these preferences from one project to all others, but I might be wrong there. |
@Bananeweizen Thank you for the great input. That's a nice summary of problems w.r.t. preference file maintenance. I like the idea of an automated preference file update mechanism and would be in favor of having that implemented. Since the list of projects is quite stable in the Eclipse platform, preference files not being checked in does not seem to be a relevant issue to me. But "incomplete" and/or out-of-date preference files will always be an issue. As far as I find the time for that, I currently try to bring all platform projects (including platform, platform.ui and maybe SWT) into a state where the code conforms to the save action definition that we have deployed to all projects in the platform repo. If meanwhile someone is interested in providing an automatism to keep the default preference files up-to-date and deploy them to all projects (and if no one objects on the idea), I would appreciate that. |
See 9c3525c#r140592763
Revert unintentional change made in 9c3525c and don't return null when creating a progress monitor. This is part of the contract of the method.
Contributes to #664