通过Files -> Settings 或者快捷键 Ctrl+Alt+S 打开Settings界面
设置默认换行符
Windows下换行默认是CRLF,也就是回车换行
Linux下只有换行LF。避免出现问题,需要修改换行符。
IntelliJ IDEA -> Settings -> Code Style -> General -> Line Separator
导入项目之后,只显示项目文件,不显示项目结构
解决方法
IntelliJ IDEA -> File -> Project Structure –>Modules
点击右上角+加号 -> Import Modules
IDEA创建文件时自动填入作者时间 定制格式
IDEA中设置模版:
IntelliJ IDEA -> Setting -> Editor -> File and Code Templates -> Includes -> File Header
添加模版配置:
案例如下:
/**
* description
*
* @author xxx
* @date ${DATE} ${TIME}
*/
IDEA已经预定义了如下一些变量,可以使用:
${PACKAGE_NAME}
name of the package in which the new file is created
${USER}
current user system login name
${DATE}
current system date
${TIME}
current system time
${YEAR}
current year
${MONTH}
current month
${MONTH_NAME_SHORT}
first 3 letters of the current month name. Example: Jan, Feb, etc.
${MONTH_NAME_FULL}
full name of the current month. Example: January, February, etc.
${DAY}
current day of the month
${DAY_NAME_SHORT}
first 3 letters of the current day name. Example: Mon, Tue, etc.
${DAY_NAME_FULL}
full name of the current day. Example: Monday, Tuesday, etc.
${HOUR}
current hour
${MINUTE}
current minute
${PROJECT_NAME}
the name of the current project
自动生成serialVersionUID
serialVersionUID介绍
在编程过程中当涉及到对象的传输问题时,我们会采用序列化的技术,通过序列化可以将对象的状态信息转换为可以存储或传输的形式的过程。在Java当中我们可以通过实现Serializable接口来序列化对象,而serialVersionUID就是Java序列化机制中一个不可或缺的角色,可以通过在运行时判断类的serialVersionUID来验证版本一致性。在进行反序列化时,JVM会把传来的字节流中的serialVersionUID与本地相应实体(类)的serialVersionUID进行比较,如果相同就认为是一致的,可以进行反序列化,否则就会出现序列化版本不一致的异常。
解决方法:
Setting –> Editor –> Inspections –> Java –> Serialization issues,
然后在搜索框中搜索serialVersionUID关键字,将serialzable class without “serialVersionUID”打上勾。
内容持续更新!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/155813.html