Bug 572208 - SWT.EDGE constant for Browser overlaps with SWT.NO_BACKGROUND
Summary: SWT.EDGE constant for Browser overlaps with SWT.NO_BACKGROUND
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.19   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 4.20 M1   Edit
Assignee: Niraj Modi CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 571909
  Show dependency tree
 
Reported: 2021-03-23 03:54 EDT by Mikael Sterner CLA
Modified: 2021-04-07 06:08 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikael Sterner CLA 2021-03-23 03:54:16 EDT
I believe that the implementation for bug 538991 caused a regression for org.eclipse.swt.browser.Browser instances that use the SWT.NO_BACKGROUND style, since SWT.EDGE has the same value (1<<18, erroneously listed as 1<<16 in the javadoc).

This leads to e.g. the SpotBugs Bug Info view trying to use the experimental WebView2 on Windows, due to setting SWT.NO_BACKGROUND: https://github.com/spotbugs/spotbugs/blob/master/eclipsePlugin/src/de/tobject/findbugs/view/BugInfoView.java#L189

Which results in an exception "Not implemented [WebView2 runtime not found]" if WebView2 is not available.
Comment 1 Nikita Nemkin CLA 2021-03-25 11:39:25 EDT
Oh, this is unfortunate. With this constant being part of a stable release I'm not sure if changing it is possible.

Anyway, SWT.NO_BACKGROUND isn't a valid style for the Browser widget, so an easy work-around is to simply remove it.
Comment 2 Mikael Sterner CLA 2021-03-26 04:58:40 EDT
Thanks for the analysis. I filed https://github.com/spotbugs/spotbugs/issues/1477 downstream. The Composite documentation clearly says that using NO_BACKGROUND is undefined for other subclasses than Canvas, so I guess it could be considered a latent bug in the SpotBugs code to use it.
Comment 3 Niraj Modi CLA 2021-04-05 06:18:22 EDT
(In reply to Mikael Sterner from comment #0)
> I believe that the implementation for bug 538991 caused a regression for
> org.eclipse.swt.browser.Browser instances that use the SWT.NO_BACKGROUND
> style, since SWT.EDGE has the same value (1<<18, erroneously listed as 1<<16
> in the javadoc).

Good catch, we need to fix this JavaDoc here.
Will submit gerrit shortly.
Comment 4 Eclipse Genie CLA 2021-04-05 06:19:23 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/178840
Comment 5 Niraj Modi CLA 2021-04-05 06:22:57 EDT
(In reply to Nikita Nemkin from comment #1)
> Oh, this is unfortunate. With this constant being part of a stable release
> I'm not sure if changing it is possible.
> 
> Anyway, SWT.NO_BACKGROUND isn't a valid style for the Browser widget, so an
> easy work-around is to simply remove it.

(In reply to Mikael Sterner from comment #2)
> Thanks for the analysis. I filed
> https://github.com/spotbugs/spotbugs/issues/1477 downstream. The Composite
> documentation clearly says that using NO_BACKGROUND is undefined for other
> subclasses than Canvas, so I guess it could be considered a latent bug in
> the SpotBugs code to use it.

Thanks Nikita/Mikael for sorting this part.
Comment 7 Niraj Modi CLA 2021-04-05 06:50:27 EDT
NO more actions needed form SWT side on this bug, closing.
Comment 8 Niraj Modi CLA 2021-04-07 06:08:02 EDT
Verified on master using Eclipse Build id: I20210406-1800