Community
Participate
Working Groups
The deprecated SubProgressMonitor is still used in org.eclipse.core.internal.utils.Policy and should be replaced by SubMonitor. Conversion seems easy, but care has to be taken that the contract of SubMonitor will not be violated. In particular, beginTask(...) must not be called more than once on each SubMonitor. Therefore, excessive use of SubMonitor.convert(...) needs to be avoided, as it calls beginTask(...) internally.
Created attachment 284136 [details] Policy patch The patch does the conversion to SubMonitor only once for each monitor, thereby preventing the above contract violations. Changing the return types from IProgressMonitor to SubMonitor should be consistent with the Liskov substitution principle. The code uses SubMonitor.newChild(...) instead of split(...) to preserve the current behavior without checking for cancellation. If these checks are desirable, use split(...) instead.