What is the “Use '--release' option” in IntelliJ 2018.1 preferences?

痴心易碎 提交于 2019-12-18 22:31:11

问题


In the preferences for IntelliJ 2018.1 (Build, Execution, Deployment > Compiler > Java Compiler) is an checkbox labeled:

Use '--release' option for cross-compilation (Java 9 and later)

I found for information when doing an internet search. The "?" help icon give a 404 error when clicked.

What is the purpose/function of this option?


回答1:


The help section can be found here:

By default, this option is selected. IntelliJ IDEA deduces from project settings when the cross-compilation is needed and automatically applies the --release compiler option for Java 9.

What is the --release option? It is a new command-line option, defined in JEP 247: Compile for Older Platform Versions.

A new command-line option, --release, is defined, which automatically configures the compiler to produce class files that will link against an implementation of the given platform version.

Discussed in this good answer here.

Also check IDEA-184333 for the background why this option was added in the IDE. In short, some users need to specify only -source and -target versions for their projects without also setting the -bootclasspath option.



来源:https://stackoverflow.com/questions/49618134/what-is-the-use-release-option-in-intellij-2018-1-preferences

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!