I’m really excited that Neon comes with a feature to remove the redundant types that haven’t been needed since Java 7. For example, List<String> list = new ArrayList<String>(); vs List<String> list = new ArrayList<>(); We have the diamond operator, but there hasn’t been any easy way that I know of for dealing with the old code.
How to use it
I wanted to run JUST this rule so my commit doesn’t have other things in it. (I like to run these rules one at a time). Here’s what I did:
- Select project
- Source > Cleanup
- Use custom profile
- Uncheck box on member access tab
- Uncheck box on missing code tab
- Uncheck all boxes on unnecessary code tab
- Check box for Remove redundant type arguments (1.7 or higher)
- Wait about 30 seconds
- Sync with repository
- Spot check three classes – all good!
- Commit the 202 files that had changes in it
- Enjoy the cleaner code 🙂