Duplicated code

取消重复代码提示 Settings -> Editor -> Inspections -> General -> Ducplicated code [取消勾选] clipboard.png 这个功能有时候还是挺有用的,能提示你有多少代码是重复的,然后进行重构。用不用看自己的习惯、需求

Typo: In word

命名提示。当你的命名不符合IDEA的推荐规则时(驼峰规则),就会在名字下方有波浪线提示。去除提示方法: Settings -> Editor -> Inspections -> Spelling -> Type [取消勾选] clipboard.png

Access can be private

当方法申明为public但是又没有任何的外部调用时,IDEA会建议我们修改为private或者protected 如果你的方法必须申明为public又暂时没有任何的外部调用时,使用以下方法可以屏蔽这个提示。 Settings -> Editor -> Inspections -> java -> Declaration redundancy -> Declaration access can be weaker [取消勾选] clipboard.png

Unused

当定义的变量或者方法未被调用时,就会提示未使用的警告。去除提示方法: Settings -> Editor -> Inspections -> java -> Declaration redundancy -> Unused declaration [取消勾选] clipboard.png

修改错误代码提示样式

默认情况下,IDEA对错误代码提示如下 clipboard.png 个人觉得不是很明显,于是修改了下,修改方式如下 Settins -> Editor -> Color Scheme -> General -> Errors and Warnings -> Error -> background [设置颜色] clipboard.png 设置之后效果如下 clipboard.png

One-line methods

当方法的方法体只有一行代码时,IDEA默认会折叠代码,变成一行,比如有方法代码

/** * 缓存注册刷新 * * @param cache */ protected void registerRefresh(DefaultAbstractCache cache) { refresh.register(getClass().getName(), cache); }

IDEA默认会折叠代码,效果如下

/** * 缓存注册刷新 * @param cache */ protected void registerRefresh(DefaultAbstractCache cache) { refresh.register(getClass().getName(), cache); }

如果不想折叠,方法如下 Settins -> Editor -> General -> Code Folding -> One-line methods [取消勾线] clipboard.png