Intellij建议并将类移动到,否则自动更正,检测到的包声明,如Eclipse(Intellij suggest and move class to, otherwise autocorrect,

编程入门 行业动态 更新时间:2024-10-26 12:22:21
Intellij建议并将类移动到,否则自动更正,检测到的包声明,如Eclipse(Intellij suggest and move class to, otherwise autocorrect, the detected package declaration, like Eclipse)

Eclipse有一个非常有用的功能:检测类的包声明与其实际的源树路径不一致。 然后Eclipse会

建议重命名包声明

或者,建议将类移动到与包声明对应的源路径。

然后立即执行IDE用户同意的任一操作。

Intellij中是否有一个机制可以触发此建议并执行类包声明的功能?

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

Suggest renaming package declaration

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

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?

最满意答案

当类未被命名为.java文件但包声明正确时,Intellij会在类名称上标记错误。 只需将光标移动到类名称,然后按Alt + Enter。

如果类正确命名但包声明不正确,则Intellij会在包声明中标记错误。 只需将光标移动到包声明,然后按Alt + Enter。

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.

更多推荐

本文发布于:2023-08-05 20:29:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1438330.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:并将   检测到   声明   建议   Eclipse

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!