Bug 564144 - Remove dead code from org.eclipse.ui.internal
Summary: Remove dead code from org.eclipse.ui.internal
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.16   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.17 M3   Edit
Assignee: Rolf Theunissen CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 563974
Blocks: 566050
  Show dependency tree
 
Reported: 2020-06-09 16:03 EDT by Rolf Theunissen CLA
Modified: 2020-08-13 15:10 EDT (History)
1 user (show)

See Also:


Attachments
Partial output from UCDetector (95.66 KB, text/plain)
2020-06-09 16:03 EDT, Rolf Theunissen CLA
no flags Details
Partial output from UCDetector (103.88 KB, text/plain)
2020-06-23 14:53 EDT, Rolf Theunissen CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rolf Theunissen CLA 2020-06-09 16:03:47 EDT
Created attachment 283207 [details]
Partial output from UCDetector

While working on Bug 563974, I took the liberty of running UCDetector [1] on the platform UI codebase.

For the org.eclipse.ui.internal package of org.eclipse.ui.workbench alone, it finds around 40 classes that potentially not used. Furthermore, there are a lot of  constants, fields and methods that are not referenced (around 500 total).
I expect that there are (some) false positives in the results. But there is surely dead code that can be removed.

Note for anybody that wants to run the tool too: The tool will find false positives for injected fields/methods. To reduce the number of false positive, you can add additional annotations that should be ignored (e.g. PostConstruct, PreDestroy, Persist, CanExecute, Execute, SetEnabled)

[1] http://www.ucdetector.org/
Comment 1 Lars Vogel CLA 2020-06-09 16:27:03 EDT
Great work. +1 for removal.

Just one additional check would be to check plugin.xml for usage of such classes. IIRC Brian once suggest to write a test for such cases not sure if we finished that....
Comment 2 Eclipse Genie CLA 2020-06-11 16:35:00 EDT
New Gerrit change created: https://git.eclipse.org/r/164740
Comment 3 Eclipse Genie CLA 2020-06-11 16:35:19 EDT
New Gerrit change created: https://git.eclipse.org/r/164741
Comment 4 Lars Vogel CLA 2020-06-11 16:36:31 EDT Comment hidden (obsolete)
Comment 5 Lars Vogel CLA 2020-06-11 16:36:39 EDT
Rolf and all others, can you check a few from Rolfs list and delete the selected once? Would be nice if that can be a group effort.

I picked two of the classes, deleted them and ran a full text search for the repo (and included multiple others) to ensure they are not used somewhere.
Comment 8 Eclipse Genie CLA 2020-06-13 09:28:23 EDT
New Gerrit change created: https://git.eclipse.org/r/164825
Comment 9 Eclipse Genie CLA 2020-06-13 09:30:38 EDT
New Gerrit change created: https://git.eclipse.org/r/164826
Comment 10 Eclipse Genie CLA 2020-06-13 09:44:19 EDT
New Gerrit change created: https://git.eclipse.org/r/164828
Comment 11 Eclipse Genie CLA 2020-06-13 10:31:38 EDT
New Gerrit change created: https://git.eclipse.org/r/164829
Comment 12 Lars Vogel CLA 2020-06-14 09:36:29 EDT
FYI - I work from the classes bottom up, looks like you start from the top, so hopefully we do not do double work.
Comment 13 Eclipse Genie CLA 2020-06-14 09:36:57 EDT
New Gerrit change created: https://git.eclipse.org/r/164847
Comment 14 Eclipse Genie CLA 2020-06-14 09:38:07 EDT
New Gerrit change created: https://git.eclipse.org/r/164848
Comment 15 Eclipse Genie CLA 2020-06-14 09:39:27 EDT
New Gerrit change created: https://git.eclipse.org/r/164849
Comment 24 Eclipse Genie CLA 2020-06-15 04:01:57 EDT
New Gerrit change created: https://git.eclipse.org/r/164878
Comment 26 Eclipse Genie CLA 2020-06-16 15:43:22 EDT
New Gerrit change created: https://git.eclipse.org/r/165017
Comment 28 Eclipse Genie CLA 2020-06-18 08:00:18 EDT
New Gerrit change created: https://git.eclipse.org/r/165143
Comment 30 Eclipse Genie CLA 2020-06-18 10:07:51 EDT
New Gerrit change created: https://git.eclipse.org/r/165162
Comment 31 Eclipse Genie CLA 2020-06-18 10:07:56 EDT
New Gerrit change created: https://git.eclipse.org/r/165163
Comment 32 Eclipse Genie CLA 2020-06-18 10:08:11 EDT
New Gerrit change created: https://git.eclipse.org/r/165164
Comment 36 Eclipse Genie CLA 2020-06-22 06:13:40 EDT
New Gerrit change created: https://git.eclipse.org/r/165286
Comment 37 Lars Vogel CLA 2020-06-22 06:16:22 EDT
Rolf, could you run UCDectector again and update the attachment to reflect the current state of work?
Comment 39 Eclipse Genie CLA 2020-06-22 10:35:51 EDT
New Gerrit change created: https://git.eclipse.org/r/165308
Comment 40 Rolf Theunissen CLA 2020-06-23 14:53:15 EDT
Created attachment 283386 [details]
Partial output from UCDetector

Current status, including code only used in test. Note that I only have platform.ui in the workspace.
Comment 41 Eclipse Genie CLA 2020-06-23 14:58:04 EDT
New Gerrit change created: https://git.eclipse.org/r/165374
Comment 42 Eclipse Genie CLA 2020-06-23 15:04:14 EDT
New Gerrit change created: https://git.eclipse.org/r/165376
Comment 43 Eclipse Genie CLA 2020-06-23 15:07:29 EDT
New Gerrit change created: https://git.eclipse.org/r/165377
Comment 44 Eclipse Genie CLA 2020-06-23 15:10:43 EDT
New Gerrit change created: https://git.eclipse.org/r/165378
Comment 45 Eclipse Genie CLA 2020-06-23 15:15:59 EDT
New Gerrit change created: https://git.eclipse.org/r/165379
Comment 46 Eclipse Genie CLA 2020-06-23 15:24:26 EDT
New Gerrit change created: https://git.eclipse.org/r/165381
Comment 47 Eclipse Genie CLA 2020-06-23 15:26:41 EDT
New Gerrit change created: https://git.eclipse.org/r/165382
Comment 48 Eclipse Genie CLA 2020-06-23 15:28:57 EDT
New Gerrit change created: https://git.eclipse.org/r/165383
Comment 52 Lars Vogel CLA 2020-06-24 05:35:14 EDT
LegacyTrim is used (full text search). Does UCDector allow to define exceptions?
Comment 53 Lars Vogel CLA 2020-06-24 05:37:40 EDT
RGBVisibleContrastColorFactory is also used (JDT)
Comment 54 Eclipse Genie CLA 2020-06-24 05:37:58 EDT
New Gerrit change created: https://git.eclipse.org/r/165398
Comment 55 Eclipse Genie CLA 2020-06-24 05:39:55 EDT
New Gerrit change created: https://git.eclipse.org/r/165400
Comment 56 Eclipse Genie CLA 2020-06-24 05:40:39 EDT
New Gerrit change created: https://git.eclipse.org/r/165401
Comment 67 Rolf Theunissen CLA 2020-06-24 08:00:59 EDT
(In reply to Lars Vogel from comment #52)
> LegacyTrim is used (full text search). Does UCDector allow to define
> exceptions?

Check the website, they support multiple ways of defining exceptions, e.g. with a special annotation or comment. There is some configuration too.

b.t.w I opened Bug 564397 to get similar functionality in JDT.
Comment 68 Eclipse Genie CLA 2020-07-03 05:52:55 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/165791
Comment 69 Lars Vogel CLA 2020-07-03 06:08:18 EDT
As the WorkbenchMessagas, didn't we have a tool which cleans-up unused messages?
Comment 70 Eclipse Genie CLA 2020-07-07 11:29:32 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/165971
Comment 73 Lars Vogel CLA 2020-07-20 06:19:44 EDT
Rolf, can you update the output of UCDector?
Comment 74 Lars Vogel CLA 2020-07-22 04:17:33 EDT
This one got really bit, suggesting to close this one as fixed and potentially continue with a new bug. Rolf, please reopen if you disagree and would like to continue using this one.