Bug 531441 - [clean up] Cleanup action: Remove redundant modifiers
Summary: [clean up] Cleanup action: Remove redundant modifiers
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.8   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.8 M7   Edit
Assignee: Karsten Thoms CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks: 534736 536612 553608
  Show dependency tree
 
Reported: 2018-02-21 02:20 EST by Karsten Thoms CLA
Modified: 2021-01-14 12:01 EST (History)
6 users (show)

See Also:
kalyan_prasad: review+


Attachments
Screenshot (133.02 KB, image/png)
2018-02-21 02:20 EST, Karsten Thoms CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Karsten Thoms CLA 2018-02-21 02:20:51 EST
Created attachment 272779 [details]
Screenshot

Redundant modifiers could be removed automatically by a cleanup action:
- interface field declarations: public, static, final
- interface method declarations: public
- nested interfaces: static
- method declarations in final classes: final

Attached screenshot shows the configuration of such a cleanup action on the Unnecessary Code tab.
Comment 1 Eclipse Genie CLA 2018-02-21 02:22:10 EST
New Gerrit change created: https://git.eclipse.org/r/117833
Comment 2 Stephan Herrmann CLA 2018-02-21 05:40:49 EST
Interesting proposal.

For a minute I was thinking: since interface methods can also be *private*, an explicit *public* could help to make code more explicit about a relevant choice. Only then I realized, that this is not a source for potential confusion, because private methods have a body whereas public ones don't.

So, I agree, all of the modifiers you mention don't really add value, and removing them is suited for clean-up.
Comment 3 Karsten Thoms CLA 2018-02-21 05:56:46 EST
I got this set of rules from Sonar warnings :)
Comment 4 Stephan Herrmann CLA 2018-02-21 05:58:13 EST
(In reply to Karsten Thoms from comment #3)
> I got this set of rules from Sonar warnings :)

So I agree with Sonar, for once :)
Comment 5 Lars Vogel CLA 2018-04-17 14:37:50 EDT
+1, this will be very useful.
Comment 7 Karsten Thoms CLA 2018-04-25 02:57:05 EDT
Will add N&N entry
Comment 8 Eclipse Genie CLA 2018-04-27 05:15:21 EDT
New Gerrit change created: https://git.eclipse.org/r/121847
Comment 10 Karsten Thoms CLA 2018-04-27 06:20:21 EDT
Verified with JDT 3.14.0.v20180425-2000

N&N entry added
Comment 11 Noopur Gupta CLA 2018-05-02 03:52:49 EDT
Please add a mnemonic to the new option.
Comment 12 Eclipse Genie CLA 2018-05-02 04:16:33 EDT
New Gerrit change created: https://git.eclipse.org/r/121998
Comment 13 Lars Vogel CLA 2018-05-02 04:17:24 EDT
(In reply to Noopur Gupta from comment #11)
> Please add a mnemonic to the new option.

Done via the Gerrit. Also noticed that on this page two other mnemonics are missing and opened Bug 534245 for that.
Comment 15 Vikas Chandra CLA 2018-05-09 08:43:02 EDT
Version: Photon (4.8)
Build id: I20180507-2205
Comment 16 Carsten Hammer CLA 2021-01-14 12:01:00 EST
Can we close Bug 130888 now?