IDEA 10.0.3用重构的完全限定名替换声明

时间:2022-04-27 20:23:07

Whenever I move a (unambiguously named) type to another package, IDEA decides to replace all occurrences of given type with its fully qualified name instead of just adding the appropriate imports; going through all affected files and manually fixing the imports is madness.

每当我将(明确命名的)类型移动到另一个包时,IDEA决定用其完全限定的名称替换所有出现的给定类型,而不是仅添加适当的导入;浏览所有受影响的文件并手动修复导入是疯狂的。

I tried out all possible combinations of the "Auto Import" settings to no effect. Has anybody run into the same problem?

我尝试了所有可能的“自动导入”设置组合无效。有没有人遇到同样的问题?

3 个解决方案

#1


1  

I recall similar issue reported at least once, however the user was not able to reproduce it with a new project and could not provide his real project affected by this bug.

我记得至少报告过一次相似的问题,但是用户无法用新项目重现它,并且无法提供受此bug影响的真实项目。

This issue seems to be caused by some specific project configuration which is very unusual and therefore not affecting the majority of IDEA users.

这个问题似乎是由某些特定的项目配置引起的,这种配置非常不寻常,因此不会影响大多数IDEA用户。

If you have a reproducible test case, please file a bug to YouTrack and attach your project to the issue so that we can investigate and fix it.

如果您有可重现的测试用例,请向YouTrack提交一个错误并将您的项目附加到该问题,以便我们进行调查和修复。

P.S. also try IDEA 10.5.1 since you are using an old version, upgrade is free for you.

附:也可以尝试使用IDEA 10.5.1,因为您使用的是旧版本,升级是免费的。

#2


2  

Make sure that "Use fully qualified class names" checkbox is disabled in Settings>CodeStyle>Imports. I apologize if that was a no brainer and you've already tried it.

确保在“设置”>“CodeStyle”>“导入”中禁用“使用完全限定的类名”复选框。我很抱歉,如果这是一个没有脑子,你已经尝试过了。

#3


0  

May be there exist two imports with same names ? Have you checked this issue ?

可能存在两个同名的进口商品?你检查过这个问题了吗?

Also please specify IntelliJ IDEA's version.

另请注明IntelliJ IDEA的版本。

#1


1  

I recall similar issue reported at least once, however the user was not able to reproduce it with a new project and could not provide his real project affected by this bug.

我记得至少报告过一次相似的问题,但是用户无法用新项目重现它,并且无法提供受此bug影响的真实项目。

This issue seems to be caused by some specific project configuration which is very unusual and therefore not affecting the majority of IDEA users.

这个问题似乎是由某些特定的项目配置引起的,这种配置非常不寻常,因此不会影响大多数IDEA用户。

If you have a reproducible test case, please file a bug to YouTrack and attach your project to the issue so that we can investigate and fix it.

如果您有可重现的测试用例,请向YouTrack提交一个错误并将您的项目附加到该问题,以便我们进行调查和修复。

P.S. also try IDEA 10.5.1 since you are using an old version, upgrade is free for you.

附:也可以尝试使用IDEA 10.5.1,因为您使用的是旧版本,升级是免费的。

#2


2  

Make sure that "Use fully qualified class names" checkbox is disabled in Settings>CodeStyle>Imports. I apologize if that was a no brainer and you've already tried it.

确保在“设置”>“CodeStyle”>“导入”中禁用“使用完全限定的类名”复选框。我很抱歉,如果这是一个没有脑子,你已经尝试过了。

#3


0  

May be there exist two imports with same names ? Have you checked this issue ?

可能存在两个同名的进口商品?你检查过这个问题了吗?

Also please specify IntelliJ IDEA's version.

另请注明IntelliJ IDEA的版本。