有没有办法在Eclipse中创建自定义警告? [英] Is there a way to create custom warning in eclipse?

查看:90
本文介绍了有没有办法在Eclipse中创建自定义警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道显而易见的答案是注意,但是由于我不断在Java和Javascript之间切换,因此我无尽地忘记了==不适用于Java方面的字符串比较。有什么方法可以让Eclipse警告我,当我看到我用 == 比较两个字符串而不是使用时,我可能没有做我想做的事情。 equals()方法?

I know that the obvious answer is "pay attention" but because I am constantly switching between Java and Javascript, I'm endlessly forgetting that == doesn't work for string comparison on the Java side of things. Is there any way to get Eclipse to warn me that I'm probably not doing what I want to be doing when it sees me comparing two strings with == rather than using the equals() method?

推荐答案

有许多静态代码分析器可以执行此类操作。
其中几个是:

There are many static code analyzer available which does such type of things. Few of them are:


  1. checkStyle

  2. PMD

  3. 声纳

  4. findBugs

  1. checkStyle
  2. PMD
  3. sonar
  4. findBugs

他们有很多建立规则,您也可以在Eclipse中配置它们。因此,当您键入并保存时,这些工具也会显示警告,就像内置的月食警告一样。

They have many in-built rules and you can configure them in eclipse also. So as and when, you type and save, these tools would also show warnings just like in-built eclipse warnings.

这篇关于有没有办法在Eclipse中创建自定义警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆