我正在修复并清理我的学校项目,我们应该使用IntelliJ IDEA中的“ InspectCode”功能,并在返回项目之前还修复所有警告。我在“声明冗余/未使用的声明/入口点”类别下得到了一些警告。我不知道为什么。对“未使用的声明的描述是:
“该检查报告了指定检查范围内未从入口点使用或无法到达的类,方法或字段。”
IDEA抱怨的类,字段和方法都已使用/启动等。项目按预期运行,并且一切正常。
public enum Direction {
/**
* When the mob is set to move up.
*/
UP_DIR,
/**
* When the mob is set to move down.
*/
DOWN_DIR,
/**
* When the mob is set to move left.
*/LEFT_DIR, /**
* When the mob is set to move right.
*/RIGHT_DIR, /**
* When the mob is set to move upleft.
*/UPLEFT_DIR, /**
* When the mob is set to move upright.
*/UPRIGHT_DIR, /**
* When the mob is set to move downleft.
*/DOWNLEFT_DIR, /**
* When the mob is set to move downright.
*/DOWNRIGHT_DIR
}
另一个错误来自于此:
public static void main(String[] args) {
// Start the game
Game game = new Game();
game.start();
}
。
有没有一种方法可以“修复”我的代码,这样我就不会收到这些警告?
将光标置于警告处,然后按Alt + Enter
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句