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

Bug 319399

Summary: Strip out dead code associated with Debug.debug
Product: [Eclipse Project] Equinox Reporter: Glyn Normington <glyn.normington>
Component: FrameworkAssignee: Thomas Watson <tjwatson>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: tjwatson
Version: 3.6   
Target Milestone: 3.7 M1   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
patch none

Description Glyn Normington CLA 2010-07-09 10:32:15 EDT
org.eclipse.osgi.framework.debug.Debug hard-codes debug to true and this is used in various places in Equinox in the pattern:

if (Debug.debug && someothercond) ...

The flag is apparently a throw-back to the embedded roots of Equinox when the codebase was sometimes built with the flag set to false. This is no longer a reasonable use case for Equinox as debug code is typically configured at runtime in the "someothercond" expressions.

So the debug flag should be deleted to make the code more readable and avoid confusion.
Comment 1 Glyn Normington CLA 2010-07-09 10:33:00 EDT
I should have mentioned that I already discussed this with Tom Watson who asked me to raise the bug. :-)
Comment 2 Thomas Watson CLA 2010-07-09 10:50:26 EDT
Agreed, should do this early to make sure there is no unforeseen issues.  The only potential issue I can foresee is if some framework extensions where using this flag.  In that case they will get a compile error, but I think binaries should still work because the compiler should inline the final constant or even completely remove it from the bytecode as an optimization since it has no effect on the outcome of the condition "if (Debug.debug && someothercond) ...".
Comment 3 Thomas Watson CLA 2010-07-13 10:43:37 EDT
Created attachment 174158 [details]
patch

Here is a patch to remove the useless constant.
Comment 4 Thomas Watson CLA 2010-07-13 10:56:05 EDT
I released this to head and have kicked of a test eclipse/equinox build to make sure no one else is referencing the constant.
Comment 5 Thomas Watson CLA 2010-07-13 14:30:22 EDT
Test build succeeded.  Fixed.
Comment 6 Glyn Normington CLA 2010-07-14 03:47:24 EDT
Thanks for addressing this so quickly Tom.