在jshell中使用C选项有什么用处 [英] What is the use of C option in jshell
问题描述
我已经浏览了
同时你可以在警告时启用编译器错误( -Werror
)并在编译时使用 -Xlint
键 cast
来警告你使用的显式强制转换abov e代码使用 -
jshell -C-Xlint:cast -C-Werror
并且相同的语句会导致Jshell编译器出现警告和错误: -
< a href =https://i.stack.imgur.com/gntZC.png =nofollow noreferrer>
虽然IMO,但这肯定记录的更少使用JShell -C
命令行选项时,应使用/不应使用所有标志。
I have gone through the introduction to jshell guide and couldn't find description/examples about the -C option in jshell.
$jshell --help
-C<flag> Pass <flag> to the compiler.
Use one -C for each compiler flag or flag argument
You can use this option to make use of javac
command line arguments for example consider this piece of code:
String str = (String)"Hello"
Starting jshell
normally and using the same would result as:
While at the same time you can enable compiler errors on warning(-Werror
) and make use of the -Xlint
key cast
while compiling to warn you of the explicit cast used in the above code using -
jshell -C-Xlint:cast -C-Werror
and the same statement would result into warnings and error from Jshell compiler as:-
Though IMO, this certainly is documented far less in terms of what all flags shall/shall not be used while using the JShell -C
command line option.
这篇关于在jshell中使用C选项有什么用处的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!