IntelliJ IDEA 4 新特性 之 On-the-Fly Code Analysis(动态代码分析)

原创 2004年04月19日 00:00:00

Intelligent error highlighting(智能突出显示错误)

All common syntax errors, as well as all other errors that would be detected during compilation, are highlighted in the source code so you do not need to compile your code in order to find all your mistakes. Each error is highlighted in the editor and has the corresponding red link on the right gutter area for easy navigation to the erroneous places, which is especially useful when working with large files.


JavaDoc error highlighting(JavaDoc错误突出)

IDEA knows general javadoc rules, such as structure and syntax, and will detect any common inconsistencies found in your javadoc comments, e.g. wrong parameter references, return attributes in the field or void method comments, etc.
Having found an unknown javadoc tag, IDEA will suggests that you add this tag to the known tags list, so that you never get an error or warning indications about it.

IDEA晓得一般的JavaDoc一些关于结构和语法的规则,而且会发现一些在你的JavaDoc中相矛盾的地方,比如,不一致的参数申明,返回局部变量或没有返回值方法的注释等等。当发现一个未知的JavaDoc Tag 时,IDEA会提醒你将这个Tag加入到已知Tag列表中,这样就再也看不到关于这个Tag的错误和警告提示了。

Detecting deprecated symbols(发现不合法的标识符)

If any deprecated code is used in any class or interface, IDEA will recognize it and highlight the corresponding statements directly in the editor.


Highlighting unused imports, throws declarations and other unused symbols(突出显示没有被使用的import和 throw声明以及其他没有使用的标识符)

IDEA will point out all redundant import statements, throws declarations and other unused symbols (like variables and methods), and will highlight them in the editor with the corresponding links on the right gutter area for easier navigation. More information on other code analysis features can be found here.


Import Assistant - helps to automatically insert import statements while typing code, and detects non-imported classes found in pasted blocks of code(Import助手——在编辑代码时帮你自动插入import声明,并自动找出你粘贴代码时没有导出的class)

Import assistant

When you use the name of a class from anywhere in a project library, but the class has not been imported into the current file, a hint with the suggestion to import the class pops up over the text. Pressing Alt + Enter inserts the import statement. Moreover, when you copy a block of text from one file and paste it into another, IDEA automatically detects all the classes that are used inside the copied block but have not been imported to the destination file. It then shows a list of all such classes and allows you to select classes you want to import into the new file.

当你随便使用一个package里的class时,而且这个class没有在当前文件中声明时,就会有一个提示来建议你import一些有这个class声明的package,你只需按下Alt + Enter就会import相应package了。当然,这个功能也会在你粘贴代码时起作用,他会提示出所有需要import的package。IDEA还会给出一个列表让你选择呢?

Intention actions(意图识别)

Intention actions

When you are typing your source code, know that IDEA is always one step ahead of you. For example, if you assign a value to a variable that represents an instance of one of its ancestors, IDEA will immediately interpret your intention as wanting either to cast the ancestor type to the variable type or to define the type of variable the same as the ancestor. A light bulb will appear suggesting that you perform one of these two operations. Also you can start using a method before it has been declared. When this occurs, IDEA’s light bulb popup will appear suggesting you create a new method from its usage. If you accept the suggestion, the new method will be created in the corresponding class. More features related to automatic code generation in IDEA are described here.


Visual indication of overriding/overriden and implementing/implemented methods(醒目的指出override和implement的方法)

Special signs (overrides and implements) on the left gutter area of the editor indicate that the current method overrides or implements the corresponding method of an ancestor class/interface. Moving the mouse to one of these symbols will bring up a tooltip with the base method details. If you click the symbol, the corresponding class/interface will be immediately opened in the editor, with the caret automatically positioned at the base method.

When icons overriden or implemented are shown, it means that the method is overriden or implemented in inheriting classes. Pressing the icon will open a lookup list with these classes, for selecting the desired one to open at the corresponding method.

 用符号(overrides 和 implements) 在代码的左边标示出当前方法是否是重载或实现了父类或接口的相应方法. 移动鼠标到这些符号上,将会显示出父类是显得的详细细节。如果你点击鼠标, 相应的父类实现就会出现在编辑器里,并自动定位到那个方法上。

当符号 overriden 或 implemented 出现时,就意味着这个方法需要重载或实现与父类的方法。 点击鼠标就会弹出相应的列表让你在其中选择一个方法。

Intellij IDEA使用git提交代码时去掉Code analysis代码分析的提示

默认情况下的git提交会出现执行代码分析的提示框 实际上提交的前一步有选项可以去掉这个提示 把"Perform code analysis" 和 "Check TODO" 复选框前面的勾去掉就...
  • gsls200808
  • gsls200808
  • 2016年11月04日 08:14
  • 4616

【项目管理】 使用IntelliJ IDEA 将项目发布(提交)到GitLab

使用IntelliJ IDEA 将项目发布(提交)到GitLab 本地Git代码仓库建立,首先需要启用项目的版本管理功能。 点击VCS 启用版本控制 IDE底部显示本地Git代码仓库建立完毕...
  • zsq520520
  • zsq520520
  • 2016年03月29日 12:01
  • 15308


1、开启Toolbar及Tool Buttons 开启之后可以看到以下工具栏,一些常用的比较方便的工具都可以在这里找到。 包括终端、从svn更新项目、提交项目、项目maven结构及插件、版本控制历...
  • u011583308
  • u011583308
  • 2015年10月16日 23:57
  • 2459

IntelliJ IDEA 代码检查规范QAPlug

静态检查规范 Avoid Array Loops 数组之间的拷贝使用System.arrayCopy更加高效 byte[] ReceiveBytes = new byte[length1+ le...
  • jizi7618937
  • jizi7618937
  • 2016年05月25日 18:38
  • 9538

eclipse代码分析(code analysis)报错

  • github_30605157
  • github_30605157
  • 2016年08月11日 20:49
  • 1550


有时候我们前端页面一些按钮或内容,当鼠标悬停在上面时给予一定的提示。那么我们就可以使用该样式库,使用起来很方便。样式在以下链接下载: 在线DEMO:
  • cjq2013
  • cjq2013
  • 2017年08月23日 21:30
  • 110

IntelliJ IDEA 智能代码分析

IntelliJ IDEA 智能代码分析#IntelliJ IDEA 会分析你的代码,在项目中查找文件和语言之间的关联。并使用这些信息,向你提供深度的代码帮助,快速导航,以及错误分析和重构。1. ID...
  • qq_15071263
  • qq_15071263
  • 2017年08月22日 21:38
  • 1332

idea 的代码分析

IntelliJ IDEA 代码分析
  • zhaoyw2008
  • zhaoyw2008
  • 2015年05月20日 20:25
  • 13312

IntelliJ IDEA for Mac 快捷键总结

⌘ Command⇧ Shift⌥ Option⌃ Control↩︎ Return/Enter⌫ Delete⌦ 向前删除键(Fn+Delete)↑ 上箭头↓ 下箭头← 左箭头→ 右箭头⇞ Page...
  • u014692324
  • u014692324
  • 2017年06月24日 10:23
  • 262

IDEA 快捷键(MAC 版)说明

Idea intellij for mac os x 快捷键说明
  • sky19891212
  • sky19891212
  • 2015年01月18日 21:21
  • 12260
您举报文章:IntelliJ IDEA 4 新特性 之 On-the-Fly Code Analysis(动态代码分析)