IDEA 代码中的类添加全路径

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 20:10   1992   0

相关环境

MacOS 10.15.3
IDEA 2019.3

问题描述

IDEA 使用过程中出现了在代码出现了 Java 类的完整包路径,比如像下面这样:

@JsonProperty(value = "ExCustomerAccounts")
private Item<ExCustomerAccounts> exCustomerAccountsItem;
@JsonProperty(value = "ExCustomerRelationship")
private Item<com.jzl.api.entity.business.excustomerdetails.onetomany.excustomerrelationship.ExCustomerRelationship> exCustomerRelationshipItem;
@JsonProperty(value = "ExCustomerRelationships")
private Item<ExCustomerRelationships> exCustomerRelationshipsItem;

问题原因

这个问题的出现是因为在 IDEA 的设置中设置了 “Use fully qualified class names” 导致的。

解决方法

更改对应的设置即可。Preferences -> Editor -> Code Style -> Java -> General,请按下方截图中的标记设置即可。

1. 取消 “Use fully qualified class names” 前的勾。

2. Use fully qualified class names in JavaDoc 后选择 “Never, use short name and add import”。

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP