Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 227128

Summary: Leverage new compiler cancellation support into BuildNotifier
Product: [Eclipse Project] JDT Reporter: Jerome Lanneluc <jerome_lanneluc>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 3.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug
Attachments:
Description Flags
Proposed patch none

Description Jerome Lanneluc CLA 2008-04-15 09:48:30 EDT
I20080410-1022

Right now, we first check for cancellation during a full build only when reporting the first .class file. The new CompilationProgress api allow a finer control of cancellation during the compile loop. We should leverage this new api in the Java builder.
Comment 1 Kent Johnson CLA 2008-04-24 15:35:17 EDT
Created attachment 97516 [details]
Proposed patch

Jerome - please take a look.
Comment 2 Jerome Lanneluc CLA 2008-04-25 08:06:54 EDT
Why throw the AbortCompilation inside isCanceled() since this is done outside this call? Wouldn't it be simpler (e.g more readable) if isCanceled() would simply return whether the progress monitor was canceled?
Comment 3 Jerome Lanneluc CLA 2008-04-25 09:00:59 EDT
Also, the compiler progress doesn't seem to be passed to the compiler. See org.eclipse.jdt.internal.compiler.Compiler.Compiler(INameEnvironment, IErrorHandlingPolicy, CompilerOptions, ICompilerRequestor, IProblemFactory, PrintWriter, CompilationProgress)
Comment 4 Kent Johnson CLA 2008-04-25 10:14:20 EDT
Oops - forgot to include the compiler call in the patch
Comment 5 Kent Johnson CLA 2008-04-25 10:46:20 EDT
As for the isCanceled()... setCancelling(true) is called before the throw AbortCompilation.

Would prefer to reuse the existing checkCancelWithinCompiler() than rely on the sender of isCanceled to throw the exception.
Comment 6 Kent Johnson CLA 2008-04-25 12:06:09 EDT
Actually we do check whenever a type is requested from the NameEnvironment, in addition to accepting a compilation unit.

I've been trying without the patch to find a point in the build when cancel is not responsive & it seems fine to me.

Jerome - do you see a point in a full build when cancel waits a noticeable amount of time ?
Comment 7 Jerome Lanneluc CLA 2008-04-28 05:38:25 EDT
There is nothing more annoying than pressing cancel and wait for the cancel to really occur. So definitely yes.
Comment 8 Jerome Lanneluc CLA 2008-04-28 05:42:42 EDT
(In reply to comment #5)
> As for the isCanceled()... setCancelling(true) is called before the throw
> AbortCompilation.
> 
> Would prefer to reuse the existing checkCancelWithinCompiler() than rely on the
> sender of isCanceled to throw the exception.
> 
What if I want to call isCanceled() to know if the build was canceled after the fact? Would I get an AbortCompilation instead? Or as your patch might imply, would it always return false?
Comment 9 Kent Johnson CLA 2008-05-01 13:12:11 EDT
Discussed with Philippe - no rush to change our current behaviour since the IDE build is actually checking for cancel more frequently than this new API does.

Will re-examine in the 3.5 timeframe.
Comment 10 Eclipse Genie CLA 2019-09-21 19:21:41 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.