Blessed Geek
Blessed Geek

Reputation: 21684

Intellij suggest and move class to, otherwise autocorrect, the detected package declaration, like Eclipse

Eclipse has a rather helpful feature: detect that the package declaration of a class is not in conjunction with its actual source tree path. Eclipse would then

  1. Suggest renaming package declaration

  2. Or, suggest moving the class to the source path that corresponds to the package declaration.

  3. And then promptly perform either of the actions as agreed by the IDE user.

Is there a mechanism in Intellij that would trigger this suggestion and perform feature for the class package declaration?

Upvotes: 0

Views: 68

Answers (1)

Tom
Tom

Reputation: 4093

When the class is not named as the .java File but the package declaration is correct, Intellij marks an error at the class name. Simply move the cursor to the class name and hit Alt+Enter.

When the class is correctly named but the package declaration is incorrect, Intellij marks an error at the package declaration. Simply move the cursor to the package declaration and hit Alt+Enter.

Upvotes: 1

Related Questions