Java 为什么在我使用的类、方法和字段上会得到未使用的声明?

Java 为什么在我使用的类、方法和字段上会得到未使用的声明?,java,intellij-idea,entry-point,Java,Intellij Idea,Entry Point,我正在修复和清理我的学校项目,我们应该使用IntelliJ IDEA中的“InspectCode”功能,并在返回项目之前修复所有警告。我在“声明冗余/未使用声明/入口点”类别下收到了一些警告。我不知道为什么。“未使用声明”的描述是: 此检查报告指定检查范围内未使用或无法从入口点访问的类、方法或字段 IDEA抱怨的类、字段和方法都已使用/启动等。 项目运行,一切正常 public enum Direction { /** * When the mob is set to move up. */

我正在修复和清理我的学校项目,我们应该使用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键

这是拼写警告,请给出警告的示例代码。您是否在项目中使用反射,以及intellij项目中是否所有的源目录都标记为反射(即它是否在intellij中生成并运行而没有错误)?@EvcanMustafa添加了引发错误的一个类的示例代码。这允许您禁用检查,但不能解释为什么会出现警告。